Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
e9e5d068
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,发现更多精彩内容 >>
未验证
提交
e9e5d068
编写于
6月 17, 2022
作者:
A
Alan Egerton
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Relax constrained generics to TypeVisitable
上级
f66c06f7
变更
23
隐藏空白更改
内联
并排
Showing
23 changed file
with
56 addition
and
43 deletion
+56
-43
compiler/rustc_borrowck/src/constraint_generation.rs
compiler/rustc_borrowck/src/constraint_generation.rs
+2
-1
compiler/rustc_borrowck/src/type_check/liveness/trace.rs
compiler/rustc_borrowck/src/type_check/liveness/trace.rs
+3
-3
compiler/rustc_const_eval/src/interpret/util.rs
compiler/rustc_const_eval/src/interpret/util.rs
+4
-2
compiler/rustc_infer/src/infer/error_reporting/nice_region_error/util.rs
...infer/src/infer/error_reporting/nice_region_error/util.rs
+2
-2
compiler/rustc_infer/src/infer/mod.rs
compiler/rustc_infer/src/infer/mod.rs
+2
-1
compiler/rustc_infer/src/infer/nll_relate/mod.rs
compiler/rustc_infer/src/infer/nll_relate/mod.rs
+2
-1
compiler/rustc_infer/src/infer/opaque_types.rs
compiler/rustc_infer/src/infer/opaque_types.rs
+3
-2
compiler/rustc_middle/src/ty/diagnostics.rs
compiler/rustc_middle/src/ty/diagnostics.rs
+3
-3
compiler/rustc_middle/src/ty/mod.rs
compiler/rustc_middle/src/ty/mod.rs
+1
-1
compiler/rustc_middle/src/ty/print/pretty.rs
compiler/rustc_middle/src/ty/print/pretty.rs
+2
-2
compiler/rustc_middle/src/ty/structural_impls.rs
compiler/rustc_middle/src/ty/structural_impls.rs
+1
-1
compiler/rustc_middle/src/ty/sty.rs
compiler/rustc_middle/src/ty/sty.rs
+7
-7
compiler/rustc_privacy/src/lib.rs
compiler/rustc_privacy/src/lib.rs
+4
-2
compiler/rustc_symbol_mangling/src/v0.rs
compiler/rustc_symbol_mangling/src/v0.rs
+2
-2
compiler/rustc_trait_selection/src/traits/object_safety.rs
compiler/rustc_trait_selection/src/traits/object_safety.rs
+2
-2
compiler/rustc_trait_selection/src/traits/project.rs
compiler/rustc_trait_selection/src/traits/project.rs
+2
-1
compiler/rustc_trait_selection/src/traits/query/normalize.rs
compiler/rustc_trait_selection/src/traits/query/normalize.rs
+2
-1
compiler/rustc_traits/src/chalk/lowering.rs
compiler/rustc_traits/src/chalk/lowering.rs
+3
-2
compiler/rustc_ty_utils/src/instance.rs
compiler/rustc_ty_utils/src/instance.rs
+2
-2
compiler/rustc_typeck/src/check/fn_ctxt/_impl.rs
compiler/rustc_typeck/src/check/fn_ctxt/_impl.rs
+2
-1
compiler/rustc_typeck/src/check/wfcheck.rs
compiler/rustc_typeck/src/check/wfcheck.rs
+1
-1
compiler/rustc_typeck/src/constrained_generic_params.rs
compiler/rustc_typeck/src/constrained_generic_params.rs
+2
-1
src/tools/clippy/clippy_utils/src/ty.rs
src/tools/clippy/clippy_utils/src/ty.rs
+2
-2
未找到文件。
compiler/rustc_borrowck/src/constraint_generation.rs
浏览文件 @
e9e5d068
...
...
@@ -7,6 +7,7 @@
};
use
rustc_middle
::
ty
::
fold
::
TypeFoldable
;
use
rustc_middle
::
ty
::
subst
::
SubstsRef
;
use
rustc_middle
::
ty
::
visit
::
TypeVisitable
;
use
rustc_middle
::
ty
::{
self
,
RegionVid
,
Ty
};
use
crate
::{
...
...
@@ -163,7 +164,7 @@ impl<'cx, 'cg, 'tcx> ConstraintGeneration<'cx, 'cg, 'tcx> {
/// `location`.
fn
add_regular_live_constraint
<
T
>
(
&
mut
self
,
live_ty
:
T
,
location
:
Location
)
where
T
:
Type
Fold
able
<
'tcx
>
,
T
:
Type
Visit
able
<
'tcx
>
,
{
debug!
(
"add_regular_live_constraint(live_ty={:?}, location={:?})"
,
live_ty
,
location
);
...
...
compiler/rustc_borrowck/src/type_check/liveness/trace.rs
浏览文件 @
e9e5d068
...
...
@@ -3,7 +3,7 @@
use
rustc_index
::
interval
::
IntervalSet
;
use
rustc_infer
::
infer
::
canonical
::
QueryRegionConstraints
;
use
rustc_middle
::
mir
::{
BasicBlock
,
Body
,
ConstraintCategory
,
Local
,
Location
};
use
rustc_middle
::
ty
::{
Ty
,
TypeFoldable
};
use
rustc_middle
::
ty
::{
Ty
,
TypeFoldable
,
TypeVisitable
};
use
rustc_trait_selection
::
traits
::
query
::
dropck_outlives
::
DropckOutlivesResult
;
use
rustc_trait_selection
::
traits
::
query
::
type_op
::
outlives
::
DropckOutlives
;
use
rustc_trait_selection
::
traits
::
query
::
type_op
::{
TypeOp
,
TypeOpOutput
};
...
...
@@ -477,7 +477,7 @@ fn initialized_at_exit(&mut self, block: BasicBlock, mpi: MovePathIndex) -> bool
/// points `live_at`.
fn
add_use_live_facts_for
(
&
mut
self
,
value
:
impl
Type
Fold
able
<
'tcx
>
,
value
:
impl
Type
Visit
able
<
'tcx
>
,
live_at
:
&
IntervalSet
<
PointIndex
>
,
)
{
debug!
(
"add_use_live_facts_for(value={:?})"
,
value
);
...
...
@@ -542,7 +542,7 @@ fn add_drop_live_facts_for(
fn
make_all_regions_live
(
elements
:
&
RegionValueElements
,
typeck
:
&
mut
TypeChecker
<
'_
,
'tcx
>
,
value
:
impl
Type
Fold
able
<
'tcx
>
,
value
:
impl
Type
Visit
able
<
'tcx
>
,
live_at
:
&
IntervalSet
<
PointIndex
>
,
)
{
debug!
(
"make_all_regions_live(value={:?})"
,
value
);
...
...
compiler/rustc_const_eval/src/interpret/util.rs
浏览文件 @
e9e5d068
use
rustc_middle
::
mir
::
interpret
::
InterpResult
;
use
rustc_middle
::
ty
::{
self
,
Ty
,
TyCtxt
,
TypeFoldable
,
TypeSuperFoldable
,
TypeVisitor
};
use
rustc_middle
::
ty
::{
self
,
Ty
,
TyCtxt
,
TypeFoldable
,
TypeSuperFoldable
,
TypeVisitable
,
TypeVisitor
,
};
use
std
::
convert
::
TryInto
;
use
std
::
ops
::
ControlFlow
;
...
...
@@ -10,7 +12,7 @@
/// case these parameters are unused.
pub
(
crate
)
fn
ensure_monomorphic_enough
<
'tcx
,
T
>
(
tcx
:
TyCtxt
<
'tcx
>
,
ty
:
T
)
->
InterpResult
<
'tcx
>
where
T
:
Type
Fold
able
<
'tcx
>
,
T
:
Type
Visit
able
<
'tcx
>
,
{
debug!
(
"ensure_monomorphic_enough: ty={:?}"
,
ty
);
if
!
ty
.needs_subst
()
{
...
...
compiler/rustc_infer/src/infer/error_reporting/nice_region_error/util.rs
浏览文件 @
e9e5d068
...
...
@@ -5,7 +5,7 @@
use
crate
::
infer
::
TyCtxt
;
use
rustc_hir
as
hir
;
use
rustc_hir
::
def_id
::
LocalDefId
;
use
rustc_middle
::
ty
::{
self
,
Binder
,
DefIdTree
,
Region
,
Ty
,
TypeFoldable
};
use
rustc_middle
::
ty
::{
self
,
Binder
,
DefIdTree
,
Region
,
Ty
,
TypeFoldable
,
TypeVisitable
};
use
rustc_span
::
Span
;
/// Information about the anonymous region we are searching for.
...
...
@@ -142,7 +142,7 @@ pub(super) fn is_return_type_anon(
fn
includes_region
(
&
self
,
ty
:
Binder
<
'tcx
,
impl
Type
Fold
able
<
'tcx
>>
,
ty
:
Binder
<
'tcx
,
impl
Type
Visit
able
<
'tcx
>>
,
region
:
ty
::
BoundRegionKind
,
)
->
bool
{
let
late_bound_regions
=
self
.tcx
()
.collect_referenced_late_bound_regions
(
&
ty
);
...
...
compiler/rustc_infer/src/infer/mod.rs
浏览文件 @
e9e5d068
...
...
@@ -25,6 +25,7 @@
use
rustc_middle
::
ty
::
fold
::{
TypeFoldable
,
TypeFolder
,
TypeSuperFoldable
};
use
rustc_middle
::
ty
::
relate
::
RelateResult
;
use
rustc_middle
::
ty
::
subst
::{
GenericArg
,
GenericArgKind
,
InternalSubsts
,
SubstsRef
};
use
rustc_middle
::
ty
::
visit
::
TypeVisitable
;
pub
use
rustc_middle
::
ty
::
IntVarValue
;
use
rustc_middle
::
ty
::{
self
,
GenericParamDefKind
,
InferConst
,
Ty
,
TyCtxt
};
use
rustc_middle
::
ty
::{
ConstVid
,
FloatVid
,
IntVid
,
TyVid
};
...
...
@@ -1438,7 +1439,7 @@ pub fn resolve_numeric_literals_with_default<T>(&self, value: T) -> T
/// `resolve_vars_if_possible()`.
pub
fn
unresolved_type_vars
<
T
>
(
&
self
,
value
:
&
T
)
->
Option
<
(
Ty
<
'tcx
>
,
Option
<
Span
>
)
>
where
T
:
Type
Fold
able
<
'tcx
>
,
T
:
Type
Visit
able
<
'tcx
>
,
{
value
.visit_with
(
&
mut
resolve
::
UnresolvedTypeFinder
::
new
(
self
))
.break_value
()
}
...
...
compiler/rustc_infer/src/infer/nll_relate/mod.rs
浏览文件 @
e9e5d068
...
...
@@ -29,6 +29,7 @@
use
rustc_middle
::
ty
::
error
::
TypeError
;
use
rustc_middle
::
ty
::
fold
::{
TypeFoldable
,
TypeSuperFoldable
,
TypeVisitor
};
use
rustc_middle
::
ty
::
relate
::{
self
,
Relate
,
RelateResult
,
TypeRelation
};
use
rustc_middle
::
ty
::
visit
::
TypeVisitable
;
use
rustc_middle
::
ty
::{
self
,
InferConst
,
Ty
,
TyCtxt
};
use
rustc_span
::
Span
;
use
std
::
fmt
::
Debug
;
...
...
@@ -810,7 +811,7 @@ struct ScopeInstantiator<'me, 'tcx> {
}
impl
<
'me
,
'tcx
>
TypeVisitor
<
'tcx
>
for
ScopeInstantiator
<
'me
,
'tcx
>
{
fn
visit_binder
<
T
:
Type
Fold
able
<
'tcx
>>
(
fn
visit_binder
<
T
:
Type
Visit
able
<
'tcx
>>
(
&
mut
self
,
t
:
&
ty
::
Binder
<
'tcx
,
T
>
,
)
->
ControlFlow
<
Self
::
BreakTy
>
{
...
...
compiler/rustc_infer/src/infer/opaque_types.rs
浏览文件 @
e9e5d068
...
...
@@ -9,7 +9,8 @@
use
rustc_middle
::
ty
::
fold
::
BottomUpFolder
;
use
rustc_middle
::
ty
::
subst
::{
GenericArgKind
,
Subst
};
use
rustc_middle
::
ty
::{
self
,
OpaqueHiddenType
,
OpaqueTypeKey
,
Ty
,
TyCtxt
,
TypeFoldable
,
TypeSuperFoldable
,
TypeVisitor
,
self
,
OpaqueHiddenType
,
OpaqueTypeKey
,
Ty
,
TyCtxt
,
TypeFoldable
,
TypeSuperFoldable
,
TypeVisitable
,
TypeVisitor
,
};
use
rustc_span
::
Span
;
...
...
@@ -461,7 +462,7 @@ impl<'tcx, OP> TypeVisitor<'tcx> for ConstrainOpaqueTypeRegionVisitor<OP>
where
OP
:
FnMut
(
ty
::
Region
<
'tcx
>
),
{
fn
visit_binder
<
T
:
Type
Fold
able
<
'tcx
>>
(
fn
visit_binder
<
T
:
Type
Visit
able
<
'tcx
>>
(
&
mut
self
,
t
:
&
ty
::
Binder
<
'tcx
,
T
>
,
)
->
ControlFlow
<
Self
::
BreakTy
>
{
...
...
compiler/rustc_middle/src/ty/diagnostics.rs
浏览文件 @
e9e5d068
...
...
@@ -3,8 +3,8 @@
use
std
::
ops
::
ControlFlow
;
use
crate
::
ty
::{
fold
::
TypeFoldable
,
Const
,
ConstKind
,
DefIdTree
,
ExistentialPredicate
,
InferTy
,
PolyTraitPredicate
,
Ty
,
TyCtxt
,
TypeSuperFoldable
,
TypeVisitor
,
fold
::
TypeFoldable
,
visit
::
TypeVisitable
,
Const
,
ConstKind
,
DefIdTree
,
ExistentialPredicate
,
InferTy
,
PolyTraitPredicate
,
Ty
,
TyCtxt
,
TypeSuperFoldable
,
TypeVisitor
,
};
use
rustc_data_structures
::
fx
::
FxHashMap
;
...
...
@@ -87,7 +87,7 @@ pub trait IsSuggestable<'tcx> {
impl
<
'tcx
,
T
>
IsSuggestable
<
'tcx
>
for
T
where
T
:
Type
Fold
able
<
'tcx
>
,
T
:
Type
Visit
able
<
'tcx
>
,
{
fn
is_suggestable
(
self
,
tcx
:
TyCtxt
<
'tcx
>
)
->
bool
{
self
.visit_with
(
&
mut
IsSuggestableVisitor
{
tcx
})
.is_continue
()
...
...
compiler/rustc_middle/src/ty/mod.rs
浏览文件 @
e9e5d068
...
...
@@ -1514,7 +1514,7 @@ pub fn without_caller_bounds(self) -> Self {
/// `where Box<u32>: Copy`, which are clearly never
/// satisfiable. We generally want to behave as if they were true,
/// although the surrounding function is never reachable.
pub
fn
and
<
T
:
Type
Fold
able
<
'tcx
>>
(
self
,
value
:
T
)
->
ParamEnvAnd
<
'tcx
,
T
>
{
pub
fn
and
<
T
:
Type
Visit
able
<
'tcx
>>
(
self
,
value
:
T
)
->
ParamEnvAnd
<
'tcx
,
T
>
{
match
self
.reveal
()
{
Reveal
::
UserFacing
=>
ParamEnvAnd
{
param_env
:
self
,
value
},
...
...
compiler/rustc_middle/src/ty/print/pretty.rs
浏览文件 @
e9e5d068
...
...
@@ -2,7 +2,7 @@
use
crate
::
ty
::
subst
::{
GenericArg
,
GenericArgKind
,
Subst
};
use
crate
::
ty
::{
self
,
ConstInt
,
DefIdTree
,
ParamConst
,
ScalarInt
,
Term
,
Ty
,
TyCtxt
,
TypeFoldable
,
TypeSuperFoldable
,
TypeSuperFoldable
,
TypeVisitable
,
};
use
rustc_apfloat
::
ieee
::{
Double
,
Single
};
use
rustc_data_structures
::
fx
::{
FxHashMap
,
FxIndexMap
};
...
...
@@ -2277,7 +2277,7 @@ pub fn pretty_wrap_binder<T, C: FnOnce(&T, Self) -> Result<Self, fmt::Error>>(
fn
prepare_late_bound_region_info
<
T
>
(
&
mut
self
,
value
:
&
ty
::
Binder
<
'tcx
,
T
>
)
where
T
:
Type
Fold
able
<
'tcx
>
,
T
:
Type
Visit
able
<
'tcx
>
,
{
struct
LateBoundRegionNameCollector
<
'a
,
'tcx
>
{
used_region_names
:
&
'a
mut
FxHashSet
<
Symbol
>
,
...
...
compiler/rustc_middle/src/ty/structural_impls.rs
浏览文件 @
e9e5d068
...
...
@@ -453,7 +453,7 @@ fn lift_to_tcx(self, tcx: TyCtxt<'tcx>) -> Option<Self::Lifted> {
impl
<
'a
,
'tcx
,
T
:
Lift
<
'tcx
>>
Lift
<
'tcx
>
for
ty
::
Binder
<
'a
,
T
>
where
<
T
as
Lift
<
'tcx
>>
::
Lifted
:
Type
Fold
able
<
'tcx
>
,
<
T
as
Lift
<
'tcx
>>
::
Lifted
:
Type
Visit
able
<
'tcx
>
,
{
type
Lifted
=
ty
::
Binder
<
'tcx
,
T
::
Lifted
>
;
fn
lift_to_tcx
(
self
,
tcx
:
TyCtxt
<
'tcx
>
)
->
Option
<
Self
::
Lifted
>
{
...
...
compiler/rustc_middle/src/ty/sty.rs
浏览文件 @
e9e5d068
...
...
@@ -8,7 +8,7 @@
use
crate
::
ty
::
InferTy
::
*
;
use
crate
::
ty
::{
self
,
AdtDef
,
DefIdTree
,
Discr
,
Term
,
Ty
,
TyCtxt
,
TypeFlags
,
TypeFoldable
,
TypeSuperFoldable
,
TypeVisitor
,
TypeVisit
able
,
TypeVisit
or
,
};
use
crate
::
ty
::{
List
,
ParamEnv
};
use
polonius_engine
::
Atom
;
...
...
@@ -986,7 +986,7 @@ pub enum BoundVariableKind {
impl
<
'tcx
,
T
>
Binder
<
'tcx
,
T
>
where
T
:
Type
Fold
able
<
'tcx
>
,
T
:
Type
Visit
able
<
'tcx
>
,
{
/// Wraps `value` in a binder, asserting that `value` does not
/// contain any bound vars that would be bound by the
...
...
@@ -1050,14 +1050,14 @@ pub fn map_bound_ref_unchecked<F, U>(&self, f: F) -> Binder<'tcx, U>
Binder
(
value
,
self
.1
)
}
pub
fn
map_bound_ref
<
F
,
U
:
Type
Fold
able
<
'tcx
>>
(
&
self
,
f
:
F
)
->
Binder
<
'tcx
,
U
>
pub
fn
map_bound_ref
<
F
,
U
:
Type
Visit
able
<
'tcx
>>
(
&
self
,
f
:
F
)
->
Binder
<
'tcx
,
U
>
where
F
:
FnOnce
(
&
T
)
->
U
,
{
self
.as_ref
()
.map_bound
(
f
)
}
pub
fn
map_bound
<
F
,
U
:
Type
Fold
able
<
'tcx
>>
(
self
,
f
:
F
)
->
Binder
<
'tcx
,
U
>
pub
fn
map_bound
<
F
,
U
:
Type
Visit
able
<
'tcx
>>
(
self
,
f
:
F
)
->
Binder
<
'tcx
,
U
>
where
F
:
FnOnce
(
T
)
->
U
,
{
...
...
@@ -1069,7 +1069,7 @@ pub fn map_bound<F, U: TypeFoldable<'tcx>>(self, f: F) -> Binder<'tcx, U>
Binder
(
value
,
self
.1
)
}
pub
fn
try_map_bound
<
F
,
U
:
Type
Fold
able
<
'tcx
>
,
E
>
(
self
,
f
:
F
)
->
Result
<
Binder
<
'tcx
,
U
>
,
E
>
pub
fn
try_map_bound
<
F
,
U
:
Type
Visit
able
<
'tcx
>
,
E
>
(
self
,
f
:
F
)
->
Result
<
Binder
<
'tcx
,
U
>
,
E
>
where
F
:
FnOnce
(
T
)
->
Result
<
U
,
E
>
,
{
...
...
@@ -1092,7 +1092,7 @@ pub fn try_map_bound<F, U: TypeFoldable<'tcx>, E>(self, f: F) -> Result<Binder<'
/// in `bind`. This may be (debug) asserted in the future.
pub
fn
rebind
<
U
>
(
&
self
,
value
:
U
)
->
Binder
<
'tcx
,
U
>
where
U
:
Type
Fold
able
<
'tcx
>
,
U
:
Type
Visit
able
<
'tcx
>
,
{
if
cfg!
(
debug_assertions
)
{
let
mut
validator
=
ValidateBoundVars
::
new
(
self
.bound_vars
());
...
...
@@ -1113,7 +1113,7 @@ pub fn rebind<U>(&self, value: U) -> Binder<'tcx, U>
/// would not be that useful.)
pub
fn
no_bound_vars
(
self
)
->
Option
<
T
>
where
T
:
Type
Fold
able
<
'tcx
>
,
T
:
Type
Visit
able
<
'tcx
>
,
{
if
self
.0
.has_escaping_bound_vars
()
{
None
}
else
{
Some
(
self
.skip_binder
())
}
}
...
...
compiler/rustc_privacy/src/lib.rs
浏览文件 @
e9e5d068
...
...
@@ -27,7 +27,9 @@
use
rustc_middle
::
ty
::
query
::
Providers
;
use
rustc_middle
::
ty
::
subst
::
InternalSubsts
;
use
rustc_middle
::
ty
::{
self
,
Const
,
DefIdTree
,
GenericParamDefKind
};
use
rustc_middle
::
ty
::{
TraitRef
,
Ty
,
TyCtxt
,
TypeFoldable
,
TypeSuperFoldable
,
TypeVisitor
};
use
rustc_middle
::
ty
::{
TraitRef
,
Ty
,
TyCtxt
,
TypeFoldable
,
TypeSuperFoldable
,
TypeVisitable
,
TypeVisitor
,
};
use
rustc_session
::
lint
;
use
rustc_span
::
hygiene
::
Transparency
;
use
rustc_span
::
symbol
::{
kw
,
Ident
};
...
...
@@ -80,7 +82,7 @@ fn skeleton(&mut self) -> DefIdVisitorSkeleton<'_, 'tcx, Self> {
dummy
:
Default
::
default
(),
}
}
fn
visit
(
&
mut
self
,
ty_fragment
:
impl
Type
Fold
able
<
'tcx
>
)
->
ControlFlow
<
Self
::
BreakTy
>
{
fn
visit
(
&
mut
self
,
ty_fragment
:
impl
Type
Visit
able
<
'tcx
>
)
->
ControlFlow
<
Self
::
BreakTy
>
{
ty_fragment
.visit_with
(
&
mut
self
.skeleton
())
}
fn
visit_trait
(
&
mut
self
,
trait_ref
:
TraitRef
<
'tcx
>
)
->
ControlFlow
<
Self
::
BreakTy
>
{
...
...
compiler/rustc_symbol_mangling/src/v0.rs
浏览文件 @
e9e5d068
...
...
@@ -9,7 +9,7 @@
use
rustc_middle
::
ty
::
print
::{
Print
,
Printer
};
use
rustc_middle
::
ty
::
subst
::{
GenericArg
,
GenericArgKind
,
Subst
};
use
rustc_middle
::
ty
::{
self
,
EarlyBinder
,
FloatTy
,
Instance
,
IntTy
,
Ty
,
TyCtxt
,
TypeFoldable
,
UintTy
,
self
,
EarlyBinder
,
FloatTy
,
Instance
,
IntTy
,
Ty
,
TyCtxt
,
TypeFoldable
,
TypeVisitable
,
UintTy
,
};
use
rustc_span
::
symbol
::
kw
;
use
rustc_target
::
abi
::
call
::
FnAbi
;
...
...
@@ -240,7 +240,7 @@ fn in_binder<'a, T>(
print_value
:
impl
FnOnce
(
&
'a
mut
Self
,
&
T
)
->
Result
<&
'a
mut
Self
,
!>
,
)
->
Result
<&
'a
mut
Self
,
!>
where
T
:
Type
Fold
able
<
'tcx
>
,
T
:
Type
Visit
able
<
'tcx
>
,
{
let
regions
=
if
value
.has_late_bound_regions
()
{
self
.tcx
.collect_referenced_late_bound_regions
(
value
)
...
...
compiler/rustc_trait_selection/src/traits/object_safety.rs
浏览文件 @
e9e5d068
...
...
@@ -19,7 +19,7 @@
use
rustc_hir
::
def_id
::
DefId
;
use
rustc_middle
::
ty
::
subst
::{
GenericArg
,
InternalSubsts
,
Subst
};
use
rustc_middle
::
ty
::{
self
,
EarlyBinder
,
Ty
,
TyCtxt
,
TypeFoldable
,
TypeSuperFoldable
,
TypeVisitor
,
self
,
EarlyBinder
,
Ty
,
TyCtxt
,
TypeFoldable
,
TypeSuperFoldable
,
TypeVisit
able
,
TypeVisit
or
,
};
use
rustc_middle
::
ty
::{
Predicate
,
ToPredicate
};
use
rustc_session
::
lint
::
builtin
::
WHERE_CLAUSES_OBJECT_SAFETY
;
...
...
@@ -731,7 +731,7 @@ fn receiver_is_dispatchable<'tcx>(
})
}
fn
contains_illegal_self_type_reference
<
'tcx
,
T
:
Type
Fold
able
<
'tcx
>>
(
fn
contains_illegal_self_type_reference
<
'tcx
,
T
:
Type
Visit
able
<
'tcx
>>
(
tcx
:
TyCtxt
<
'tcx
>
,
trait_def_id
:
DefId
,
value
:
T
,
...
...
compiler/rustc_trait_selection/src/traits/project.rs
浏览文件 @
e9e5d068
...
...
@@ -31,6 +31,7 @@
use
rustc_middle
::
traits
::
select
::
OverflowError
;
use
rustc_middle
::
ty
::
fold
::{
MaxUniverse
,
TypeFoldable
,
TypeFolder
,
TypeSuperFoldable
};
use
rustc_middle
::
ty
::
subst
::
Subst
;
use
rustc_middle
::
ty
::
visit
::
TypeVisitable
;
use
rustc_middle
::
ty
::{
self
,
EarlyBinder
,
Term
,
ToPredicate
,
Ty
,
TyCtxt
};
use
rustc_span
::
symbol
::
sym
;
...
...
@@ -359,7 +360,7 @@ pub fn try_normalize_with_depth_to<'a, 'b, 'tcx, T>(
result
}
pub
(
crate
)
fn
needs_normalization
<
'tcx
,
T
:
Type
Fold
able
<
'tcx
>>
(
value
:
&
T
,
reveal
:
Reveal
)
->
bool
{
pub
(
crate
)
fn
needs_normalization
<
'tcx
,
T
:
Type
Visit
able
<
'tcx
>>
(
value
:
&
T
,
reveal
:
Reveal
)
->
bool
{
match
reveal
{
Reveal
::
UserFacing
=>
value
.has_type_flags
(
ty
::
TypeFlags
::
HAS_TY_PROJECTION
|
ty
::
TypeFlags
::
HAS_CT_PROJECTION
),
...
...
compiler/rustc_trait_selection/src/traits/query/normalize.rs
浏览文件 @
e9e5d068
...
...
@@ -14,6 +14,7 @@
use
rustc_middle
::
mir
;
use
rustc_middle
::
ty
::
fold
::{
FallibleTypeFolder
,
TypeFoldable
,
TypeSuperFoldable
};
use
rustc_middle
::
ty
::
subst
::
Subst
;
use
rustc_middle
::
ty
::
visit
::
TypeVisitable
;
use
rustc_middle
::
ty
::{
self
,
Ty
,
TyCtxt
,
TypeVisitor
};
use
std
::
ops
::
ControlFlow
;
...
...
@@ -108,7 +109,7 @@ struct MaxEscapingBoundVarVisitor {
}
impl
<
'tcx
>
TypeVisitor
<
'tcx
>
for
MaxEscapingBoundVarVisitor
{
fn
visit_binder
<
T
:
Type
Fold
able
<
'tcx
>>
(
fn
visit_binder
<
T
:
Type
Visit
able
<
'tcx
>>
(
&
mut
self
,
t
:
&
ty
::
Binder
<
'tcx
,
T
>
,
)
->
ControlFlow
<
Self
::
BreakTy
>
{
...
...
compiler/rustc_traits/src/chalk/lowering.rs
浏览文件 @
e9e5d068
...
...
@@ -35,7 +35,8 @@
use
rustc_middle
::
traits
::{
ChalkEnvironmentAndGoal
,
ChalkRustInterner
as
RustInterner
};
use
rustc_middle
::
ty
::
subst
::{
GenericArg
,
GenericArgKind
,
SubstsRef
};
use
rustc_middle
::
ty
::{
self
,
Binder
,
Region
,
Ty
,
TyCtxt
,
TypeFoldable
,
TypeFolder
,
TypeSuperFoldable
,
TypeVisitor
,
self
,
Binder
,
Region
,
Ty
,
TyCtxt
,
TypeFoldable
,
TypeFolder
,
TypeSuperFoldable
,
TypeVisitable
,
TypeVisitor
,
};
use
rustc_span
::
def_id
::
DefId
;
...
...
@@ -896,7 +897,7 @@ pub(crate) fn new() -> Self {
}
impl
<
'tcx
>
TypeVisitor
<
'tcx
>
for
BoundVarsCollector
<
'tcx
>
{
fn
visit_binder
<
T
:
Type
Fold
able
<
'tcx
>>
(
fn
visit_binder
<
T
:
Type
Visit
able
<
'tcx
>>
(
&
mut
self
,
t
:
&
Binder
<
'tcx
,
T
>
,
)
->
ControlFlow
<
Self
::
BreakTy
>
{
...
...
compiler/rustc_ty_utils/src/instance.rs
浏览文件 @
e9e5d068
...
...
@@ -4,7 +4,7 @@
use
rustc_middle
::
traits
::
CodegenObligationError
;
use
rustc_middle
::
ty
::
subst
::
SubstsRef
;
use
rustc_middle
::
ty
::{
self
,
Binder
,
Instance
,
Ty
,
TyCtxt
,
TypeFoldable
,
TypeSuperFoldable
,
TypeVisitor
,
self
,
Binder
,
Instance
,
Ty
,
TyCtxt
,
TypeFoldable
,
TypeSuperFoldable
,
TypeVisit
able
,
TypeVisit
or
,
};
use
rustc_span
::{
sym
,
DUMMY_SP
};
use
rustc_trait_selection
::
traits
;
...
...
@@ -56,7 +56,7 @@ fn into_vars(self, tcx: TyCtxt<'tcx>) -> &'tcx ty::List<ty::BoundVariableKind> {
impl
<
'tcx
>
TypeVisitor
<
'tcx
>
for
BoundVarsCollector
<
'tcx
>
{
type
BreakTy
=
();
fn
visit_binder
<
T
:
Type
Fold
able
<
'tcx
>>
(
fn
visit_binder
<
T
:
Type
Visit
able
<
'tcx
>>
(
&
mut
self
,
t
:
&
Binder
<
'tcx
,
T
>
,
)
->
ControlFlow
<
Self
::
BreakTy
>
{
...
...
compiler/rustc_typeck/src/check/fn_ctxt/_impl.rs
浏览文件 @
e9e5d068
...
...
@@ -23,6 +23,7 @@
use
rustc_middle
::
ty
::
subst
::{
self
,
GenericArgKind
,
InternalSubsts
,
Subst
,
SubstsRef
,
UserSelfTy
,
UserSubsts
,
};
use
rustc_middle
::
ty
::
visit
::
TypeVisitable
;
use
rustc_middle
::
ty
::{
self
,
AdtKind
,
CanonicalUserType
,
DefIdTree
,
EarlyBinder
,
GenericParamDefKind
,
ToPolyTraitRef
,
ToPredicate
,
Ty
,
UserType
,
...
...
@@ -557,7 +558,7 @@ pub fn const_arg_to_const(
// sufficiently enforced with erased regions. =)
fn
can_contain_user_lifetime_bounds
<
T
>
(
t
:
T
)
->
bool
where
T
:
Type
Fold
able
<
'tcx
>
,
T
:
Type
Visit
able
<
'tcx
>
,
{
t
.has_free_regions
()
||
t
.has_projections
()
||
t
.has_infer_types
()
}
...
...
compiler/rustc_typeck/src/check/wfcheck.rs
浏览文件 @
e9e5d068
...
...
@@ -18,7 +18,7 @@
use
rustc_middle
::
ty
::
trait_def
::
TraitSpecializationKind
;
use
rustc_middle
::
ty
::{
self
,
AdtKind
,
DefIdTree
,
EarlyBinder
,
GenericParamDefKind
,
ToPredicate
,
Ty
,
TyCtxt
,
TypeFoldable
,
Type
SuperFold
able
,
TypeVisitor
,
TypeFoldable
,
Type
Visit
able
,
TypeVisitor
,
};
use
rustc_session
::
parse
::
feature_err
;
use
rustc_span
::
symbol
::{
sym
,
Ident
,
Symbol
};
...
...
compiler/rustc_typeck/src/constrained_generic_params.rs
浏览文件 @
e9e5d068
use
rustc_data_structures
::
fx
::
FxHashSet
;
use
rustc_middle
::
ty
::
fold
::{
TypeFoldable
,
TypeSuperFoldable
,
TypeVisitor
};
use
rustc_middle
::
ty
::
visit
::
TypeVisitable
;
use
rustc_middle
::
ty
::{
self
,
Ty
,
TyCtxt
};
use
rustc_span
::
source_map
::
Span
;
use
std
::
ops
::
ControlFlow
;
...
...
@@ -43,7 +44,7 @@ pub fn parameters_for_impl<'tcx>(
/// of parameters whose values are needed in order to constrain `ty` - these
/// differ, with the latter being a superset, in the presence of projections.
pub
fn
parameters_for
<
'tcx
>
(
t
:
&
impl
Type
Fold
able
<
'tcx
>
,
t
:
&
impl
Type
Visit
able
<
'tcx
>
,
include_nonconstraining
:
bool
,
)
->
Vec
<
Parameter
>
{
let
mut
collector
=
ParameterCollector
{
parameters
:
vec!
[],
include_nonconstraining
};
...
...
src/tools/clippy/clippy_utils/src/ty.rs
浏览文件 @
e9e5d068
...
...
@@ -15,7 +15,7 @@
use
rustc_middle
::
ty
::
subst
::{
GenericArg
,
GenericArgKind
,
Subst
};
use
rustc_middle
::
ty
::{
self
,
AdtDef
,
Binder
,
BoundRegion
,
DefIdTree
,
FnSig
,
IntTy
,
ParamEnv
,
Predicate
,
PredicateKind
,
ProjectionTy
,
Region
,
RegionKind
,
Ty
,
TyCtxt
,
Type
Foldable
,
TypeSuperFold
able
,
TypeVisitor
,
UintTy
,
VariantDef
,
VariantDiscr
,
Region
,
RegionKind
,
Ty
,
TyCtxt
,
Type
SuperVisitable
,
TypeVisit
able
,
TypeVisitor
,
UintTy
,
VariantDef
,
VariantDiscr
,
};
use
rustc_span
::
symbol
::
Ident
;
use
rustc_span
::{
sym
,
Span
,
Symbol
,
DUMMY_SP
};
...
...
@@ -765,7 +765,7 @@ fn visit_region(&mut self, r: Region<'tcx>) -> ControlFlow<Self::BreakTy> {
ControlFlow
::
Continue
(())
}
}
fn
visit_binder
<
T
:
Type
Fold
able
<
'tcx
>>
(
&
mut
self
,
t
:
&
Binder
<
'tcx
,
T
>
)
->
ControlFlow
<
Self
::
BreakTy
>
{
fn
visit_binder
<
T
:
Type
Visit
able
<
'tcx
>>
(
&
mut
self
,
t
:
&
Binder
<
'tcx
,
T
>
)
->
ControlFlow
<
Self
::
BreakTy
>
{
self
.index
+=
1
;
let
res
=
t
.super_visit_with
(
self
);
self
.index
-=
1
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录