Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
75c4f395
R
Rust
项目概览
int
/
Rust
11 个月 前同步成功
通知
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,发现更多精彩内容 >>
提交
75c4f395
编写于
12月 22, 2015
作者:
N
Niko Matsakis
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Strip the trait-def phase from collect, which has no function.
上级
005fa143
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
7 addition
and
43 deletion
+7
-43
src/librustc_typeck/collect.rs
src/librustc_typeck/collect.rs
+7
-43
未找到文件。
src/librustc_typeck/collect.rs
浏览文件 @
75c4f395
...
...
@@ -34,13 +34,12 @@
Demand is driven by calls to `AstConv::get_item_type_scheme` or
`AstConv::lookup_trait_def`.
Currently, we "convert" types and traits in t
hree
phases (note that
Currently, we "convert" types and traits in t
wo
phases (note that
conversion only affects the types of items / enum variants / methods;
it does not e.g. compute the types of individual expressions):
0. Intrinsics
1. Trait definitions
2. Type definitions
1. Trait/Type definitions
Conversion itself is done by simply walking each of the items in turn
and invoking an appropriate function (e.g., `trait_def_of_item` or
...
...
@@ -56,11 +55,6 @@
- Because the type scheme includes defaults, cycles through type
parameter defaults are illegal even if those defaults are never
employed. This is not necessarily a bug.
- The phasing of trait definitions before type definitions does not
seem to be necessary, sufficient, or particularly helpful, given that
processing a trait definition can trigger processing a type def and
vice versa. However, if I remove it, I get ICEs, so some more work is
needed in that area. -nmatsakis
*/
...
...
@@ -105,9 +99,6 @@
pub
fn
collect_item_types
(
tcx
:
&
ty
::
ctxt
)
{
let
ccx
=
&
CrateCtxt
{
tcx
:
tcx
,
stack
:
RefCell
::
new
(
Vec
::
new
())
};
let
mut
visitor
=
CollectTraitDefVisitor
{
ccx
:
ccx
};
ccx
.tcx.map
.krate
()
.visit_all_items
(
&
mut
visitor
);
let
mut
visitor
=
CollectItemTypesVisitor
{
ccx
:
ccx
};
ccx
.tcx.map
.krate
()
.visit_all_items
(
&
mut
visitor
);
}
...
...
@@ -147,28 +138,6 @@ enum AstConvRequest {
}
///////////////////////////////////////////////////////////////////////////
// First phase: just collect *trait definitions* -- basically, the set
// of type parameters and supertraits. This is information we need to
// know later when parsing field defs.
struct
CollectTraitDefVisitor
<
'a
,
'tcx
:
'a
>
{
ccx
:
&
'a
CrateCtxt
<
'a
,
'tcx
>
}
impl
<
'a
,
'tcx
,
'v
>
intravisit
::
Visitor
<
'v
>
for
CollectTraitDefVisitor
<
'a
,
'tcx
>
{
fn
visit_item
(
&
mut
self
,
i
:
&
hir
::
Item
)
{
match
i
.node
{
hir
::
ItemTrait
(
..
)
=>
{
// computing the trait def also fills in the table
let
_
=
trait_def_of_item
(
self
.ccx
,
i
);
}
_
=>
{
}
}
}
}
///////////////////////////////////////////////////////////////////////////
// Second phase: collection proper.
struct
CollectItemTypesVisitor
<
'a
,
'tcx
:
'a
>
{
ccx
:
&
'a
CrateCtxt
<
'a
,
'tcx
>
...
...
@@ -1286,16 +1255,11 @@ fn trait_def_of_item<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>,
substs
:
substs
,
};
let
trait_def
=
ty
::
TraitDef
{
paren_sugar
:
paren_sugar
,
unsafety
:
unsafety
,
generics
:
ty_generics
,
trait_ref
:
trait_ref
,
associated_type_names
:
associated_type_names
,
nonblanket_impls
:
RefCell
::
new
(
FnvHashMap
()),
blanket_impls
:
RefCell
::
new
(
vec!
[]),
flags
:
Cell
::
new
(
ty
::
TraitFlags
::
NO_TRAIT_FLAGS
)
};
let
trait_def
=
ty
::
TraitDef
::
new
(
unsafety
,
paren_sugar
,
ty_generics
,
trait_ref
,
associated_type_names
);
return
tcx
.intern_trait_def
(
trait_def
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录