Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
87c7e570
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,发现更多精彩内容 >>
提交
87c7e570
编写于
8月 22, 2018
作者:
V
varkor
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Rename ty::Slice to ty::List
上级
674ef668
变更
20
显示空白变更内容
内联
并排
Showing
20 changed file
with
140 addition
and
139 deletion
+140
-139
src/librustc/ich/impls_ty.rs
src/librustc/ich/impls_ty.rs
+2
-2
src/librustc/infer/canonical/canonicalizer.rs
src/librustc/infer/canonical/canonicalizer.rs
+2
-2
src/librustc/infer/canonical/mod.rs
src/librustc/infer/canonical/mod.rs
+3
-3
src/librustc/traits/mod.rs
src/librustc/traits/mod.rs
+3
-3
src/librustc/traits/structural_impls.rs
src/librustc/traits/structural_impls.rs
+2
-2
src/librustc/ty/codec.rs
src/librustc/ty/codec.rs
+6
-6
src/librustc/ty/context.rs
src/librustc/ty/context.rs
+60
-60
src/librustc/ty/error.rs
src/librustc/ty/error.rs
+1
-1
src/librustc/ty/mod.rs
src/librustc/ty/mod.rs
+31
-30
src/librustc/ty/relate.rs
src/librustc/ty/relate.rs
+2
-2
src/librustc/ty/structural_impls.rs
src/librustc/ty/structural_impls.rs
+3
-3
src/librustc/ty/sty.rs
src/librustc/ty/sty.rs
+9
-9
src/librustc/ty/subst.rs
src/librustc/ty/subst.rs
+2
-2
src/librustc/ty/wf.rs
src/librustc/ty/wf.rs
+2
-2
src/librustc/util/ppaux.rs
src/librustc/util/ppaux.rs
+3
-3
src/librustc_mir/borrow_check/nll/type_check/relate_tys.rs
src/librustc_mir/borrow_check/nll/type_check/relate_tys.rs
+2
-2
src/librustc_mir/borrow_check/nll/universal_regions.rs
src/librustc_mir/borrow_check/nll/universal_regions.rs
+1
-1
src/librustc_mir/transform/lower_128bit.rs
src/librustc_mir/transform/lower_128bit.rs
+2
-2
src/librustc_traits/lowering.rs
src/librustc_traits/lowering.rs
+3
-3
src/librustc_typeck/astconv.rs
src/librustc_typeck/astconv.rs
+1
-1
未找到文件。
src/librustc/ich/impls_ty.rs
浏览文件 @
87c7e570
...
...
@@ -25,7 +25,7 @@
use
mir
;
impl
<
'a
,
'gcx
,
T
>
HashStable
<
StableHashingContext
<
'a
>>
for
&
'gcx
ty
::
Slice
<
T
>
for
&
'gcx
ty
::
List
<
T
>
where
T
:
HashStable
<
StableHashingContext
<
'a
>>
{
fn
hash_stable
<
W
:
StableHasherResult
>
(
&
self
,
hcx
:
&
mut
StableHashingContext
<
'a
>
,
...
...
@@ -53,7 +53,7 @@ fn hash_stable<W: StableHasherResult>(&self,
}
}
impl
<
'a
,
'gcx
,
T
>
ToStableHashKey
<
StableHashingContext
<
'a
>>
for
&
'gcx
ty
::
Slice
<
T
>
impl
<
'a
,
'gcx
,
T
>
ToStableHashKey
<
StableHashingContext
<
'a
>>
for
&
'gcx
ty
::
List
<
T
>
where
T
:
HashStable
<
StableHashingContext
<
'a
>>
{
type
KeyType
=
Fingerprint
;
...
...
src/librustc/infer/canonical/canonicalizer.rs
浏览文件 @
87c7e570
...
...
@@ -23,7 +23,7 @@
use
std
::
sync
::
atomic
::
Ordering
;
use
ty
::
fold
::{
TypeFoldable
,
TypeFolder
};
use
ty
::
subst
::
Kind
;
use
ty
::{
self
,
CanonicalVar
,
Lift
,
Slice
,
Ty
,
TyCtxt
,
TypeFlags
};
use
ty
::{
self
,
CanonicalVar
,
Lift
,
List
,
Ty
,
TyCtxt
,
TypeFlags
};
use
rustc_data_structures
::
fx
::
FxHashMap
;
use
rustc_data_structures
::
indexed_vec
::
Idx
;
...
...
@@ -327,7 +327,7 @@ fn canonicalize<V>(
if
!
value
.has_type_flags
(
needs_canonical_flags
)
{
let
out_value
=
gcx
.lift
(
value
)
.unwrap
();
let
canon_value
=
Canonical
{
variables
:
Slice
::
empty
(),
variables
:
List
::
empty
(),
value
:
out_value
,
};
return
canon_value
;
...
...
src/librustc/infer/canonical/mod.rs
浏览文件 @
87c7e570
...
...
@@ -40,7 +40,7 @@
use
syntax
::
source_map
::
Span
;
use
ty
::
fold
::
TypeFoldable
;
use
ty
::
subst
::
Kind
;
use
ty
::{
self
,
CanonicalVar
,
Lift
,
Region
,
Slice
,
TyCtxt
};
use
ty
::{
self
,
CanonicalVar
,
Lift
,
Region
,
List
,
TyCtxt
};
mod
canonicalizer
;
...
...
@@ -57,7 +57,7 @@ pub struct Canonical<'gcx, V> {
pub
value
:
V
,
}
pub
type
CanonicalVarInfos
<
'gcx
>
=
&
'gcx
Slice
<
CanonicalVarInfo
>
;
pub
type
CanonicalVarInfos
<
'gcx
>
=
&
'gcx
List
<
CanonicalVarInfo
>
;
impl
<
'gcx
>
UseSpecializedDecodable
for
CanonicalVarInfos
<
'gcx
>
{}
...
...
@@ -221,7 +221,7 @@ pub fn instantiate_canonical_with_fresh_inference_vars<T>(
fn
fresh_inference_vars_for_canonical_vars
(
&
self
,
span
:
Span
,
variables
:
&
Slice
<
CanonicalVarInfo
>
,
variables
:
&
List
<
CanonicalVarInfo
>
,
)
->
CanonicalVarValues
<
'tcx
>
{
let
var_values
:
IndexVec
<
CanonicalVar
,
Kind
<
'tcx
>>
=
variables
.iter
()
...
...
src/librustc/traits/mod.rs
浏览文件 @
87c7e570
...
...
@@ -24,7 +24,7 @@
use
middle
::
region
;
use
mir
::
interpret
::
ConstEvalErr
;
use
ty
::
subst
::
Substs
;
use
ty
::{
self
,
AdtKind
,
Slice
,
Ty
,
TyCtxt
,
GenericParamDefKind
,
ToPredicate
};
use
ty
::{
self
,
AdtKind
,
List
,
Ty
,
TyCtxt
,
GenericParamDefKind
,
ToPredicate
};
use
ty
::
error
::{
ExpectedFound
,
TypeError
};
use
ty
::
fold
::{
TypeFolder
,
TypeFoldable
,
TypeVisitor
};
use
infer
::{
InferCtxt
};
...
...
@@ -325,7 +325,7 @@ pub enum Goal<'tcx> {
CannotProve
,
}
pub
type
Goals
<
'tcx
>
=
&
'tcx
Slice
<
Goal
<
'tcx
>>
;
pub
type
Goals
<
'tcx
>
=
&
'tcx
List
<
Goal
<
'tcx
>>
;
impl
<
'tcx
>
DomainGoal
<
'tcx
>
{
pub
fn
into_goal
(
self
)
->
Goal
<
'tcx
>
{
...
...
@@ -357,7 +357,7 @@ pub enum Clause<'tcx> {
}
/// Multiple clauses.
pub
type
Clauses
<
'tcx
>
=
&
'tcx
Slice
<
Clause
<
'tcx
>>
;
pub
type
Clauses
<
'tcx
>
=
&
'tcx
List
<
Clause
<
'tcx
>>
;
/// A "program clause" has the form `D :- G1, ..., Gn`. It is saying
/// that the domain goal `D` is true if `G1...Gn` are provable. This
...
...
src/librustc/traits/structural_impls.rs
浏览文件 @
87c7e570
...
...
@@ -620,7 +620,7 @@ impl<'a, 'tcx> Lift<'tcx> for traits::Goal<'a> {
}
}
impl
<
'tcx
>
TypeFoldable
<
'tcx
>
for
&
'tcx
ty
::
Slice
<
traits
::
Goal
<
'tcx
>>
{
impl
<
'tcx
>
TypeFoldable
<
'tcx
>
for
&
'tcx
ty
::
List
<
traits
::
Goal
<
'tcx
>>
{
fn
super_fold_with
<
'gcx
:
'tcx
,
F
:
TypeFolder
<
'gcx
,
'tcx
>>
(
&
self
,
folder
:
&
mut
F
)
->
Self
{
let
v
=
self
.iter
()
.map
(|
t
|
t
.fold_with
(
folder
))
...
...
@@ -658,7 +658,7 @@ impl<'tcx> TypeFoldable<'tcx> for traits::Clause<'tcx> {
}
}
impl
<
'tcx
>
TypeFoldable
<
'tcx
>
for
&
'tcx
ty
::
Slice
<
traits
::
Clause
<
'tcx
>>
{
impl
<
'tcx
>
TypeFoldable
<
'tcx
>
for
&
'tcx
ty
::
List
<
traits
::
Clause
<
'tcx
>>
{
fn
super_fold_with
<
'gcx
:
'tcx
,
F
:
TypeFolder
<
'gcx
,
'tcx
>>
(
&
self
,
folder
:
&
mut
F
)
->
Self
{
let
v
=
self
.iter
()
.map
(|
t
|
t
.fold_with
(
folder
))
...
...
src/librustc/ty/codec.rs
浏览文件 @
87c7e570
...
...
@@ -212,7 +212,7 @@ pub fn decode_region<'a, 'tcx, D>(decoder: &mut D) -> Result<ty::Region<'tcx>, D
#[inline]
pub
fn
decode_ty_slice
<
'a
,
'tcx
,
D
>
(
decoder
:
&
mut
D
)
->
Result
<&
'tcx
ty
::
Slice
<
Ty
<
'tcx
>>
,
D
::
Error
>
->
Result
<&
'tcx
ty
::
List
<
Ty
<
'tcx
>>
,
D
::
Error
>
where
D
:
TyDecoder
<
'a
,
'tcx
>
,
'tcx
:
'a
,
{
...
...
@@ -232,7 +232,7 @@ pub fn decode_adt_def<'a, 'tcx, D>(decoder: &mut D)
#[inline]
pub
fn
decode_existential_predicate_slice
<
'a
,
'tcx
,
D
>
(
decoder
:
&
mut
D
)
->
Result
<&
'tcx
ty
::
Slice
<
ty
::
ExistentialPredicate
<
'tcx
>>
,
D
::
Error
>
->
Result
<&
'tcx
ty
::
List
<
ty
::
ExistentialPredicate
<
'tcx
>>
,
D
::
Error
>
where
D
:
TyDecoder
<
'a
,
'tcx
>
,
'tcx
:
'a
,
{
...
...
@@ -366,10 +366,10 @@ fn specialized_decode(&mut self) -> Result<ty::Region<'tcx>, Self::Error> {
}
}
impl
<
$
(
$typaram
),
*>
SpecializedDecoder
<&
'tcx
ty
::
Slice
<
ty
::
Ty
<
'tcx
>>>
impl
<
$
(
$typaram
),
*>
SpecializedDecoder
<&
'tcx
ty
::
List
<
ty
::
Ty
<
'tcx
>>>
for
$DecoderName
<
$
(
$typaram
),
*>
{
fn
specialized_decode
(
&
mut
self
)
->
Result
<&
'tcx
ty
::
Slice
<
ty
::
Ty
<
'tcx
>>
,
Self
::
Error
>
{
->
Result
<&
'tcx
ty
::
List
<
ty
::
Ty
<
'tcx
>>
,
Self
::
Error
>
{
decode_ty_slice
(
self
)
}
}
...
...
@@ -381,10 +381,10 @@ fn specialized_decode(&mut self) -> Result<&'tcx ty::AdtDef, Self::Error> {
}
}
impl
<
$
(
$typaram
),
*>
SpecializedDecoder
<&
'tcx
ty
::
Slice
<
ty
::
ExistentialPredicate
<
'tcx
>>>
impl
<
$
(
$typaram
),
*>
SpecializedDecoder
<&
'tcx
ty
::
List
<
ty
::
ExistentialPredicate
<
'tcx
>>>
for
$DecoderName
<
$
(
$typaram
),
*>
{
fn
specialized_decode
(
&
mut
self
)
->
Result
<&
'tcx
ty
::
Slice
<
ty
::
ExistentialPredicate
<
'tcx
>>
,
Self
::
Error
>
{
->
Result
<&
'tcx
ty
::
List
<
ty
::
ExistentialPredicate
<
'tcx
>>
,
Self
::
Error
>
{
decode_existential_predicate_slice
(
self
)
}
}
...
...
src/librustc/ty/context.rs
浏览文件 @
87c7e570
...
...
@@ -38,7 +38,7 @@
use
traits
;
use
traits
::{
Clause
,
Clauses
,
Goal
,
Goals
};
use
ty
::{
self
,
Ty
,
TypeAndMut
};
use
ty
::{
TyS
,
TypeVariants
,
Slice
};
use
ty
::{
TyS
,
TypeVariants
,
List
};
use
ty
::{
AdtKind
,
AdtDef
,
ClosureSubsts
,
GeneratorSubsts
,
Region
,
Const
};
use
ty
::{
PolyFnSig
,
InferTy
,
ParamTy
,
ProjectionTy
,
ExistentialPredicate
,
Predicate
};
use
ty
::
RegionKind
;
...
...
@@ -135,15 +135,15 @@ pub struct CtxtInterners<'tcx> {
/// Specifically use a speedy hash algorithm for these hash sets,
/// they're accessed quite often.
type_
:
InternedSet
<
'tcx
,
TyS
<
'tcx
>>
,
type_list
:
InternedSet
<
'tcx
,
Slice
<
Ty
<
'tcx
>>>
,
type_list
:
InternedSet
<
'tcx
,
List
<
Ty
<
'tcx
>>>
,
substs
:
InternedSet
<
'tcx
,
Substs
<
'tcx
>>
,
canonical_var_infos
:
InternedSet
<
'tcx
,
Slice
<
CanonicalVarInfo
>>
,
canonical_var_infos
:
InternedSet
<
'tcx
,
List
<
CanonicalVarInfo
>>
,
region
:
InternedSet
<
'tcx
,
RegionKind
>
,
existential_predicates
:
InternedSet
<
'tcx
,
Slice
<
ExistentialPredicate
<
'tcx
>>>
,
predicates
:
InternedSet
<
'tcx
,
Slice
<
Predicate
<
'tcx
>>>
,
existential_predicates
:
InternedSet
<
'tcx
,
List
<
ExistentialPredicate
<
'tcx
>>>
,
predicates
:
InternedSet
<
'tcx
,
List
<
Predicate
<
'tcx
>>>
,
const_
:
InternedSet
<
'tcx
,
Const
<
'tcx
>>
,
clauses
:
InternedSet
<
'tcx
,
Slice
<
Clause
<
'tcx
>>>
,
goals
:
InternedSet
<
'tcx
,
Slice
<
Goal
<
'tcx
>>>
,
clauses
:
InternedSet
<
'tcx
,
List
<
Clause
<
'tcx
>>>
,
goals
:
InternedSet
<
'tcx
,
List
<
Goal
<
'tcx
>>>
,
}
impl
<
'gcx
:
'tcx
,
'tcx
>
CtxtInterners
<
'tcx
>
{
...
...
@@ -1593,12 +1593,12 @@ fn lift_to_tcx<'b, 'gcx>(&self, tcx: TyCtxt<'b, 'gcx, 'tcx>) -> Option<&'tcx Goa
}
}
impl
<
'a
,
'tcx
>
Lift
<
'tcx
>
for
&
'a
Slice
<
Goal
<
'a
>>
{
type
Lifted
=
&
'tcx
Slice
<
Goal
<
'tcx
>>
;
impl
<
'a
,
'tcx
>
Lift
<
'tcx
>
for
&
'a
List
<
Goal
<
'a
>>
{
type
Lifted
=
&
'tcx
List
<
Goal
<
'tcx
>>
;
fn
lift_to_tcx
<
'b
,
'gcx
>
(
&
self
,
tcx
:
TyCtxt
<
'b
,
'gcx
,
'tcx
>
,
)
->
Option
<&
'tcx
Slice
<
Goal
<
'tcx
>>>
{
)
->
Option
<&
'tcx
List
<
Goal
<
'tcx
>>>
{
if
tcx
.interners.arena
.in_arena
(
*
self
as
*
const
_
)
{
return
Some
(
unsafe
{
mem
::
transmute
(
*
self
)
});
}
...
...
@@ -1611,12 +1611,12 @@ fn lift_to_tcx<'b, 'gcx>(
}
}
impl
<
'a
,
'tcx
>
Lift
<
'tcx
>
for
&
'a
Slice
<
Clause
<
'a
>>
{
type
Lifted
=
&
'tcx
Slice
<
Clause
<
'tcx
>>
;
impl
<
'a
,
'tcx
>
Lift
<
'tcx
>
for
&
'a
List
<
Clause
<
'a
>>
{
type
Lifted
=
&
'tcx
List
<
Clause
<
'tcx
>>
;
fn
lift_to_tcx
<
'b
,
'gcx
>
(
&
self
,
tcx
:
TyCtxt
<
'b
,
'gcx
,
'tcx
>
,
)
->
Option
<&
'tcx
Slice
<
Clause
<
'tcx
>>>
{
)
->
Option
<&
'tcx
List
<
Clause
<
'tcx
>>>
{
if
tcx
.interners.arena
.in_arena
(
*
self
as
*
const
_
)
{
return
Some
(
unsafe
{
mem
::
transmute
(
*
self
)
});
}
...
...
@@ -1648,7 +1648,7 @@ impl<'a, 'tcx> Lift<'tcx> for &'a Substs<'a> {
type
Lifted
=
&
'tcx
Substs
<
'tcx
>
;
fn
lift_to_tcx
<
'b
,
'gcx
>
(
&
self
,
tcx
:
TyCtxt
<
'b
,
'gcx
,
'tcx
>
)
->
Option
<&
'tcx
Substs
<
'tcx
>>
{
if
self
.len
()
==
0
{
return
Some
(
Slice
::
empty
());
return
Some
(
List
::
empty
());
}
if
tcx
.interners.arena
.in_arena
(
&
self
[
..
]
as
*
const
_
)
{
return
Some
(
unsafe
{
mem
::
transmute
(
*
self
)
});
...
...
@@ -1662,12 +1662,12 @@ fn lift_to_tcx<'b, 'gcx>(&self, tcx: TyCtxt<'b, 'gcx, 'tcx>) -> Option<&'tcx Sub
}
}
impl
<
'a
,
'tcx
>
Lift
<
'tcx
>
for
&
'a
Slice
<
Ty
<
'a
>>
{
type
Lifted
=
&
'tcx
Slice
<
Ty
<
'tcx
>>
;
impl
<
'a
,
'tcx
>
Lift
<
'tcx
>
for
&
'a
List
<
Ty
<
'a
>>
{
type
Lifted
=
&
'tcx
List
<
Ty
<
'tcx
>>
;
fn
lift_to_tcx
<
'b
,
'gcx
>
(
&
self
,
tcx
:
TyCtxt
<
'b
,
'gcx
,
'tcx
>
)
->
Option
<&
'tcx
Slice
<
Ty
<
'tcx
>>>
{
->
Option
<&
'tcx
List
<
Ty
<
'tcx
>>>
{
if
self
.len
()
==
0
{
return
Some
(
Slice
::
empty
());
return
Some
(
List
::
empty
());
}
if
tcx
.interners.arena
.in_arena
(
*
self
as
*
const
_
)
{
return
Some
(
unsafe
{
mem
::
transmute
(
*
self
)
});
...
...
@@ -1681,12 +1681,12 @@ fn lift_to_tcx<'b, 'gcx>(&self, tcx: TyCtxt<'b, 'gcx, 'tcx>)
}
}
impl
<
'a
,
'tcx
>
Lift
<
'tcx
>
for
&
'a
Slice
<
ExistentialPredicate
<
'a
>>
{
type
Lifted
=
&
'tcx
Slice
<
ExistentialPredicate
<
'tcx
>>
;
impl
<
'a
,
'tcx
>
Lift
<
'tcx
>
for
&
'a
List
<
ExistentialPredicate
<
'a
>>
{
type
Lifted
=
&
'tcx
List
<
ExistentialPredicate
<
'tcx
>>
;
fn
lift_to_tcx
<
'b
,
'gcx
>
(
&
self
,
tcx
:
TyCtxt
<
'b
,
'gcx
,
'tcx
>
)
->
Option
<&
'tcx
Slice
<
ExistentialPredicate
<
'tcx
>>>
{
->
Option
<&
'tcx
List
<
ExistentialPredicate
<
'tcx
>>>
{
if
self
.is_empty
()
{
return
Some
(
Slice
::
empty
());
return
Some
(
List
::
empty
());
}
if
tcx
.interners.arena
.in_arena
(
*
self
as
*
const
_
)
{
return
Some
(
unsafe
{
mem
::
transmute
(
*
self
)
});
...
...
@@ -1700,12 +1700,12 @@ fn lift_to_tcx<'b, 'gcx>(&self, tcx: TyCtxt<'b, 'gcx, 'tcx>)
}
}
impl
<
'a
,
'tcx
>
Lift
<
'tcx
>
for
&
'a
Slice
<
Predicate
<
'a
>>
{
type
Lifted
=
&
'tcx
Slice
<
Predicate
<
'tcx
>>
;
impl
<
'a
,
'tcx
>
Lift
<
'tcx
>
for
&
'a
List
<
Predicate
<
'a
>>
{
type
Lifted
=
&
'tcx
List
<
Predicate
<
'tcx
>>
;
fn
lift_to_tcx
<
'b
,
'gcx
>
(
&
self
,
tcx
:
TyCtxt
<
'b
,
'gcx
,
'tcx
>
)
->
Option
<&
'tcx
Slice
<
Predicate
<
'tcx
>>>
{
->
Option
<&
'tcx
List
<
Predicate
<
'tcx
>>>
{
if
self
.is_empty
()
{
return
Some
(
Slice
::
empty
());
return
Some
(
List
::
empty
());
}
if
tcx
.interners.arena
.in_arena
(
*
self
as
*
const
_
)
{
return
Some
(
unsafe
{
mem
::
transmute
(
*
self
)
});
...
...
@@ -1719,11 +1719,11 @@ fn lift_to_tcx<'b, 'gcx>(&self, tcx: TyCtxt<'b, 'gcx, 'tcx>)
}
}
impl
<
'a
,
'tcx
>
Lift
<
'tcx
>
for
&
'a
Slice
<
CanonicalVarInfo
>
{
type
Lifted
=
&
'tcx
Slice
<
CanonicalVarInfo
>
;
impl
<
'a
,
'tcx
>
Lift
<
'tcx
>
for
&
'a
List
<
CanonicalVarInfo
>
{
type
Lifted
=
&
'tcx
List
<
CanonicalVarInfo
>
;
fn
lift_to_tcx
<
'b
,
'gcx
>
(
&
self
,
tcx
:
TyCtxt
<
'b
,
'gcx
,
'tcx
>
)
->
Option
<
Self
::
Lifted
>
{
if
self
.len
()
==
0
{
return
Some
(
Slice
::
empty
());
return
Some
(
List
::
empty
());
}
if
tcx
.interners.arena
.in_arena
(
*
self
as
*
const
_
)
{
return
Some
(
unsafe
{
mem
::
transmute
(
*
self
)
});
...
...
@@ -2113,28 +2113,28 @@ fn borrow<'a>(&'a self) -> &'a TypeVariants<'lcx> {
}
}
// NB: An Interned<
Slice
<T>> compares and hashes as its elements.
impl
<
'tcx
,
T
:
PartialEq
>
PartialEq
for
Interned
<
'tcx
,
Slice
<
T
>>
{
fn
eq
(
&
self
,
other
:
&
Interned
<
'tcx
,
Slice
<
T
>>
)
->
bool
{
// NB: An Interned<
List
<T>> compares and hashes as its elements.
impl
<
'tcx
,
T
:
PartialEq
>
PartialEq
for
Interned
<
'tcx
,
List
<
T
>>
{
fn
eq
(
&
self
,
other
:
&
Interned
<
'tcx
,
List
<
T
>>
)
->
bool
{
self
.0
[
..
]
==
other
.0
[
..
]
}
}
impl
<
'tcx
,
T
:
Eq
>
Eq
for
Interned
<
'tcx
,
Slice
<
T
>>
{}
impl
<
'tcx
,
T
:
Eq
>
Eq
for
Interned
<
'tcx
,
List
<
T
>>
{}
impl
<
'tcx
,
T
:
Hash
>
Hash
for
Interned
<
'tcx
,
Slice
<
T
>>
{
impl
<
'tcx
,
T
:
Hash
>
Hash
for
Interned
<
'tcx
,
List
<
T
>>
{
fn
hash
<
H
:
Hasher
>
(
&
self
,
s
:
&
mut
H
)
{
self
.0
[
..
]
.hash
(
s
)
}
}
impl
<
'tcx
:
'lcx
,
'lcx
>
Borrow
<
[
Ty
<
'lcx
>
]
>
for
Interned
<
'tcx
,
Slice
<
Ty
<
'tcx
>>>
{
impl
<
'tcx
:
'lcx
,
'lcx
>
Borrow
<
[
Ty
<
'lcx
>
]
>
for
Interned
<
'tcx
,
List
<
Ty
<
'tcx
>>>
{
fn
borrow
<
'a
>
(
&
'a
self
)
->
&
'a
[
Ty
<
'lcx
>
]
{
&
self
.0
[
..
]
}
}
impl
<
'tcx
:
'lcx
,
'lcx
>
Borrow
<
[
CanonicalVarInfo
]
>
for
Interned
<
'tcx
,
Slice
<
CanonicalVarInfo
>>
{
impl
<
'tcx
:
'lcx
,
'lcx
>
Borrow
<
[
CanonicalVarInfo
]
>
for
Interned
<
'tcx
,
List
<
CanonicalVarInfo
>>
{
fn
borrow
<
'a
>
(
&
'a
self
)
->
&
'a
[
CanonicalVarInfo
]
{
&
self
.0
[
..
]
}
...
...
@@ -2153,14 +2153,14 @@ fn borrow<'a>(&'a self) -> &'a RegionKind {
}
impl
<
'tcx
:
'lcx
,
'lcx
>
Borrow
<
[
ExistentialPredicate
<
'lcx
>
]
>
for
Interned
<
'tcx
,
Slice
<
ExistentialPredicate
<
'tcx
>>>
{
for
Interned
<
'tcx
,
List
<
ExistentialPredicate
<
'tcx
>>>
{
fn
borrow
<
'a
>
(
&
'a
self
)
->
&
'a
[
ExistentialPredicate
<
'lcx
>
]
{
&
self
.0
[
..
]
}
}
impl
<
'tcx
:
'lcx
,
'lcx
>
Borrow
<
[
Predicate
<
'lcx
>
]
>
for
Interned
<
'tcx
,
Slice
<
Predicate
<
'tcx
>>>
{
for
Interned
<
'tcx
,
List
<
Predicate
<
'tcx
>>>
{
fn
borrow
<
'a
>
(
&
'a
self
)
->
&
'a
[
Predicate
<
'lcx
>
]
{
&
self
.0
[
..
]
}
...
...
@@ -2173,14 +2173,14 @@ fn borrow<'a>(&'a self) -> &'a Const<'lcx> {
}
impl
<
'tcx
:
'lcx
,
'lcx
>
Borrow
<
[
Clause
<
'lcx
>
]
>
for
Interned
<
'tcx
,
Slice
<
Clause
<
'tcx
>>>
{
for
Interned
<
'tcx
,
List
<
Clause
<
'tcx
>>>
{
fn
borrow
<
'a
>
(
&
'a
self
)
->
&
'a
[
Clause
<
'lcx
>
]
{
&
self
.0
[
..
]
}
}
impl
<
'tcx
:
'lcx
,
'lcx
>
Borrow
<
[
Goal
<
'lcx
>
]
>
for
Interned
<
'tcx
,
Slice
<
Goal
<
'tcx
>>>
{
for
Interned
<
'tcx
,
List
<
Goal
<
'tcx
>>>
{
fn
borrow
<
'a
>
(
&
'a
self
)
->
&
'a
[
Goal
<
'lcx
>
]
{
&
self
.0
[
..
]
}
...
...
@@ -2274,9 +2274,9 @@ pub fn keep_local<'tcx, T: ty::TypeFoldable<'tcx>>(x: &T) -> bool {
(
$
(
$field:ident
:
$method:ident
(
$ty:ident
)),
+
)
=>
(
$
(
intern_method!
(
'tcx
,
$field
:
$method
(
&
[
$ty
<
'tcx
>
],
|
a
,
v
|
Slice
::
from_arena
(
a
,
v
),
|
a
,
v
|
List
::
from_arena
(
a
,
v
),
Deref
::
deref
,
|
xs
:
&
[
$ty
]|
xs
.iter
()
.any
(
keep_local
))
->
Slice
<
$ty
<
'tcx
>>
);)
+
|
xs
:
&
[
$ty
]|
xs
.iter
()
.any
(
keep_local
))
->
List
<
$ty
<
'tcx
>>
);)
+
)
}
...
...
@@ -2298,10 +2298,10 @@ pub fn keep_local<'tcx, T: ty::TypeFoldable<'tcx>>(x: &T) -> bool {
'tcx
,
canonical_var_infos
:
_
intern_canonical_var_infos
(
&
[
CanonicalVarInfo
],
|
a
,
v
|
Slice
::
from_arena
(
a
,
v
),
|
a
,
v
|
List
::
from_arena
(
a
,
v
),
Deref
::
deref
,
|
_
xs
:
&
[
CanonicalVarInfo
]|
->
bool
{
false
}
)
->
Slice
<
CanonicalVarInfo
>
)
->
List
<
CanonicalVarInfo
>
}
impl
<
'a
,
'gcx
,
'tcx
>
TyCtxt
<
'a
,
'gcx
,
'tcx
>
{
...
...
@@ -2480,7 +2480,7 @@ pub fn mk_fn_ptr(self, fty: PolyFnSig<'tcx>) -> Ty<'tcx> {
pub
fn
mk_dynamic
(
self
,
obj
:
ty
::
Binder
<&
'tcx
Slice
<
ExistentialPredicate
<
'tcx
>>>
,
obj
:
ty
::
Binder
<&
'tcx
List
<
ExistentialPredicate
<
'tcx
>>>
,
reg
:
ty
::
Region
<
'tcx
>
)
->
Ty
<
'tcx
>
{
self
.mk_ty
(
TyDynamic
(
obj
,
reg
))
...
...
@@ -2509,7 +2509,7 @@ pub fn mk_generator(self,
self
.mk_ty
(
TyGenerator
(
id
,
generator_substs
,
movability
))
}
pub
fn
mk_generator_witness
(
self
,
types
:
ty
::
Binder
<&
'tcx
Slice
<
Ty
<
'tcx
>>>
)
->
Ty
<
'tcx
>
{
pub
fn
mk_generator_witness
(
self
,
types
:
ty
::
Binder
<&
'tcx
List
<
Ty
<
'tcx
>>>
)
->
Ty
<
'tcx
>
{
self
.mk_ty
(
TyGeneratorWitness
(
types
))
}
...
...
@@ -2553,36 +2553,36 @@ pub fn mk_anon(self, def_id: DefId, substs: &'tcx Substs<'tcx>) -> Ty<'tcx> {
}
pub
fn
intern_existential_predicates
(
self
,
eps
:
&
[
ExistentialPredicate
<
'tcx
>
])
->
&
'tcx
Slice
<
ExistentialPredicate
<
'tcx
>>
{
->
&
'tcx
List
<
ExistentialPredicate
<
'tcx
>>
{
assert
!
(
!
eps
.is_empty
());
assert
!
(
eps
.windows
(
2
)
.all
(|
w
|
w
[
0
]
.stable_cmp
(
self
,
&
w
[
1
])
!=
Ordering
::
Greater
));
self
._intern_existential_predicates
(
eps
)
}
pub
fn
intern_predicates
(
self
,
preds
:
&
[
Predicate
<
'tcx
>
])
->
&
'tcx
Slice
<
Predicate
<
'tcx
>>
{
->
&
'tcx
List
<
Predicate
<
'tcx
>>
{
// FIXME consider asking the input slice to be sorted to avoid
// re-interning permutations, in which case that would be asserted
// here.
if
preds
.len
()
==
0
{
// The macro-generated method below asserts we don't intern an empty slice.
Slice
::
empty
()
List
::
empty
()
}
else
{
self
._intern_predicates
(
preds
)
}
}
pub
fn
intern_type_list
(
self
,
ts
:
&
[
Ty
<
'tcx
>
])
->
&
'tcx
Slice
<
Ty
<
'tcx
>>
{
pub
fn
intern_type_list
(
self
,
ts
:
&
[
Ty
<
'tcx
>
])
->
&
'tcx
List
<
Ty
<
'tcx
>>
{
if
ts
.len
()
==
0
{
Slice
::
empty
()
List
::
empty
()
}
else
{
self
._intern_type_list
(
ts
)
}
}
pub
fn
intern_substs
(
self
,
ts
:
&
[
Kind
<
'tcx
>
])
->
&
'tcx
Slice
<
Kind
<
'tcx
>>
{
pub
fn
intern_substs
(
self
,
ts
:
&
[
Kind
<
'tcx
>
])
->
&
'tcx
List
<
Kind
<
'tcx
>>
{
if
ts
.len
()
==
0
{
Slice
::
empty
()
List
::
empty
()
}
else
{
self
._intern_substs
(
ts
)
}
...
...
@@ -2590,7 +2590,7 @@ pub fn intern_substs(self, ts: &[Kind<'tcx>]) -> &'tcx Slice<Kind<'tcx>> {
pub
fn
intern_canonical_var_infos
(
self
,
ts
:
&
[
CanonicalVarInfo
])
->
CanonicalVarInfos
<
'gcx
>
{
if
ts
.len
()
==
0
{
Slice
::
empty
()
List
::
empty
()
}
else
{
self
.global_tcx
()
._intern_canonical_var_infos
(
ts
)
}
...
...
@@ -2598,7 +2598,7 @@ pub fn intern_canonical_var_infos(self, ts: &[CanonicalVarInfo]) -> CanonicalVar
pub
fn
intern_clauses
(
self
,
ts
:
&
[
Clause
<
'tcx
>
])
->
Clauses
<
'tcx
>
{
if
ts
.len
()
==
0
{
Slice
::
empty
()
List
::
empty
()
}
else
{
self
._intern_clauses
(
ts
)
}
...
...
@@ -2606,7 +2606,7 @@ pub fn intern_clauses(self, ts: &[Clause<'tcx>]) -> Clauses<'tcx> {
pub
fn
intern_goals
(
self
,
ts
:
&
[
Goal
<
'tcx
>
])
->
Goals
<
'tcx
>
{
if
ts
.len
()
==
0
{
Slice
::
empty
()
List
::
empty
()
}
else
{
self
._intern_goals
(
ts
)
}
...
...
@@ -2629,24 +2629,24 @@ pub fn mk_fn_sig<I>(self,
}
pub
fn
mk_existential_predicates
<
I
:
InternAs
<
[
ExistentialPredicate
<
'tcx
>
],
&
'tcx
Slice
<
ExistentialPredicate
<
'tcx
>>>>
(
self
,
iter
:
I
)
&
'tcx
List
<
ExistentialPredicate
<
'tcx
>>>>
(
self
,
iter
:
I
)
->
I
::
Output
{
iter
.intern_with
(|
xs
|
self
.intern_existential_predicates
(
xs
))
}
pub
fn
mk_predicates
<
I
:
InternAs
<
[
Predicate
<
'tcx
>
],
&
'tcx
Slice
<
Predicate
<
'tcx
>>>>
(
self
,
iter
:
I
)
&
'tcx
List
<
Predicate
<
'tcx
>>>>
(
self
,
iter
:
I
)
->
I
::
Output
{
iter
.intern_with
(|
xs
|
self
.intern_predicates
(
xs
))
}
pub
fn
mk_type_list
<
I
:
InternAs
<
[
Ty
<
'tcx
>
],
&
'tcx
Slice
<
Ty
<
'tcx
>>>>
(
self
,
iter
:
I
)
->
I
::
Output
{
&
'tcx
List
<
Ty
<
'tcx
>>>>
(
self
,
iter
:
I
)
->
I
::
Output
{
iter
.intern_with
(|
xs
|
self
.intern_type_list
(
xs
))
}
pub
fn
mk_substs
<
I
:
InternAs
<
[
Kind
<
'tcx
>
],
&
'tcx
Slice
<
Kind
<
'tcx
>>>>
(
self
,
iter
:
I
)
->
I
::
Output
{
&
'tcx
List
<
Kind
<
'tcx
>>>>
(
self
,
iter
:
I
)
->
I
::
Output
{
iter
.intern_with
(|
xs
|
self
.intern_substs
(
xs
))
}
...
...
src/librustc/ty/error.rs
浏览文件 @
87c7e570
...
...
@@ -51,7 +51,7 @@ pub enum TypeError<'tcx> {
CyclicTy
(
Ty
<
'tcx
>
),
ProjectionMismatched
(
ExpectedFound
<
DefId
>
),
ProjectionBoundsLength
(
ExpectedFound
<
usize
>
),
ExistentialMismatch
(
ExpectedFound
<&
'tcx
ty
::
Slice
<
ty
::
ExistentialPredicate
<
'tcx
>>>
),
ExistentialMismatch
(
ExpectedFound
<&
'tcx
ty
::
List
<
ty
::
ExistentialPredicate
<
'tcx
>>>
),
OldStyleLUB
(
Box
<
TypeError
<
'tcx
>>
),
}
...
...
src/librustc/ty/mod.rs
浏览文件 @
87c7e570
...
...
@@ -596,8 +596,8 @@ impl<'tcx> serialize::UseSpecializedDecodable for Ty<'tcx> {}
pub
type
CanonicalTy
<
'gcx
>
=
Canonical
<
'gcx
,
Ty
<
'gcx
>>
;
extern
{
/// A dummy type used to force
Slice
to by unsized without requiring fat pointers
type
Opaque
Slice
Contents
;
/// A dummy type used to force
List
to by unsized without requiring fat pointers
type
Opaque
List
Contents
;
}
/// A wrapper for slices with the additional invariant
...
...
@@ -605,18 +605,19 @@ impl<'tcx> serialize::UseSpecializedDecodable for Ty<'tcx> {}
/// the same contents can exist in the same context.
/// This means we can use pointer for both
/// equality comparisons and hashing.
/// Note: `Slice` was already taken by the `Ty`.
#[repr(C)]
pub
struct
Slice
<
T
>
{
pub
struct
List
<
T
>
{
len
:
usize
,
data
:
[
T
;
0
],
opaque
:
Opaque
Slice
Contents
,
opaque
:
Opaque
List
Contents
,
}
unsafe
impl
<
T
:
Sync
>
Sync
for
Slice
<
T
>
{}
unsafe
impl
<
T
:
Sync
>
Sync
for
List
<
T
>
{}
impl
<
T
:
Copy
>
Slice
<
T
>
{
impl
<
T
:
Copy
>
List
<
T
>
{
#[inline]
fn
from_arena
<
'tcx
>
(
arena
:
&
'tcx
SyncDroplessArena
,
slice
:
&
[
T
])
->
&
'tcx
Slice
<
T
>
{
fn
from_arena
<
'tcx
>
(
arena
:
&
'tcx
SyncDroplessArena
,
slice
:
&
[
T
])
->
&
'tcx
List
<
T
>
{
assert
!
(
!
mem
::
needs_drop
::
<
T
>
());
assert
!
(
mem
::
size_of
::
<
T
>
()
!=
0
);
assert
!
(
slice
.len
()
!=
0
);
...
...
@@ -633,7 +634,7 @@ fn from_arena<'tcx>(arena: &'tcx SyncDroplessArena, slice: &[T]) -> &'tcx Slice<
size
,
cmp
::
max
(
mem
::
align_of
::
<
T
>
(),
mem
::
align_of
::
<
usize
>
()));
unsafe
{
let
result
=
&
mut
*
(
mem
.as_mut_ptr
()
as
*
mut
Slice
<
T
>
);
let
result
=
&
mut
*
(
mem
.as_mut_ptr
()
as
*
mut
List
<
T
>
);
// Write the length
result
.len
=
slice
.len
();
...
...
@@ -646,51 +647,51 @@ fn from_arena<'tcx>(arena: &'tcx SyncDroplessArena, slice: &[T]) -> &'tcx Slice<
}
}
impl
<
T
:
fmt
::
Debug
>
fmt
::
Debug
for
Slice
<
T
>
{
impl
<
T
:
fmt
::
Debug
>
fmt
::
Debug
for
List
<
T
>
{
fn
fmt
(
&
self
,
f
:
&
mut
fmt
::
Formatter
)
->
fmt
::
Result
{
(
**
self
)
.fmt
(
f
)
}
}
impl
<
T
:
Encodable
>
Encodable
for
Slice
<
T
>
{
impl
<
T
:
Encodable
>
Encodable
for
List
<
T
>
{
#[inline]
fn
encode
<
S
:
Encoder
>
(
&
self
,
s
:
&
mut
S
)
->
Result
<
(),
S
::
Error
>
{
(
**
self
)
.encode
(
s
)
}
}
impl
<
T
>
Ord
for
Slice
<
T
>
where
T
:
Ord
{
fn
cmp
(
&
self
,
other
:
&
Slice
<
T
>
)
->
Ordering
{
impl
<
T
>
Ord
for
List
<
T
>
where
T
:
Ord
{
fn
cmp
(
&
self
,
other
:
&
List
<
T
>
)
->
Ordering
{
if
self
==
other
{
Ordering
::
Equal
}
else
{
<
[
T
]
as
Ord
>
::
cmp
(
&**
self
,
&**
other
)
}
}
}
impl
<
T
>
PartialOrd
for
Slice
<
T
>
where
T
:
PartialOrd
{
fn
partial_cmp
(
&
self
,
other
:
&
Slice
<
T
>
)
->
Option
<
Ordering
>
{
impl
<
T
>
PartialOrd
for
List
<
T
>
where
T
:
PartialOrd
{
fn
partial_cmp
(
&
self
,
other
:
&
List
<
T
>
)
->
Option
<
Ordering
>
{
if
self
==
other
{
Some
(
Ordering
::
Equal
)
}
else
{
<
[
T
]
as
PartialOrd
>
::
partial_cmp
(
&**
self
,
&**
other
)
}
}
}
impl
<
T
:
PartialEq
>
PartialEq
for
Slice
<
T
>
{
impl
<
T
:
PartialEq
>
PartialEq
for
List
<
T
>
{
#[inline]
fn
eq
(
&
self
,
other
:
&
Slice
<
T
>
)
->
bool
{
fn
eq
(
&
self
,
other
:
&
List
<
T
>
)
->
bool
{
ptr
::
eq
(
self
,
other
)
}
}
impl
<
T
:
Eq
>
Eq
for
Slice
<
T
>
{}
impl
<
T
:
Eq
>
Eq
for
List
<
T
>
{}
impl
<
T
>
Hash
for
Slice
<
T
>
{
impl
<
T
>
Hash
for
List
<
T
>
{
#[inline]
fn
hash
<
H
:
Hasher
>
(
&
self
,
s
:
&
mut
H
)
{
(
self
as
*
const
Slice
<
T
>
)
.hash
(
s
)
(
self
as
*
const
List
<
T
>
)
.hash
(
s
)
}
}
impl
<
T
>
Deref
for
Slice
<
T
>
{
impl
<
T
>
Deref
for
List
<
T
>
{
type
Target
=
[
T
];
#[inline(always)]
fn
deref
(
&
self
)
->
&
[
T
]
{
...
...
@@ -700,7 +701,7 @@ fn deref(&self) -> &[T] {
}
}
impl
<
'a
,
T
>
IntoIterator
for
&
'a
Slice
<
T
>
{
impl
<
'a
,
T
>
IntoIterator
for
&
'a
List
<
T
>
{
type
Item
=
&
'a
T
;
type
IntoIter
=
<&
'a
[
T
]
as
IntoIterator
>
::
IntoIter
;
#[inline(always)]
...
...
@@ -709,17 +710,17 @@ fn into_iter(self) -> Self::IntoIter {
}
}
impl
<
'tcx
>
serialize
::
UseSpecializedDecodable
for
&
'tcx
Slice
<
Ty
<
'tcx
>>
{}
impl
<
'tcx
>
serialize
::
UseSpecializedDecodable
for
&
'tcx
List
<
Ty
<
'tcx
>>
{}
impl
<
T
>
Slice
<
T
>
{
impl
<
T
>
List
<
T
>
{
#[inline(always)]
pub
fn
empty
<
'a
>
()
->
&
'a
Slice
<
T
>
{
pub
fn
empty
<
'a
>
()
->
&
'a
List
<
T
>
{
#[repr(align(
64
),
C)]
struct
EmptySlice
([
u8
;
64
]);
static
EMPTY_SLICE
:
EmptySlice
=
EmptySlice
([
0
;
64
]);
assert
!
(
mem
::
align_of
::
<
T
>
()
<=
64
);
unsafe
{
&*
(
&
EMPTY_SLICE
as
*
const
_
as
*
const
Slice
<
T
>
)
&*
(
&
EMPTY_SLICE
as
*
const
_
as
*
const
List
<
T
>
)
}
}
}
...
...
@@ -1556,7 +1557,7 @@ pub struct ParamEnv<'tcx> {
/// Obligations that the caller must satisfy. This is basically
/// the set of bounds on the in-scope type parameters, translated
/// into Obligations, and elaborated and normalized.
pub
caller_bounds
:
&
'tcx
Slice
<
ty
::
Predicate
<
'tcx
>>
,
pub
caller_bounds
:
&
'tcx
List
<
ty
::
Predicate
<
'tcx
>>
,
/// Typically, this is `Reveal::UserFacing`, but during codegen we
/// want `Reveal::All` -- note that this is always paired with an
...
...
@@ -1570,7 +1571,7 @@ impl<'tcx> ParamEnv<'tcx> {
/// Trait`) are left hidden, so this is suitable for ordinary
/// type-checking.
pub
fn
empty
()
->
Self
{
Self
::
new
(
ty
::
Slice
::
empty
(),
Reveal
::
UserFacing
)
Self
::
new
(
List
::
empty
(),
Reveal
::
UserFacing
)
}
/// Construct a trait environment with no where clauses in scope
...
...
@@ -1581,11 +1582,11 @@ pub fn empty() -> Self {
/// NB. If you want to have predicates in scope, use `ParamEnv::new`,
/// or invoke `param_env.with_reveal_all()`.
pub
fn
reveal_all
()
->
Self
{
Self
::
new
(
ty
::
Slice
::
empty
(),
Reveal
::
All
)
Self
::
new
(
List
::
empty
(),
Reveal
::
All
)
}
/// Construct a trait environment with the given set of predicates.
pub
fn
new
(
caller_bounds
:
&
'tcx
ty
::
Slice
<
ty
::
Predicate
<
'tcx
>>
,
pub
fn
new
(
caller_bounds
:
&
'tcx
List
<
ty
::
Predicate
<
'tcx
>>
,
reveal
:
Reveal
)
->
Self
{
ty
::
ParamEnv
{
caller_bounds
,
reveal
}
...
...
@@ -1603,7 +1604,7 @@ pub fn with_reveal_all(self) -> Self {
/// Returns this same environment but with no caller bounds.
pub
fn
without_caller_bounds
(
self
)
->
Self
{
ty
::
ParamEnv
{
caller_bounds
:
ty
::
Slice
::
empty
(),
..
self
}
ty
::
ParamEnv
{
caller_bounds
:
List
::
empty
(),
..
self
}
}
/// Creates a suitable environment in which to perform trait
...
...
src/librustc/ty/relate.rs
浏览文件 @
87c7e570
...
...
@@ -316,7 +316,7 @@ fn relate<'a, 'gcx, R>(relation: &mut R,
}
#[derive(Debug,
Clone)]
struct
GeneratorWitness
<
'tcx
>
(
&
'tcx
ty
::
Slice
<
Ty
<
'tcx
>>
);
struct
GeneratorWitness
<
'tcx
>
(
&
'tcx
ty
::
List
<
Ty
<
'tcx
>>
);
TupleStructTypeFoldableImpl!
{
impl
<
'tcx
>
TypeFoldable
<
'tcx
>
for
GeneratorWitness
<
'tcx
>
{
...
...
@@ -578,7 +578,7 @@ pub fn super_relate_tys<'a, 'gcx, 'tcx, R>(relation: &mut R,
}
}
impl
<
'tcx
>
Relate
<
'tcx
>
for
&
'tcx
ty
::
Slice
<
ty
::
ExistentialPredicate
<
'tcx
>>
{
impl
<
'tcx
>
Relate
<
'tcx
>
for
&
'tcx
ty
::
List
<
ty
::
ExistentialPredicate
<
'tcx
>>
{
fn
relate
<
'a
,
'gcx
,
R
>
(
relation
:
&
mut
R
,
a
:
&
Self
,
b
:
&
Self
)
...
...
src/librustc/ty/structural_impls.rs
浏览文件 @
87c7e570
...
...
@@ -735,7 +735,7 @@ fn visit_with<V: TypeVisitor<'tcx>>(&self, visitor: &mut V) -> bool {
impl
<
'tcx
>
TypeFoldable
<
'tcx
>
for
ty
::
ParamEnv
<
'tcx
>
{
reveal
,
caller_bounds
}
}
impl
<
'tcx
>
TypeFoldable
<
'tcx
>
for
&
'tcx
ty
::
Slice
<
ty
::
ExistentialPredicate
<
'tcx
>>
{
impl
<
'tcx
>
TypeFoldable
<
'tcx
>
for
&
'tcx
ty
::
List
<
ty
::
ExistentialPredicate
<
'tcx
>>
{
fn
super_fold_with
<
'gcx
:
'tcx
,
F
:
TypeFolder
<
'gcx
,
'tcx
>>
(
&
self
,
folder
:
&
mut
F
)
->
Self
{
let
v
=
self
.iter
()
.map
(|
p
|
p
.fold_with
(
folder
))
.collect
::
<
AccumulateVec
<
[
_
;
8
]
>>
();
folder
.tcx
()
.intern_existential_predicates
(
&
v
)
...
...
@@ -754,7 +754,7 @@ impl<'tcx> TypeFoldable<'tcx> for ty::ExistentialPredicate<'tcx> {
}
}
impl
<
'tcx
>
TypeFoldable
<
'tcx
>
for
&
'tcx
ty
::
Slice
<
Ty
<
'tcx
>>
{
impl
<
'tcx
>
TypeFoldable
<
'tcx
>
for
&
'tcx
ty
::
List
<
Ty
<
'tcx
>>
{
fn
super_fold_with
<
'gcx
:
'tcx
,
F
:
TypeFolder
<
'gcx
,
'tcx
>>
(
&
self
,
folder
:
&
mut
F
)
->
Self
{
let
v
=
self
.iter
()
.map
(|
t
|
t
.fold_with
(
folder
))
.collect
::
<
AccumulateVec
<
[
_
;
8
]
>>
();
folder
.tcx
()
.intern_type_list
(
&
v
)
...
...
@@ -1010,7 +1010,7 @@ impl<'tcx> TypeFoldable<'tcx> for ty::GenericPredicates<'tcx> {
}
}
impl
<
'tcx
>
TypeFoldable
<
'tcx
>
for
&
'tcx
ty
::
Slice
<
ty
::
Predicate
<
'tcx
>>
{
impl
<
'tcx
>
TypeFoldable
<
'tcx
>
for
&
'tcx
ty
::
List
<
ty
::
Predicate
<
'tcx
>>
{
fn
super_fold_with
<
'gcx
:
'tcx
,
F
:
TypeFolder
<
'gcx
,
'tcx
>>
(
&
self
,
folder
:
&
mut
F
)
->
Self
{
let
v
=
self
.iter
()
.map
(|
p
|
p
.fold_with
(
folder
))
.collect
::
<
AccumulateVec
<
[
_
;
8
]
>>
();
folder
.tcx
()
.intern_predicates
(
&
v
)
...
...
src/librustc/ty/sty.rs
浏览文件 @
87c7e570
...
...
@@ -18,7 +18,7 @@
use
rustc_data_structures
::
indexed_vec
::
Idx
;
use
ty
::
subst
::{
Substs
,
Subst
,
Kind
,
UnpackedKind
};
use
ty
::{
self
,
AdtDef
,
TypeFlags
,
Ty
,
TyCtxt
,
TypeFoldable
};
use
ty
::{
Slice
,
TyS
,
ParamEnvAnd
,
ParamEnv
};
use
ty
::{
List
,
TyS
,
ParamEnvAnd
,
ParamEnv
};
use
util
::
captures
::
Captures
;
use
mir
::
interpret
::{
Scalar
,
Pointer
};
...
...
@@ -133,7 +133,7 @@ pub enum TypeVariants<'tcx> {
TyFnPtr
(
PolyFnSig
<
'tcx
>
),
/// A trait, defined with `trait`.
TyDynamic
(
Binder
<&
'tcx
Slice
<
ExistentialPredicate
<
'tcx
>>>
,
ty
::
Region
<
'tcx
>
),
TyDynamic
(
Binder
<&
'tcx
List
<
ExistentialPredicate
<
'tcx
>>>
,
ty
::
Region
<
'tcx
>
),
/// The anonymous type of a closure. Used to represent the type of
/// `|a| a`.
...
...
@@ -145,13 +145,13 @@ pub enum TypeVariants<'tcx> {
/// A type representin the types stored inside a generator.
/// This should only appear in GeneratorInteriors.
TyGeneratorWitness
(
Binder
<&
'tcx
Slice
<
Ty
<
'tcx
>>>
),
TyGeneratorWitness
(
Binder
<&
'tcx
List
<
Ty
<
'tcx
>>>
),
/// The never type `!`
TyNever
,
/// A tuple type. For example, `(i32, bool)`.
TyTuple
(
&
'tcx
Slice
<
Ty
<
'tcx
>>
),
TyTuple
(
&
'tcx
List
<
Ty
<
'tcx
>>
),
/// The projection of an associated type. For example,
/// `<T as Trait<..>>::N`.
...
...
@@ -536,9 +536,9 @@ pub fn with_self_ty(&self, tcx: TyCtxt<'a, 'gcx, 'tcx>, self_ty: Ty<'tcx>)
}
}
impl
<
'tcx
>
serialize
::
UseSpecializedDecodable
for
&
'tcx
Slice
<
ExistentialPredicate
<
'tcx
>>
{}
impl
<
'tcx
>
serialize
::
UseSpecializedDecodable
for
&
'tcx
List
<
ExistentialPredicate
<
'tcx
>>
{}
impl
<
'tcx
>
Slice
<
ExistentialPredicate
<
'tcx
>>
{
impl
<
'tcx
>
List
<
ExistentialPredicate
<
'tcx
>>
{
pub
fn
principal
(
&
self
)
->
Option
<
ExistentialTraitRef
<
'tcx
>>
{
match
self
.get
(
0
)
{
Some
(
&
ExistentialPredicate
::
Trait
(
tr
))
=>
Some
(
tr
),
...
...
@@ -568,7 +568,7 @@ pub fn auto_traits<'a>(&'a self) -> impl Iterator<Item=DefId> + 'a {
}
}
impl
<
'tcx
>
Binder
<&
'tcx
Slice
<
ExistentialPredicate
<
'tcx
>>>
{
impl
<
'tcx
>
Binder
<&
'tcx
List
<
ExistentialPredicate
<
'tcx
>>>
{
pub
fn
principal
(
&
self
)
->
Option
<
PolyExistentialTraitRef
<
'tcx
>>
{
self
.skip_binder
()
.principal
()
.map
(
Binder
::
bind
)
}
...
...
@@ -918,7 +918,7 @@ pub fn return_ty(&self) -> ty::Binder<Ty<'tcx>> {
/// - `variadic` indicates whether this is a variadic function. (only true for foreign fns)
#[derive(Copy,
Clone,
PartialEq,
Eq,
PartialOrd,
Ord,
Hash,
RustcEncodable,
RustcDecodable)]
pub
struct
FnSig
<
'tcx
>
{
pub
inputs_and_output
:
&
'tcx
Slice
<
Ty
<
'tcx
>>
,
pub
inputs_and_output
:
&
'tcx
List
<
Ty
<
'tcx
>>
,
pub
variadic
:
bool
,
pub
unsafety
:
hir
::
Unsafety
,
pub
abi
:
abi
::
Abi
,
...
...
@@ -943,7 +943,7 @@ pub fn inputs(&self) -> Binder<&'tcx [Ty<'tcx>]> {
pub
fn
input
(
&
self
,
index
:
usize
)
->
ty
::
Binder
<
Ty
<
'tcx
>>
{
self
.map_bound_ref
(|
fn_sig
|
fn_sig
.inputs
()[
index
])
}
pub
fn
inputs_and_output
(
&
self
)
->
ty
::
Binder
<&
'tcx
Slice
<
Ty
<
'tcx
>>>
{
pub
fn
inputs_and_output
(
&
self
)
->
ty
::
Binder
<&
'tcx
List
<
Ty
<
'tcx
>>>
{
self
.map_bound_ref
(|
fn_sig
|
fn_sig
.inputs_and_output
)
}
pub
fn
output
(
&
self
)
->
ty
::
Binder
<
Ty
<
'tcx
>>
{
...
...
src/librustc/ty/subst.rs
浏览文件 @
87c7e570
...
...
@@ -11,7 +11,7 @@
// Type substitutions.
use
hir
::
def_id
::
DefId
;
use
ty
::{
self
,
Lift
,
Slice
,
Ty
,
TyCtxt
};
use
ty
::{
self
,
Lift
,
List
,
Ty
,
TyCtxt
};
use
ty
::
fold
::{
TypeFoldable
,
TypeFolder
,
TypeVisitor
};
use
serialize
::{
self
,
Encodable
,
Encoder
,
Decodable
,
Decoder
};
...
...
@@ -177,7 +177,7 @@ fn decode<D: Decoder>(d: &mut D) -> Result<Kind<'tcx>, D::Error> {
}
/// A substitution mapping generic parameters to new values.
pub
type
Substs
<
'tcx
>
=
Slice
<
Kind
<
'tcx
>>
;
pub
type
Substs
<
'tcx
>
=
List
<
Kind
<
'tcx
>>
;
impl
<
'a
,
'gcx
,
'tcx
>
Substs
<
'tcx
>
{
/// Creates a Substs that maps each generic parameter to itself.
...
...
src/librustc/ty/wf.rs
浏览文件 @
87c7e570
...
...
@@ -453,7 +453,7 @@ fn nominal_obligations(&mut self,
}
fn
from_object_ty
(
&
mut
self
,
ty
:
Ty
<
'tcx
>
,
data
:
ty
::
Binder
<&
'tcx
ty
::
Slice
<
ty
::
ExistentialPredicate
<
'tcx
>>>
,
data
:
ty
::
Binder
<&
'tcx
ty
::
List
<
ty
::
ExistentialPredicate
<
'tcx
>>>
,
region
:
ty
::
Region
<
'tcx
>
)
{
// Imagine a type like this:
//
...
...
@@ -513,7 +513,7 @@ fn from_object_ty(&mut self, ty: Ty<'tcx>,
/// `ty::required_region_bounds`, see that for more information.
pub
fn
object_region_bounds
<
'a
,
'gcx
,
'tcx
>
(
tcx
:
TyCtxt
<
'a
,
'gcx
,
'tcx
>
,
existential_predicates
:
ty
::
Binder
<&
'tcx
ty
::
Slice
<
ty
::
ExistentialPredicate
<
'tcx
>>>
)
existential_predicates
:
ty
::
Binder
<&
'tcx
ty
::
List
<
ty
::
ExistentialPredicate
<
'tcx
>>>
)
->
Vec
<
ty
::
Region
<
'tcx
>>
{
// Since we don't actually *know* the self type for an object,
...
...
src/librustc/util/ppaux.rs
浏览文件 @
87c7e570
...
...
@@ -586,7 +586,7 @@ fn print<F: fmt::Write>(&self, f: &mut F, cx: &mut PrintContext) -> fmt::Result
}
define_print!
{
(
'tcx
)
&
'tcx
ty
::
Slice
<
ty
::
ExistentialPredicate
<
'tcx
>>
,
(
self
,
f
,
cx
)
{
(
'tcx
)
&
'tcx
ty
::
List
<
ty
::
ExistentialPredicate
<
'tcx
>>
,
(
self
,
f
,
cx
)
{
display
{
// Generate the main trait ref, including associated types.
ty
::
tls
::
with
(|
tcx
|
{
...
...
@@ -672,7 +672,7 @@ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
}
define_print!
{
(
'tcx
)
&
'tcx
ty
::
Slice
<
Ty
<
'tcx
>>
,
(
self
,
f
,
cx
)
{
(
'tcx
)
&
'tcx
ty
::
List
<
Ty
<
'tcx
>>
,
(
self
,
f
,
cx
)
{
display
{
write!
(
f
,
"{{"
)
?
;
let
mut
tys
=
self
.iter
();
...
...
@@ -993,7 +993,7 @@ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
define_print_multi!
{
[
(
'tcx
)
ty
::
Binder
<&
'tcx
ty
::
Slice
<
ty
::
ExistentialPredicate
<
'tcx
>>>
,
(
'tcx
)
ty
::
Binder
<&
'tcx
ty
::
List
<
ty
::
ExistentialPredicate
<
'tcx
>>>
,
(
'tcx
)
ty
::
Binder
<
ty
::
TraitRef
<
'tcx
>>
,
(
'tcx
)
ty
::
Binder
<
ty
::
FnSig
<
'tcx
>>
,
(
'tcx
)
ty
::
Binder
<
ty
::
TraitPredicate
<
'tcx
>>
,
...
...
src/librustc_mir/borrow_check/nll/type_check/relate_tys.rs
浏览文件 @
87c7e570
...
...
@@ -36,7 +36,7 @@ pub(super) fn sub_types<'tcx>(
ty
::
Variance
::
Covariant
,
locations
,
borrowck_context
,
ty
::
Slice
::
empty
(),
ty
::
List
::
empty
(),
)
.relate
(
&
a
,
&
b
)
?
;
Ok
(())
}
...
...
@@ -54,7 +54,7 @@ pub(super) fn eq_types<'tcx>(
ty
::
Variance
::
Invariant
,
locations
,
borrowck_context
,
ty
::
Slice
::
empty
(),
ty
::
List
::
empty
(),
)
.relate
(
&
a
,
&
b
)
?
;
Ok
(())
}
...
...
src/librustc_mir/borrow_check/nll/universal_regions.rs
浏览文件 @
87c7e570
...
...
@@ -506,7 +506,7 @@ fn compute_inputs_and_output(
&
self
,
indices
:
&
UniversalRegionIndices
<
'tcx
>
,
defining_ty
:
DefiningTy
<
'tcx
>
,
)
->
ty
::
Binder
<&
'tcx
ty
::
Slice
<
Ty
<
'tcx
>>>
{
)
->
ty
::
Binder
<&
'tcx
ty
::
List
<
Ty
<
'tcx
>>>
{
let
tcx
=
self
.infcx.tcx
;
match
defining_ty
{
DefiningTy
::
Closure
(
def_id
,
substs
)
=>
{
...
...
src/librustc_mir/transform/lower_128bit.rs
浏览文件 @
87c7e570
...
...
@@ -13,7 +13,7 @@
use
rustc
::
hir
::
def_id
::
DefId
;
use
rustc
::
middle
::
lang_items
::
LangItem
;
use
rustc
::
mir
::
*
;
use
rustc
::
ty
::{
Slice
,
Ty
,
TyCtxt
,
TypeVariants
};
use
rustc
::
ty
::{
List
,
Ty
,
TyCtxt
,
TypeVariants
};
use
rustc_data_structures
::
indexed_vec
::{
Idx
};
use
transform
::{
MirPass
,
MirSource
};
use
syntax
;
...
...
@@ -114,7 +114,7 @@ fn lower_128bit_ops<'a, 'tcx>(&self, tcx: TyCtxt<'a, 'tcx, 'tcx>, mir: &mut Mir<
source_info
,
kind
:
TerminatorKind
::
Call
{
func
:
Operand
::
function_handle
(
tcx
,
call_did
,
Slice
::
empty
(),
source_info
.span
),
List
::
empty
(),
source_info
.span
),
args
:
vec!
[
lhs
,
rhs
],
destination
:
Some
((
place
,
bb
)),
cleanup
:
None
,
...
...
src/librustc_traits/lowering.rs
浏览文件 @
87c7e570
...
...
@@ -17,7 +17,7 @@
WhereClause
,
};
use
rustc
::
ty
::
query
::
Providers
;
use
rustc
::
ty
::{
self
,
Slice
,
TyCtxt
};
use
rustc
::
ty
::{
self
,
List
,
TyCtxt
};
use
rustc_data_structures
::
fx
::
FxHashSet
;
use
std
::
mem
;
use
syntax
::
ast
;
...
...
@@ -162,7 +162,7 @@ fn into_well_formed_goal(self) -> DomainGoal<'tcx> {
DefPathData
::
AssocTypeInImpl
(
..
)
=>
program_clauses_for_associated_type_value
(
tcx
,
def_id
),
DefPathData
::
AssocTypeInTrait
(
..
)
=>
program_clauses_for_associated_type_def
(
tcx
,
def_id
),
DefPathData
::
TypeNs
(
..
)
=>
program_clauses_for_type_def
(
tcx
,
def_id
),
_
=>
Slice
::
empty
(),
_
=>
List
::
empty
(),
}
}
...
...
@@ -319,7 +319,7 @@ fn program_clauses_for_trait<'a, 'tcx>(
fn
program_clauses_for_impl
<
'a
,
'tcx
>
(
tcx
:
TyCtxt
<
'a
,
'tcx
,
'tcx
>
,
def_id
:
DefId
)
->
Clauses
<
'tcx
>
{
if
let
ImplPolarity
::
Negative
=
tcx
.impl_polarity
(
def_id
)
{
return
Slice
::
empty
();
return
List
::
empty
();
}
// Rule Implemented-From-Impl (see rustc guide)
...
...
src/librustc_typeck/astconv.rs
浏览文件 @
87c7e570
...
...
@@ -1666,7 +1666,7 @@ pub fn ty_of_fn(&self,
/// we return `None`.
fn
compute_object_lifetime_bound
(
&
self
,
span
:
Span
,
existential_predicates
:
ty
::
Binder
<&
'tcx
ty
::
Slice
<
ty
::
ExistentialPredicate
<
'tcx
>>>
)
existential_predicates
:
ty
::
Binder
<&
'tcx
ty
::
List
<
ty
::
ExistentialPredicate
<
'tcx
>>>
)
->
Option
<
ty
::
Region
<
'tcx
>>
// if None, use the default
{
let
tcx
=
self
.tcx
();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录