Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
c9d8e149
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,发现更多精彩内容 >>
提交
c9d8e149
编写于
4月 27, 2016
作者:
J
Jeffrey Seyfried
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Refactor field `span` of `NameBinding` from `Option<Span>` to `Span`.
上级
c46164b6
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
13 addition
and
14 deletion
+13
-14
src/librustc_resolve/build_reduced_graph.rs
src/librustc_resolve/build_reduced_graph.rs
+2
-2
src/librustc_resolve/lib.rs
src/librustc_resolve/lib.rs
+7
-8
src/librustc_resolve/resolve_imports.rs
src/librustc_resolve/resolve_imports.rs
+4
-4
未找到文件。
src/librustc_resolve/build_reduced_graph.rs
浏览文件 @
c9d8e149
...
...
@@ -48,13 +48,13 @@ trait ToNameBinding<'a> {
impl
<
'a
>
ToNameBinding
<
'a
>
for
(
Module
<
'a
>
,
Span
,
ty
::
Visibility
)
{
fn
to_name_binding
(
self
)
->
NameBinding
<
'a
>
{
NameBinding
{
kind
:
NameBindingKind
::
Module
(
self
.0
),
span
:
Some
(
self
.1
)
,
vis
:
self
.2
}
NameBinding
{
kind
:
NameBindingKind
::
Module
(
self
.0
),
span
:
self
.1
,
vis
:
self
.2
}
}
}
impl
<
'a
>
ToNameBinding
<
'a
>
for
(
Def
,
Span
,
ty
::
Visibility
)
{
fn
to_name_binding
(
self
)
->
NameBinding
<
'a
>
{
NameBinding
{
kind
:
NameBindingKind
::
Def
(
self
.0
),
span
:
Some
(
self
.1
)
,
vis
:
self
.2
}
NameBinding
{
kind
:
NameBindingKind
::
Def
(
self
.0
),
span
:
self
.1
,
vis
:
self
.2
}
}
}
...
...
src/librustc_resolve/lib.rs
浏览文件 @
c9d8e149
...
...
@@ -349,7 +349,7 @@ fn resolve_struct_error<'b, 'a: 'b, 'tcx: 'a>(resolver: &'b Resolver<'a, 'tcx>,
if
let
Some
(
binding
)
=
resolver
.current_module
.resolve_name_in_lexical_scope
(
name
,
ValueNS
)
{
if
binding
.is_import
()
{
err
.span_note
(
binding
.span
.unwrap
()
,
"constant imported here"
);
err
.span_note
(
binding
.span
,
"constant imported here"
);
}
}
err
...
...
@@ -900,7 +900,7 @@ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
#[derive(Clone,
Debug)]
pub
struct
NameBinding
<
'a
>
{
kind
:
NameBindingKind
<
'a
>
,
span
:
Option
<
Span
>
,
span
:
Span
,
vis
:
ty
::
Visibility
,
}
...
...
@@ -3293,7 +3293,7 @@ fn lookup_candidates<FilterFn>(&mut self,
identifier
:
ident
,
parameters
:
params
,
};
let
span
=
name_binding
.span
.unwrap_or
(
syntax
::
codemap
::
DUMMY_SP
)
;
let
span
=
name_binding
.span
;
let
mut
segms
=
path_segments
.clone
();
segms
.push
(
segment
);
let
segms
=
HirVec
::
from_vec
(
segms
);
...
...
@@ -3447,7 +3447,7 @@ fn report_conflict(&self,
binding
:
&
NameBinding
,
old_binding
:
&
NameBinding
)
{
// Error on the second of two conflicting names
if
old_binding
.span
.
unwrap
()
.lo
>
binding
.span
.unwrap
()
.lo
{
if
old_binding
.span.
lo
>
binding
.span
.lo
{
return
self
.report_conflict
(
parent
,
name
,
ns
,
old_binding
,
binding
);
}
...
...
@@ -3463,7 +3463,7 @@ fn report_conflict(&self,
false
=>
(
"defined"
,
"definition"
),
};
let
span
=
binding
.span
.unwrap
()
;
let
span
=
binding
.span
;
let
msg
=
{
let
kind
=
match
(
ns
,
old_binding
.module
())
{
(
ValueNS
,
_
)
=>
"a value"
,
...
...
@@ -3488,9 +3488,8 @@ fn report_conflict(&self,
},
};
let
span
=
old_binding
.span
.unwrap
();
if
span
!=
codemap
::
DUMMY_SP
{
err
.span_note
(
span
,
&
format!
(
"previous {} of `{}` here"
,
noun
,
name
));
if
old_binding
.span
!=
codemap
::
DUMMY_SP
{
err
.span_note
(
old_binding
.span
,
&
format!
(
"previous {} of `{}` here"
,
noun
,
name
));
}
err
.emit
();
}
...
...
src/librustc_resolve/resolve_imports.rs
浏览文件 @
c9d8e149
...
...
@@ -26,7 +26,7 @@
use
syntax
::
ast
::{
NodeId
,
Name
};
use
syntax
::
attr
::
AttrMetaMethods
;
use
syntax
::
codemap
::
Span
;
use
syntax
::
codemap
::
{
Span
,
DUMMY_SP
}
;
use
syntax
::
util
::
lev_distance
::
find_best_match_for_name
;
use
std
::
cell
::{
Cell
,
RefCell
};
...
...
@@ -76,7 +76,7 @@ fn import(&'a self, binding: &'a NameBinding<'a>, privacy_error: Option<Box<Priv
directive
:
self
,
privacy_error
:
privacy_error
,
},
span
:
Some
(
self
.span
)
,
span
:
self
.span
,
vis
:
self
.vis
,
}
}
...
...
@@ -412,7 +412,7 @@ fn import_resolving_error(&self, e: ImportResolvingError<'b>) {
if
let
SingleImport
{
target
,
..
}
=
e
.import_directive.subclass
{
let
dummy_binding
=
self
.resolver.arenas
.alloc_name_binding
(
NameBinding
{
kind
:
NameBindingKind
::
Def
(
Def
::
Err
),
span
:
None
,
span
:
DUMMY_SP
,
vis
:
ty
::
Visibility
::
Public
,
});
let
dummy_binding
=
e
.import_directive
.import
(
dummy_binding
,
None
);
...
...
@@ -696,7 +696,7 @@ fn finalize_resolutions_in(&mut self, module: Module<'b>, report_unresolved_impo
(error E0364), consider declaring its enum as `pub`"
,
name
);
let
lint
=
lint
::
builtin
::
PRIVATE_IN_PUBLIC
;
self
.resolver.session
.add_lint
(
lint
,
directive
.id
,
binding
.span
.unwrap
()
,
msg
);
self
.resolver.session
.add_lint
(
lint
,
directive
.id
,
binding
.span
,
msg
);
}
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录