Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
0eb87ed5
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,发现更多精彩内容 >>
提交
0eb87ed5
编写于
6月 23, 2020
作者:
M
Matthew Jasper
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Rename projection_predicates to item_bounds
上级
5ded3945
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
21 addition
and
32 deletion
+21
-32
compiler/rustc_infer/src/infer/outlives/verify.rs
compiler/rustc_infer/src/infer/outlives/verify.rs
+2
-2
compiler/rustc_middle/src/query/mod.rs
compiler/rustc_middle/src/query/mod.rs
+2
-2
compiler/rustc_trait_selection/src/traits/project.rs
compiler/rustc_trait_selection/src/traits/project.rs
+2
-4
compiler/rustc_trait_selection/src/traits/select/mod.rs
compiler/rustc_trait_selection/src/traits/select/mod.rs
+2
-4
compiler/rustc_ty/src/ty.rs
compiler/rustc_ty/src/ty.rs
+9
-16
compiler/rustc_typeck/src/check/compare_method.rs
compiler/rustc_typeck/src/check/compare_method.rs
+4
-4
未找到文件。
compiler/rustc_infer/src/infer/outlives/verify.rs
浏览文件 @
0eb87ed5
...
...
@@ -328,8 +328,8 @@ fn region_bounds_declared_on_associated_item(
assoc_item_def_id
:
DefId
,
)
->
impl
Iterator
<
Item
=
ty
::
Region
<
'tcx
>>
{
let
tcx
=
self
.tcx
;
let
predicates
=
tcx
.projection_predicate
s
(
assoc_item_def_id
);
predicate
s
let
bounds
=
tcx
.item_bound
s
(
assoc_item_def_id
);
bound
s
.into_iter
()
.filter_map
(|
p
|
p
.to_opt_type_outlives
())
.filter_map
(|
p
|
p
.no_bound_vars
())
...
...
compiler/rustc_middle/src/query/mod.rs
浏览文件 @
0eb87ed5
...
...
@@ -156,7 +156,7 @@ fn describe_as_module(def_id: LocalDefId, tcx: TyCtxt<'_>) -> String {
cache_on_disk_if
{
key
.is_local
()
}
}
/// Returns the list of
predicate
s that can be used for
/// Returns the list of
bound
s that can be used for
/// `SelectionCandidate::ProjectionCandidate` and
/// `ProjectionTyCandidate::TraitDef`.
/// Specifically this is the bounds (equivalent to) those
...
...
@@ -169,7 +169,7 @@ fn describe_as_module(def_id: LocalDefId, tcx: TyCtxt<'_>) -> String {
/// ^^^^^^^^^^^^^^^
///
/// `key` is the `DefId` of the associated type or opaque type.
query
projection_predicate
s
(
key
:
DefId
)
->
&
'tcx
ty
::
List
<
ty
::
Predicate
<
'tcx
>>
{
query
item_bound
s
(
key
:
DefId
)
->
&
'tcx
ty
::
List
<
ty
::
Predicate
<
'tcx
>>
{
desc
{
|
tcx
|
"finding projection predicates for `{}`"
,
tcx
.def_path_str
(
key
)
}
}
...
...
compiler/rustc_trait_selection/src/traits/project.rs
浏览文件 @
0eb87ed5
...
...
@@ -909,10 +909,8 @@ fn assemble_candidates_from_trait_def<'cx, 'tcx>(
// Check whether the self-type is itself a projection.
// If so, extract what we know from the trait and try to come up with a good answer.
let
bounds
=
match
*
obligation_trait_ref
.self_ty
()
.kind
()
{
ty
::
Projection
(
ref
data
)
=>
{
tcx
.projection_predicates
(
data
.item_def_id
)
.subst
(
tcx
,
data
.substs
)
}
ty
::
Opaque
(
def_id
,
substs
)
=>
tcx
.projection_predicates
(
def_id
)
.subst
(
tcx
,
substs
),
ty
::
Projection
(
ref
data
)
=>
tcx
.item_bounds
(
data
.item_def_id
)
.subst
(
tcx
,
data
.substs
),
ty
::
Opaque
(
def_id
,
substs
)
=>
tcx
.item_bounds
(
def_id
)
.subst
(
tcx
,
substs
),
ty
::
Infer
(
ty
::
TyVar
(
_
))
=>
{
// If the self-type is an inference variable, then it MAY wind up
// being a projected type, so induce an ambiguity.
...
...
compiler/rustc_trait_selection/src/traits/select/mod.rs
浏览文件 @
0eb87ed5
...
...
@@ -1171,10 +1171,8 @@ fn match_projection_obligation_against_definition_bounds(
let
tcx
=
self
.infcx.tcx
;
let
predicates
=
match
*
placeholder_trait_predicate
.trait_ref
.self_ty
()
.kind
()
{
ty
::
Projection
(
ref
data
)
=>
{
tcx
.projection_predicates
(
data
.item_def_id
)
.subst
(
tcx
,
data
.substs
)
}
ty
::
Opaque
(
def_id
,
substs
)
=>
tcx
.projection_predicates
(
def_id
)
.subst
(
tcx
,
substs
),
ty
::
Projection
(
ref
data
)
=>
tcx
.item_bounds
(
data
.item_def_id
)
.subst
(
tcx
,
data
.substs
),
ty
::
Opaque
(
def_id
,
substs
)
=>
tcx
.item_bounds
(
def_id
)
.subst
(
tcx
,
substs
),
_
=>
{
span_bug!
(
obligation
.cause.span
,
...
...
compiler/rustc_ty/src/ty.rs
浏览文件 @
0eb87ed5
...
...
@@ -500,7 +500,7 @@ fn asyncness(tcx: TyCtxt<'_>, def_id: DefId) -> hir::IsAsync {
/// simplify checking that these bounds are met in impls. This means that
/// a bound such as `for<'b> <Self as X<'b>>::U: Clone` can't be used, as in
/// `hr-associated-type-bound-1.rs`.
fn
associated_type_
projection_predicate
s
(
fn
associated_type_
bound
s
(
tcx
:
TyCtxt
<
'_
>
,
assoc_item_def_id
:
DefId
,
)
->
&
'_
ty
::
List
<
ty
::
Predicate
<
'_
>>
{
...
...
@@ -545,21 +545,14 @@ fn associated_type_projection_predicates(
});
let
result
=
tcx
.mk_predicates
(
predicates
);
debug!
(
"associated_type_projection_predicates({}) = {:?}"
,
tcx
.def_path_str
(
assoc_item_def_id
),
result
);
debug!
(
"associated_type_bounds({}) = {:?}"
,
tcx
.def_path_str
(
assoc_item_def_id
),
result
);
result
}
/// Opaque types don't have the same issues as associated types: the only
/// predicates on an opaque type (excluding those it inherits from its parent
/// item) should be of the form we're expecting.
fn
opaque_type_projection_predicates
(
tcx
:
TyCtxt
<
'_
>
,
def_id
:
DefId
,
)
->
&
'_
ty
::
List
<
ty
::
Predicate
<
'_
>>
{
fn
opaque_type_bounds
(
tcx
:
TyCtxt
<
'_
>
,
def_id
:
DefId
)
->
&
'_
ty
::
List
<
ty
::
Predicate
<
'_
>>
{
let
substs
=
InternalSubsts
::
identity_for_item
(
tcx
,
def_id
);
let
bounds
=
tcx
.predicates_of
(
def_id
);
...
...
@@ -607,15 +600,15 @@ fn opaque_type_projection_predicates(
});
let
result
=
tcx
.mk_predicates
(
filtered_predicates
);
debug!
(
"opaque_type_
projection_predicate
s({}) = {:?}"
,
tcx
.def_path_str
(
def_id
),
result
);
debug!
(
"opaque_type_
bound
s({}) = {:?}"
,
tcx
.def_path_str
(
def_id
),
result
);
result
}
fn
projection_predicate
s
(
tcx
:
TyCtxt
<
'_
>
,
def_id
:
DefId
)
->
&
'_
ty
::
List
<
ty
::
Predicate
<
'_
>>
{
fn
item_bound
s
(
tcx
:
TyCtxt
<
'_
>
,
def_id
:
DefId
)
->
&
'_
ty
::
List
<
ty
::
Predicate
<
'_
>>
{
match
tcx
.def_kind
(
def_id
)
{
DefKind
::
AssocTy
=>
associated_type_
projection_predicate
s
(
tcx
,
def_id
),
DefKind
::
OpaqueTy
=>
opaque_type_
projection_predicate
s
(
tcx
,
def_id
),
k
=>
bug!
(
"
projection_predicate
s called on {}"
,
k
.descr
(
def_id
)),
DefKind
::
AssocTy
=>
associated_type_
bound
s
(
tcx
,
def_id
),
DefKind
::
OpaqueTy
=>
opaque_type_
bound
s
(
tcx
,
def_id
),
k
=>
bug!
(
"
item_bound
s called on {}"
,
k
.descr
(
def_id
)),
}
}
...
...
@@ -636,7 +629,7 @@ pub fn provide(providers: &mut ty::query::Providers) {
instance_def_size_estimate
,
issue33140_self_ty
,
impl_defaultness
,
projection_predicate
s
,
item_bound
s
,
..*
providers
};
}
compiler/rustc_typeck/src/check/compare_method.rs
浏览文件 @
0eb87ed5
...
...
@@ -1052,7 +1052,7 @@ fn nested_visit_map(
compare_type_predicate_entailment
(
tcx
,
impl_ty
,
impl_ty_span
,
trait_ty
,
impl_trait_ref
)
?
;
c
ompare_projection
_bounds
(
tcx
,
trait_ty
,
impl_ty
,
impl_ty_span
,
impl_trait_ref
)
c
heck_type
_bounds
(
tcx
,
trait_ty
,
impl_ty
,
impl_ty_span
,
impl_trait_ref
)
})();
}
...
...
@@ -1170,7 +1170,7 @@ fn compare_type_predicate_entailment<'tcx>(
/// For default associated types the normalization is not possible (the value
/// from the impl could be overridden). We also can't normalize generic
/// associated types (yet) because they contain bound parameters.
fn
c
ompare_projection
_bounds
<
'tcx
>
(
fn
c
heck_type
_bounds
<
'tcx
>
(
tcx
:
TyCtxt
<
'tcx
>
,
trait_ty
:
&
ty
::
AssocItem
,
impl_ty
:
&
ty
::
AssocItem
,
...
...
@@ -1237,8 +1237,8 @@ fn compare_projection_bounds<'tcx>(
ObligationCauseCode
::
ItemObligation
(
trait_ty
.def_id
),
);
let
predicates
=
tcx
.
projection_predicate
s
(
trait_ty
.def_id
);
debug!
(
"c
ompare_projection_bounds: projection_predicate
s={:?}"
,
predicates
);
let
predicates
=
tcx
.
item_bound
s
(
trait_ty
.def_id
);
debug!
(
"c
heck_type_bounds: item_bound
s={:?}"
,
predicates
);
for
predicate
in
predicates
{
let
concrete_ty_predicate
=
predicate
.subst
(
tcx
,
rebased_substs
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录