Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
6cb33a08
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,发现更多精彩内容 >>
提交
6cb33a08
编写于
11月 17, 2016
作者:
J
Jeffrey Seyfried
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Cleanup formatting.
上级
d8722f3f
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
28 addition
and
23 deletion
+28
-23
src/librustc_resolve/build_reduced_graph.rs
src/librustc_resolve/build_reduced_graph.rs
+18
-17
src/librustc_resolve/macros.rs
src/librustc_resolve/macros.rs
+10
-6
未找到文件。
src/librustc_resolve/build_reduced_graph.rs
浏览文件 @
6cb33a08
...
...
@@ -362,9 +362,11 @@ fn build_reduced_graph_for_item(&mut self, item: &Item, expansion: Mark) {
// Constructs the reduced graph for one variant. Variants exist in the
// type and value namespaces.
fn
build_reduced_graph_for_variant
(
&
mut
self
,
variant
:
&
Variant
,
parent
:
Module
<
'b
>
,
vis
:
ty
::
Visibility
,
expansion
:
Mark
,
)
{
fn
build_reduced_graph_for_variant
(
&
mut
self
,
variant
:
&
Variant
,
parent
:
Module
<
'b
>
,
vis
:
ty
::
Visibility
,
expansion
:
Mark
)
{
let
name
=
variant
.node.name.name
;
let
def_id
=
self
.definitions
.local_def_id
(
variant
.node.data
.id
());
...
...
@@ -381,22 +383,20 @@ fn build_reduced_graph_for_variant(
}
/// Constructs the reduced graph for one foreign item.
fn
build_reduced_graph_for_foreign_item
(
&
mut
self
,
foreign_item
:
&
ForeignItem
,
expansion
:
Mark
,
)
{
fn
build_reduced_graph_for_foreign_item
(
&
mut
self
,
item
:
&
ForeignItem
,
expansion
:
Mark
)
{
let
parent
=
self
.current_module
;
let
name
=
foreign_
item
.ident.name
;
let
name
=
item
.ident.name
;
let
def
=
match
foreign_
item
.node
{
let
def
=
match
item
.node
{
ForeignItemKind
::
Fn
(
..
)
=>
{
Def
::
Fn
(
self
.definitions
.local_def_id
(
foreign_
item
.id
))
Def
::
Fn
(
self
.definitions
.local_def_id
(
item
.id
))
}
ForeignItemKind
::
Static
(
_
,
m
)
=>
{
Def
::
Static
(
self
.definitions
.local_def_id
(
foreign_
item
.id
),
m
)
Def
::
Static
(
self
.definitions
.local_def_id
(
item
.id
),
m
)
}
};
let
vis
=
self
.resolve_visibility
(
&
foreign_
item
.vis
);
self
.define
(
parent
,
name
,
ValueNS
,
(
def
,
vis
,
foreign_
item
.span
,
expansion
));
let
vis
=
self
.resolve_visibility
(
&
item
.vis
);
self
.define
(
parent
,
name
,
ValueNS
,
(
def
,
vis
,
item
.span
,
expansion
));
}
fn
build_reduced_graph_for_block
(
&
mut
self
,
block
:
&
Block
)
{
...
...
@@ -415,8 +415,7 @@ fn build_reduced_graph_for_block(&mut self, block: &Block) {
}
/// Builds the reduced graph for a single item in an external crate.
fn
build_reduced_graph_for_external_crate_def
(
&
mut
self
,
parent
:
Module
<
'b
>
,
child
:
Export
)
{
fn
build_reduced_graph_for_external_crate_def
(
&
mut
self
,
parent
:
Module
<
'b
>
,
child
:
Export
)
{
let
name
=
child
.name
;
let
def
=
child
.def
;
let
def_id
=
def
.def_id
();
...
...
@@ -545,9 +544,11 @@ pub fn populate_module_if_necessary(&mut self, module: Module<'b>) {
module
.populated
.set
(
true
)
}
fn
legacy_import_macro
(
&
mut
self
,
name
:
Name
,
binding
:
&
'b
NameBinding
<
'b
>
,
span
:
Span
,
allow_shadowing
:
bool
,
)
{
fn
legacy_import_macro
(
&
mut
self
,
name
:
Name
,
binding
:
&
'b
NameBinding
<
'b
>
,
span
:
Span
,
allow_shadowing
:
bool
)
{
self
.used_crates
.insert
(
binding
.def
()
.def_id
()
.krate
);
self
.macro_names
.insert
(
name
);
if
self
.builtin_macros
.insert
(
name
,
binding
)
.is_some
()
&&
!
allow_shadowing
{
...
...
src/librustc_resolve/macros.rs
浏览文件 @
6cb33a08
...
...
@@ -262,9 +262,11 @@ fn resolve_macro(&mut self, scope: Mark, path: &ast::Path, force: bool)
impl
<
'a
>
Resolver
<
'a
>
{
// Resolve the name in the module's lexical scope, excluding non-items.
fn
resolve_in_item_lexical_scope
(
&
mut
self
,
name
:
Name
,
ns
:
Namespace
,
record_used
:
Option
<
Span
>
,
)
->
Option
<&
'a
NameBinding
<
'a
>>
{
fn
resolve_in_item_lexical_scope
(
&
mut
self
,
name
:
Name
,
ns
:
Namespace
,
record_used
:
Option
<
Span
>
)
->
Option
<&
'a
NameBinding
<
'a
>>
{
let
mut
module
=
self
.current_module
;
let
mut
potential_expanded_shadower
=
None
;
loop
{
...
...
@@ -298,9 +300,11 @@ fn resolve_in_item_lexical_scope(
}
}
pub
fn
resolve_legacy_scope
(
&
mut
self
,
mut
scope
:
LegacyScope
<
'a
>
,
name
:
ast
::
Name
,
record_used
:
bool
,
)
->
Option
<
MacroBinding
<
'a
>>
{
pub
fn
resolve_legacy_scope
(
&
mut
self
,
mut
scope
:
LegacyScope
<
'a
>
,
name
:
Name
,
record_used
:
bool
)
->
Option
<
MacroBinding
<
'a
>>
{
let
mut
possible_time_travel
=
None
;
let
mut
relative_depth
:
u32
=
0
;
let
mut
binding
=
None
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录