Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
c83e31e7
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,发现更多精彩内容 >>
提交
c83e31e7
编写于
7月 15, 2016
作者:
J
Jeffrey Seyfried
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Include the `MacroDefinition` rib in the label ribs.
上级
56c4ddff
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
16 addition
and
4 deletion
+16
-4
src/librustc_resolve/lib.rs
src/librustc_resolve/lib.rs
+16
-4
未找到文件。
src/librustc_resolve/lib.rs
浏览文件 @
c83e31e7
...
...
@@ -1576,12 +1576,21 @@ fn with_scope<F>(&mut self, id: NodeId, f: F)
/// Searches the current set of local scopes for labels.
/// Stops after meeting a closure.
fn
search_label
(
&
self
,
ident
:
ast
::
Ident
)
->
Option
<
Def
>
{
fn
search_label
(
&
self
,
mut
ident
:
ast
::
Ident
)
->
Option
<
Def
>
{
for
rib
in
self
.label_ribs
.iter
()
.rev
()
{
match
rib
.kind
{
NormalRibKind
=>
{
// Continue
}
MacroDefinition
(
mac
)
=>
{
// If an invocation of this macro created `ident`, give up on `ident`
// and switch to `ident`'s source from the macro definition.
if
let
Some
((
source_ident
,
source_macro
))
=
mtwt
::
source
(
ident
)
{
if
mac
==
source_macro
{
ident
=
source_ident
;
}
}
}
_
=>
{
// Do not resolve labels across function boundary
return
None
;
...
...
@@ -2088,7 +2097,7 @@ fn resolve_block(&mut self, block: &Block) {
let
orig_module
=
self
.current_module
;
let
anonymous_module
=
self
.module_map
.get
(
&
block
.id
)
.cloned
();
// clones a reference
let
mut
num_
value_ribs
=
1
;
let
mut
num_
macro_definition_ribs
=
0
;
if
let
Some
(
anonymous_module
)
=
anonymous_module
{
debug!
(
"(resolving block) found anonymous module, moving down"
);
self
.value_ribs
.push
(
Rib
::
new
(
ModuleRibKind
(
anonymous_module
)));
...
...
@@ -2101,9 +2110,10 @@ fn resolve_block(&mut self, block: &Block) {
// Descend into the block.
for
stmt
in
&
block
.stmts
{
if
let
Some
(
marks
)
=
self
.macros_at_scope
.remove
(
&
stmt
.id
)
{
num_
value
_ribs
+=
marks
.len
()
as
u32
;
num_
macro_definition
_ribs
+=
marks
.len
()
as
u32
;
for
mark
in
marks
{
self
.value_ribs
.push
(
Rib
::
new
(
MacroDefinition
(
mark
)));
self
.label_ribs
.push
(
Rib
::
new
(
MacroDefinition
(
mark
)));
}
}
...
...
@@ -2112,9 +2122,11 @@ fn resolve_block(&mut self, block: &Block) {
// Move back up.
self
.current_module
=
orig_module
;
for
_
in
0
..
num_
value
_ribs
{
for
_
in
0
..
num_
macro_definition
_ribs
{
self
.value_ribs
.pop
();
self
.label_ribs
.pop
();
}
self
.value_ribs
.pop
();
if
let
Some
(
_
)
=
anonymous_module
{
self
.type_ribs
.pop
();
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录