Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
2ad5a61f
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,发现更多精彩内容 >>
提交
2ad5a61f
编写于
9月 14, 2015
作者:
A
Ariel Ben-Yehuda
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
move traits structural impls to traits::structural_impls
上级
5f564fbb
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
238 addition
and
226 deletion
+238
-226
src/librustc/middle/traits/fulfill.rs
src/librustc/middle/traits/fulfill.rs
+0
-9
src/librustc/middle/traits/mod.rs
src/librustc/middle/traits/mod.rs
+1
-0
src/librustc/middle/traits/project.rs
src/librustc/middle/traits/project.rs
+0
-26
src/librustc/middle/traits/structural_impls.rs
src/librustc/middle/traits/structural_impls.rs
+235
-0
src/librustc/middle/traits/util.rs
src/librustc/middle/traits/util.rs
+2
-109
src/librustc/middle/ty/structural_impls.rs
src/librustc/middle/ty/structural_impls.rs
+0
-82
未找到文件。
src/librustc/middle/traits/fulfill.rs
浏览文件 @
2ad5a61f
...
...
@@ -11,7 +11,6 @@
use
middle
::
infer
::
InferCtxt
;
use
middle
::
ty
::{
self
,
RegionEscape
,
Ty
,
HasTypeFlags
};
use
std
::
fmt
;
use
syntax
::
ast
;
use
util
::
common
::
ErrorReported
;
use
util
::
nodemap
::{
FnvHashSet
,
NodeMap
};
...
...
@@ -509,14 +508,6 @@ fn process_predicate<'a,'tcx>(selcx: &mut SelectionContext<'a,'tcx>,
}
}
impl
<
'tcx
>
fmt
::
Debug
for
RegionObligation
<
'tcx
>
{
fn
fmt
(
&
self
,
f
:
&
mut
fmt
::
Formatter
)
->
fmt
::
Result
{
write!
(
f
,
"RegionObligation(sub_region={:?}, sup_type={:?})"
,
self
.sub_region
,
self
.sup_type
)
}
}
fn
register_region_obligation
<
'tcx
>
(
t_a
:
Ty
<
'tcx
>
,
r_b
:
ty
::
Region
,
cause
:
ObligationCause
<
'tcx
>
,
...
...
src/librustc/middle/traits/mod.rs
浏览文件 @
2ad5a61f
...
...
@@ -63,6 +63,7 @@
mod
project
;
mod
object_safety
;
mod
select
;
mod
structural_impls
;
mod
util
;
/// An `Obligation` represents some trait reference (e.g. `int:Eq`) for
...
...
src/librustc/middle/traits/project.rs
浏览文件 @
2ad5a61f
...
...
@@ -28,8 +28,6 @@
use
syntax
::
parse
::
token
;
use
util
::
common
::
FN_OUTPUT_NAME
;
use
std
::
fmt
;
pub
type
PolyProjectionObligation
<
'tcx
>
=
Obligation
<
'tcx
,
ty
::
PolyProjectionPredicate
<
'tcx
>>
;
...
...
@@ -917,27 +915,3 @@ fn confirm_impl_candidate<'cx,'tcx>(
&
format!
(
"No associated type for {:?}"
,
trait_ref
));
}
impl
<
'tcx
,
T
:
TypeFoldable
<
'tcx
>>
TypeFoldable
<
'tcx
>
for
Normalized
<
'tcx
,
T
>
{
fn
fold_with
<
F
:
TypeFolder
<
'tcx
>>
(
&
self
,
folder
:
&
mut
F
)
->
Normalized
<
'tcx
,
T
>
{
Normalized
{
value
:
self
.value
.fold_with
(
folder
),
obligations
:
self
.obligations
.fold_with
(
folder
),
}
}
}
impl
<
'tcx
,
T
:
HasTypeFlags
>
HasTypeFlags
for
Normalized
<
'tcx
,
T
>
{
fn
has_type_flags
(
&
self
,
flags
:
ty
::
TypeFlags
)
->
bool
{
self
.value
.has_type_flags
(
flags
)
||
self
.obligations
.has_type_flags
(
flags
)
}
}
impl
<
'tcx
,
T
:
fmt
::
Debug
>
fmt
::
Debug
for
Normalized
<
'tcx
,
T
>
{
fn
fmt
(
&
self
,
f
:
&
mut
fmt
::
Formatter
)
->
fmt
::
Result
{
write!
(
f
,
"Normalized({:?},{:?})"
,
self
.value
,
self
.obligations
)
}
}
src/librustc/middle/traits/structural_impls.rs
0 → 100644
浏览文件 @
2ad5a61f
// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use
middle
::
traits
;
use
middle
::
traits
::
project
::
Normalized
;
use
middle
::
ty
::{
HasTypeFlags
,
TypeFlags
,
RegionEscape
};
use
middle
::
ty
::
fold
::{
TypeFoldable
,
TypeFolder
};
use
std
::
fmt
;
// structural impls for the structs in middle::traits
impl
<
'tcx
,
T
:
fmt
::
Debug
>
fmt
::
Debug
for
Normalized
<
'tcx
,
T
>
{
fn
fmt
(
&
self
,
f
:
&
mut
fmt
::
Formatter
)
->
fmt
::
Result
{
write!
(
f
,
"Normalized({:?},{:?})"
,
self
.value
,
self
.obligations
)
}
}
impl
<
'tcx
>
fmt
::
Debug
for
traits
::
RegionObligation
<
'tcx
>
{
fn
fmt
(
&
self
,
f
:
&
mut
fmt
::
Formatter
)
->
fmt
::
Result
{
write!
(
f
,
"RegionObligation(sub_region={:?}, sup_type={:?})"
,
self
.sub_region
,
self
.sup_type
)
}
}
impl
<
'tcx
,
O
:
fmt
::
Debug
>
fmt
::
Debug
for
traits
::
Obligation
<
'tcx
,
O
>
{
fn
fmt
(
&
self
,
f
:
&
mut
fmt
::
Formatter
)
->
fmt
::
Result
{
write!
(
f
,
"Obligation(predicate={:?},depth={})"
,
self
.predicate
,
self
.recursion_depth
)
}
}
impl
<
'tcx
,
N
:
fmt
::
Debug
>
fmt
::
Debug
for
traits
::
Vtable
<
'tcx
,
N
>
{
fn
fmt
(
&
self
,
f
:
&
mut
fmt
::
Formatter
)
->
fmt
::
Result
{
match
*
self
{
super
::
VtableImpl
(
ref
v
)
=>
write!
(
f
,
"{:?}"
,
v
),
super
::
VtableDefaultImpl
(
ref
t
)
=>
write!
(
f
,
"{:?}"
,
t
),
super
::
VtableClosure
(
ref
d
)
=>
write!
(
f
,
"{:?}"
,
d
),
super
::
VtableFnPointer
(
ref
d
)
=>
write!
(
f
,
"VtableFnPointer({:?})"
,
d
),
super
::
VtableObject
(
ref
d
)
=>
write!
(
f
,
"{:?}"
,
d
),
super
::
VtableParam
(
ref
n
)
=>
write!
(
f
,
"VtableParam({:?})"
,
n
),
super
::
VtableBuiltin
(
ref
d
)
=>
write!
(
f
,
"{:?}"
,
d
)
}
}
}
impl
<
'tcx
,
N
:
fmt
::
Debug
>
fmt
::
Debug
for
traits
::
VtableImplData
<
'tcx
,
N
>
{
fn
fmt
(
&
self
,
f
:
&
mut
fmt
::
Formatter
)
->
fmt
::
Result
{
write!
(
f
,
"VtableImpl(impl_def_id={:?}, substs={:?}, nested={:?})"
,
self
.impl_def_id
,
self
.substs
,
self
.nested
)
}
}
impl
<
'tcx
,
N
:
fmt
::
Debug
>
fmt
::
Debug
for
traits
::
VtableClosureData
<
'tcx
,
N
>
{
fn
fmt
(
&
self
,
f
:
&
mut
fmt
::
Formatter
)
->
fmt
::
Result
{
write!
(
f
,
"VtableClosure(closure_def_id={:?}, substs={:?}, nested={:?})"
,
self
.closure_def_id
,
self
.substs
,
self
.nested
)
}
}
impl
<
'tcx
,
N
:
fmt
::
Debug
>
fmt
::
Debug
for
traits
::
VtableBuiltinData
<
N
>
{
fn
fmt
(
&
self
,
f
:
&
mut
fmt
::
Formatter
)
->
fmt
::
Result
{
write!
(
f
,
"VtableBuiltin(nested={:?})"
,
self
.nested
)
}
}
impl
<
'tcx
,
N
:
fmt
::
Debug
>
fmt
::
Debug
for
traits
::
VtableDefaultImplData
<
N
>
{
fn
fmt
(
&
self
,
f
:
&
mut
fmt
::
Formatter
)
->
fmt
::
Result
{
write!
(
f
,
"VtableDefaultImplData(trait_def_id={:?}, nested={:?})"
,
self
.trait_def_id
,
self
.nested
)
}
}
impl
<
'tcx
>
fmt
::
Debug
for
traits
::
VtableObjectData
<
'tcx
>
{
fn
fmt
(
&
self
,
f
:
&
mut
fmt
::
Formatter
)
->
fmt
::
Result
{
write!
(
f
,
"VtableObject(upcast={:?}, vtable_base={})"
,
self
.upcast_trait_ref
,
self
.vtable_base
)
}
}
impl
<
'tcx
>
fmt
::
Debug
for
traits
::
FulfillmentError
<
'tcx
>
{
fn
fmt
(
&
self
,
f
:
&
mut
fmt
::
Formatter
)
->
fmt
::
Result
{
write!
(
f
,
"FulfillmentError({:?},{:?})"
,
self
.obligation
,
self
.code
)
}
}
impl
<
'tcx
>
fmt
::
Debug
for
traits
::
FulfillmentErrorCode
<
'tcx
>
{
fn
fmt
(
&
self
,
f
:
&
mut
fmt
::
Formatter
)
->
fmt
::
Result
{
match
*
self
{
super
::
CodeSelectionError
(
ref
e
)
=>
write!
(
f
,
"{:?}"
,
e
),
super
::
CodeProjectionError
(
ref
e
)
=>
write!
(
f
,
"{:?}"
,
e
),
super
::
CodeAmbiguity
=>
write!
(
f
,
"Ambiguity"
)
}
}
}
impl
<
'tcx
>
fmt
::
Debug
for
traits
::
MismatchedProjectionTypes
<
'tcx
>
{
fn
fmt
(
&
self
,
f
:
&
mut
fmt
::
Formatter
)
->
fmt
::
Result
{
write!
(
f
,
"MismatchedProjectionTypes({:?})"
,
self
.err
)
}
}
impl
<
'tcx
,
P
:
RegionEscape
>
RegionEscape
for
traits
::
Obligation
<
'tcx
,
P
>
{
fn
has_regions_escaping_depth
(
&
self
,
depth
:
u32
)
->
bool
{
self
.predicate
.has_regions_escaping_depth
(
depth
)
}
}
impl
<
'tcx
,
T
:
HasTypeFlags
>
HasTypeFlags
for
traits
::
Obligation
<
'tcx
,
T
>
{
fn
has_type_flags
(
&
self
,
flags
:
TypeFlags
)
->
bool
{
self
.predicate
.has_type_flags
(
flags
)
}
}
impl
<
'tcx
,
T
:
HasTypeFlags
>
HasTypeFlags
for
Normalized
<
'tcx
,
T
>
{
fn
has_type_flags
(
&
self
,
flags
:
TypeFlags
)
->
bool
{
self
.value
.has_type_flags
(
flags
)
||
self
.obligations
.has_type_flags
(
flags
)
}
}
impl
<
'tcx
,
O
:
TypeFoldable
<
'tcx
>>
TypeFoldable
<
'tcx
>
for
traits
::
Obligation
<
'tcx
,
O
>
{
fn
fold_with
<
F
:
TypeFolder
<
'tcx
>>
(
&
self
,
folder
:
&
mut
F
)
->
traits
::
Obligation
<
'tcx
,
O
>
{
traits
::
Obligation
{
cause
:
self
.cause
.clone
(),
recursion_depth
:
self
.recursion_depth
,
predicate
:
self
.predicate
.fold_with
(
folder
),
}
}
}
impl
<
'tcx
,
N
:
TypeFoldable
<
'tcx
>>
TypeFoldable
<
'tcx
>
for
traits
::
VtableImplData
<
'tcx
,
N
>
{
fn
fold_with
<
F
:
TypeFolder
<
'tcx
>>
(
&
self
,
folder
:
&
mut
F
)
->
traits
::
VtableImplData
<
'tcx
,
N
>
{
traits
::
VtableImplData
{
impl_def_id
:
self
.impl_def_id
,
substs
:
self
.substs
.fold_with
(
folder
),
nested
:
self
.nested
.fold_with
(
folder
),
}
}
}
impl
<
'tcx
,
N
:
TypeFoldable
<
'tcx
>>
TypeFoldable
<
'tcx
>
for
traits
::
VtableClosureData
<
'tcx
,
N
>
{
fn
fold_with
<
F
:
TypeFolder
<
'tcx
>>
(
&
self
,
folder
:
&
mut
F
)
->
traits
::
VtableClosureData
<
'tcx
,
N
>
{
traits
::
VtableClosureData
{
closure_def_id
:
self
.closure_def_id
,
substs
:
self
.substs
.fold_with
(
folder
),
nested
:
self
.nested
.fold_with
(
folder
),
}
}
}
impl
<
'tcx
,
N
:
TypeFoldable
<
'tcx
>>
TypeFoldable
<
'tcx
>
for
traits
::
VtableDefaultImplData
<
N
>
{
fn
fold_with
<
F
:
TypeFolder
<
'tcx
>>
(
&
self
,
folder
:
&
mut
F
)
->
traits
::
VtableDefaultImplData
<
N
>
{
traits
::
VtableDefaultImplData
{
trait_def_id
:
self
.trait_def_id
,
nested
:
self
.nested
.fold_with
(
folder
),
}
}
}
impl
<
'tcx
,
N
:
TypeFoldable
<
'tcx
>>
TypeFoldable
<
'tcx
>
for
traits
::
VtableBuiltinData
<
N
>
{
fn
fold_with
<
F
:
TypeFolder
<
'tcx
>>
(
&
self
,
folder
:
&
mut
F
)
->
traits
::
VtableBuiltinData
<
N
>
{
traits
::
VtableBuiltinData
{
nested
:
self
.nested
.fold_with
(
folder
),
}
}
}
impl
<
'tcx
,
N
:
TypeFoldable
<
'tcx
>>
TypeFoldable
<
'tcx
>
for
traits
::
Vtable
<
'tcx
,
N
>
{
fn
fold_with
<
F
:
TypeFolder
<
'tcx
>>
(
&
self
,
folder
:
&
mut
F
)
->
traits
::
Vtable
<
'tcx
,
N
>
{
match
*
self
{
traits
::
VtableImpl
(
ref
v
)
=>
traits
::
VtableImpl
(
v
.fold_with
(
folder
)),
traits
::
VtableDefaultImpl
(
ref
t
)
=>
traits
::
VtableDefaultImpl
(
t
.fold_with
(
folder
)),
traits
::
VtableClosure
(
ref
d
)
=>
{
traits
::
VtableClosure
(
d
.fold_with
(
folder
))
}
traits
::
VtableFnPointer
(
ref
d
)
=>
{
traits
::
VtableFnPointer
(
d
.fold_with
(
folder
))
}
traits
::
VtableParam
(
ref
n
)
=>
traits
::
VtableParam
(
n
.fold_with
(
folder
)),
traits
::
VtableBuiltin
(
ref
d
)
=>
traits
::
VtableBuiltin
(
d
.fold_with
(
folder
)),
traits
::
VtableObject
(
ref
d
)
=>
traits
::
VtableObject
(
d
.fold_with
(
folder
)),
}
}
}
impl
<
'tcx
>
TypeFoldable
<
'tcx
>
for
traits
::
VtableObjectData
<
'tcx
>
{
fn
fold_with
<
F
:
TypeFolder
<
'tcx
>>
(
&
self
,
folder
:
&
mut
F
)
->
traits
::
VtableObjectData
<
'tcx
>
{
traits
::
VtableObjectData
{
upcast_trait_ref
:
self
.upcast_trait_ref
.fold_with
(
folder
),
vtable_base
:
self
.vtable_base
}
}
}
impl
<
'tcx
,
T
:
TypeFoldable
<
'tcx
>>
TypeFoldable
<
'tcx
>
for
Normalized
<
'tcx
,
T
>
{
fn
fold_with
<
F
:
TypeFolder
<
'tcx
>>
(
&
self
,
folder
:
&
mut
F
)
->
Normalized
<
'tcx
,
T
>
{
Normalized
{
value
:
self
.value
.fold_with
(
folder
),
obligations
:
self
.obligations
.fold_with
(
folder
),
}
}
}
src/librustc/middle/traits/util.rs
浏览文件 @
2ad5a61f
...
...
@@ -11,14 +11,12 @@
use
middle
::
def_id
::
DefId
;
use
middle
::
infer
::
InferCtxt
;
use
middle
::
subst
::
Substs
;
use
middle
::
ty
::{
self
,
HasTypeFlags
,
Ty
,
ToPredicate
,
ToPolyTraitRef
};
use
std
::
fmt
;
use
middle
::
ty
::{
self
,
Ty
,
ToPredicate
,
ToPolyTraitRef
};
use
syntax
::
codemap
::
Span
;
use
util
::
common
::
ErrorReported
;
use
util
::
nodemap
::
FnvHashSet
;
use
super
::{
Obligation
,
ObligationCause
,
PredicateObligation
,
VtableImpl
,
VtableParam
,
VtableImplData
,
VtableDefaultImplData
};
use
super
::{
Obligation
,
ObligationCause
,
PredicateObligation
};
struct
PredicateSet
<
'a
,
'tcx
:
'a
>
{
tcx
:
&
'a
ty
::
ctxt
<
'tcx
>
,
...
...
@@ -477,108 +475,3 @@ pub fn closure_trait_ref_and_return_type<'tcx>(
};
ty
::
Binder
((
trait_ref
,
sig
.0
.output
.unwrap_or
(
tcx
.mk_nil
())))
}
impl
<
'tcx
,
O
:
fmt
::
Debug
>
fmt
::
Debug
for
super
::
Obligation
<
'tcx
,
O
>
{
fn
fmt
(
&
self
,
f
:
&
mut
fmt
::
Formatter
)
->
fmt
::
Result
{
write!
(
f
,
"Obligation(predicate={:?},depth={})"
,
self
.predicate
,
self
.recursion_depth
)
}
}
impl
<
'tcx
,
N
:
fmt
::
Debug
>
fmt
::
Debug
for
super
::
Vtable
<
'tcx
,
N
>
{
fn
fmt
(
&
self
,
f
:
&
mut
fmt
::
Formatter
)
->
fmt
::
Result
{
match
*
self
{
super
::
VtableImpl
(
ref
v
)
=>
write!
(
f
,
"{:?}"
,
v
),
super
::
VtableDefaultImpl
(
ref
t
)
=>
write!
(
f
,
"{:?}"
,
t
),
super
::
VtableClosure
(
ref
d
)
=>
write!
(
f
,
"{:?}"
,
d
),
super
::
VtableFnPointer
(
ref
d
)
=>
write!
(
f
,
"VtableFnPointer({:?})"
,
d
),
super
::
VtableObject
(
ref
d
)
=>
write!
(
f
,
"{:?}"
,
d
),
super
::
VtableParam
(
ref
n
)
=>
write!
(
f
,
"VtableParam({:?})"
,
n
),
super
::
VtableBuiltin
(
ref
d
)
=>
write!
(
f
,
"{:?}"
,
d
)
}
}
}
impl
<
'tcx
,
N
:
fmt
::
Debug
>
fmt
::
Debug
for
super
::
VtableImplData
<
'tcx
,
N
>
{
fn
fmt
(
&
self
,
f
:
&
mut
fmt
::
Formatter
)
->
fmt
::
Result
{
write!
(
f
,
"VtableImpl(impl_def_id={:?}, substs={:?}, nested={:?})"
,
self
.impl_def_id
,
self
.substs
,
self
.nested
)
}
}
impl
<
'tcx
,
N
:
fmt
::
Debug
>
fmt
::
Debug
for
super
::
VtableClosureData
<
'tcx
,
N
>
{
fn
fmt
(
&
self
,
f
:
&
mut
fmt
::
Formatter
)
->
fmt
::
Result
{
write!
(
f
,
"VtableClosure(closure_def_id={:?}, substs={:?}, nested={:?})"
,
self
.closure_def_id
,
self
.substs
,
self
.nested
)
}
}
impl
<
'tcx
,
N
:
fmt
::
Debug
>
fmt
::
Debug
for
super
::
VtableBuiltinData
<
N
>
{
fn
fmt
(
&
self
,
f
:
&
mut
fmt
::
Formatter
)
->
fmt
::
Result
{
write!
(
f
,
"VtableBuiltin(nested={:?})"
,
self
.nested
)
}
}
impl
<
'tcx
,
N
:
fmt
::
Debug
>
fmt
::
Debug
for
super
::
VtableDefaultImplData
<
N
>
{
fn
fmt
(
&
self
,
f
:
&
mut
fmt
::
Formatter
)
->
fmt
::
Result
{
write!
(
f
,
"VtableDefaultImplData(trait_def_id={:?}, nested={:?})"
,
self
.trait_def_id
,
self
.nested
)
}
}
impl
<
'tcx
>
fmt
::
Debug
for
super
::
VtableObjectData
<
'tcx
>
{
fn
fmt
(
&
self
,
f
:
&
mut
fmt
::
Formatter
)
->
fmt
::
Result
{
write!
(
f
,
"VtableObject(upcast={:?}, vtable_base={})"
,
self
.upcast_trait_ref
,
self
.vtable_base
)
}
}
impl
<
'tcx
>
fmt
::
Debug
for
super
::
FulfillmentError
<
'tcx
>
{
fn
fmt
(
&
self
,
f
:
&
mut
fmt
::
Formatter
)
->
fmt
::
Result
{
write!
(
f
,
"FulfillmentError({:?},{:?})"
,
self
.obligation
,
self
.code
)
}
}
impl
<
'tcx
>
fmt
::
Debug
for
super
::
FulfillmentErrorCode
<
'tcx
>
{
fn
fmt
(
&
self
,
f
:
&
mut
fmt
::
Formatter
)
->
fmt
::
Result
{
match
*
self
{
super
::
CodeSelectionError
(
ref
e
)
=>
write!
(
f
,
"{:?}"
,
e
),
super
::
CodeProjectionError
(
ref
e
)
=>
write!
(
f
,
"{:?}"
,
e
),
super
::
CodeAmbiguity
=>
write!
(
f
,
"Ambiguity"
)
}
}
}
impl
<
'tcx
>
fmt
::
Debug
for
super
::
MismatchedProjectionTypes
<
'tcx
>
{
fn
fmt
(
&
self
,
f
:
&
mut
fmt
::
Formatter
)
->
fmt
::
Result
{
write!
(
f
,
"MismatchedProjectionTypes({:?})"
,
self
.err
)
}
}
impl
<
'tcx
,
T
:
HasTypeFlags
>
HasTypeFlags
for
Obligation
<
'tcx
,
T
>
{
fn
has_type_flags
(
&
self
,
flags
:
ty
::
TypeFlags
)
->
bool
{
self
.predicate
.has_type_flags
(
flags
)
}
}
src/librustc/middle/ty/structural_impls.rs
浏览文件 @
2ad5a61f
...
...
@@ -116,12 +116,6 @@ fn has_regions_escaping_depth(&self, depth: u32) -> bool {
}
}
impl
<
'tcx
,
P
:
RegionEscape
>
RegionEscape
for
traits
::
Obligation
<
'tcx
,
P
>
{
fn
has_regions_escaping_depth
(
&
self
,
depth
:
u32
)
->
bool
{
self
.predicate
.has_regions_escaping_depth
(
depth
)
}
}
impl
<
'tcx
>
RegionEscape
for
TraitRef
<
'tcx
>
{
fn
has_regions_escaping_depth
(
&
self
,
depth
:
u32
)
->
bool
{
self
.substs.types
.iter
()
.any
(|
t
|
t
.has_regions_escaping_depth
(
depth
))
||
...
...
@@ -770,82 +764,6 @@ fn fold_with<F: TypeFolder<'tcx>>(&self, folder: &mut F) -> ty::InstantiatedPred
}
}
impl
<
'tcx
,
O
>
TypeFoldable
<
'tcx
>
for
traits
::
Obligation
<
'tcx
,
O
>
where
O
:
TypeFoldable
<
'tcx
>
{
fn
fold_with
<
F
:
TypeFolder
<
'tcx
>>
(
&
self
,
folder
:
&
mut
F
)
->
traits
::
Obligation
<
'tcx
,
O
>
{
traits
::
Obligation
{
cause
:
self
.cause
.clone
(),
recursion_depth
:
self
.recursion_depth
,
predicate
:
self
.predicate
.fold_with
(
folder
),
}
}
}
impl
<
'tcx
,
N
:
TypeFoldable
<
'tcx
>>
TypeFoldable
<
'tcx
>
for
traits
::
VtableImplData
<
'tcx
,
N
>
{
fn
fold_with
<
F
:
TypeFolder
<
'tcx
>>
(
&
self
,
folder
:
&
mut
F
)
->
traits
::
VtableImplData
<
'tcx
,
N
>
{
traits
::
VtableImplData
{
impl_def_id
:
self
.impl_def_id
,
substs
:
self
.substs
.fold_with
(
folder
),
nested
:
self
.nested
.fold_with
(
folder
),
}
}
}
impl
<
'tcx
,
N
:
TypeFoldable
<
'tcx
>>
TypeFoldable
<
'tcx
>
for
traits
::
VtableClosureData
<
'tcx
,
N
>
{
fn
fold_with
<
F
:
TypeFolder
<
'tcx
>>
(
&
self
,
folder
:
&
mut
F
)
->
traits
::
VtableClosureData
<
'tcx
,
N
>
{
traits
::
VtableClosureData
{
closure_def_id
:
self
.closure_def_id
,
substs
:
self
.substs
.fold_with
(
folder
),
nested
:
self
.nested
.fold_with
(
folder
),
}
}
}
impl
<
'tcx
,
N
:
TypeFoldable
<
'tcx
>>
TypeFoldable
<
'tcx
>
for
traits
::
VtableDefaultImplData
<
N
>
{
fn
fold_with
<
F
:
TypeFolder
<
'tcx
>>
(
&
self
,
folder
:
&
mut
F
)
->
traits
::
VtableDefaultImplData
<
N
>
{
traits
::
VtableDefaultImplData
{
trait_def_id
:
self
.trait_def_id
,
nested
:
self
.nested
.fold_with
(
folder
),
}
}
}
impl
<
'tcx
,
N
:
TypeFoldable
<
'tcx
>>
TypeFoldable
<
'tcx
>
for
traits
::
VtableBuiltinData
<
N
>
{
fn
fold_with
<
F
:
TypeFolder
<
'tcx
>>
(
&
self
,
folder
:
&
mut
F
)
->
traits
::
VtableBuiltinData
<
N
>
{
traits
::
VtableBuiltinData
{
nested
:
self
.nested
.fold_with
(
folder
),
}
}
}
impl
<
'tcx
,
N
:
TypeFoldable
<
'tcx
>>
TypeFoldable
<
'tcx
>
for
traits
::
Vtable
<
'tcx
,
N
>
{
fn
fold_with
<
F
:
TypeFolder
<
'tcx
>>
(
&
self
,
folder
:
&
mut
F
)
->
traits
::
Vtable
<
'tcx
,
N
>
{
match
*
self
{
traits
::
VtableImpl
(
ref
v
)
=>
traits
::
VtableImpl
(
v
.fold_with
(
folder
)),
traits
::
VtableDefaultImpl
(
ref
t
)
=>
traits
::
VtableDefaultImpl
(
t
.fold_with
(
folder
)),
traits
::
VtableClosure
(
ref
d
)
=>
{
traits
::
VtableClosure
(
d
.fold_with
(
folder
))
}
traits
::
VtableFnPointer
(
ref
d
)
=>
{
traits
::
VtableFnPointer
(
d
.fold_with
(
folder
))
}
traits
::
VtableParam
(
ref
n
)
=>
traits
::
VtableParam
(
n
.fold_with
(
folder
)),
traits
::
VtableBuiltin
(
ref
d
)
=>
traits
::
VtableBuiltin
(
d
.fold_with
(
folder
)),
traits
::
VtableObject
(
ref
d
)
=>
traits
::
VtableObject
(
d
.fold_with
(
folder
)),
}
}
}
impl
<
'tcx
>
TypeFoldable
<
'tcx
>
for
traits
::
VtableObjectData
<
'tcx
>
{
fn
fold_with
<
F
:
TypeFolder
<
'tcx
>>
(
&
self
,
folder
:
&
mut
F
)
->
traits
::
VtableObjectData
<
'tcx
>
{
traits
::
VtableObjectData
{
upcast_trait_ref
:
self
.upcast_trait_ref
.fold_with
(
folder
),
vtable_base
:
self
.vtable_base
}
}
}
impl
<
'tcx
>
TypeFoldable
<
'tcx
>
for
ty
::
EquatePredicate
<
'tcx
>
{
fn
fold_with
<
F
:
TypeFolder
<
'tcx
>>
(
&
self
,
folder
:
&
mut
F
)
->
ty
::
EquatePredicate
<
'tcx
>
{
ty
::
EquatePredicate
(
self
.0
.fold_with
(
folder
),
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录