Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
834fb17e
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,发现更多精彩内容 >>
提交
834fb17e
编写于
1月 06, 2016
作者:
J
Jeffrey Seyfried
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix bug in duplicate checking for extern crates.
上级
41611bae
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
22 addition
and
13 deletion
+22
-13
src/librustc_resolve/build_reduced_graph.rs
src/librustc_resolve/build_reduced_graph.rs
+1
-1
src/librustc_resolve/lib.rs
src/librustc_resolve/lib.rs
+21
-12
未找到文件。
src/librustc_resolve/build_reduced_graph.rs
浏览文件 @
834fb17e
...
...
@@ -325,7 +325,7 @@ fn build_reduced_graph_for_item(&mut self, item: &Item, parent: &Rc<Module>) ->
debug!
(
"(build reduced graph for item) found extern `{}`"
,
module_to_string
(
&*
external_module
));
self
.check_for_conflicts_
between_external_crates
(
&**
parent
,
name
,
sp
);
self
.check_for_conflicts_
for_external_crate
(
&
parent
,
name
,
sp
);
parent
.external_module_children
.borrow_mut
()
.insert
(
name
,
external_module
.clone
());
...
...
src/librustc_resolve/lib.rs
浏览文件 @
834fb17e
...
...
@@ -122,6 +122,8 @@ enum SuggestionType {
}
pub
enum
ResolutionError
<
'a
>
{
/// error E0260: name conflicts with an extern crate
NameConflictsWithExternCrate
(
Name
),
/// error E0401: can't use type parameters from outer function
TypeParametersFromOuterFunction
,
/// error E0402: cannot use an outer type parameter in this context
...
...
@@ -228,6 +230,14 @@ fn resolve_struct_error<'b, 'a: 'b, 'tcx: 'a>(resolver: &'b Resolver<'a, 'tcx>,
}
match
resolution_error
{
ResolutionError
::
NameConflictsWithExternCrate
(
name
)
=>
{
struct_span_err!
(
resolver
.session
,
span
,
E0260
,
"the name `{}` conflicts with an external crate
\
that has been imported into this module"
,
name
)
}
ResolutionError
::
TypeParametersFromOuterFunction
=>
{
struct_span_err!
(
resolver
.session
,
span
,
...
...
@@ -1292,12 +1302,8 @@ fn get_trait_name(&self, did: DefId) -> Name {
}
}
/// Checks that the names of external crates don't collide with other
/// external crates.
fn
check_for_conflicts_between_external_crates
(
&
self
,
module
:
&
Module
,
name
:
Name
,
span
:
Span
)
{
/// Check that an external crate doesn't collide with items or other external crates.
fn
check_for_conflicts_for_external_crate
(
&
self
,
module
:
&
Module
,
name
:
Name
,
span
:
Span
)
{
if
module
.external_module_children
.borrow
()
.contains_key
(
&
name
)
{
span_err!
(
self
.session
,
span
,
...
...
@@ -1305,6 +1311,14 @@ fn check_for_conflicts_between_external_crates(&self,
"an external crate named `{}` has already been imported into this module"
,
name
);
}
match
module
.children
.borrow
()
.get
(
&
name
)
{
Some
(
name_bindings
)
if
name_bindings
.type_ns
.defined
()
=>
{
resolve_error
(
self
,
name_bindings
.type_ns
.span
()
.unwrap_or
(
codemap
::
DUMMY_SP
),
ResolutionError
::
NameConflictsWithExternCrate
(
name
));
}
_
=>
{},
}
}
/// Checks that the names of items don't collide with external crates.
...
...
@@ -1313,12 +1327,7 @@ fn check_for_conflicts_between_external_crates_and_items(&self,
name
:
Name
,
span
:
Span
)
{
if
module
.external_module_children
.borrow
()
.contains_key
(
&
name
)
{
span_err!
(
self
.session
,
span
,
E0260
,
"the name `{}` conflicts with an external crate that has been imported
\
into this module"
,
name
);
resolve_error
(
self
,
span
,
ResolutionError
::
NameConflictsWithExternCrate
(
name
));
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录