Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
e4b9625b
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,发现更多精彩内容 >>
未验证
提交
e4b9625b
编写于
6月 17, 2022
作者:
A
Alan Egerton
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add #[derive(TypeVisitable)]
上级
bca89490
变更
31
隐藏空白更改
内联
并排
Showing
31 changed file
with
183 addition
and
221 deletion
+183
-221
compiler/rustc_infer/src/infer/mod.rs
compiler/rustc_infer/src/infer/mod.rs
+1
-1
compiler/rustc_infer/src/infer/region_constraints/mod.rs
compiler/rustc_infer/src/infer/region_constraints/mod.rs
+2
-2
compiler/rustc_infer/src/traits/project.rs
compiler/rustc_infer/src/traits/project.rs
+1
-1
compiler/rustc_macros/src/lib.rs
compiler/rustc_macros/src/lib.rs
+2
-0
compiler/rustc_macros/src/type_foldable.rs
compiler/rustc_macros/src/type_foldable.rs
+0
-13
compiler/rustc_macros/src/type_visitable.rs
compiler/rustc_macros/src/type_visitable.rs
+33
-0
compiler/rustc_middle/src/hir/place.rs
compiler/rustc_middle/src/hir/place.rs
+10
-38
compiler/rustc_middle/src/infer/canonical.rs
compiler/rustc_middle/src/infer/canonical.rs
+4
-4
compiler/rustc_middle/src/infer/mod.rs
compiler/rustc_middle/src/infer/mod.rs
+1
-1
compiler/rustc_middle/src/mir/coverage.rs
compiler/rustc_middle/src/mir/coverage.rs
+5
-14
compiler/rustc_middle/src/mir/mod.rs
compiler/rustc_middle/src/mir/mod.rs
+12
-12
compiler/rustc_middle/src/mir/query.rs
compiler/rustc_middle/src/mir/query.rs
+1
-1
compiler/rustc_middle/src/mir/syntax.rs
compiler/rustc_middle/src/mir/syntax.rs
+8
-4
compiler/rustc_middle/src/mir/tcx.rs
compiler/rustc_middle/src/mir/tcx.rs
+1
-1
compiler/rustc_middle/src/thir.rs
compiler/rustc_middle/src/thir.rs
+2
-12
compiler/rustc_middle/src/traits/chalk.rs
compiler/rustc_middle/src/traits/chalk.rs
+1
-1
compiler/rustc_middle/src/traits/mod.rs
compiler/rustc_middle/src/traits/mod.rs
+23
-12
compiler/rustc_middle/src/traits/query.rs
compiler/rustc_middle/src/traits/query.rs
+13
-8
compiler/rustc_middle/src/traits/select.rs
compiler/rustc_middle/src/traits/select.rs
+1
-1
compiler/rustc_middle/src/ty/adjustment.rs
compiler/rustc_middle/src/ty/adjustment.rs
+6
-4
compiler/rustc_middle/src/ty/closure.rs
compiler/rustc_middle/src/ty/closure.rs
+12
-17
compiler/rustc_middle/src/ty/context.rs
compiler/rustc_middle/src/ty/context.rs
+3
-3
compiler/rustc_middle/src/ty/error.rs
compiler/rustc_middle/src/ty/error.rs
+2
-2
compiler/rustc_middle/src/ty/instance.rs
compiler/rustc_middle/src/ty/instance.rs
+1
-1
compiler/rustc_middle/src/ty/mod.rs
compiler/rustc_middle/src/ty/mod.rs
+19
-49
compiler/rustc_middle/src/ty/print/pretty.rs
compiler/rustc_middle/src/ty/print/pretty.rs
+3
-3
compiler/rustc_middle/src/ty/relate.rs
compiler/rustc_middle/src/ty/relate.rs
+1
-1
compiler/rustc_middle/src/ty/sty.rs
compiler/rustc_middle/src/ty/sty.rs
+11
-11
compiler/rustc_middle/src/ty/subst.rs
compiler/rustc_middle/src/ty/subst.rs
+2
-2
compiler/rustc_trait_selection/src/traits/query/type_op/implied_outlives_bounds.rs
...ction/src/traits/query/type_op/implied_outlives_bounds.rs
+1
-1
compiler/rustc_trait_selection/src/traits/query/type_op/outlives.rs
...ustc_trait_selection/src/traits/query/type_op/outlives.rs
+1
-1
未找到文件。
compiler/rustc_infer/src/infer/mod.rs
浏览文件 @
e4b9625b
...
...
@@ -318,7 +318,7 @@ pub struct InferCtxt<'a, 'tcx> {
}
/// See the `error_reporting` module for more details.
#[derive(Clone,
Copy,
Debug,
PartialEq,
Eq,
TypeFoldable)]
#[derive(Clone,
Copy,
Debug,
PartialEq,
Eq,
TypeFoldable
,
TypeVisitable
)]
pub
enum
ValuePairs
<
'tcx
>
{
Regions
(
ExpectedFound
<
ty
::
Region
<
'tcx
>>
),
Terms
(
ExpectedFound
<
ty
::
Term
<
'tcx
>>
),
...
...
compiler/rustc_infer/src/infer/region_constraints/mod.rs
浏览文件 @
e4b9625b
...
...
@@ -165,7 +165,7 @@ pub struct Verify<'tcx> {
pub
bound
:
VerifyBound
<
'tcx
>
,
}
#[derive(Copy,
Clone,
PartialEq,
Eq,
Hash,
TypeFoldable)]
#[derive(Copy,
Clone,
PartialEq,
Eq,
Hash,
TypeFoldable
,
TypeVisitable
)]
pub
enum
GenericKind
<
'tcx
>
{
Param
(
ty
::
ParamTy
),
Projection
(
ty
::
ProjectionTy
<
'tcx
>
),
...
...
@@ -272,7 +272,7 @@ pub enum VerifyBound<'tcx> {
/// }
/// }
/// ```
#[derive(Debug,
Copy,
Clone,
TypeFoldable)]
#[derive(Debug,
Copy,
Clone,
TypeFoldable
,
TypeVisitable
)]
pub
struct
VerifyIfEq
<
'tcx
>
{
/// Type which must match the generic `G`
pub
ty
:
Ty
<
'tcx
>
,
...
...
compiler/rustc_infer/src/traits/project.rs
浏览文件 @
e4b9625b
...
...
@@ -20,7 +20,7 @@ pub struct MismatchedProjectionTypes<'tcx> {
pub
err
:
ty
::
error
::
TypeError
<
'tcx
>
,
}
#[derive(Clone,
TypeFoldable)]
#[derive(Clone,
TypeFoldable
,
TypeVisitable
)]
pub
struct
Normalized
<
'tcx
,
T
>
{
pub
value
:
T
,
pub
obligations
:
Vec
<
PredicateObligation
<
'tcx
>>
,
...
...
compiler/rustc_macros/src/lib.rs
浏览文件 @
e4b9625b
...
...
@@ -18,6 +18,7 @@
mod
serialize
;
mod
symbols
;
mod
type_foldable
;
mod
type_visitable
;
#[proc_macro]
pub
fn
rustc_queries
(
input
:
TokenStream
)
->
TokenStream
{
...
...
@@ -121,6 +122,7 @@ pub fn fluent_messages(input: TokenStream) -> TokenStream {
decl_derive!
([
MetadataDecodable
]
=>
serialize
::
meta_decodable_derive
);
decl_derive!
([
MetadataEncodable
]
=>
serialize
::
meta_encodable_derive
);
decl_derive!
([
TypeFoldable
,
attributes
(
type_foldable
)]
=>
type_foldable
::
type_foldable_derive
);
decl_derive!
([
TypeVisitable
,
attributes
(
type_visitable
)]
=>
type_visitable
::
type_visitable_derive
);
decl_derive!
([
Lift
,
attributes
(
lift
)]
=>
lift
::
lift_derive
);
decl_derive!
(
[
SessionDiagnostic
,
attributes
(
...
...
compiler/rustc_macros/src/type_foldable.rs
浏览文件 @
e4b9625b
...
...
@@ -11,11 +11,6 @@ pub fn type_foldable_derive(mut s: synstructure::Structure<'_>) -> proc_macro2::
}
s
.add_bounds
(
synstructure
::
AddBounds
::
Generics
);
let
body_visit
=
s
.each
(|
bind
|
{
quote!
{
::
rustc_middle
::
ty
::
fold
::
TypeFoldable
::
visit_with
(
#
bind
,
__
folder
)
?
;
}
});
s
.bind_with
(|
_
|
synstructure
::
BindStyle
::
Move
);
let
body_fold
=
s
.each_variant
(|
vi
|
{
let
bindings
=
vi
.bindings
();
...
...
@@ -36,14 +31,6 @@ fn try_fold_with<__F: ::rustc_middle::ty::fold::FallibleTypeFolder<'tcx>>(
)
->
Result
<
Self
,
__
F
::
Error
>
{
Ok
(
match
self
{
#
body_fold
})
}
fn
visit_with
<
__
F
:
::
rustc_middle
::
ty
::
fold
::
TypeVisitor
<
'tcx
>>
(
&
self
,
__
folder
:
&
mut
__
F
)
->
::
std
::
ops
::
ControlFlow
<
__
F
::
BreakTy
>
{
match
*
self
{
#
body_visit
}
::
std
::
ops
::
ControlFlow
::
CONTINUE
}
},
)
}
compiler/rustc_macros/src/type_visitable.rs
0 → 100644
浏览文件 @
e4b9625b
use
quote
::
quote
;
use
syn
::
parse_quote
;
pub
fn
type_visitable_derive
(
mut
s
:
synstructure
::
Structure
<
'_
>
)
->
proc_macro2
::
TokenStream
{
if
let
syn
::
Data
::
Union
(
_
)
=
s
.ast
()
.data
{
panic!
(
"cannot derive on union"
)
}
if
!
s
.ast
()
.generics
.lifetimes
()
.any
(|
lt
|
lt
.lifetime.ident
==
"tcx"
)
{
s
.add_impl_generic
(
parse_quote!
{
'tcx
});
}
s
.add_bounds
(
synstructure
::
AddBounds
::
Generics
);
let
body_visit
=
s
.each
(|
bind
|
{
quote!
{
::
rustc_middle
::
ty
::
visit
::
TypeVisitable
::
visit_with
(
#
bind
,
__
visitor
)
?
;
}
});
s
.bind_with
(|
_
|
synstructure
::
BindStyle
::
Move
);
s
.bound_impl
(
quote!
(::
rustc_middle
::
ty
::
visit
::
TypeVisitable
<
'tcx
>
),
quote!
{
fn
visit_with
<
__
V
:
::
rustc_middle
::
ty
::
visit
::
TypeVisitor
<
'tcx
>>
(
&
self
,
__
visitor
:
&
mut
__
V
)
->
::
std
::
ops
::
ControlFlow
<
__
V
::
BreakTy
>
{
match
*
self
{
#
body_visit
}
::
std
::
ops
::
ControlFlow
::
CONTINUE
}
},
)
}
compiler/rustc_middle/src/hir/place.rs
浏览文件 @
e4b9625b
...
...
@@ -4,18 +4,8 @@
use
rustc_hir
::
HirId
;
use
rustc_target
::
abi
::
VariantIdx
;
#[derive(
Clone,
Copy,
Debug,
PartialEq,
Eq,
Hash,
TyEncodable,
TyDecodable,
TypeFoldable,
HashStable
)]
#[derive(Clone,
Copy,
Debug,
PartialEq,
Eq,
Hash,
TyEncodable,
TyDecodable,
HashStable)]
#[derive(TypeFoldable,
TypeVisitable)]
pub
enum
PlaceBase
{
/// A temporary variable.
Rvalue
,
...
...
@@ -27,18 +17,8 @@ pub enum PlaceBase {
Upvar
(
ty
::
UpvarId
),
}
#[derive(
Clone,
Copy,
Debug,
PartialEq,
Eq,
Hash,
TyEncodable,
TyDecodable,
TypeFoldable,
HashStable
)]
#[derive(Clone,
Copy,
Debug,
PartialEq,
Eq,
Hash,
TyEncodable,
TyDecodable,
HashStable)]
#[derive(TypeFoldable,
TypeVisitable)]
pub
enum
ProjectionKind
{
/// A dereference of a pointer, reference or `Box<T>` of the given type.
Deref
,
...
...
@@ -58,18 +38,8 @@ pub enum ProjectionKind {
Subslice
,
}
#[derive(
Clone,
Copy,
Debug,
PartialEq,
Eq,
Hash,
TyEncodable,
TyDecodable,
TypeFoldable,
HashStable
)]
#[derive(Clone,
Copy,
Debug,
PartialEq,
Eq,
Hash,
TyEncodable,
TyDecodable,
HashStable)]
#[derive(TypeFoldable,
TypeVisitable)]
pub
struct
Projection
<
'tcx
>
{
/// Type after the projection is applied.
pub
ty
:
Ty
<
'tcx
>
,
...
...
@@ -81,7 +51,8 @@ pub struct Projection<'tcx> {
/// A `Place` represents how a value is located in memory.
///
/// This is an HIR version of [`rustc_middle::mir::Place`].
#[derive(Clone,
Debug,
PartialEq,
Eq,
Hash,
TyEncodable,
TyDecodable,
TypeFoldable,
HashStable)]
#[derive(Clone,
Debug,
PartialEq,
Eq,
Hash,
TyEncodable,
TyDecodable,
HashStable)]
#[derive(TypeFoldable,
TypeVisitable)]
pub
struct
Place
<
'tcx
>
{
/// The type of the `PlaceBase`
pub
base_ty
:
Ty
<
'tcx
>
,
...
...
@@ -94,7 +65,8 @@ pub struct Place<'tcx> {
/// A `PlaceWithHirId` represents how a value is located in memory.
///
/// This is an HIR version of [`rustc_middle::mir::Place`].
#[derive(Clone,
Debug,
PartialEq,
Eq,
Hash,
TyEncodable,
TyDecodable,
TypeFoldable,
HashStable)]
#[derive(Clone,
Debug,
PartialEq,
Eq,
Hash,
TyEncodable,
TyDecodable,
HashStable)]
#[derive(TypeFoldable,
TypeVisitable)]
pub
struct
PlaceWithHirId
<
'tcx
>
{
/// `HirId` of the expression or pattern producing this value.
pub
hir_id
:
HirId
,
...
...
compiler/rustc_middle/src/infer/canonical.rs
浏览文件 @
e4b9625b
...
...
@@ -34,7 +34,7 @@
/// variables have been rewritten to "canonical vars". These are
/// numbered starting from 0 in order of first appearance.
#[derive(Copy,
Clone,
Debug,
PartialEq,
Eq,
Hash,
TyDecodable,
TyEncodable)]
#[derive(HashStable,
TypeFoldable,
Lift)]
#[derive(HashStable,
TypeFoldable,
TypeVisitable,
Lift)]
pub
struct
Canonical
<
'tcx
,
V
>
{
pub
max_universe
:
ty
::
UniverseIndex
,
pub
variables
:
CanonicalVarInfos
<
'tcx
>
,
...
...
@@ -53,7 +53,7 @@ pub struct Canonical<'tcx, V> {
/// variables. You will need to supply it later to instantiate the
/// canonicalized query response.
#[derive(Clone,
Debug,
PartialEq,
Eq,
Hash,
TyDecodable,
TyEncodable)]
#[derive(HashStable,
TypeFoldable,
Lift)]
#[derive(HashStable,
TypeFoldable,
TypeVisitable,
Lift)]
pub
struct
CanonicalVarValues
<
'tcx
>
{
pub
var_values
:
IndexVec
<
BoundVar
,
GenericArg
<
'tcx
>>
,
}
...
...
@@ -173,7 +173,7 @@ pub enum CanonicalTyVarKind {
/// After we execute a query with a canonicalized key, we get back a
/// `Canonical<QueryResponse<..>>`. You can use
/// `instantiate_query_result` to access the data in this result.
#[derive(Clone,
Debug,
HashStable,
TypeFoldable,
Lift)]
#[derive(Clone,
Debug,
HashStable,
TypeFoldable,
TypeVisitable,
Lift)]
pub
struct
QueryResponse
<
'tcx
,
R
>
{
pub
var_values
:
CanonicalVarValues
<
'tcx
>
,
pub
region_constraints
:
QueryRegionConstraints
<
'tcx
>
,
...
...
@@ -187,7 +187,7 @@ pub struct QueryResponse<'tcx, R> {
pub
value
:
R
,
}
#[derive(Clone,
Debug,
Default,
HashStable,
TypeFoldable,
Lift)]
#[derive(Clone,
Debug,
Default,
HashStable,
TypeFoldable,
TypeVisitable,
Lift)]
pub
struct
QueryRegionConstraints
<
'tcx
>
{
pub
outlives
:
Vec
<
QueryOutlivesConstraint
<
'tcx
>>
,
pub
member_constraints
:
Vec
<
MemberConstraint
<
'tcx
>>
,
...
...
compiler/rustc_middle/src/infer/mod.rs
浏览文件 @
e4b9625b
...
...
@@ -13,7 +13,7 @@
/// ```text
/// R0 member of [O1..On]
/// ```
#[derive(Debug,
Clone,
HashStable,
TypeFoldable,
Lift)]
#[derive(Debug,
Clone,
HashStable,
TypeFoldable,
TypeVisitable,
Lift)]
pub
struct
MemberConstraint
<
'tcx
>
{
/// The `DefId` of the opaque type causing this constraint: used for error reporting.
pub
opaque_type_def_id
:
DefId
,
...
...
compiler/rustc_middle/src/mir/coverage.rs
浏览文件 @
e4b9625b
...
...
@@ -100,7 +100,7 @@ fn from(v: InjectedExpressionId) -> ExpressionOperandId {
}
}
#[derive(Clone,
PartialEq,
TyEncodable,
TyDecodable,
Hash,
HashStable,
TypeFoldable)]
#[derive(Clone,
PartialEq,
TyEncodable,
TyDecodable,
Hash,
HashStable,
TypeFoldable
,
TypeVisitable
)]
pub
enum
CoverageKind
{
Counter
{
function_source_hash
:
u64
,
...
...
@@ -148,18 +148,8 @@ fn fmt(&self, fmt: &mut Formatter<'_>) -> fmt::Result {
}
}
#[derive(
Clone,
TyEncodable,
TyDecodable,
Hash,
HashStable,
TypeFoldable,
PartialEq,
Eq,
PartialOrd,
Ord
)]
#[derive(Clone,
TyEncodable,
TyDecodable,
Hash,
HashStable,
PartialEq,
Eq,
PartialOrd,
Ord)]
#[derive(TypeFoldable,
TypeVisitable)]
pub
struct
CodeRegion
{
pub
file_name
:
Symbol
,
pub
start_line
:
u32
,
...
...
@@ -178,7 +168,8 @@ fn fmt(&self, fmt: &mut Formatter<'_>) -> fmt::Result {
}
}
#[derive(Copy,
Clone,
Debug,
PartialEq,
TyEncodable,
TyDecodable,
Hash,
HashStable,
TypeFoldable)]
#[derive(Copy,
Clone,
Debug,
PartialEq,
TyEncodable,
TyDecodable,
Hash,
HashStable)]
#[derive(TypeFoldable,
TypeVisitable)]
pub
enum
Op
{
Subtract
,
Add
,
...
...
compiler/rustc_middle/src/mir/mod.rs
浏览文件 @
e4b9625b
...
...
@@ -136,7 +136,7 @@ pub fn phase_index(&self) -> usize {
/// Where a specific `mir::Body` comes from.
#[derive(Copy,
Clone,
Debug,
PartialEq,
Eq)]
#[derive(HashStable,
TyEncodable,
TyDecodable,
TypeFoldable)]
#[derive(HashStable,
TyEncodable,
TyDecodable,
TypeFoldable
,
TypeVisitable
)]
pub
struct
MirSource
<
'tcx
>
{
pub
instance
:
InstanceDef
<
'tcx
>
,
...
...
@@ -166,7 +166,7 @@ pub fn def_id(&self) -> DefId {
}
}
#[derive(Clone,
TyEncodable,
TyDecodable,
Debug,
HashStable,
TypeFoldable)]
#[derive(Clone,
TyEncodable,
TyDecodable,
Debug,
HashStable,
TypeFoldable
,
TypeVisitable
)]
pub
struct
GeneratorInfo
<
'tcx
>
{
/// The yield type of the function, if it is a generator.
pub
yield_ty
:
Option
<
Ty
<
'tcx
>>
,
...
...
@@ -183,7 +183,7 @@ pub struct GeneratorInfo<'tcx> {
}
/// The lowered representation of a single function.
#[derive(Clone,
TyEncodable,
TyDecodable,
Debug,
HashStable,
TypeFoldable)]
#[derive(Clone,
TyEncodable,
TyDecodable,
Debug,
HashStable,
TypeFoldable
,
TypeVisitable
)]
pub
struct
Body
<
'tcx
>
{
/// A list of basic blocks. References to basic block use a newtyped index type [`BasicBlock`]
/// that indexes into this vector.
...
...
@@ -601,7 +601,7 @@ fn index_mut(&mut self, index: BasicBlock) -> &mut BasicBlockData<'tcx> {
}
}
#[derive(Copy,
Clone,
Debug,
HashStable,
TypeFoldable)]
#[derive(Copy,
Clone,
Debug,
HashStable,
TypeFoldable
,
TypeVisitable
)]
pub
enum
ClearCrossCrate
<
T
>
{
Clear
,
Set
(
T
),
...
...
@@ -807,7 +807,7 @@ pub struct BlockTailInfo {
///
/// This can be a binding declared by the user, a temporary inserted by the compiler, a function
/// argument, or the return place.
#[derive(Clone,
Debug,
TyEncodable,
TyDecodable,
HashStable,
TypeFoldable)]
#[derive(Clone,
Debug,
TyEncodable,
TyDecodable,
HashStable,
TypeFoldable
,
TypeVisitable
)]
pub
struct
LocalDecl
<
'tcx
>
{
/// Whether this is a mutable binding (i.e., `let x` or `let mut x`).
///
...
...
@@ -942,7 +942,7 @@ pub struct LocalDecl<'tcx> {
///
/// Not used for non-StaticRef temporaries, the return place, or anonymous
/// function parameters.
#[derive(Clone,
Debug,
TyEncodable,
TyDecodable,
HashStable,
TypeFoldable)]
#[derive(Clone,
Debug,
TyEncodable,
TyDecodable,
HashStable,
TypeFoldable
,
TypeVisitable
)]
pub
enum
LocalInfo
<
'tcx
>
{
/// A user-defined local variable or function parameter
///
...
...
@@ -1081,7 +1081,7 @@ pub fn block_tail(mut self, info: BlockTailInfo) -> Self {
}
}
#[derive(Clone,
TyEncodable,
TyDecodable,
HashStable,
TypeFoldable)]
#[derive(Clone,
TyEncodable,
TyDecodable,
HashStable,
TypeFoldable
,
TypeVisitable
)]
pub
enum
VarDebugInfoContents
<
'tcx
>
{
/// NOTE(eddyb) There's an unenforced invariant that this `Place` is
/// based on a `Local`, not a `Static`, and contains no indexing.
...
...
@@ -1099,7 +1099,7 @@ fn fmt(&self, fmt: &mut Formatter<'_>) -> fmt::Result {
}
/// Debug information pertaining to a user variable.
#[derive(Clone,
Debug,
TyEncodable,
TyDecodable,
HashStable,
TypeFoldable)]
#[derive(Clone,
Debug,
TyEncodable,
TyDecodable,
HashStable,
TypeFoldable
,
TypeVisitable
)]
pub
struct
VarDebugInfo
<
'tcx
>
{
pub
name
:
Symbol
,
...
...
@@ -1155,7 +1155,7 @@ pub fn start_location(self) -> Location {
// BasicBlockData
/// See [`BasicBlock`] for documentation on what basic blocks are at a high level.
#[derive(Clone,
Debug,
TyEncodable,
TyDecodable,
HashStable,
TypeFoldable)]
#[derive(Clone,
Debug,
TyEncodable,
TyDecodable,
HashStable,
TypeFoldable
,
TypeVisitable
)]
pub
struct
BasicBlockData
<
'tcx
>
{
/// List of statements in this block.
pub
statements
:
Vec
<
Statement
<
'tcx
>>
,
...
...
@@ -1392,7 +1392,7 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
///////////////////////////////////////////////////////////////////////////
// Statements
#[derive(Clone,
TyEncodable,
TyDecodable,
HashStable,
TypeFoldable)]
#[derive(Clone,
TyEncodable,
TyDecodable,
HashStable,
TypeFoldable
,
TypeVisitable
)]
pub
struct
Statement
<
'tcx
>
{
pub
source_info
:
SourceInfo
,
pub
kind
:
StatementKind
<
'tcx
>
,
...
...
@@ -1758,7 +1758,7 @@ pub fn lint_root<'tcx>(
}
}
#[derive(Clone,
Debug,
TyEncodable,
TyDecodable,
HashStable,
TypeFoldable)]
#[derive(Clone,
Debug,
TyEncodable,
TyDecodable,
HashStable,
TypeFoldable
,
TypeVisitable
)]
pub
struct
SourceScopeData
<
'tcx
>
{
pub
span
:
Span
,
pub
parent_scope
:
Option
<
SourceScope
>
,
...
...
@@ -2524,7 +2524,7 @@ pub fn from_const(c: ty::Const<'tcx>, tcx: TyCtxt<'tcx>) -> Self {
/// The first will lead to the constraint `w: &'1 str` (for some
/// inferred region `'1`). The second will lead to the constraint `w:
/// &'static str`.
#[derive(Clone,
Debug,
TyEncodable,
TyDecodable,
HashStable,
TypeFoldable)]
#[derive(Clone,
Debug,
TyEncodable,
TyDecodable,
HashStable,
TypeFoldable
,
TypeVisitable
)]
pub
struct
UserTypeProjections
{
pub
contents
:
Vec
<
(
UserTypeProjection
,
Span
)
>
,
}
...
...
compiler/rustc_middle/src/mir/query.rs
浏览文件 @
e4b9625b
...
...
@@ -161,7 +161,7 @@ pub struct GeneratorSavedLocal {
}
/// The layout of generator state.
#[derive(Clone,
TyEncodable,
TyDecodable,
HashStable,
TypeFoldable)]
#[derive(Clone,
TyEncodable,
TyDecodable,
HashStable,
TypeFoldable
,
TypeVisitable
)]
pub
struct
GeneratorLayout
<
'tcx
>
{
/// The type of every local stored inside the generator.
pub
field_tys
:
IndexVec
<
GeneratorSavedLocal
,
Ty
<
'tcx
>>
,
...
...
compiler/rustc_middle/src/mir/syntax.rs
浏览文件 @
e4b9625b
...
...
@@ -179,7 +179,8 @@ pub enum BorrowKind {
/// Not all of these are allowed at every [`MirPhase`]. Check the documentation there to see which
/// ones you do not have to worry about. The MIR validator will generally enforce such restrictions,
/// causing an ICE if they are violated.
#[derive(Clone,
Debug,
PartialEq,
TyEncodable,
TyDecodable,
Hash,
HashStable,
TypeFoldable)]
#[derive(Clone,
Debug,
PartialEq,
TyEncodable,
TyDecodable,
Hash,
HashStable)]
#[derive(TypeFoldable,
TypeVisitable)]
pub
enum
StatementKind
<
'tcx
>
{
/// Assign statements roughly correspond to an assignment in Rust proper (`x = ...`) except
/// without the possibility of dropping the previous value (that must be done separately, if at
...
...
@@ -376,13 +377,15 @@ pub enum FakeReadCause {
ForIndex
,
}
#[derive(Clone,
Debug,
PartialEq,
TyEncodable,
TyDecodable,
Hash,
HashStable,
TypeFoldable)]
#[derive(Clone,
Debug,
PartialEq,
TyEncodable,
TyDecodable,
Hash,
HashStable)]
#[derive(TypeFoldable,
TypeVisitable)]
pub
struct
Coverage
{
pub
kind
:
CoverageKind
,
pub
code_region
:
Option
<
CodeRegion
>
,
}
#[derive(Clone,
Debug,
PartialEq,
TyEncodable,
TyDecodable,
Hash,
HashStable,
TypeFoldable)]
#[derive(Clone,
Debug,
PartialEq,
TyEncodable,
TyDecodable,
Hash,
HashStable)]
#[derive(TypeFoldable,
TypeVisitable)]
pub
struct
CopyNonOverlapping
<
'tcx
>
{
pub
src
:
Operand
<
'tcx
>
,
pub
dst
:
Operand
<
'tcx
>
,
...
...
@@ -672,7 +675,8 @@ pub enum AssertKind<O> {
ResumedAfterPanic
(
GeneratorKind
),
}
#[derive(Clone,
Debug,
PartialEq,
TyEncodable,
TyDecodable,
Hash,
HashStable,
TypeFoldable)]
#[derive(Clone,
Debug,
PartialEq,
TyEncodable,
TyDecodable,
Hash,
HashStable)]
#[derive(TypeFoldable,
TypeVisitable)]
pub
enum
InlineAsmOperand
<
'tcx
>
{
In
{
reg
:
InlineAsmRegOrRegClass
,
...
...
compiler/rustc_middle/src/mir/tcx.rs
浏览文件 @
e4b9625b
...
...
@@ -9,7 +9,7 @@
use
rustc_hir
as
hir
;
use
rustc_target
::
abi
::
VariantIdx
;
#[derive(Copy,
Clone,
Debug,
TypeFoldable)]
#[derive(Copy,
Clone,
Debug,
TypeFoldable
,
TypeVisitable
)]
pub
struct
PlaceTy
<
'tcx
>
{
pub
ty
:
Ty
<
'tcx
>
,
/// Downcast to a particular variant of an enum or a generator, if included.
...
...
compiler/rustc_middle/src/thir.rs
浏览文件 @
e4b9625b
...
...
@@ -191,18 +191,8 @@ pub enum StmtKind<'tcx> {
#[cfg(all(target_arch
=
"x86_64"
,
target_pointer_width
=
"64"
))]
rustc_data_structures
::
static_assert_size!
(
Expr
<
'_
>
,
104
);
#[derive(
Clone,
Debug,
Copy,
PartialEq,
Eq,
Hash,
HashStable,
TyEncodable,
TyDecodable,
TypeFoldable
)]
#[derive(Clone,
Debug,
Copy,
PartialEq,
Eq,
Hash,
HashStable,
TyEncodable,
TyDecodable)]
#[derive(TypeFoldable,
TypeVisitable)]
pub
struct
LocalVarId
(
pub
hir
::
HirId
);
/// A THIR expression.
...
...
compiler/rustc_middle/src/traits/chalk.rs
浏览文件 @
e4b9625b
...
...
@@ -390,7 +390,7 @@ impl<'tcx> chalk_ir::interner::HasInterner for RustInterner<'tcx> {
}
/// A chalk environment and goal.
#[derive(Copy,
Clone,
PartialEq,
Eq,
Hash,
Debug,
HashStable,
TypeFoldable)]
#[derive(Copy,
Clone,
PartialEq,
Eq,
Hash,
Debug,
HashStable,
TypeFoldable
,
TypeVisitable
)]
pub
struct
ChalkEnvironmentAndGoal
<
'tcx
>
{
pub
environment
:
&
'tcx
ty
::
List
<
ty
::
Predicate
<
'tcx
>>
,
pub
goal
:
ty
::
Predicate
<
'tcx
>
,
...
...
compiler/rustc_middle/src/traits/mod.rs
浏览文件 @
e4b9625b
...
...
@@ -523,7 +523,7 @@ pub struct DerivedObligationCause<'tcx> {
pub
parent_code
:
InternedObligationCauseCode
<
'tcx
>
,
}
#[derive(Clone,
Debug,
TypeFoldable,
Lift)]
#[derive(Clone,
Debug,
TypeFoldable,
TypeVisitable,
Lift)]
pub
enum
SelectionError
<
'tcx
>
{
/// The trait is not implemented.
Unimplemented
,
...
...
@@ -592,7 +592,8 @@ pub enum SelectionError<'tcx> {
/// ### The type parameter `N`
///
/// See explanation on `ImplSourceUserDefinedData`.
#[derive(Clone,
PartialEq,
Eq,
TyEncodable,
TyDecodable,
HashStable,
TypeFoldable,
Lift)]
#[derive(Clone,
PartialEq,
Eq,
TyEncodable,
TyDecodable,
HashStable,
Lift)]
#[derive(TypeFoldable,
TypeVisitable)]
pub
enum
ImplSource
<
'tcx
,
N
>
{
/// ImplSource identifying a particular impl.
UserDefined
(
ImplSourceUserDefinedData
<
'tcx
,
N
>
),
...
...
@@ -753,14 +754,16 @@ pub fn map<M, F>(self, f: F) -> ImplSource<'tcx, M>
/// is `Obligation`, as one might expect. During codegen, however, this
/// is `()`, because codegen only requires a shallow resolution of an
/// impl, and nested obligations are satisfied later.
#[derive(Clone,
PartialEq,
Eq,
TyEncodable,
TyDecodable,
HashStable,
TypeFoldable,
Lift)]
#[derive(Clone,
PartialEq,
Eq,
TyEncodable,
TyDecodable,
HashStable,
Lift)]
#[derive(TypeFoldable,
TypeVisitable)]
pub
struct
ImplSourceUserDefinedData
<
'tcx
,
N
>
{
pub
impl_def_id
:
DefId
,
pub
substs
:
SubstsRef
<
'tcx
>
,
pub
nested
:
Vec
<
N
>
,
}
#[derive(Clone,
PartialEq,
Eq,
TyEncodable,
TyDecodable,
HashStable,
TypeFoldable,
Lift)]
#[derive(Clone,
PartialEq,
Eq,
TyEncodable,
TyDecodable,
HashStable,
Lift)]
#[derive(TypeFoldable,
TypeVisitable)]
pub
struct
ImplSourceGeneratorData
<
'tcx
,
N
>
{
pub
generator_def_id
:
DefId
,
pub
substs
:
SubstsRef
<
'tcx
>
,
...
...
@@ -769,7 +772,8 @@ pub struct ImplSourceGeneratorData<'tcx, N> {
pub
nested
:
Vec
<
N
>
,
}
#[derive(Clone,
PartialEq,
Eq,
TyEncodable,
TyDecodable,
HashStable,
TypeFoldable,
Lift)]
#[derive(Clone,
PartialEq,
Eq,
TyEncodable,
TyDecodable,
HashStable,
Lift)]
#[derive(TypeFoldable,
TypeVisitable)]
pub
struct
ImplSourceClosureData
<
'tcx
,
N
>
{
pub
closure_def_id
:
DefId
,
pub
substs
:
SubstsRef
<
'tcx
>
,
...
...
@@ -778,13 +782,15 @@ pub struct ImplSourceClosureData<'tcx, N> {
pub
nested
:
Vec
<
N
>
,
}
#[derive(Clone,
PartialEq,
Eq,
TyEncodable,
TyDecodable,
HashStable,
TypeFoldable,
Lift)]
#[derive(Clone,
PartialEq,
Eq,
TyEncodable,
TyDecodable,
HashStable,
Lift)]
#[derive(TypeFoldable,
TypeVisitable)]
pub
struct
ImplSourceAutoImplData
<
N
>
{
pub
trait_def_id
:
DefId
,
pub
nested
:
Vec
<
N
>
,
}
#[derive(Clone,
PartialEq,
Eq,
TyEncodable,
TyDecodable,
HashStable,
TypeFoldable,
Lift)]
#[derive(Clone,
PartialEq,
Eq,
TyEncodable,
TyDecodable,
HashStable,
Lift)]
#[derive(TypeFoldable,
TypeVisitable)]
pub
struct
ImplSourceTraitUpcastingData
<
'tcx
,
N
>
{
/// `Foo` upcast to the obligation trait. This will be some supertrait of `Foo`.
pub
upcast_trait_ref
:
ty
::
PolyTraitRef
<
'tcx
>
,
...
...
@@ -798,12 +804,14 @@ pub struct ImplSourceTraitUpcastingData<'tcx, N> {
pub
nested
:
Vec
<
N
>
,
}
#[derive(Clone,
PartialEq,
Eq,
TyEncodable,
TyDecodable,
HashStable,
TypeFoldable,
Lift)]
#[derive(Clone,
PartialEq,
Eq,
TyEncodable,
TyDecodable,
HashStable,
Lift)]
#[derive(TypeFoldable,
TypeVisitable)]
pub
struct
ImplSourceBuiltinData
<
N
>
{
pub
nested
:
Vec
<
N
>
,
}
#[derive(PartialEq,
Eq,
Clone,
TyEncodable,
TyDecodable,
HashStable,
TypeFoldable,
Lift)]
#[derive(PartialEq,
Eq,
Clone,
TyEncodable,
TyDecodable,
HashStable,
Lift)]
#[derive(TypeFoldable,
TypeVisitable)]
pub
struct
ImplSourceObjectData
<
'tcx
,
N
>
{
/// `Foo` upcast to the obligation trait. This will be some supertrait of `Foo`.
pub
upcast_trait_ref
:
ty
::
PolyTraitRef
<
'tcx
>
,
...
...
@@ -817,7 +825,8 @@ pub struct ImplSourceObjectData<'tcx, N> {
pub
nested
:
Vec
<
N
>
,
}
#[derive(Clone,
PartialEq,
Eq,
TyEncodable,
TyDecodable,
HashStable,
TypeFoldable,
Lift)]
#[derive(Clone,
PartialEq,
Eq,
TyEncodable,
TyDecodable,
HashStable,
Lift)]
#[derive(TypeFoldable,
TypeVisitable)]
pub
struct
ImplSourceFnPointerData
<
'tcx
,
N
>
{
pub
fn_ty
:
Ty
<
'tcx
>
,
pub
nested
:
Vec
<
N
>
,
...
...
@@ -830,12 +839,14 @@ pub struct ImplSourceFnPointerData<'tcx, N> {
#[derive(Clone,
Debug,
PartialEq,
Eq,
TyEncodable,
TyDecodable,
HashStable)]
pub
struct
ImplSourcePointeeData
;
#[derive(Clone,
PartialEq,
Eq,
TyEncodable,
TyDecodable,
HashStable,
TypeFoldable,
Lift)]
#[derive(Clone,
PartialEq,
Eq,
TyEncodable,
TyDecodable,
HashStable,
Lift)]
#[derive(TypeFoldable,
TypeVisitable)]
pub
struct
ImplSourceConstDestructData
<
N
>
{
pub
nested
:
Vec
<
N
>
,
}
#[derive(Clone,
PartialEq,
Eq,
TyEncodable,
TyDecodable,
HashStable,
TypeFoldable,
Lift)]
#[derive(Clone,
PartialEq,
Eq,
TyEncodable,
TyDecodable,
HashStable,
Lift)]
#[derive(TypeFoldable,
TypeVisitable)]
pub
struct
ImplSourceTraitAliasData
<
'tcx
,
N
>
{
pub
alias_def_id
:
DefId
,
pub
substs
:
SubstsRef
<
'tcx
>
,
...
...
compiler/rustc_middle/src/traits/query.rs
浏览文件 @
e4b9625b
...
...
@@ -24,7 +24,8 @@ pub mod type_op {
use
rustc_hir
::
def_id
::
DefId
;
use
std
::
fmt
;
#[derive(Copy,
Clone,
Debug,
Hash,
PartialEq,
Eq,
HashStable,
TypeFoldable,
Lift)]
#[derive(Copy,
Clone,
Debug,
Hash,
PartialEq,
Eq,
HashStable,
Lift)]
#[derive(TypeFoldable,
TypeVisitable)]
pub
struct
AscribeUserType
<
'tcx
>
{
pub
mir_ty
:
Ty
<
'tcx
>
,
pub
def_id
:
DefId
,
...
...
@@ -37,19 +38,22 @@ pub fn new(mir_ty: Ty<'tcx>, def_id: DefId, user_substs: UserSubsts<'tcx>) -> Se
}
}
#[derive(Copy,
Clone,
Debug,
Hash,
PartialEq,
Eq,
HashStable,
TypeFoldable,
Lift)]
#[derive(Copy,
Clone,
Debug,
Hash,
PartialEq,
Eq,
HashStable,
Lift)]
#[derive(TypeFoldable,
TypeVisitable)]
pub
struct
Eq
<
'tcx
>
{
pub
a
:
Ty
<
'tcx
>
,
pub
b
:
Ty
<
'tcx
>
,
}
#[derive(Copy,
Clone,
Debug,
Hash,
PartialEq,
Eq,
HashStable,
TypeFoldable,
Lift)]
#[derive(Copy,
Clone,
Debug,
Hash,
PartialEq,
Eq,
HashStable,
Lift)]
#[derive(TypeFoldable,
TypeVisitable)]
pub
struct
Subtype
<
'tcx
>
{
pub
sub
:
Ty
<
'tcx
>
,
pub
sup
:
Ty
<
'tcx
>
,
}
#[derive(Copy,
Clone,
Debug,
Hash,
PartialEq,
Eq,
HashStable,
TypeFoldable,
Lift)]
#[derive(Copy,
Clone,
Debug,
Hash,
PartialEq,
Eq,
HashStable,
Lift)]
#[derive(TypeFoldable,
TypeVisitable)]
pub
struct
ProvePredicate
<
'tcx
>
{
pub
predicate
:
Predicate
<
'tcx
>
,
}
...
...
@@ -60,7 +64,8 @@ pub fn new(predicate: Predicate<'tcx>) -> Self {
}
}
#[derive(Copy,
Clone,
Debug,
Hash,
PartialEq,
Eq,
HashStable,
TypeFoldable,
Lift)]
#[derive(Copy,
Clone,
Debug,
Hash,
PartialEq,
Eq,
HashStable,
Lift)]
#[derive(TypeFoldable,
TypeVisitable)]
pub
struct
Normalize
<
T
>
{
pub
value
:
T
,
}
...
...
@@ -107,7 +112,7 @@ fn from(_: TypeError<'tcx>) -> NoSolution {
}
}
#[derive(Clone,
Debug,
Default,
HashStable,
TypeFoldable,
Lift)]
#[derive(Clone,
Debug,
Default,
HashStable,
TypeFoldable,
TypeVisitable,
Lift)]
pub
struct
DropckOutlivesResult
<
'tcx
>
{
pub
kinds
:
Vec
<
GenericArg
<
'tcx
>>
,
pub
overflows
:
Vec
<
Ty
<
'tcx
>>
,
...
...
@@ -208,7 +213,7 @@ pub struct MethodAutoderefBadTy<'tcx> {
}
/// Result from the `normalize_projection_ty` query.
#[derive(Clone,
Debug,
HashStable,
TypeFoldable,
Lift)]
#[derive(Clone,
Debug,
HashStable,
TypeFoldable,
TypeVisitable,
Lift)]
pub
struct
NormalizationResult
<
'tcx
>
{
/// Result of normalization.
pub
normalized_ty
:
Ty
<
'tcx
>
,
...
...
@@ -221,7 +226,7 @@ pub struct NormalizationResult<'tcx> {
/// case they are called implied bounds). They are fed to the
/// `OutlivesEnv` which in turn is supplied to the region checker and
/// other parts of the inference system.
#[derive(Clone,
Debug,
TypeFoldable,
Lift)]
#[derive(Clone,
Debug,
TypeFoldable,
TypeVisitable,
Lift)]
pub
enum
OutlivesBound
<
'tcx
>
{
RegionSubRegion
(
ty
::
Region
<
'tcx
>
,
ty
::
Region
<
'tcx
>
),
RegionSubParam
(
ty
::
Region
<
'tcx
>
,
ty
::
ParamTy
),
...
...
compiler/rustc_middle/src/traits/select.rs
浏览文件 @
e4b9625b
...
...
@@ -103,7 +103,7 @@
/// required for associated types to work in default impls, as the bounds
/// are visible both as projection bounds and as where-clauses from the
/// parameter environment.
#[derive(PartialEq,
Eq,
Debug,
Clone,
TypeFoldable)]
#[derive(PartialEq,
Eq,
Debug,
Clone,
TypeFoldable
,
TypeVisitable
)]
pub
enum
SelectionCandidate
<
'tcx
>
{
BuiltinCandidate
{
/// `false` if there are no *further* obligations.
...
...
compiler/rustc_middle/src/ty/adjustment.rs
浏览文件 @
e4b9625b
...
...
@@ -77,7 +77,7 @@ pub enum PointerCast {
/// At some point, of course, `Box` should move out of the compiler, in which
/// case this is analogous to transforming a struct. E.g., `Box<[i32; 4]>` ->
/// `Box<[i32]>` is an `Adjust::Unsize` with the target `Box<[i32]>`.
#[derive(Clone,
TyEncodable,
TyDecodable,
HashStable,
TypeFoldable)]
#[derive(Clone,
TyEncodable,
TyDecodable,
HashStable,
TypeFoldable
,
TypeVisitable
)]
pub
struct
Adjustment
<
'tcx
>
{
pub
kind
:
Adjust
<
'tcx
>
,
pub
target
:
Ty
<
'tcx
>
,
...
...
@@ -89,7 +89,7 @@ pub fn is_region_borrow(&self) -> bool {
}
}
#[derive(Clone,
Debug,
TyEncodable,
TyDecodable,
HashStable,
TypeFoldable)]
#[derive(Clone,
Debug,
TyEncodable,
TyDecodable,
HashStable,
TypeFoldable
,
TypeVisitable
)]
pub
enum
Adjust
<
'tcx
>
{
/// Go from ! to any type.
NeverToAny
,
...
...
@@ -107,7 +107,8 @@ pub enum Adjust<'tcx> {
/// call, with the signature `&'a T -> &'a U` or `&'a mut T -> &'a mut U`.
/// The target type is `U` in both cases, with the region and mutability
/// being those shared by both the receiver and the returned reference.
#[derive(Copy,
Clone,
PartialEq,
Debug,
TyEncodable,
TyDecodable,
HashStable,
TypeFoldable)]
#[derive(Copy,
Clone,
PartialEq,
Debug,
TyEncodable,
TyDecodable,
HashStable)]
#[derive(TypeFoldable,
TypeVisitable)]
pub
struct
OverloadedDeref
<
'tcx
>
{
pub
region
:
ty
::
Region
<
'tcx
>
,
pub
mutbl
:
hir
::
Mutability
,
...
...
@@ -165,7 +166,8 @@ fn from(m: AutoBorrowMutability) -> Self {
}
}
#[derive(Copy,
Clone,
PartialEq,
Debug,
TyEncodable,
TyDecodable,
HashStable,
TypeFoldable)]
#[derive(Copy,
Clone,
PartialEq,
Debug,
TyEncodable,
TyDecodable,
HashStable)]
#[derive(TypeFoldable,
TypeVisitable)]
pub
enum
AutoBorrow
<
'tcx
>
{
/// Converts from T to &T.
Ref
(
ty
::
Region
<
'tcx
>
,
AutoBorrowMutability
),
...
...
compiler/rustc_middle/src/ty/closure.rs
浏览文件 @
e4b9625b
...
...
@@ -18,18 +18,8 @@
// This represents accessing self in the closure structure
pub
const
CAPTURE_STRUCT_LOCAL
:
mir
::
Local
=
mir
::
Local
::
from_u32
(
1
);
#[derive(
Clone,
Copy,
Debug,
PartialEq,
Eq,
Hash,
TyEncodable,
TyDecodable,
TypeFoldable,
HashStable
)]
#[derive(Clone,
Copy,
Debug,
PartialEq,
Eq,
Hash,
TyEncodable,
TyDecodable,
HashStable)]
#[derive(TypeFoldable,
TypeVisitable)]
pub
struct
UpvarPath
{
pub
hir_id
:
hir
::
HirId
,
}
...
...
@@ -37,7 +27,8 @@ pub struct UpvarPath {
/// Upvars do not get their own `NodeId`. Instead, we use the pair of
/// the original var ID (that is, the root variable that is referenced
/// by the upvar) and the ID of the closure expression.
#[derive(Clone,
Copy,
PartialEq,
Eq,
Hash,
TyEncodable,
TyDecodable,
TypeFoldable,
HashStable)]
#[derive(Clone,
Copy,
PartialEq,
Eq,
Hash,
TyEncodable,
TyDecodable,
HashStable)]
#[derive(TypeFoldable,
TypeVisitable)]
pub
struct
UpvarId
{
pub
var_path
:
UpvarPath
,
pub
closure_expr_id
:
LocalDefId
,
...
...
@@ -51,7 +42,8 @@ pub fn new(var_hir_id: hir::HirId, closure_def_id: LocalDefId) -> UpvarId {
/// Information describing the capture of an upvar. This is computed
/// during `typeck`, specifically by `regionck`.
#[derive(PartialEq,
Clone,
Debug,
Copy,
TyEncodable,
TyDecodable,
TypeFoldable,
HashStable)]
#[derive(PartialEq,
Clone,
Debug,
Copy,
TyEncodable,
TyDecodable,
HashStable)]
#[derive(TypeFoldable,
TypeVisitable)]
pub
enum
UpvarCapture
{
/// Upvar is captured by value. This is always true when the
/// closure is labeled `move`, but can also be true in other cases
...
...
@@ -139,7 +131,8 @@ pub fn from_def_id(tcx: TyCtxt<'_>, def_id: DefId) -> Option<ClosureKind> {
}
/// A composite describing a `Place` that is captured by a closure.
#[derive(PartialEq,
Clone,
Debug,
TyEncodable,
TyDecodable,
TypeFoldable,
HashStable)]
#[derive(PartialEq,
Clone,
Debug,
TyEncodable,
TyDecodable,
HashStable)]
#[derive(TypeFoldable,
TypeVisitable)]
pub
struct
CapturedPlace
<
'tcx
>
{
/// The `Place` that is captured.
pub
place
:
HirPlace
<
'tcx
>
,
...
...
@@ -284,7 +277,8 @@ pub fn is_ancestor_or_same_capture(
/// Part of `MinCaptureInformationMap`; describes the capture kind (&, &mut, move)
/// for a particular capture as well as identifying the part of the source code
/// that triggered this capture to occur.
#[derive(PartialEq,
Clone,
Debug,
Copy,
TyEncodable,
TyDecodable,
TypeFoldable,
HashStable)]
#[derive(PartialEq,
Clone,
Debug,
Copy,
TyEncodable,
TyDecodable,
HashStable)]
#[derive(TypeFoldable,
TypeVisitable)]
pub
struct
CaptureInfo
{
/// Expr Id pointing to use that resulted in selecting the current capture kind
///
...
...
@@ -362,7 +356,8 @@ pub fn place_to_string_for_capture<'tcx>(tcx: TyCtxt<'tcx>, place: &HirPlace<'tc
curr_string
}
#[derive(Clone,
PartialEq,
Debug,
TyEncodable,
TyDecodable,
TypeFoldable,
Copy,
HashStable)]
#[derive(Clone,
PartialEq,
Debug,
TyEncodable,
TyDecodable,
Copy,
HashStable)]
#[derive(TypeFoldable,
TypeVisitable)]
pub
enum
BorrowKind
{
/// Data must be immutable and is aliasable.
ImmBorrow
,
...
...
compiler/rustc_middle/src/ty/context.rs
浏览文件 @
e4b9625b
...
...
@@ -390,7 +390,7 @@ pub fn remove(&mut self, id: hir::HirId) -> Option<V> {
/// Here, we would store the type `T`, the span of the value `x`, the "scope-span" for
/// the scope that contains `x`, the expr `T` evaluated from, and the span of `foo.await`.
#[derive(TyEncodable,
TyDecodable,
Clone,
Debug,
Eq,
Hash,
PartialEq,
HashStable)]
#[derive(TypeFoldable)]
#[derive(TypeFoldable
,
TypeVisitable
)]
pub
struct
GeneratorInteriorTypeCause
<
'tcx
>
{
/// Type of the captured binding.
pub
ty
:
Ty
<
'tcx
>
,
...
...
@@ -871,7 +871,7 @@ pub struct UserTypeAnnotationIndex {
pub
type
CanonicalUserTypeAnnotations
<
'tcx
>
=
IndexVec
<
UserTypeAnnotationIndex
,
CanonicalUserTypeAnnotation
<
'tcx
>>
;
#[derive(Clone,
Debug,
TyEncodable,
TyDecodable,
HashStable,
TypeFoldable,
Lift)]
#[derive(Clone,
Debug,
TyEncodable,
TyDecodable,
HashStable,
TypeFoldable,
TypeVisitable,
Lift)]
pub
struct
CanonicalUserTypeAnnotation
<
'tcx
>
{
pub
user_ty
:
CanonicalUserType
<
'tcx
>
,
pub
span
:
Span
,
...
...
@@ -931,7 +931,7 @@ pub fn is_identity(&self) -> bool {
/// from constants that are named via paths, like `Foo::<A>::new` and
/// so forth.
#[derive(Copy,
Clone,
Debug,
PartialEq,
TyEncodable,
TyDecodable)]
#[derive(HashStable,
TypeFoldable,
Lift)]
#[derive(HashStable,
TypeFoldable,
TypeVisitable,
Lift)]
pub
enum
UserType
<
'tcx
>
{
Ty
(
Ty
<
'tcx
>
),
...
...
compiler/rustc_middle/src/ty/error.rs
浏览文件 @
e4b9625b
...
...
@@ -13,7 +13,7 @@
use
std
::
borrow
::
Cow
;
use
std
::
fmt
;
#[derive(Clone,
Copy,
Debug,
PartialEq,
Eq,
TypeFoldable)]
#[derive(Clone,
Copy,
Debug,
PartialEq,
Eq,
TypeFoldable
,
TypeVisitable
)]
pub
struct
ExpectedFound
<
T
>
{
pub
expected
:
T
,
pub
found
:
T
,
...
...
@@ -30,7 +30,7 @@ pub fn new(a_is_expected: bool, a: T, b: T) -> Self {
}
// Data structures used in type unification
#[derive(Clone,
Debug,
TypeFoldable)]
#[derive(Clone,
Debug,
TypeFoldable
,
TypeVisitable
)]
pub
enum
TypeError
<
'tcx
>
{
Mismatch
,
ConstnessMismatch
(
ExpectedFound
<
ty
::
BoundConstness
>
),
...
...
compiler/rustc_middle/src/ty/instance.rs
浏览文件 @
e4b9625b
...
...
@@ -25,7 +25,7 @@ pub struct Instance<'tcx> {
}
#[derive(Copy,
Clone,
PartialEq,
Eq,
PartialOrd,
Ord,
Hash,
Debug)]
#[derive(TyEncodable,
TyDecodable,
HashStable,
TypeFoldable)]
#[derive(TyEncodable,
TyDecodable,
HashStable,
TypeFoldable
,
TypeVisitable
)]
pub
enum
InstanceDef
<
'tcx
>
{
/// A user-defined callable item.
///
...
...
compiler/rustc_middle/src/ty/mod.rs
浏览文件 @
e4b9625b
...
...
@@ -206,7 +206,7 @@ pub fn opt_fn_def_id(self) -> Option<DefId> {
/// The "header" of an impl is everything outside the body: a Self type, a trait
/// ref (in the case of a trait impl), and a set of predicates (from the
/// bounds / where-clauses).
#[derive(Clone,
Debug,
TypeFoldable)]
#[derive(Clone,
Debug,
TypeFoldable
,
TypeVisitable
)]
pub
struct
ImplHeader
<
'tcx
>
{
pub
impl_def_id
:
DefId
,
pub
self_ty
:
Ty
<
'tcx
>
,
...
...
@@ -214,24 +214,14 @@ pub struct ImplHeader<'tcx> {
pub
predicates
:
Vec
<
Predicate
<
'tcx
>>
,
}
#[derive(Copy,
Clone,
Debug,
TypeFoldable)]
#[derive(Copy,
Clone,
Debug,
TypeFoldable
,
TypeVisitable
)]
pub
enum
ImplSubject
<
'tcx
>
{
Trait
(
TraitRef
<
'tcx
>
),
Inherent
(
Ty
<
'tcx
>
),
}
#[derive(
Copy,
Clone,
PartialEq,
Eq,
Hash,
TyEncodable,
TyDecodable,
HashStable,
Debug,
TypeFoldable
)]
#[derive(Copy,
Clone,
PartialEq,
Eq,
Hash,
TyEncodable,
TyDecodable,
HashStable,
Debug)]
#[derive(TypeFoldable,
TypeVisitable)]
pub
enum
ImplPolarity
{
/// `impl Trait for Type`
Positive
,
...
...
@@ -307,18 +297,8 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
}
}
#[derive(
Clone,
Debug,
PartialEq,
Eq,
Copy,
Hash,
TyEncodable,
TyDecodable,
HashStable,
TypeFoldable
)]
#[derive(Clone,
Debug,
PartialEq,
Eq,
Copy,
Hash,
TyEncodable,
TyDecodable,
HashStable)]
#[derive(TypeFoldable,
TypeVisitable)]
pub
struct
ClosureSizeProfileData
<
'tcx
>
{
/// Tuple containing the types of closure captures before the feature `capture_disjoint_fields`
pub
before_feature_tys
:
Ty
<
'tcx
>
,
...
...
@@ -618,7 +598,7 @@ fn into_diagnostic_arg(self) -> rustc_errors::DiagnosticArgValue<'static> {
}
#[derive(Clone,
Copy,
PartialEq,
Eq,
Hash,
TyEncodable,
TyDecodable)]
#[derive(HashStable,
TypeFoldable)]
#[derive(HashStable,
TypeFoldable
,
TypeVisitable
)]
pub
enum
PredicateKind
<
'tcx
>
{
/// Corresponds to `where Foo: Bar<A, B, C>`. `Foo` here would be
/// the `Self` type of the trait reference and `A`, `B`, and `C`
...
...
@@ -790,7 +770,7 @@ pub fn subst_supertrait(
}
#[derive(Clone,
Copy,
PartialEq,
Eq,
Hash,
TyEncodable,
TyDecodable)]
#[derive(HashStable,
TypeFoldable)]
#[derive(HashStable,
TypeFoldable
,
TypeVisitable
)]
pub
struct
TraitPredicate
<
'tcx
>
{
pub
trait_ref
:
TraitRef
<
'tcx
>
,
...
...
@@ -869,7 +849,7 @@ pub fn is_const_if_const(self) -> bool {
}
#[derive(Clone,
Copy,
PartialEq,
Eq,
PartialOrd,
Ord,
Hash,
Debug,
TyEncodable,
TyDecodable)]
#[derive(HashStable,
TypeFoldable)]
#[derive(HashStable,
TypeFoldable
,
TypeVisitable
)]
pub
struct
OutlivesPredicate
<
A
,
B
>
(
pub
A
,
pub
B
);
// `A: B`
pub
type
RegionOutlivesPredicate
<
'tcx
>
=
OutlivesPredicate
<
ty
::
Region
<
'tcx
>
,
ty
::
Region
<
'tcx
>>
;
pub
type
TypeOutlivesPredicate
<
'tcx
>
=
OutlivesPredicate
<
Ty
<
'tcx
>
,
ty
::
Region
<
'tcx
>>
;
...
...
@@ -880,7 +860,7 @@ pub fn is_const_if_const(self) -> bool {
/// whether the `a` type is the type that we should label as "expected" when
/// presenting user diagnostics.
#[derive(Clone,
Copy,
PartialEq,
Eq,
Hash,
Debug,
TyEncodable,
TyDecodable)]
#[derive(HashStable,
TypeFoldable)]
#[derive(HashStable,
TypeFoldable
,
TypeVisitable
)]
pub
struct
SubtypePredicate
<
'tcx
>
{
pub
a_is_expected
:
bool
,
pub
a
:
Ty
<
'tcx
>
,
...
...
@@ -890,7 +870,7 @@ pub struct SubtypePredicate<'tcx> {
/// Encodes that we have to coerce *from* the `a` type to the `b` type.
#[derive(Clone,
Copy,
PartialEq,
Eq,
Hash,
Debug,
TyEncodable,
TyDecodable)]
#[derive(HashStable,
TypeFoldable)]
#[derive(HashStable,
TypeFoldable
,
TypeVisitable
)]
pub
struct
CoercePredicate
<
'tcx
>
{
pub
a
:
Ty
<
'tcx
>
,
pub
b
:
Ty
<
'tcx
>
,
...
...
@@ -898,7 +878,7 @@ pub struct CoercePredicate<'tcx> {
pub
type
PolyCoercePredicate
<
'tcx
>
=
ty
::
Binder
<
'tcx
,
CoercePredicate
<
'tcx
>>
;
#[derive(Debug,
Copy,
Clone,
PartialEq,
Eq,
Hash,
PartialOrd,
Ord,
TyEncodable,
TyDecodable)]
#[derive(HashStable,
TypeFoldable)]
#[derive(HashStable,
TypeFoldable
,
TypeVisitable
)]
pub
enum
Term
<
'tcx
>
{
Ty
(
Ty
<
'tcx
>
),
Const
(
Const
<
'tcx
>
),
...
...
@@ -946,7 +926,7 @@ pub fn into_arg(self) -> GenericArg<'tcx> {
/// Form #2 eventually yields one of these `ProjectionPredicate`
/// instances to normalize the LHS.
#[derive(Copy,
Clone,
PartialEq,
Eq,
Hash,
TyEncodable,
TyDecodable)]
#[derive(HashStable,
TypeFoldable)]
#[derive(HashStable,
TypeFoldable
,
TypeVisitable
)]
pub
struct
ProjectionPredicate
<
'tcx
>
{
pub
projection_ty
:
ProjectionTy
<
'tcx
>
,
pub
term
:
Term
<
'tcx
>
,
...
...
@@ -1090,7 +1070,7 @@ pub fn to_opt_type_outlives(self) -> Option<PolyTypeOutlivesPredicate<'tcx>> {
/// `[[], [U:Bar<T>]]`. Now if there were some particular reference
/// like `Foo<isize,usize>`, then the `InstantiatedPredicates` would be `[[],
/// [usize:Bar<isize>]]`.
#[derive(Clone,
Debug,
TypeFoldable)]
#[derive(Clone,
Debug,
TypeFoldable
,
TypeVisitable
)]
pub
struct
InstantiatedPredicates
<
'tcx
>
{
pub
predicates
:
Vec
<
Predicate
<
'tcx
>>
,
pub
spans
:
Vec
<
Span
>
,
...
...
@@ -1106,24 +1086,14 @@ pub fn is_empty(&self) -> bool {
}
}
#[derive(
Copy,
Clone,
Debug,
PartialEq,
Eq,
HashStable,
TyEncodable,
TyDecodable,
TypeFoldable,
Lift
)]
#[derive(Copy,
Clone,
Debug,
PartialEq,
Eq,
HashStable,
TyEncodable,
TyDecodable,
Lift)]
#[derive(TypeFoldable,
TypeVisitable)]
pub
struct
OpaqueTypeKey
<
'tcx
>
{
pub
def_id
:
DefId
,
pub
substs
:
SubstsRef
<
'tcx
>
,
}
#[derive(Copy,
Clone,
Debug,
TypeFoldable,
HashStable,
TyEncodable,
TyDecodable)]
#[derive(Copy,
Clone,
Debug,
TypeFoldable,
TypeVisitable,
HashStable,
TyEncodable,
TyDecodable)]
pub
struct
OpaqueHiddenType
<
'tcx
>
{
/// The span of this particular definition of the opaque type. So
/// for example:
...
...
@@ -1259,7 +1229,7 @@ pub struct BoundConst<'tcx> {
/// except that instead of a `Ty` we bundle the `DefId` of the const parameter.
/// Meaning that we need to use `type_of(const_param_did)` if `const_param_did` is `Some`
/// to get the type of `did`.
#[derive(Copy,
Clone,
Debug,
TypeFoldable,
Lift,
TyEncodable,
TyDecodable)]
#[derive(Copy,
Clone,
Debug,
TypeFoldable,
TypeVisitable,
Lift,
TyEncodable,
TyDecodable)]
#[derive(PartialEq,
Eq,
PartialOrd,
Ord)]
#[derive(Hash,
HashStable)]
pub
struct
WithOptConstParam
<
T
>
{
...
...
@@ -1575,7 +1545,7 @@ pub fn without_const(self) -> PolyTraitPredicate<'tcx> {
}
}
#[derive(Copy,
Clone,
Debug,
PartialEq,
Eq,
Hash,
TypeFoldable)]
#[derive(Copy,
Clone,
Debug,
PartialEq,
Eq,
Hash,
TypeFoldable
,
TypeVisitable
)]
pub
struct
ParamEnvAnd
<
'tcx
,
T
>
{
pub
param_env
:
ParamEnv
<
'tcx
>
,
pub
value
:
T
,
...
...
compiler/rustc_middle/src/ty/print/pretty.rs
浏览文件 @
e4b9625b
...
...
@@ -2388,7 +2388,7 @@ fn print(&$self, $cx: P) -> Result<Self::Output, Self::Error> {
/// Wrapper type for `ty::TraitRef` which opts-in to pretty printing only
/// the trait path. That is, it will print `Trait<U>` instead of
/// `<T as Trait<U>>`.
#[derive(Copy,
Clone,
TypeFoldable,
Lift)]
#[derive(Copy,
Clone,
TypeFoldable,
TypeVisitable,
Lift)]
pub
struct
TraitRefPrintOnlyTraitPath
<
'tcx
>
(
ty
::
TraitRef
<
'tcx
>
);
impl
<
'tcx
>
fmt
::
Debug
for
TraitRefPrintOnlyTraitPath
<
'tcx
>
{
...
...
@@ -2400,7 +2400,7 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
/// Wrapper type for `ty::TraitRef` which opts-in to pretty printing only
/// the trait name. That is, it will print `Trait` instead of
/// `<T as Trait<U>>`.
#[derive(Copy,
Clone,
TypeFoldable,
Lift)]
#[derive(Copy,
Clone,
TypeFoldable,
TypeVisitable,
Lift)]
pub
struct
TraitRefPrintOnlyTraitName
<
'tcx
>
(
ty
::
TraitRef
<
'tcx
>
);
impl
<
'tcx
>
fmt
::
Debug
for
TraitRefPrintOnlyTraitName
<
'tcx
>
{
...
...
@@ -2425,7 +2425,7 @@ pub fn print_only_trait_path(self) -> ty::Binder<'tcx, TraitRefPrintOnlyTraitPat
}
}
#[derive(Copy,
Clone,
TypeFoldable,
Lift)]
#[derive(Copy,
Clone,
TypeFoldable,
TypeVisitable,
Lift)]
pub
struct
TraitPredPrintModifiersAndPath
<
'tcx
>
(
ty
::
TraitPredicate
<
'tcx
>
);
impl
<
'tcx
>
fmt
::
Debug
for
TraitPredPrintModifiersAndPath
<
'tcx
>
{
...
...
compiler/rustc_middle/src/ty/relate.rs
浏览文件 @
e4b9625b
...
...
@@ -345,7 +345,7 @@ fn relate<R: TypeRelation<'tcx>>(
}
}
#[derive(Copy,
Debug,
Clone,
TypeFoldable)]
#[derive(Copy,
Debug,
Clone,
TypeFoldable
,
TypeVisitable
)]
struct
GeneratorWitness
<
'tcx
>
(
&
'tcx
ty
::
List
<
Ty
<
'tcx
>>
);
impl
<
'tcx
>
Relate
<
'tcx
>
for
GeneratorWitness
<
'tcx
>
{
...
...
compiler/rustc_middle/src/ty/sty.rs
浏览文件 @
e4b9625b
...
...
@@ -38,7 +38,7 @@
pub
type
RegionKind
<
'tcx
>
=
IrRegionKind
<
TyCtxt
<
'tcx
>>
;
#[derive(Clone,
Copy,
PartialEq,
Eq,
PartialOrd,
Ord,
Hash,
Debug,
TyEncodable,
TyDecodable)]
#[derive(HashStable,
TypeFoldable,
Lift)]
#[derive(HashStable,
TypeFoldable,
TypeVisitable,
Lift)]
pub
struct
TypeAndMut
<
'tcx
>
{
pub
ty
:
Ty
<
'tcx
>
,
pub
mutbl
:
hir
::
Mutability
,
...
...
@@ -201,7 +201,7 @@ fn article(&self) -> &'static str {
/// * `GR`: The "return type", which is the type of value returned upon
/// completion of the generator.
/// * `GW`: The "generator witness".
#[derive(Copy,
Clone,
Debug,
TypeFoldable)]
#[derive(Copy,
Clone,
Debug,
TypeFoldable
,
TypeVisitable
)]
pub
struct
ClosureSubsts
<
'tcx
>
{
/// Lifetime and type parameters from the enclosing function,
/// concatenated with a tuple containing the types of the upvars.
...
...
@@ -328,7 +328,7 @@ pub fn sig(self) -> ty::PolyFnSig<'tcx> {
}
/// Similar to `ClosureSubsts`; see the above documentation for more.
#[derive(Copy,
Clone,
Debug,
TypeFoldable)]
#[derive(Copy,
Clone,
Debug,
TypeFoldable
,
TypeVisitable
)]
pub
struct
GeneratorSubsts
<
'tcx
>
{
pub
substs
:
SubstsRef
<
'tcx
>
,
}
...
...
@@ -608,7 +608,7 @@ pub fn tupled_upvars_ty(self) -> Ty<'tcx> {
/// type of the constant. The reason that `R` is represented as an extra type parameter
/// is the same reason that [`ClosureSubsts`] have `CS` and `U` as type parameters:
/// inline const can reference lifetimes that are internal to the creating function.
#[derive(Copy,
Clone,
Debug,
TypeFoldable)]
#[derive(Copy,
Clone,
Debug,
TypeFoldable
,
TypeVisitable
)]
pub
struct
InlineConstSubsts
<
'tcx
>
{
/// Generic parameters from the enclosing item,
/// concatenated with the inferred type of the constant.
...
...
@@ -655,7 +655,7 @@ pub fn ty(self) -> Ty<'tcx> {
}
#[derive(Debug,
Copy,
Clone,
PartialEq,
PartialOrd,
Ord,
Eq,
Hash,
TyEncodable,
TyDecodable)]
#[derive(HashStable,
TypeFoldable)]
#[derive(HashStable,
TypeFoldable
,
TypeVisitable
)]
pub
enum
ExistentialPredicate
<
'tcx
>
{
/// E.g., `Iterator`.
Trait
(
ExistentialTraitRef
<
'tcx
>
),
...
...
@@ -781,7 +781,7 @@ pub fn auto_traits<'a>(&'a self) -> impl Iterator<Item = DefId> + Captures<'tcx>
/// Trait references also appear in object types like `Foo<U>`, but in
/// that case the `Self` parameter is absent from the substitutions.
#[derive(Copy,
Clone,
PartialEq,
Eq,
PartialOrd,
Ord,
Hash,
TyEncodable,
TyDecodable)]
#[derive(HashStable,
TypeFoldable)]
#[derive(HashStable,
TypeFoldable
,
TypeVisitable
)]
pub
struct
TraitRef
<
'tcx
>
{
pub
def_id
:
DefId
,
pub
substs
:
SubstsRef
<
'tcx
>
,
...
...
@@ -853,7 +853,7 @@ pub fn to_poly_trait_predicate_negative_polarity(&self) -> ty::PolyTraitPredicat
/// The substitutions don't include the erased `Self`, only trait
/// type and lifetime parameters (`[X, Y]` and `['a, 'b]` above).
#[derive(Copy,
Clone,
PartialEq,
Eq,
PartialOrd,
Ord,
Hash,
TyEncodable,
TyDecodable)]
#[derive(HashStable,
TypeFoldable)]
#[derive(HashStable,
TypeFoldable
,
TypeVisitable
)]
pub
struct
ExistentialTraitRef
<
'tcx
>
{
pub
def_id
:
DefId
,
pub
substs
:
SubstsRef
<
'tcx
>
,
...
...
@@ -1143,7 +1143,7 @@ pub fn transpose(self) -> Option<Binder<'tcx, T>> {
/// Represents the projection of an associated type. In explicit UFCS
/// form this would be written `<T as Trait<..>>::N`.
#[derive(Copy,
Clone,
PartialEq,
Eq,
PartialOrd,
Ord,
Hash,
Debug,
TyEncodable,
TyDecodable)]
#[derive(HashStable,
TypeFoldable)]
#[derive(HashStable,
TypeFoldable
,
TypeVisitable
)]
pub
struct
ProjectionTy
<
'tcx
>
{
/// The parameters of the associated item.
pub
substs
:
SubstsRef
<
'tcx
>
,
...
...
@@ -1192,7 +1192,7 @@ pub fn self_ty(&self) -> Ty<'tcx> {
}
}
#[derive(Copy,
Clone,
Debug,
TypeFoldable)]
#[derive(Copy,
Clone,
Debug,
TypeFoldable
,
TypeVisitable
)]
pub
struct
GenSig
<
'tcx
>
{
pub
resume_ty
:
Ty
<
'tcx
>
,
pub
yield_ty
:
Ty
<
'tcx
>
,
...
...
@@ -1208,7 +1208,7 @@ pub struct GenSig<'tcx> {
/// - `output`: is the return type.
/// - `c_variadic`: indicates whether this is a C-variadic function.
#[derive(Copy,
Clone,
PartialEq,
Eq,
PartialOrd,
Ord,
Hash,
TyEncodable,
TyDecodable)]
#[derive(HashStable,
TypeFoldable)]
#[derive(HashStable,
TypeFoldable
,
TypeVisitable
)]
pub
struct
FnSig
<
'tcx
>
{
pub
inputs_and_output
:
&
'tcx
List
<
Ty
<
'tcx
>>
,
pub
c_variadic
:
bool
,
...
...
@@ -1385,7 +1385,7 @@ fn from(var: BoundVar) -> Self {
/// A `ProjectionPredicate` for an `ExistentialTraitRef`.
#[derive(Clone,
Copy,
PartialEq,
Eq,
PartialOrd,
Ord,
Hash,
Debug,
TyEncodable,
TyDecodable)]
#[derive(HashStable,
TypeFoldable)]
#[derive(HashStable,
TypeFoldable
,
TypeVisitable
)]
pub
struct
ExistentialProjection
<
'tcx
>
{
pub
item_def_id
:
DefId
,
pub
substs
:
SubstsRef
<
'tcx
>
,
...
...
compiler/rustc_middle/src/ty/subst.rs
浏览文件 @
e4b9625b
...
...
@@ -722,7 +722,7 @@ fn shift_region_through_binders(&self, region: ty::Region<'tcx>) -> ty::Region<'
/// Stores the user-given substs to reach some fully qualified path
/// (e.g., `<T>::Item` or `<T as Trait>::Item`).
#[derive(Copy,
Clone,
Debug,
PartialEq,
Eq,
Hash,
TyEncodable,
TyDecodable)]
#[derive(HashStable,
TypeFoldable,
Lift)]
#[derive(HashStable,
TypeFoldable,
TypeVisitable,
Lift)]
pub
struct
UserSubsts
<
'tcx
>
{
/// The substitutions for the item as given by the user.
pub
substs
:
SubstsRef
<
'tcx
>
,
...
...
@@ -749,7 +749,7 @@ pub struct UserSubsts<'tcx> {
/// the self type, giving `Foo<?A>`. Finally, we unify that with
/// the self type here, which contains `?A` to be `&'static u32`
#[derive(Copy,
Clone,
Debug,
PartialEq,
Eq,
Hash,
TyEncodable,
TyDecodable)]
#[derive(HashStable,
TypeFoldable,
Lift)]
#[derive(HashStable,
TypeFoldable,
TypeVisitable,
Lift)]
pub
struct
UserSelfTy
<
'tcx
>
{
pub
impl_def_id
:
DefId
,
pub
self_ty
:
Ty
<
'tcx
>
,
...
...
compiler/rustc_trait_selection/src/traits/query/type_op/implied_outlives_bounds.rs
浏览文件 @
e4b9625b
...
...
@@ -3,7 +3,7 @@
use
rustc_infer
::
traits
::
query
::
OutlivesBound
;
use
rustc_middle
::
ty
::{
self
,
ParamEnvAnd
,
Ty
,
TyCtxt
};
#[derive(Copy,
Clone,
Debug,
HashStable,
TypeFoldable,
Lift)]
#[derive(Copy,
Clone,
Debug,
HashStable,
TypeFoldable,
TypeVisitable,
Lift)]
pub
struct
ImpliedOutlivesBounds
<
'tcx
>
{
pub
ty
:
Ty
<
'tcx
>
,
}
...
...
compiler/rustc_trait_selection/src/traits/query/type_op/outlives.rs
浏览文件 @
e4b9625b
...
...
@@ -3,7 +3,7 @@
use
crate
::
traits
::
query
::
Fallible
;
use
rustc_middle
::
ty
::{
ParamEnvAnd
,
Ty
,
TyCtxt
};
#[derive(Copy,
Clone,
Debug,
HashStable,
TypeFoldable,
Lift)]
#[derive(Copy,
Clone,
Debug,
HashStable,
TypeFoldable,
TypeVisitable,
Lift)]
pub
struct
DropckOutlives
<
'tcx
>
{
dropped_ty
:
Ty
<
'tcx
>
,
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录