Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
cf683e64
R
Rust
项目概览
int
/
Rust
12 个月 前同步成功
通知
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,发现更多精彩内容 >>
未验证
提交
cf683e64
编写于
12月 01, 2021
作者:
A
Alan Egerton
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Rename TypeFolderFallible to FallibleTypeFolder
上级
d79e17da
变更
12
隐藏空白更改
内联
并排
Showing
12 changed file
with
68 addition
and
68 deletion
+68
-68
compiler/rustc_infer/src/infer/resolve.rs
compiler/rustc_infer/src/infer/resolve.rs
+2
-2
compiler/rustc_infer/src/traits/structural_impls.rs
compiler/rustc_infer/src/traits/structural_impls.rs
+2
-2
compiler/rustc_macros/src/type_foldable.rs
compiler/rustc_macros/src/type_foldable.rs
+1
-1
compiler/rustc_middle/src/macros.rs
compiler/rustc_middle/src/macros.rs
+2
-2
compiler/rustc_middle/src/mir/mod.rs
compiler/rustc_middle/src/mir/mod.rs
+2
-2
compiler/rustc_middle/src/mir/type_foldable.rs
compiler/rustc_middle/src/mir/type_foldable.rs
+13
-13
compiler/rustc_middle/src/ty/fold.rs
compiler/rustc_middle/src/ty/fold.rs
+7
-7
compiler/rustc_middle/src/ty/mod.rs
compiler/rustc_middle/src/ty/mod.rs
+2
-2
compiler/rustc_middle/src/ty/structural_impls.rs
compiler/rustc_middle/src/ty/structural_impls.rs
+30
-30
compiler/rustc_middle/src/ty/subst.rs
compiler/rustc_middle/src/ty/subst.rs
+3
-3
compiler/rustc_middle/src/ty/util.rs
compiler/rustc_middle/src/ty/util.rs
+2
-2
compiler/rustc_trait_selection/src/traits/query/normalize.rs
compiler/rustc_trait_selection/src/traits/query/normalize.rs
+2
-2
未找到文件。
compiler/rustc_infer/src/infer/resolve.rs
浏览文件 @
cf683e64
use
super
::
type_variable
::{
TypeVariableOrigin
,
TypeVariableOriginKind
};
use
super
::{
FixupError
,
FixupResult
,
InferCtxt
,
Span
};
use
rustc_middle
::
mir
;
use
rustc_middle
::
ty
::
fold
::{
TypeFolder
,
TypeFolderFallible
,
TypeVisitor
};
use
rustc_middle
::
ty
::
fold
::{
FallibleTypeFolder
,
TypeFolder
,
TypeVisitor
};
use
rustc_middle
::
ty
::{
self
,
Const
,
InferConst
,
Ty
,
TyCtxt
,
TypeFoldable
};
use
std
::
ops
::
ControlFlow
;
...
...
@@ -192,7 +192,7 @@ fn tcx<'b>(&'b self) -> TyCtxt<'tcx> {
}
}
impl
<
'a
,
'tcx
>
TypeFolderFallible
<
'tcx
>
for
FullTypeResolver
<
'a
,
'tcx
>
{
impl
<
'a
,
'tcx
>
FallibleTypeFolder
<
'tcx
>
for
FullTypeResolver
<
'a
,
'tcx
>
{
fn
try_fold_ty
(
&
mut
self
,
t
:
Ty
<
'tcx
>
)
->
Result
<
Ty
<
'tcx
>
,
Self
::
Error
>
{
if
!
t
.needs_infer
()
{
Ok
(
t
)
// micro-optimize -- if there is nothing in this type that this fold affects...
...
...
compiler/rustc_infer/src/traits/structural_impls.rs
浏览文件 @
cf683e64
use
crate
::
traits
;
use
crate
::
traits
::
project
::
Normalized
;
use
rustc_middle
::
ty
;
use
rustc_middle
::
ty
::
fold
::{
TypeFoldable
,
TypeFolderFalli
ble
,
TypeVisitor
};
use
rustc_middle
::
ty
::
fold
::{
FallibleTypeFolder
,
TypeFolda
ble
,
TypeVisitor
};
use
std
::
fmt
;
use
std
::
ops
::
ControlFlow
;
...
...
@@ -60,7 +60,7 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
// TypeFoldable implementations.
impl
<
'tcx
,
O
:
TypeFoldable
<
'tcx
>>
TypeFoldable
<
'tcx
>
for
traits
::
Obligation
<
'tcx
,
O
>
{
fn
try_super_fold_with
<
F
:
TypeFolderFallible
<
'tcx
>>
(
fn
try_super_fold_with
<
F
:
FallibleTypeFolder
<
'tcx
>>
(
self
,
folder
:
&
mut
F
,
)
->
Result
<
Self
,
F
::
Error
>
{
...
...
compiler/rustc_macros/src/type_foldable.rs
浏览文件 @
cf683e64
...
...
@@ -25,7 +25,7 @@ pub fn type_foldable_derive(mut s: synstructure::Structure<'_>) -> proc_macro2::
s
.bound_impl
(
quote!
(::
rustc_middle
::
ty
::
fold
::
TypeFoldable
<
'tcx
>
),
quote!
{
fn
try_super_fold_with
<
__
F
:
::
rustc_middle
::
ty
::
fold
::
TypeFolderFallible
<
'tcx
>>
(
fn
try_super_fold_with
<
__
F
:
::
rustc_middle
::
ty
::
fold
::
FallibleTypeFolder
<
'tcx
>>
(
self
,
__
folder
:
&
mut
__
F
)
->
Result
<
Self
,
__
F
::
Error
>
{
...
...
compiler/rustc_middle/src/macros.rs
浏览文件 @
cf683e64
...
...
@@ -52,7 +52,7 @@ fn lift_to_tcx(self, _: $crate::ty::TyCtxt<$tcx>) -> Option<Self> {
(
for
<
$tcx:lifetime
>
{
$
(
$ty:ty
,)
+
})
=>
{
$
(
impl
<
$tcx
>
$crate
::
ty
::
fold
::
TypeFoldable
<
$tcx
>
for
$ty
{
fn
try_super_fold_with
<
F
:
$crate
::
ty
::
fold
::
TypeFolderFallible
<
$tcx
>>
(
fn
try_super_fold_with
<
F
:
$crate
::
ty
::
fold
::
FallibleTypeFolder
<
$tcx
>>
(
self
,
_
:
&
mut
F
)
->
::
std
::
result
::
Result
<
$ty
,
F
::
Error
>
{
...
...
@@ -95,7 +95,7 @@ fn super_visit_with<F: $crate::ty::fold::TypeVisitor<$tcx>>(
impl
<
$
(
$p
),
*>
$crate
::
ty
::
fold
::
TypeFoldable
<
$tcx
>
for
$s
$
(
where
$
(
$wc
)
*
)
*
{
fn
try_super_fold_with
<
V
:
$crate
::
ty
::
fold
::
TypeFolderFallible
<
$tcx
>>
(
fn
try_super_fold_with
<
V
:
$crate
::
ty
::
fold
::
FallibleTypeFolder
<
$tcx
>>
(
self
,
folder
:
&
mut
V
,
)
->
::
std
::
result
::
Result
<
Self
,
V
::
Error
>
{
...
...
compiler/rustc_middle/src/mir/mod.rs
浏览文件 @
cf683e64
...
...
@@ -7,7 +7,7 @@
use
crate
::
mir
::
visit
::
MirVisitable
;
use
crate
::
ty
::
adjustment
::
PointerCast
;
use
crate
::
ty
::
codec
::{
TyDecoder
,
TyEncoder
};
use
crate
::
ty
::
fold
::{
TypeFoldable
,
TypeFolderFalli
ble
,
TypeVisitor
};
use
crate
::
ty
::
fold
::{
FallibleTypeFolder
,
TypeFolda
ble
,
TypeVisitor
};
use
crate
::
ty
::
print
::{
FmtPrinter
,
Printer
};
use
crate
::
ty
::
subst
::{
Subst
,
SubstsRef
};
use
crate
::
ty
::{
self
,
List
,
Ty
,
TyCtxt
};
...
...
@@ -2760,7 +2760,7 @@ pub(crate) fn variant(
TrivialTypeFoldableAndLiftImpls!
{
ProjectionKind
,
}
impl
<
'tcx
>
TypeFoldable
<
'tcx
>
for
UserTypeProjection
{
fn
try_super_fold_with
<
F
:
TypeFolderFallible
<
'tcx
>>
(
fn
try_super_fold_with
<
F
:
FallibleTypeFolder
<
'tcx
>>
(
self
,
folder
:
&
mut
F
,
)
->
Result
<
Self
,
F
::
Error
>
{
...
...
compiler/rustc_middle/src/mir/type_foldable.rs
浏览文件 @
cf683e64
...
...
@@ -16,7 +16,7 @@
}
impl
<
'tcx
>
TypeFoldable
<
'tcx
>
for
Terminator
<
'tcx
>
{
fn
try_super_fold_with
<
F
:
TypeFolderFallible
<
'tcx
>>
(
fn
try_super_fold_with
<
F
:
FallibleTypeFolder
<
'tcx
>>
(
self
,
folder
:
&
mut
F
,
)
->
Result
<
Self
,
F
::
Error
>
{
...
...
@@ -148,7 +148,7 @@ fn super_visit_with<V: TypeVisitor<'tcx>>(&self, visitor: &mut V) -> ControlFlow
}
impl
<
'tcx
>
TypeFoldable
<
'tcx
>
for
GeneratorKind
{
fn
try_super_fold_with
<
F
:
TypeFolderFallible
<
'tcx
>>
(
self
,
_
:
&
mut
F
)
->
Result
<
Self
,
F
::
Error
>
{
fn
try_super_fold_with
<
F
:
FallibleTypeFolder
<
'tcx
>>
(
self
,
_
:
&
mut
F
)
->
Result
<
Self
,
F
::
Error
>
{
Ok
(
self
)
}
...
...
@@ -158,7 +158,7 @@ fn super_visit_with<V: TypeVisitor<'tcx>>(&self, _: &mut V) -> ControlFlow<V::Br
}
impl
<
'tcx
>
TypeFoldable
<
'tcx
>
for
Place
<
'tcx
>
{
fn
try_super_fold_with
<
F
:
TypeFolderFallible
<
'tcx
>>
(
fn
try_super_fold_with
<
F
:
FallibleTypeFolder
<
'tcx
>>
(
self
,
folder
:
&
mut
F
,
)
->
Result
<
Self
,
F
::
Error
>
{
...
...
@@ -175,7 +175,7 @@ fn super_visit_with<V: TypeVisitor<'tcx>>(&self, visitor: &mut V) -> ControlFlow
}
impl
<
'tcx
>
TypeFoldable
<
'tcx
>
for
&
'tcx
ty
::
List
<
PlaceElem
<
'tcx
>>
{
fn
try_super_fold_with
<
F
:
TypeFolderFallible
<
'tcx
>>
(
fn
try_super_fold_with
<
F
:
FallibleTypeFolder
<
'tcx
>>
(
self
,
folder
:
&
mut
F
,
)
->
Result
<
Self
,
F
::
Error
>
{
...
...
@@ -188,7 +188,7 @@ fn super_visit_with<V: TypeVisitor<'tcx>>(&self, visitor: &mut V) -> ControlFlow
}
impl
<
'tcx
>
TypeFoldable
<
'tcx
>
for
Rvalue
<
'tcx
>
{
fn
try_super_fold_with
<
F
:
TypeFolderFallible
<
'tcx
>>
(
fn
try_super_fold_with
<
F
:
FallibleTypeFolder
<
'tcx
>>
(
self
,
folder
:
&
mut
F
,
)
->
Result
<
Self
,
F
::
Error
>
{
...
...
@@ -292,7 +292,7 @@ fn super_visit_with<V: TypeVisitor<'tcx>>(&self, visitor: &mut V) -> ControlFlow
}
impl
<
'tcx
>
TypeFoldable
<
'tcx
>
for
Operand
<
'tcx
>
{
fn
try_super_fold_with
<
F
:
TypeFolderFallible
<
'tcx
>>
(
fn
try_super_fold_with
<
F
:
FallibleTypeFolder
<
'tcx
>>
(
self
,
folder
:
&
mut
F
,
)
->
Result
<
Self
,
F
::
Error
>
{
...
...
@@ -312,7 +312,7 @@ fn super_visit_with<V: TypeVisitor<'tcx>>(&self, visitor: &mut V) -> ControlFlow
}
impl
<
'tcx
>
TypeFoldable
<
'tcx
>
for
PlaceElem
<
'tcx
>
{
fn
try_super_fold_with
<
F
:
TypeFolderFallible
<
'tcx
>>
(
fn
try_super_fold_with
<
F
:
FallibleTypeFolder
<
'tcx
>>
(
self
,
folder
:
&
mut
F
,
)
->
Result
<
Self
,
F
::
Error
>
{
...
...
@@ -345,7 +345,7 @@ fn super_visit_with<Vs: TypeVisitor<'tcx>>(
}
impl
<
'tcx
>
TypeFoldable
<
'tcx
>
for
Field
{
fn
try_super_fold_with
<
F
:
TypeFolderFallible
<
'tcx
>>
(
self
,
_
:
&
mut
F
)
->
Result
<
Self
,
F
::
Error
>
{
fn
try_super_fold_with
<
F
:
FallibleTypeFolder
<
'tcx
>>
(
self
,
_
:
&
mut
F
)
->
Result
<
Self
,
F
::
Error
>
{
Ok
(
self
)
}
fn
super_visit_with
<
V
:
TypeVisitor
<
'tcx
>>
(
&
self
,
_
:
&
mut
V
)
->
ControlFlow
<
V
::
BreakTy
>
{
...
...
@@ -354,7 +354,7 @@ fn super_visit_with<V: TypeVisitor<'tcx>>(&self, _: &mut V) -> ControlFlow<V::Br
}
impl
<
'tcx
>
TypeFoldable
<
'tcx
>
for
GeneratorSavedLocal
{
fn
try_super_fold_with
<
F
:
TypeFolderFallible
<
'tcx
>>
(
self
,
_
:
&
mut
F
)
->
Result
<
Self
,
F
::
Error
>
{
fn
try_super_fold_with
<
F
:
FallibleTypeFolder
<
'tcx
>>
(
self
,
_
:
&
mut
F
)
->
Result
<
Self
,
F
::
Error
>
{
Ok
(
self
)
}
fn
super_visit_with
<
V
:
TypeVisitor
<
'tcx
>>
(
&
self
,
_
:
&
mut
V
)
->
ControlFlow
<
V
::
BreakTy
>
{
...
...
@@ -363,7 +363,7 @@ fn super_visit_with<V: TypeVisitor<'tcx>>(&self, _: &mut V) -> ControlFlow<V::Br
}
impl
<
'tcx
,
R
:
Idx
,
C
:
Idx
>
TypeFoldable
<
'tcx
>
for
BitMatrix
<
R
,
C
>
{
fn
try_super_fold_with
<
F
:
TypeFolderFallible
<
'tcx
>>
(
self
,
_
:
&
mut
F
)
->
Result
<
Self
,
F
::
Error
>
{
fn
try_super_fold_with
<
F
:
FallibleTypeFolder
<
'tcx
>>
(
self
,
_
:
&
mut
F
)
->
Result
<
Self
,
F
::
Error
>
{
Ok
(
self
)
}
fn
super_visit_with
<
V
:
TypeVisitor
<
'tcx
>>
(
&
self
,
_
:
&
mut
V
)
->
ControlFlow
<
V
::
BreakTy
>
{
...
...
@@ -372,7 +372,7 @@ fn super_visit_with<V: TypeVisitor<'tcx>>(&self, _: &mut V) -> ControlFlow<V::Br
}
impl
<
'tcx
>
TypeFoldable
<
'tcx
>
for
Constant
<
'tcx
>
{
fn
try_super_fold_with
<
F
:
TypeFolderFallible
<
'tcx
>>
(
fn
try_super_fold_with
<
F
:
FallibleTypeFolder
<
'tcx
>>
(
self
,
folder
:
&
mut
F
,
)
->
Result
<
Self
,
F
::
Error
>
{
...
...
@@ -390,11 +390,11 @@ fn super_visit_with<V: TypeVisitor<'tcx>>(&self, visitor: &mut V) -> ControlFlow
impl
<
'tcx
>
TypeFoldable
<
'tcx
>
for
ConstantKind
<
'tcx
>
{
#[inline(always)]
fn
try_fold_with
<
F
:
TypeFolderFallible
<
'tcx
>>
(
self
,
folder
:
&
mut
F
)
->
Result
<
Self
,
F
::
Error
>
{
fn
try_fold_with
<
F
:
FallibleTypeFolder
<
'tcx
>>
(
self
,
folder
:
&
mut
F
)
->
Result
<
Self
,
F
::
Error
>
{
folder
.try_fold_mir_const
(
self
)
}
fn
try_super_fold_with
<
F
:
TypeFolderFallible
<
'tcx
>>
(
fn
try_super_fold_with
<
F
:
FallibleTypeFolder
<
'tcx
>>
(
self
,
folder
:
&
mut
F
,
)
->
Result
<
Self
,
F
::
Error
>
{
...
...
compiler/rustc_middle/src/ty/fold.rs
浏览文件 @
cf683e64
...
...
@@ -63,12 +63,12 @@ fn fold_with<F: TypeFolder<'tcx, Error = !>>(self, folder: &mut F) -> Self {
self
.try_fold_with
(
folder
)
.into_ok
()
}
fn
try_super_fold_with
<
F
:
TypeFolderFallible
<
'tcx
>>
(
fn
try_super_fold_with
<
F
:
FallibleTypeFolder
<
'tcx
>>
(
self
,
folder
:
&
mut
F
,
)
->
Result
<
Self
,
F
::
Error
>
;
fn
try_fold_with
<
F
:
TypeFolderFallible
<
'tcx
>>
(
self
,
folder
:
&
mut
F
)
->
Result
<
Self
,
F
::
Error
>
{
fn
try_fold_with
<
F
:
FallibleTypeFolder
<
'tcx
>>
(
self
,
folder
:
&
mut
F
)
->
Result
<
Self
,
F
::
Error
>
{
self
.try_super_fold_with
(
folder
)
}
...
...
@@ -216,8 +216,8 @@ fn super_visit_with<V: TypeVisitor<'tcx>>(&self, _: &mut V) -> ControlFlow<V::Br
///
/// If this folder is fallible (and therefore its [`Error`][`TypeFolder::Error`]
/// associated type is something other than the default, never),
/// [`
TypeFolderFallible
`] should be implemented manually; otherwise,
/// a blanket implementation of [`
TypeFolderFallible
`] will defer to
/// [`
FallibleTypeFolder
`] should be implemented manually; otherwise,
/// a blanket implementation of [`
FallibleTypeFolder
`] will defer to
/// the infallible methods of this trait to ensure that the two APIs
/// are coherent.
pub
trait
TypeFolder
<
'tcx
>
:
Sized
{
...
...
@@ -269,7 +269,7 @@ fn fold_mir_const(&mut self, c: mir::ConstantKind<'tcx>) -> mir::ConstantKind<'t
}
}
/// The `
TypeFolderFallible
` trait defines the actual *folding*. There is a
/// The `
FallibleTypeFolder
` trait defines the actual *folding*. There is a
/// method defined for every foldable type. Each of these has a
/// default implementation that does an "identity" fold. Within each
/// identity fold, it should invoke `foo.try_fold_with(self)` to fold each
...
...
@@ -278,7 +278,7 @@ fn fold_mir_const(&mut self, c: mir::ConstantKind<'tcx>) -> mir::ConstantKind<'t
/// A blanket implementation of this trait (that defers to the relevant
/// method of [`TypeFolder`]) is provided for all infallible folders in
/// order to ensure the two APIs are coherent.
pub
trait
TypeFolderFallible
<
'tcx
>
:
TypeFolder
<
'tcx
>
{
pub
trait
FallibleTypeFolder
<
'tcx
>
:
TypeFolder
<
'tcx
>
{
fn
try_fold_binder
<
T
>
(
&
mut
self
,
t
:
Binder
<
'tcx
,
T
>
)
->
Result
<
Binder
<
'tcx
,
T
>
,
Self
::
Error
>
where
T
:
TypeFoldable
<
'tcx
>
,
...
...
@@ -318,7 +318,7 @@ fn try_fold_mir_const(
// Blanket implementation of fallible trait for infallible folders
// delegates to infallible methods to prevent incoherence
impl
<
'tcx
,
F
>
TypeFolderFallible
<
'tcx
>
for
F
impl
<
'tcx
,
F
>
FallibleTypeFolder
<
'tcx
>
for
F
where
F
:
TypeFolder
<
'tcx
,
Error
=
!>
,
{
...
...
compiler/rustc_middle/src/ty/mod.rs
浏览文件 @
cf683e64
...
...
@@ -9,7 +9,7 @@
//!
//! ["The `ty` module: representing types"]: https://rustc-dev-guide.rust-lang.org/ty.html
pub
use
self
::
fold
::{
TypeFoldable
,
TypeFolder
,
TypeFolderFallible
,
TypeVisitor
};
pub
use
self
::
fold
::{
FallibleTypeFolder
,
TypeFoldable
,
TypeFolder
,
TypeVisitor
};
pub
use
self
::
AssocItemContainer
::
*
;
pub
use
self
::
BorrowKind
::
*
;
pub
use
self
::
IntVarValue
::
*
;
...
...
@@ -1269,7 +1269,7 @@ fn hash_stable(&self, hcx: &mut StableHashingContext<'a>, hasher: &mut StableHas
}
impl
<
'tcx
>
TypeFoldable
<
'tcx
>
for
ParamEnv
<
'tcx
>
{
fn
try_super_fold_with
<
F
:
ty
::
fold
::
TypeFolderFallible
<
'tcx
>>
(
fn
try_super_fold_with
<
F
:
ty
::
fold
::
FallibleTypeFolder
<
'tcx
>>
(
self
,
folder
:
&
mut
F
,
)
->
Result
<
Self
,
F
::
Error
>
{
...
...
compiler/rustc_middle/src/ty/structural_impls.rs
浏览文件 @
cf683e64
...
...
@@ -4,7 +4,7 @@
use
crate
::
mir
::
interpret
;
use
crate
::
mir
::
ProjectionKind
;
use
crate
::
ty
::
fold
::{
TypeFoldable
,
TypeFolderFalli
ble
,
TypeVisitor
};
use
crate
::
ty
::
fold
::{
FallibleTypeFolder
,
TypeFolda
ble
,
TypeVisitor
};
use
crate
::
ty
::
print
::{
with_no_trimmed_paths
,
FmtPrinter
,
Printer
};
use
crate
::
ty
::{
self
,
InferConst
,
Lift
,
Ty
,
TyCtxt
};
use
rustc_data_structures
::
functor
::
IdFunctor
;
...
...
@@ -669,7 +669,7 @@ fn lift_to_tcx(self, tcx: TyCtxt<'tcx>) -> Option<Self::Lifted> {
/// AdtDefs are basically the same as a DefId.
impl
<
'tcx
>
TypeFoldable
<
'tcx
>
for
&
'tcx
ty
::
AdtDef
{
fn
try_super_fold_with
<
F
:
TypeFolderFallible
<
'tcx
>>
(
fn
try_super_fold_with
<
F
:
FallibleTypeFolder
<
'tcx
>>
(
self
,
_
folder
:
&
mut
F
,
)
->
Result
<
Self
,
F
::
Error
>
{
...
...
@@ -682,7 +682,7 @@ fn super_visit_with<V: TypeVisitor<'tcx>>(&self, _visitor: &mut V) -> ControlFlo
}
impl
<
'tcx
,
T
:
TypeFoldable
<
'tcx
>
,
U
:
TypeFoldable
<
'tcx
>>
TypeFoldable
<
'tcx
>
for
(
T
,
U
)
{
fn
try_super_fold_with
<
F
:
TypeFolderFallible
<
'tcx
>>
(
fn
try_super_fold_with
<
F
:
FallibleTypeFolder
<
'tcx
>>
(
self
,
folder
:
&
mut
F
,
)
->
Result
<
(
T
,
U
),
F
::
Error
>
{
...
...
@@ -698,7 +698,7 @@ fn super_visit_with<V: TypeVisitor<'tcx>>(&self, visitor: &mut V) -> ControlFlow
impl
<
'tcx
,
A
:
TypeFoldable
<
'tcx
>
,
B
:
TypeFoldable
<
'tcx
>
,
C
:
TypeFoldable
<
'tcx
>>
TypeFoldable
<
'tcx
>
for
(
A
,
B
,
C
)
{
fn
try_super_fold_with
<
F
:
TypeFolderFallible
<
'tcx
>>
(
fn
try_super_fold_with
<
F
:
FallibleTypeFolder
<
'tcx
>>
(
self
,
folder
:
&
mut
F
,
)
->
Result
<
(
A
,
B
,
C
),
F
::
Error
>
{
...
...
@@ -731,7 +731,7 @@ impl<'tcx, T, E> TypeFoldable<'tcx> for Result<T, E> {
}
impl
<
'tcx
,
T
:
TypeFoldable
<
'tcx
>>
TypeFoldable
<
'tcx
>
for
Rc
<
T
>
{
fn
try_super_fold_with
<
F
:
TypeFolderFallible
<
'tcx
>>
(
fn
try_super_fold_with
<
F
:
FallibleTypeFolder
<
'tcx
>>
(
self
,
folder
:
&
mut
F
,
)
->
Result
<
Self
,
F
::
Error
>
{
...
...
@@ -745,7 +745,7 @@ fn super_visit_with<V: TypeVisitor<'tcx>>(&self, visitor: &mut V) -> ControlFlow
}
impl
<
'tcx
,
T
:
TypeFoldable
<
'tcx
>>
TypeFoldable
<
'tcx
>
for
Arc
<
T
>
{
fn
try_super_fold_with
<
F
:
TypeFolderFallible
<
'tcx
>>
(
fn
try_super_fold_with
<
F
:
FallibleTypeFolder
<
'tcx
>>
(
self
,
folder
:
&
mut
F
,
)
->
Result
<
Self
,
F
::
Error
>
{
...
...
@@ -759,7 +759,7 @@ fn super_visit_with<V: TypeVisitor<'tcx>>(&self, visitor: &mut V) -> ControlFlow
}
impl
<
'tcx
,
T
:
TypeFoldable
<
'tcx
>>
TypeFoldable
<
'tcx
>
for
Box
<
T
>
{
fn
try_super_fold_with
<
F
:
TypeFolderFallible
<
'tcx
>>
(
fn
try_super_fold_with
<
F
:
FallibleTypeFolder
<
'tcx
>>
(
self
,
folder
:
&
mut
F
,
)
->
Result
<
Self
,
F
::
Error
>
{
...
...
@@ -772,7 +772,7 @@ fn super_visit_with<V: TypeVisitor<'tcx>>(&self, visitor: &mut V) -> ControlFlow
}
impl
<
'tcx
,
T
:
TypeFoldable
<
'tcx
>>
TypeFoldable
<
'tcx
>
for
Vec
<
T
>
{
fn
try_super_fold_with
<
F
:
TypeFolderFallible
<
'tcx
>>
(
fn
try_super_fold_with
<
F
:
FallibleTypeFolder
<
'tcx
>>
(
self
,
folder
:
&
mut
F
,
)
->
Result
<
Self
,
F
::
Error
>
{
...
...
@@ -785,7 +785,7 @@ fn super_visit_with<V: TypeVisitor<'tcx>>(&self, visitor: &mut V) -> ControlFlow
}
impl
<
'tcx
,
T
:
TypeFoldable
<
'tcx
>>
TypeFoldable
<
'tcx
>
for
Box
<
[
T
]
>
{
fn
try_super_fold_with
<
F
:
TypeFolderFallible
<
'tcx
>>
(
fn
try_super_fold_with
<
F
:
FallibleTypeFolder
<
'tcx
>>
(
self
,
folder
:
&
mut
F
,
)
->
Result
<
Self
,
F
::
Error
>
{
...
...
@@ -798,14 +798,14 @@ fn super_visit_with<V: TypeVisitor<'tcx>>(&self, visitor: &mut V) -> ControlFlow
}
impl
<
'tcx
,
T
:
TypeFoldable
<
'tcx
>>
TypeFoldable
<
'tcx
>
for
ty
::
Binder
<
'tcx
,
T
>
{
fn
try_super_fold_with
<
F
:
TypeFolderFallible
<
'tcx
>>
(
fn
try_super_fold_with
<
F
:
FallibleTypeFolder
<
'tcx
>>
(
self
,
folder
:
&
mut
F
,
)
->
Result
<
Self
,
F
::
Error
>
{
self
.try_map_bound
(|
ty
|
ty
.try_fold_with
(
folder
))
}
fn
try_fold_with
<
F
:
TypeFolderFallible
<
'tcx
>>
(
self
,
folder
:
&
mut
F
)
->
Result
<
Self
,
F
::
Error
>
{
fn
try_fold_with
<
F
:
FallibleTypeFolder
<
'tcx
>>
(
self
,
folder
:
&
mut
F
)
->
Result
<
Self
,
F
::
Error
>
{
folder
.try_fold_binder
(
self
)
}
...
...
@@ -819,7 +819,7 @@ fn visit_with<V: TypeVisitor<'tcx>>(&self, visitor: &mut V) -> ControlFlow<V::Br
}
impl
<
'tcx
>
TypeFoldable
<
'tcx
>
for
&
'tcx
ty
::
List
<
ty
::
Binder
<
'tcx
,
ty
::
ExistentialPredicate
<
'tcx
>>>
{
fn
try_super_fold_with
<
F
:
TypeFolderFallible
<
'tcx
>>
(
fn
try_super_fold_with
<
F
:
FallibleTypeFolder
<
'tcx
>>
(
self
,
folder
:
&
mut
F
,
)
->
Result
<
Self
,
F
::
Error
>
{
...
...
@@ -832,7 +832,7 @@ fn super_visit_with<V: TypeVisitor<'tcx>>(&self, visitor: &mut V) -> ControlFlow
}
impl
<
'tcx
>
TypeFoldable
<
'tcx
>
for
&
'tcx
ty
::
List
<
Ty
<
'tcx
>>
{
fn
try_super_fold_with
<
F
:
TypeFolderFallible
<
'tcx
>>
(
fn
try_super_fold_with
<
F
:
FallibleTypeFolder
<
'tcx
>>
(
self
,
folder
:
&
mut
F
,
)
->
Result
<
Self
,
F
::
Error
>
{
...
...
@@ -845,7 +845,7 @@ fn super_visit_with<V: TypeVisitor<'tcx>>(&self, visitor: &mut V) -> ControlFlow
}
impl
<
'tcx
>
TypeFoldable
<
'tcx
>
for
&
'tcx
ty
::
List
<
ProjectionKind
>
{
fn
try_super_fold_with
<
F
:
TypeFolderFallible
<
'tcx
>>
(
fn
try_super_fold_with
<
F
:
FallibleTypeFolder
<
'tcx
>>
(
self
,
folder
:
&
mut
F
,
)
->
Result
<
Self
,
F
::
Error
>
{
...
...
@@ -858,7 +858,7 @@ fn super_visit_with<V: TypeVisitor<'tcx>>(&self, visitor: &mut V) -> ControlFlow
}
impl
<
'tcx
>
TypeFoldable
<
'tcx
>
for
ty
::
instance
::
Instance
<
'tcx
>
{
fn
try_super_fold_with
<
F
:
TypeFolderFallible
<
'tcx
>>
(
fn
try_super_fold_with
<
F
:
FallibleTypeFolder
<
'tcx
>>
(
self
,
folder
:
&
mut
F
,
)
->
Result
<
Self
,
F
::
Error
>
{
...
...
@@ -909,7 +909,7 @@ fn super_visit_with<V: TypeVisitor<'tcx>>(&self, visitor: &mut V) -> ControlFlow
}
impl
<
'tcx
>
TypeFoldable
<
'tcx
>
for
interpret
::
GlobalId
<
'tcx
>
{
fn
try_super_fold_with
<
F
:
TypeFolderFallible
<
'tcx
>>
(
fn
try_super_fold_with
<
F
:
FallibleTypeFolder
<
'tcx
>>
(
self
,
folder
:
&
mut
F
,
)
->
Result
<
Self
,
F
::
Error
>
{
...
...
@@ -922,7 +922,7 @@ fn super_visit_with<V: TypeVisitor<'tcx>>(&self, visitor: &mut V) -> ControlFlow
}
impl
<
'tcx
>
TypeFoldable
<
'tcx
>
for
Ty
<
'tcx
>
{
fn
try_super_fold_with
<
F
:
TypeFolderFallible
<
'tcx
>>
(
fn
try_super_fold_with
<
F
:
FallibleTypeFolder
<
'tcx
>>
(
self
,
folder
:
&
mut
F
,
)
->
Result
<
Self
,
F
::
Error
>
{
...
...
@@ -966,7 +966,7 @@ fn try_super_fold_with<F: TypeFolderFallible<'tcx>>(
Ok
(
if
*
self
.kind
()
==
kind
{
self
}
else
{
folder
.tcx
()
.mk_ty
(
kind
)
})
}
fn
try_fold_with
<
F
:
TypeFolderFallible
<
'tcx
>>
(
self
,
folder
:
&
mut
F
)
->
Result
<
Self
,
F
::
Error
>
{
fn
try_fold_with
<
F
:
FallibleTypeFolder
<
'tcx
>>
(
self
,
folder
:
&
mut
F
)
->
Result
<
Self
,
F
::
Error
>
{
folder
.try_fold_ty
(
self
)
}
...
...
@@ -1018,14 +1018,14 @@ fn visit_with<V: TypeVisitor<'tcx>>(&self, visitor: &mut V) -> ControlFlow<V::Br
}
impl
<
'tcx
>
TypeFoldable
<
'tcx
>
for
ty
::
Region
<
'tcx
>
{
fn
try_super_fold_with
<
F
:
TypeFolderFallible
<
'tcx
>>
(
fn
try_super_fold_with
<
F
:
FallibleTypeFolder
<
'tcx
>>
(
self
,
_
folder
:
&
mut
F
,
)
->
Result
<
Self
,
F
::
Error
>
{
Ok
(
self
)
}
fn
try_fold_with
<
F
:
TypeFolderFallible
<
'tcx
>>
(
self
,
folder
:
&
mut
F
)
->
Result
<
Self
,
F
::
Error
>
{
fn
try_fold_with
<
F
:
FallibleTypeFolder
<
'tcx
>>
(
self
,
folder
:
&
mut
F
)
->
Result
<
Self
,
F
::
Error
>
{
folder
.try_fold_region
(
self
)
}
...
...
@@ -1039,11 +1039,11 @@ fn visit_with<V: TypeVisitor<'tcx>>(&self, visitor: &mut V) -> ControlFlow<V::Br
}
impl
<
'tcx
>
TypeFoldable
<
'tcx
>
for
ty
::
Predicate
<
'tcx
>
{
fn
try_fold_with
<
F
:
TypeFolderFallible
<
'tcx
>>
(
self
,
folder
:
&
mut
F
)
->
Result
<
Self
,
F
::
Error
>
{
fn
try_fold_with
<
F
:
FallibleTypeFolder
<
'tcx
>>
(
self
,
folder
:
&
mut
F
)
->
Result
<
Self
,
F
::
Error
>
{
folder
.try_fold_predicate
(
self
)
}
fn
try_super_fold_with
<
F
:
TypeFolderFallible
<
'tcx
>>
(
fn
try_super_fold_with
<
F
:
FallibleTypeFolder
<
'tcx
>>
(
self
,
folder
:
&
mut
F
,
)
->
Result
<
Self
,
F
::
Error
>
{
...
...
@@ -1069,7 +1069,7 @@ fn has_type_flags(&self, flags: ty::TypeFlags) -> bool {
}
impl
<
'tcx
>
TypeFoldable
<
'tcx
>
for
&
'tcx
ty
::
List
<
ty
::
Predicate
<
'tcx
>>
{
fn
try_super_fold_with
<
F
:
TypeFolderFallible
<
'tcx
>>
(
fn
try_super_fold_with
<
F
:
FallibleTypeFolder
<
'tcx
>>
(
self
,
folder
:
&
mut
F
,
)
->
Result
<
Self
,
F
::
Error
>
{
...
...
@@ -1082,7 +1082,7 @@ fn super_visit_with<V: TypeVisitor<'tcx>>(&self, visitor: &mut V) -> ControlFlow
}
impl
<
'tcx
,
T
:
TypeFoldable
<
'tcx
>
,
I
:
Idx
>
TypeFoldable
<
'tcx
>
for
IndexVec
<
I
,
T
>
{
fn
try_super_fold_with
<
F
:
TypeFolderFallible
<
'tcx
>>
(
fn
try_super_fold_with
<
F
:
FallibleTypeFolder
<
'tcx
>>
(
self
,
folder
:
&
mut
F
,
)
->
Result
<
Self
,
F
::
Error
>
{
...
...
@@ -1095,7 +1095,7 @@ fn super_visit_with<V: TypeVisitor<'tcx>>(&self, visitor: &mut V) -> ControlFlow
}
impl
<
'tcx
>
TypeFoldable
<
'tcx
>
for
&
'tcx
ty
::
Const
<
'tcx
>
{
fn
try_super_fold_with
<
F
:
TypeFolderFallible
<
'tcx
>>
(
fn
try_super_fold_with
<
F
:
FallibleTypeFolder
<
'tcx
>>
(
self
,
folder
:
&
mut
F
,
)
->
Result
<
Self
,
F
::
Error
>
{
...
...
@@ -1108,7 +1108,7 @@ fn try_super_fold_with<F: TypeFolderFallible<'tcx>>(
}
}
fn
try_fold_with
<
F
:
TypeFolderFallible
<
'tcx
>>
(
self
,
folder
:
&
mut
F
)
->
Result
<
Self
,
F
::
Error
>
{
fn
try_fold_with
<
F
:
FallibleTypeFolder
<
'tcx
>>
(
self
,
folder
:
&
mut
F
)
->
Result
<
Self
,
F
::
Error
>
{
folder
.try_fold_const
(
self
)
}
...
...
@@ -1123,7 +1123,7 @@ fn visit_with<V: TypeVisitor<'tcx>>(&self, visitor: &mut V) -> ControlFlow<V::Br
}
impl
<
'tcx
>
TypeFoldable
<
'tcx
>
for
ty
::
ConstKind
<
'tcx
>
{
fn
try_super_fold_with
<
F
:
TypeFolderFallible
<
'tcx
>>
(
fn
try_super_fold_with
<
F
:
FallibleTypeFolder
<
'tcx
>>
(
self
,
folder
:
&
mut
F
,
)
->
Result
<
Self
,
F
::
Error
>
{
...
...
@@ -1152,7 +1152,7 @@ fn super_visit_with<V: TypeVisitor<'tcx>>(&self, visitor: &mut V) -> ControlFlow
}
impl
<
'tcx
>
TypeFoldable
<
'tcx
>
for
InferConst
<
'tcx
>
{
fn
try_super_fold_with
<
F
:
TypeFolderFallible
<
'tcx
>>
(
fn
try_super_fold_with
<
F
:
FallibleTypeFolder
<
'tcx
>>
(
self
,
_
folder
:
&
mut
F
,
)
->
Result
<
Self
,
F
::
Error
>
{
...
...
@@ -1165,7 +1165,7 @@ fn super_visit_with<V: TypeVisitor<'tcx>>(&self, _visitor: &mut V) -> ControlFlo
}
impl
<
'tcx
>
TypeFoldable
<
'tcx
>
for
ty
::
Unevaluated
<
'tcx
>
{
fn
try_super_fold_with
<
F
:
TypeFolderFallible
<
'tcx
>>
(
fn
try_super_fold_with
<
F
:
FallibleTypeFolder
<
'tcx
>>
(
self
,
folder
:
&
mut
F
,
)
->
Result
<
Self
,
F
::
Error
>
{
...
...
@@ -1193,7 +1193,7 @@ fn super_visit_with<V: TypeVisitor<'tcx>>(&self, visitor: &mut V) -> ControlFlow
}
impl
<
'tcx
>
TypeFoldable
<
'tcx
>
for
ty
::
Unevaluated
<
'tcx
,
()
>
{
fn
try_super_fold_with
<
F
:
TypeFolderFallible
<
'tcx
>>
(
fn
try_super_fold_with
<
F
:
FallibleTypeFolder
<
'tcx
>>
(
self
,
folder
:
&
mut
F
,
)
->
Result
<
Self
,
F
::
Error
>
{
...
...
compiler/rustc_middle/src/ty/subst.rs
浏览文件 @
cf683e64
...
...
@@ -2,7 +2,7 @@
use
crate
::
mir
;
use
crate
::
ty
::
codec
::{
TyDecoder
,
TyEncoder
};
use
crate
::
ty
::
fold
::{
TypeFoldable
,
TypeFolder
,
TypeFolderFallible
,
TypeVisitor
};
use
crate
::
ty
::
fold
::{
FallibleTypeFolder
,
TypeFoldable
,
TypeFolder
,
TypeVisitor
};
use
crate
::
ty
::
sty
::{
ClosureSubsts
,
GeneratorSubsts
,
InlineConstSubsts
};
use
crate
::
ty
::{
self
,
Lift
,
List
,
ParamConst
,
Ty
,
TyCtxt
};
...
...
@@ -153,7 +153,7 @@ fn lift_to_tcx(self, tcx: TyCtxt<'tcx>) -> Option<Self::Lifted> {
}
impl
<
'tcx
>
TypeFoldable
<
'tcx
>
for
GenericArg
<
'tcx
>
{
fn
try_super_fold_with
<
F
:
TypeFolderFallible
<
'tcx
>>
(
fn
try_super_fold_with
<
F
:
FallibleTypeFolder
<
'tcx
>>
(
self
,
folder
:
&
mut
F
,
)
->
Result
<
Self
,
F
::
Error
>
{
...
...
@@ -375,7 +375,7 @@ pub fn truncate_to(&self, tcx: TyCtxt<'tcx>, generics: &ty::Generics) -> SubstsR
}
impl
<
'tcx
>
TypeFoldable
<
'tcx
>
for
SubstsRef
<
'tcx
>
{
fn
try_super_fold_with
<
F
:
TypeFolderFallible
<
'tcx
>>
(
fn
try_super_fold_with
<
F
:
FallibleTypeFolder
<
'tcx
>>
(
self
,
folder
:
&
mut
F
,
)
->
Result
<
Self
,
F
::
Error
>
{
...
...
compiler/rustc_middle/src/ty/util.rs
浏览文件 @
cf683e64
//! Miscellaneous type-system utilities that are too small to deserve their own modules.
use
crate
::
middle
::
codegen_fn_attrs
::
CodegenFnAttrFlags
;
use
crate
::
ty
::
fold
::{
TypeFolder
,
TypeFolderFallible
};
use
crate
::
ty
::
fold
::{
FallibleTypeFolder
,
TypeFolder
};
use
crate
::
ty
::
layout
::
IntegerExt
;
use
crate
::
ty
::
query
::
TyCtxtAt
;
use
crate
::
ty
::
subst
::{
GenericArgKind
,
Subst
,
SubstsRef
};
...
...
@@ -1048,7 +1048,7 @@ pub fn fold_list<'tcx, F, T>(
intern
:
impl
FnOnce
(
TyCtxt
<
'tcx
>
,
&
[
T
])
->
&
'tcx
ty
::
List
<
T
>
,
)
->
Result
<&
'tcx
ty
::
List
<
T
>
,
F
::
Error
>
where
F
:
TypeFolderFallible
<
'tcx
>
,
F
:
FallibleTypeFolder
<
'tcx
>
,
T
:
TypeFoldable
<
'tcx
>
+
PartialEq
+
Copy
,
{
let
mut
iter
=
list
.iter
();
...
...
compiler/rustc_trait_selection/src/traits/query/normalize.rs
浏览文件 @
cf683e64
...
...
@@ -12,7 +12,7 @@
use
rustc_data_structures
::
stack
::
ensure_sufficient_stack
;
use
rustc_infer
::
traits
::
Normalized
;
use
rustc_middle
::
mir
;
use
rustc_middle
::
ty
::
fold
::{
TypeFoldable
,
TypeFolder
,
TypeFolderFallible
};
use
rustc_middle
::
ty
::
fold
::{
FallibleTypeFolder
,
TypeFoldable
,
TypeFolder
};
use
rustc_middle
::
ty
::
subst
::
Subst
;
use
rustc_middle
::
ty
::{
self
,
Ty
,
TyCtxt
,
TypeVisitor
};
...
...
@@ -178,7 +178,7 @@ fn tcx<'c>(&'c self) -> TyCtxt<'tcx> {
}
}
impl
<
'cx
,
'tcx
>
TypeFolderFallible
<
'tcx
>
for
QueryNormalizer
<
'cx
,
'tcx
>
{
impl
<
'cx
,
'tcx
>
FallibleTypeFolder
<
'tcx
>
for
QueryNormalizer
<
'cx
,
'tcx
>
{
fn
try_fold_binder
<
T
:
TypeFoldable
<
'tcx
>>
(
&
mut
self
,
t
:
ty
::
Binder
<
'tcx
,
T
>
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录