Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
6544d7b6
R
Rust
项目概览
int
/
Rust
大约 1 年 前同步成功
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
Rust
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
6544d7b6
编写于
5月 11, 2020
作者:
B
Bastian Kauschke
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
change `Predicate::kind` to return a reference
上级
57746f94
变更
13
隐藏空白更改
内联
并排
Showing
13 changed file
with
66 addition
and
67 deletion
+66
-67
src/librustc_infer/traits/util.rs
src/librustc_infer/traits/util.rs
+9
-9
src/librustc_middle/ty/mod.rs
src/librustc_middle/ty/mod.rs
+17
-16
src/librustc_middle/ty/print/pretty.rs
src/librustc_middle/ty/print/pretty.rs
+8
-8
src/librustc_mir/transform/qualify_min_const_fn.rs
src/librustc_mir/transform/qualify_min_const_fn.rs
+1
-1
src/librustc_trait_selection/traits/auto_trait.rs
src/librustc_trait_selection/traits/auto_trait.rs
+2
-2
src/librustc_trait_selection/traits/error_reporting/mod.rs
src/librustc_trait_selection/traits/error_reporting/mod.rs
+2
-2
src/librustc_trait_selection/traits/fulfill.rs
src/librustc_trait_selection/traits/fulfill.rs
+5
-5
src/librustc_trait_selection/traits/project.rs
src/librustc_trait_selection/traits/project.rs
+5
-7
src/librustc_trait_selection/traits/select.rs
src/librustc_trait_selection/traits/select.rs
+7
-7
src/librustc_trait_selection/traits/wf.rs
src/librustc_trait_selection/traits/wf.rs
+6
-6
src/librustc_typeck/astconv.rs
src/librustc_typeck/astconv.rs
+1
-1
src/librustc_typeck/check/coercion.rs
src/librustc_typeck/check/coercion.rs
+1
-1
src/librustc_typeck/check/dropck.rs
src/librustc_typeck/check/dropck.rs
+2
-2
未找到文件。
src/librustc_infer/traits/util.rs
浏览文件 @
6544d7b6
...
...
@@ -11,42 +11,42 @@ pub fn anonymize_predicate<'tcx>(
pred
:
&
ty
::
Predicate
<
'tcx
>
,
)
->
ty
::
Predicate
<
'tcx
>
{
match
pred
.kind
()
{
ty
::
PredicateKind
::
Trait
(
ref
data
,
constness
)
=>
{
&
ty
::
PredicateKind
::
Trait
(
ref
data
,
constness
)
=>
{
ty
::
PredicateKind
::
Trait
(
tcx
.anonymize_late_bound_regions
(
data
),
constness
)
.to_predicate
(
tcx
)
}
ty
::
PredicateKind
::
RegionOutlives
(
ref
data
)
=>
{
ty
::
PredicateKind
::
RegionOutlives
(
data
)
=>
{
ty
::
PredicateKind
::
RegionOutlives
(
tcx
.anonymize_late_bound_regions
(
data
))
.to_predicate
(
tcx
)
}
ty
::
PredicateKind
::
TypeOutlives
(
ref
data
)
=>
{
ty
::
PredicateKind
::
TypeOutlives
(
data
)
=>
{
ty
::
PredicateKind
::
TypeOutlives
(
tcx
.anonymize_late_bound_regions
(
data
))
.to_predicate
(
tcx
)
}
ty
::
PredicateKind
::
Projection
(
ref
data
)
=>
{
ty
::
PredicateKind
::
Projection
(
data
)
=>
{
ty
::
PredicateKind
::
Projection
(
tcx
.anonymize_late_bound_regions
(
data
))
.to_predicate
(
tcx
)
}
ty
::
PredicateKind
::
WellFormed
(
data
)
=>
{
&
ty
::
PredicateKind
::
WellFormed
(
data
)
=>
{
ty
::
PredicateKind
::
WellFormed
(
data
)
.to_predicate
(
tcx
)
}
ty
::
PredicateKind
::
ObjectSafe
(
data
)
=>
{
&
ty
::
PredicateKind
::
ObjectSafe
(
data
)
=>
{
ty
::
PredicateKind
::
ObjectSafe
(
data
)
.to_predicate
(
tcx
)
}
ty
::
PredicateKind
::
ClosureKind
(
closure_def_id
,
closure_substs
,
kind
)
=>
{
&
ty
::
PredicateKind
::
ClosureKind
(
closure_def_id
,
closure_substs
,
kind
)
=>
{
ty
::
PredicateKind
::
ClosureKind
(
closure_def_id
,
closure_substs
,
kind
)
.to_predicate
(
tcx
)
}
ty
::
PredicateKind
::
Subtype
(
ref
data
)
=>
{
ty
::
PredicateKind
::
Subtype
(
data
)
=>
{
ty
::
PredicateKind
::
Subtype
(
tcx
.anonymize_late_bound_regions
(
data
))
.to_predicate
(
tcx
)
}
ty
::
PredicateKind
::
ConstEvaluatable
(
def_id
,
substs
)
=>
{
&
ty
::
PredicateKind
::
ConstEvaluatable
(
def_id
,
substs
)
=>
{
ty
::
PredicateKind
::
ConstEvaluatable
(
def_id
,
substs
)
.to_predicate
(
tcx
)
}
...
...
src/librustc_middle/ty/mod.rs
浏览文件 @
6544d7b6
...
...
@@ -1023,8 +1023,8 @@ pub struct Predicate<'tcx> {
}
impl
Predicate
<
'tcx
>
{
pub
fn
kind
(
&
self
)
->
PredicateKind
<
'tcx
>
{
*
self
.kind
pub
fn
kind
(
&
self
)
->
&
'tcx
PredicateKind
<
'tcx
>
{
self
.kind
}
}
...
...
@@ -1163,35 +1163,36 @@ pub fn subst_supertrait(
// this trick achieves that).
let
substs
=
&
trait_ref
.skip_binder
()
.substs
;
match
self
.kind
()
{
PredicateKind
::
Trait
(
ref
binder
,
constness
)
=>
{
let
predicate
=
match
self
.kind
()
{
&
PredicateKind
::
Trait
(
ref
binder
,
constness
)
=>
{
PredicateKind
::
Trait
(
binder
.map_bound
(|
data
|
data
.subst
(
tcx
,
substs
)),
constness
)
}
PredicateKind
::
Subtype
(
ref
binder
)
=>
{
PredicateKind
::
Subtype
(
binder
)
=>
{
PredicateKind
::
Subtype
(
binder
.map_bound
(|
data
|
data
.subst
(
tcx
,
substs
)))
}
PredicateKind
::
RegionOutlives
(
ref
binder
)
=>
{
PredicateKind
::
RegionOutlives
(
binder
)
=>
{
PredicateKind
::
RegionOutlives
(
binder
.map_bound
(|
data
|
data
.subst
(
tcx
,
substs
)))
}
PredicateKind
::
TypeOutlives
(
ref
binder
)
=>
{
PredicateKind
::
TypeOutlives
(
binder
)
=>
{
PredicateKind
::
TypeOutlives
(
binder
.map_bound
(|
data
|
data
.subst
(
tcx
,
substs
)))
}
PredicateKind
::
Projection
(
ref
binder
)
=>
{
PredicateKind
::
Projection
(
binder
)
=>
{
PredicateKind
::
Projection
(
binder
.map_bound
(|
data
|
data
.subst
(
tcx
,
substs
)))
}
PredicateKind
::
WellFormed
(
data
)
=>
PredicateKind
::
WellFormed
(
data
.subst
(
tcx
,
substs
)),
PredicateKind
::
ObjectSafe
(
trait_def_id
)
=>
PredicateKind
::
ObjectSafe
(
trait_def_id
),
PredicateKind
::
ClosureKind
(
closure_def_id
,
closure_substs
,
kind
)
=>
{
&
PredicateKind
::
WellFormed
(
data
)
=>
PredicateKind
::
WellFormed
(
data
.subst
(
tcx
,
substs
)),
&
PredicateKind
::
ObjectSafe
(
trait_def_id
)
=>
PredicateKind
::
ObjectSafe
(
trait_def_id
),
&
PredicateKind
::
ClosureKind
(
closure_def_id
,
closure_substs
,
kind
)
=>
{
PredicateKind
::
ClosureKind
(
closure_def_id
,
closure_substs
.subst
(
tcx
,
substs
),
kind
)
}
PredicateKind
::
ConstEvaluatable
(
def_id
,
const_substs
)
=>
{
&
PredicateKind
::
ConstEvaluatable
(
def_id
,
const_substs
)
=>
{
PredicateKind
::
ConstEvaluatable
(
def_id
,
const_substs
.subst
(
tcx
,
substs
))
}
PredicateKind
::
ConstEquate
(
c1
,
c2
)
=>
{
PredicateKind
::
ConstEquate
(
c1
.subst
(
tcx
,
substs
),
c2
.subst
(
tcx
,
substs
))
}
}
.to_predicate
(
tcx
)
};
predicate
.to_predicate
(
tcx
)
}
}
...
...
@@ -1370,7 +1371,7 @@ fn to_predicate(&self, tcx: TyCtxt<'tcx>) -> Predicate<'tcx> {
impl
<
'tcx
>
Predicate
<
'tcx
>
{
pub
fn
to_opt_poly_trait_ref
(
&
self
)
->
Option
<
PolyTraitRef
<
'tcx
>>
{
match
self
.kind
()
{
PredicateKind
::
Trait
(
ref
t
,
_
)
=>
Some
(
t
.to_poly_trait_ref
()),
&
PredicateKind
::
Trait
(
ref
t
,
_
)
=>
Some
(
t
.to_poly_trait_ref
()),
PredicateKind
::
Projection
(
..
)
|
PredicateKind
::
Subtype
(
..
)
|
PredicateKind
::
RegionOutlives
(
..
)
...
...
@@ -1385,7 +1386,7 @@ pub fn to_opt_poly_trait_ref(&self) -> Option<PolyTraitRef<'tcx>> {
pub
fn
to_opt_type_outlives
(
&
self
)
->
Option
<
PolyTypeOutlivesPredicate
<
'tcx
>>
{
match
self
.kind
()
{
PredicateKind
::
TypeOutlives
(
data
)
=>
Some
(
data
),
&
PredicateKind
::
TypeOutlives
(
data
)
=>
Some
(
data
),
PredicateKind
::
Trait
(
..
)
|
PredicateKind
::
Projection
(
..
)
|
PredicateKind
::
Subtype
(
..
)
...
...
src/librustc_middle/ty/print/pretty.rs
浏览文件 @
6544d7b6
...
...
@@ -2032,28 +2032,28 @@ pub fn print_only_trait_path(self) -> ty::Binder<TraitRefPrintOnlyTraitPath<'tcx
ty
::
Predicate
<
'tcx
>
{
match
self
.kind
()
{
ty
::
PredicateKind
::
Trait
(
ref
data
,
constness
)
=>
{
&
ty
::
PredicateKind
::
Trait
(
ref
data
,
constness
)
=>
{
if
let
hir
::
Constness
::
Const
=
constness
{
p!
(
write
(
"const "
));
}
p!
(
print
(
data
))
}
ty
::
PredicateKind
::
Subtype
(
ref
predicate
)
=>
p!
(
print
(
predicate
)),
ty
::
PredicateKind
::
RegionOutlives
(
ref
predicate
)
=>
p!
(
print
(
predicate
)),
ty
::
PredicateKind
::
TypeOutlives
(
ref
predicate
)
=>
p!
(
print
(
predicate
)),
ty
::
PredicateKind
::
Projection
(
ref
predicate
)
=>
p!
(
print
(
predicate
)),
ty
::
PredicateKind
::
Subtype
(
predicate
)
=>
p!
(
print
(
predicate
)),
ty
::
PredicateKind
::
RegionOutlives
(
predicate
)
=>
p!
(
print
(
predicate
)),
ty
::
PredicateKind
::
TypeOutlives
(
predicate
)
=>
p!
(
print
(
predicate
)),
ty
::
PredicateKind
::
Projection
(
predicate
)
=>
p!
(
print
(
predicate
)),
ty
::
PredicateKind
::
WellFormed
(
ty
)
=>
p!
(
print
(
ty
),
write
(
" well-formed"
)),
ty
::
PredicateKind
::
ObjectSafe
(
trait_def_id
)
=>
{
&
ty
::
PredicateKind
::
ObjectSafe
(
trait_def_id
)
=>
{
p!
(
write
(
"the trait `"
),
print_def_path
(
trait_def_id
,
&
[]),
write
(
"` is object-safe"
))
}
ty
::
PredicateKind
::
ClosureKind
(
closure_def_id
,
_
closure_substs
,
kind
)
=>
{
&
ty
::
PredicateKind
::
ClosureKind
(
closure_def_id
,
_
closure_substs
,
kind
)
=>
{
p!
(
write
(
"the closure `"
),
print_value_path
(
closure_def_id
,
&
[]),
write
(
"` implements the trait `{}`"
,
kind
))
}
ty
::
PredicateKind
::
ConstEvaluatable
(
def_id
,
substs
)
=>
{
&
ty
::
PredicateKind
::
ConstEvaluatable
(
def_id
,
substs
)
=>
{
p!
(
write
(
"the constant `"
),
print_value_path
(
def_id
,
substs
),
write
(
"` can be evaluated"
))
...
...
src/librustc_mir/transform/qualify_min_const_fn.rs
浏览文件 @
6544d7b6
...
...
@@ -39,7 +39,7 @@ pub fn is_min_const_fn(tcx: TyCtxt<'tcx>, def_id: DefId, body: &'a Body<'tcx>) -
ty
::
PredicateKind
::
Subtype
(
_
)
=>
{
bug!
(
"subtype predicate on function: {:#?}"
,
predicate
)
}
ty
::
PredicateKind
::
Trait
(
pred
,
constness
)
=>
{
&
ty
::
PredicateKind
::
Trait
(
pred
,
constness
)
=>
{
if
Some
(
pred
.def_id
())
==
tcx
.lang_items
()
.sized_trait
()
{
continue
;
}
...
...
src/librustc_trait_selection/traits/auto_trait.rs
浏览文件 @
6544d7b6
...
...
@@ -634,7 +634,7 @@ fn evaluate_nested_obligations(
// We check this by calling is_of_param on the relevant types
// from the various possible predicates
match
predicate
.kind
()
{
ty
::
PredicateKind
::
Trait
(
p
,
_
)
=>
{
&
ty
::
PredicateKind
::
Trait
(
p
,
_
)
=>
{
if
self
.is_param_no_infer
(
p
.skip_binder
()
.trait_ref.substs
)
&&
!
only_projections
&&
is_new_pred
...
...
@@ -643,7 +643,7 @@ fn evaluate_nested_obligations(
}
predicates
.push_back
(
p
);
}
ty
::
PredicateKind
::
Projection
(
p
)
=>
{
&
ty
::
PredicateKind
::
Projection
(
p
)
=>
{
debug!
(
"evaluate_nested_obligations: examining projection predicate {:?}"
,
predicate
...
...
src/librustc_trait_selection/traits/error_reporting/mod.rs
浏览文件 @
6544d7b6
...
...
@@ -524,12 +524,12 @@ fn report_selection_error(
)
}
ty
::
PredicateKind
::
ObjectSafe
(
trait_def_id
)
=>
{
&
ty
::
PredicateKind
::
ObjectSafe
(
trait_def_id
)
=>
{
let
violations
=
self
.tcx
.object_safety_violations
(
trait_def_id
);
report_object_safety_error
(
self
.tcx
,
span
,
trait_def_id
,
violations
)
}
ty
::
PredicateKind
::
ClosureKind
(
closure_def_id
,
closure_substs
,
kind
)
=>
{
&
ty
::
PredicateKind
::
ClosureKind
(
closure_def_id
,
closure_substs
,
kind
)
=>
{
let
found_kind
=
self
.closure_kind
(
closure_substs
)
.unwrap
();
let
closure_span
=
self
.tcx.sess
.source_map
()
.guess_head_span
(
...
...
src/librustc_trait_selection/traits/fulfill.rs
浏览文件 @
6544d7b6
...
...
@@ -443,7 +443,7 @@ fn process_obligation(
}
}
ty
::
PredicateKind
::
ObjectSafe
(
trait_def_id
)
=>
{
&
ty
::
PredicateKind
::
ObjectSafe
(
trait_def_id
)
=>
{
if
!
self
.selcx
.tcx
()
.is_object_safe
(
trait_def_id
)
{
ProcessResult
::
Error
(
CodeSelectionError
(
Unimplemented
))
}
else
{
...
...
@@ -451,7 +451,7 @@ fn process_obligation(
}
}
ty
::
PredicateKind
::
ClosureKind
(
_
,
closure_substs
,
kind
)
=>
{
&
ty
::
PredicateKind
::
ClosureKind
(
_
,
closure_substs
,
kind
)
=>
{
match
self
.selcx
.infcx
()
.closure_kind
(
closure_substs
)
{
Some
(
closure_kind
)
=>
{
if
closure_kind
.extends
(
kind
)
{
...
...
@@ -464,7 +464,7 @@ fn process_obligation(
}
}
ty
::
PredicateKind
::
WellFormed
(
ty
)
=>
{
&
ty
::
PredicateKind
::
WellFormed
(
ty
)
=>
{
match
wf
::
obligations
(
self
.selcx
.infcx
(),
obligation
.param_env
,
...
...
@@ -481,7 +481,7 @@ fn process_obligation(
}
}
ty
::
PredicateKind
::
Subtype
(
ref
subtype
)
=>
{
ty
::
PredicateKind
::
Subtype
(
subtype
)
=>
{
match
self
.selcx
.infcx
()
.subtype_predicate
(
&
obligation
.cause
,
obligation
.param_env
,
...
...
@@ -510,7 +510,7 @@ fn process_obligation(
}
}
ty
::
PredicateKind
::
ConstEvaluatable
(
def_id
,
substs
)
=>
{
&
ty
::
PredicateKind
::
ConstEvaluatable
(
def_id
,
substs
)
=>
{
match
self
.selcx
.infcx
()
.const_eval_resolve
(
obligation
.param_env
,
def_id
,
...
...
src/librustc_trait_selection/traits/project.rs
浏览文件 @
6544d7b6
...
...
@@ -930,7 +930,7 @@ fn assemble_candidates_from_predicates<'cx, 'tcx>(
let
infcx
=
selcx
.infcx
();
for
predicate
in
env_predicates
{
debug!
(
"assemble_candidates_from_predicates: predicate={:?}"
,
predicate
);
if
let
ty
::
PredicateKind
::
Projection
(
data
)
=
predicate
.kind
()
{
if
let
&
ty
::
PredicateKind
::
Projection
(
data
)
=
predicate
.kind
()
{
let
same_def_id
=
data
.projection_def_id
()
==
obligation
.predicate.item_def_id
;
let
is_match
=
same_def_id
...
...
@@ -1167,12 +1167,10 @@ fn confirm_object_candidate<'cx, 'tcx>(
// select only those projections that are actually projecting an
// item with the correct name
let
env_predicates
=
env_predicates
.filter_map
(|
o
|
match
o
.predicate
.kind
()
{
ty
::
PredicateKind
::
Projection
(
data
)
=>
{
if
data
.projection_def_id
()
==
obligation
.predicate.item_def_id
{
Some
(
data
)
}
else
{
None
}
&
ty
::
PredicateKind
::
Projection
(
data
)
if
data
.projection_def_id
()
==
obligation
.predicate.item_def_id
=>
{
Some
(
data
)
}
_
=>
None
,
});
...
...
src/librustc_trait_selection/traits/select.rs
浏览文件 @
6544d7b6
...
...
@@ -414,13 +414,13 @@ fn evaluate_predicate_recursively<'o>(
}
match
obligation
.predicate
.kind
()
{
ty
::
PredicateKind
::
Trait
(
ref
t
,
_
)
=>
{
ty
::
PredicateKind
::
Trait
(
t
,
_
)
=>
{
debug_assert!
(
!
t
.has_escaping_bound_vars
());
let
obligation
=
obligation
.with
(
*
t
);
self
.evaluate_trait_predicate_recursively
(
previous_stack
,
obligation
)
}
ty
::
PredicateKind
::
Subtype
(
ref
p
)
=>
{
ty
::
PredicateKind
::
Subtype
(
p
)
=>
{
// Does this code ever run?
match
self
.infcx
.subtype_predicate
(
&
obligation
.cause
,
obligation
.param_env
,
p
)
{
Some
(
Ok
(
InferOk
{
mut
obligations
,
..
}))
=>
{
...
...
@@ -435,7 +435,7 @@ fn evaluate_predicate_recursively<'o>(
}
}
ty
::
PredicateKind
::
WellFormed
(
ty
)
=>
match
wf
::
obligations
(
&
ty
::
PredicateKind
::
WellFormed
(
ty
)
=>
match
wf
::
obligations
(
self
.infcx
,
obligation
.param_env
,
obligation
.cause.body_id
,
...
...
@@ -454,7 +454,7 @@ fn evaluate_predicate_recursively<'o>(
Ok
(
EvaluatedToOkModuloRegions
)
}
ty
::
PredicateKind
::
ObjectSafe
(
trait_def_id
)
=>
{
&
ty
::
PredicateKind
::
ObjectSafe
(
trait_def_id
)
=>
{
if
self
.tcx
()
.is_object_safe
(
trait_def_id
)
{
Ok
(
EvaluatedToOk
)
}
else
{
...
...
@@ -462,7 +462,7 @@ fn evaluate_predicate_recursively<'o>(
}
}
ty
::
PredicateKind
::
Projection
(
ref
data
)
=>
{
ty
::
PredicateKind
::
Projection
(
data
)
=>
{
let
project_obligation
=
obligation
.with
(
*
data
);
match
project
::
poly_project_and_unify_type
(
self
,
&
project_obligation
)
{
Ok
(
Some
(
mut
subobligations
))
=>
{
...
...
@@ -483,7 +483,7 @@ fn evaluate_predicate_recursively<'o>(
}
}
ty
::
PredicateKind
::
ClosureKind
(
_
,
closure_substs
,
kind
)
=>
{
&
ty
::
PredicateKind
::
ClosureKind
(
_
,
closure_substs
,
kind
)
=>
{
match
self
.infcx
.closure_kind
(
closure_substs
)
{
Some
(
closure_kind
)
=>
{
if
closure_kind
.extends
(
kind
)
{
...
...
@@ -496,7 +496,7 @@ fn evaluate_predicate_recursively<'o>(
}
}
ty
::
PredicateKind
::
ConstEvaluatable
(
def_id
,
substs
)
=>
{
&
ty
::
PredicateKind
::
ConstEvaluatable
(
def_id
,
substs
)
=>
{
match
self
.tcx
()
.const_eval_resolve
(
obligation
.param_env
,
def_id
,
...
...
src/librustc_trait_selection/traits/wf.rs
浏览文件 @
6544d7b6
...
...
@@ -73,28 +73,28 @@ pub fn predicate_obligations<'a, 'tcx>(
// (*) ok to skip binders, because wf code is prepared for it
match
predicate
.kind
()
{
ty
::
PredicateKind
::
Trait
(
ref
t
,
_
)
=>
{
ty
::
PredicateKind
::
Trait
(
t
,
_
)
=>
{
wf
.compute_trait_ref
(
&
t
.skip_binder
()
.trait_ref
,
Elaborate
::
None
);
// (*)
}
ty
::
PredicateKind
::
RegionOutlives
(
..
)
=>
{}
ty
::
PredicateKind
::
TypeOutlives
(
ref
t
)
=>
{
ty
::
PredicateKind
::
TypeOutlives
(
t
)
=>
{
wf
.compute
(
t
.skip_binder
()
.0
);
}
ty
::
PredicateKind
::
Projection
(
ref
t
)
=>
{
ty
::
PredicateKind
::
Projection
(
t
)
=>
{
let
t
=
t
.skip_binder
();
// (*)
wf
.compute_projection
(
t
.projection_ty
);
wf
.compute
(
t
.ty
);
}
ty
::
PredicateKind
::
WellFormed
(
t
)
=>
{
&
ty
::
PredicateKind
::
WellFormed
(
t
)
=>
{
wf
.compute
(
t
);
}
ty
::
PredicateKind
::
ObjectSafe
(
_
)
=>
{}
ty
::
PredicateKind
::
ClosureKind
(
..
)
=>
{}
ty
::
PredicateKind
::
Subtype
(
ref
data
)
=>
{
ty
::
PredicateKind
::
Subtype
(
data
)
=>
{
wf
.compute
(
data
.skip_binder
()
.a
);
// (*)
wf
.compute
(
data
.skip_binder
()
.b
);
// (*)
}
ty
::
PredicateKind
::
ConstEvaluatable
(
def_id
,
substs
)
=>
{
&
ty
::
PredicateKind
::
ConstEvaluatable
(
def_id
,
substs
)
=>
{
let
obligations
=
wf
.nominal_obligations
(
def_id
,
substs
);
wf
.out
.extend
(
obligations
);
...
...
src/librustc_typeck/astconv.rs
浏览文件 @
6544d7b6
...
...
@@ -1605,7 +1605,7 @@ fn conv_object_ty_poly_trait_ref(
.map
(|
item
|
item
.def_id
),
);
}
ty
::
PredicateKind
::
Projection
(
pred
)
=>
{
&
ty
::
PredicateKind
::
Projection
(
pred
)
=>
{
// A `Self` within the original bound will be substituted with a
// `trait_object_dummy_self`, so check for that.
let
references_self
=
...
...
src/librustc_typeck/check/coercion.rs
浏览文件 @
6544d7b6
...
...
@@ -597,7 +597,7 @@ fn coerce_unsized(&self, mut source: Ty<'tcx>, mut target: Ty<'tcx>) -> CoerceRe
let
obligation
=
queue
.remove
(
0
);
debug!
(
"coerce_unsized resolve step: {:?}"
,
obligation
);
let
trait_pred
=
match
obligation
.predicate
.kind
()
{
ty
::
PredicateKind
::
Trait
(
trait_pred
,
_
)
&
ty
::
PredicateKind
::
Trait
(
trait_pred
,
_
)
if
traits
.contains
(
&
trait_pred
.def_id
())
=>
{
if
unsize_did
==
trait_pred
.def_id
()
{
...
...
src/librustc_typeck/check/dropck.rs
浏览文件 @
6544d7b6
...
...
@@ -232,10 +232,10 @@ fn ensure_drop_predicates_are_implied_by_item_defn<'tcx>(
let
mut
relator
:
SimpleEqRelation
<
'tcx
>
=
SimpleEqRelation
::
new
(
tcx
,
self_param_env
);
match
(
predicate
.kind
(),
p
.kind
())
{
(
ty
::
PredicateKind
::
Trait
(
a
,
_
),
ty
::
PredicateKind
::
Trait
(
b
,
_
))
=>
{
relator
.relate
(
&
a
,
&
b
)
.is_ok
()
relator
.relate
(
a
,
b
)
.is_ok
()
}
(
ty
::
PredicateKind
::
Projection
(
a
),
ty
::
PredicateKind
::
Projection
(
b
))
=>
{
relator
.relate
(
&
a
,
&
b
)
.is_ok
()
relator
.relate
(
a
,
b
)
.is_ok
()
}
_
=>
predicate
==
p
,
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录