Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
61181aee
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,发现更多精彩内容 >>
提交
61181aee
编写于
12月 17, 2017
作者:
E
Esteban Küber
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Point at def span on redefined name diagnostic
上级
3cc68bac
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
25 addition
and
30 deletion
+25
-30
src/librustc_resolve/lib.rs
src/librustc_resolve/lib.rs
+3
-3
src/test/ui/blind-item-item-shadow.stderr
src/test/ui/blind-item-item-shadow.stderr
+1
-1
src/test/ui/enum-and-module-in-same-scope.stderr
src/test/ui/enum-and-module-in-same-scope.stderr
+5
-10
src/test/ui/issue-19498.stderr
src/test/ui/issue-19498.stderr
+3
-3
src/test/ui/issue-21546.stderr
src/test/ui/issue-21546.stderr
+8
-8
src/test/ui/issue-24081.stderr
src/test/ui/issue-24081.stderr
+4
-4
src/test/ui/resolve-conflict-item-vs-import.stderr
src/test/ui/resolve-conflict-item-vs-import.stderr
+1
-1
未找到文件。
src/librustc_resolve/lib.rs
浏览文件 @
61181aee
...
...
@@ -3840,7 +3840,7 @@ fn report_conflict<'b>(&mut self,
false
=>
"defined"
,
};
let
(
name
,
span
)
=
(
ident
.name
,
new_binding
.span
);
let
(
name
,
span
)
=
(
ident
.name
,
self
.session
.codemap
()
.def_span
(
new_binding
.span
)
);
if
let
Some
(
s
)
=
self
.name_already_seen
.get
(
&
name
)
{
if
s
==
&
span
{
...
...
@@ -3885,8 +3885,8 @@ fn report_conflict<'b>(&mut self,
err
.span_label
(
span
,
format!
(
"`{}` re{} here"
,
name
,
new_participle
));
if
old_binding
.span
!=
syntax_pos
::
DUMMY_SP
{
err
.span_label
(
old_binding
.span
,
format!
(
"previous {} of the {} `{}` here"
,
old_noun
,
old_kind
,
name
));
err
.span_label
(
self
.session
.codemap
()
.def_span
(
old_binding
.span
)
,
format!
(
"previous {} of the {} `{}` here"
,
old_noun
,
old_kind
,
name
));
}
// See https://github.com/rust-lang/rust/issues/32354
...
...
src/test/ui/blind-item-item-shadow.stderr
浏览文件 @
61181aee
...
...
@@ -2,7 +2,7 @@ error[E0255]: the name `foo` is defined multiple times
--> $DIR/blind-item-item-shadow.rs:13:5
|
11 | mod foo { pub mod foo { } }
| -------
---------------------
previous definition of the module `foo` here
| ------- previous definition of the module `foo` here
12 |
13 | use foo::foo;
| ^^^^^^^^ `foo` reimported here
...
...
src/test/ui/enum-and-module-in-same-scope.stderr
浏览文件 @
61181aee
error[E0428]: the name `Foo` is defined multiple times
--> $DIR/enum-and-module-in-same-scope.rs:15:1
|
11 | / enum Foo {
12 | | X
13 | | }
| |_- previous definition of the type `Foo` here
14 |
15 | / mod Foo { //~ ERROR the name `Foo` is defined multiple times
16 | | pub static X: isize = 42;
17 | | fn f() { f() } // Check that this does not result in a resolution error
18 | | }
| |_^ `Foo` redefined here
11 | enum Foo {
| -------- previous definition of the type `Foo` here
...
15 | mod Foo { //~ ERROR the name `Foo` is defined multiple times
| ^^^^^^^ `Foo` redefined here
|
= note: `Foo` must be defined only once in the type namespace of this module
...
...
src/test/ui/issue-19498.stderr
浏览文件 @
61181aee
...
...
@@ -5,7 +5,7 @@ error[E0255]: the name `A` is defined multiple times
| ------- previous import of the module `A` here
12 | use self::B;
13 | mod A {} //~ ERROR the name `A` is defined multiple times
| ^^^^^
^^^
`A` redefined here
| ^^^^^ `A` redefined here
|
= note: `A` must be defined only once in the type namespace of this module
help: You can use `as` to change the binding name of the import
...
...
@@ -20,7 +20,7 @@ error[E0255]: the name `B` is defined multiple times
| ------- previous import of the module `B` here
...
15 | pub mod B {} //~ ERROR the name `B` is defined multiple times
| ^^^^^^^^^
^^^
`B` redefined here
| ^^^^^^^^^ `B` redefined here
|
= note: `B` must be defined only once in the type namespace of this module
help: You can use `as` to change the binding name of the import
...
...
@@ -34,7 +34,7 @@ error[E0255]: the name `D` is defined multiple times
18 | use C::D;
| ---- previous import of the module `D` here
19 | mod D {} //~ ERROR the name `D` is defined multiple times
| ^^^^^
^^^
`D` redefined here
| ^^^^^ `D` redefined here
|
= note: `D` must be defined only once in the type namespace of this module
help: You can use `as` to change the binding name of the import
...
...
src/test/ui/issue-21546.stderr
浏览文件 @
61181aee
...
...
@@ -2,7 +2,7 @@ error[E0428]: the name `Foo` is defined multiple times
--> $DIR/issue-21546.rs:17:1
|
14 | mod Foo { }
| -------
----
previous definition of the module `Foo` here
| ------- previous definition of the module `Foo` here
...
17 | struct Foo;
| ^^^^^^^^^^^ `Foo` redefined here
...
...
@@ -13,7 +13,7 @@ error[E0428]: the name `Bar` is defined multiple times
--> $DIR/issue-21546.rs:24:1
|
21 | mod Bar { }
| -------
----
previous definition of the module `Bar` here
| ------- previous definition of the module `Bar` here
...
24 | struct Bar(i32);
| ^^^^^^^^^^^^^^^^ `Bar` redefined here
...
...
@@ -27,7 +27,7 @@ error[E0428]: the name `Baz` is defined multiple times
| ---------------- previous definition of the type `Baz` here
...
32 | mod Baz { }
| ^^^^^^^
^^^^
`Baz` redefined here
| ^^^^^^^ `Baz` redefined here
|
= note: `Baz` must be defined only once in the type namespace of this module
...
...
@@ -35,10 +35,10 @@ error[E0428]: the name `Qux` is defined multiple times
--> $DIR/issue-21546.rs:40:1
|
37 | struct Qux { x: bool }
| ----------
------------
previous definition of the type `Qux` here
| ---------- previous definition of the type `Qux` here
...
40 | mod Qux { }
| ^^^^^^^
^^^^
`Qux` redefined here
| ^^^^^^^ `Qux` redefined here
|
= note: `Qux` must be defined only once in the type namespace of this module
...
...
@@ -49,7 +49,7 @@ error[E0428]: the name `Quux` is defined multiple times
| ------------ previous definition of the type `Quux` here
...
48 | mod Quux { }
| ^^^^^^^^
^^^^
`Quux` redefined here
| ^^^^^^^^ `Quux` redefined here
|
= note: `Quux` must be defined only once in the type namespace of this module
...
...
@@ -57,10 +57,10 @@ error[E0428]: the name `Corge` is defined multiple times
--> $DIR/issue-21546.rs:56:1
|
53 | enum Corge { A, B }
| ----------
---------
previous definition of the type `Corge` here
| ---------- previous definition of the type `Corge` here
...
56 | mod Corge { }
| ^^^^^^^^^
^^^^
`Corge` redefined here
| ^^^^^^^^^ `Corge` redefined here
|
= note: `Corge` must be defined only once in the type namespace of this module
...
...
src/test/ui/issue-24081.stderr
浏览文件 @
61181aee
...
...
@@ -20,7 +20,7 @@ error[E0255]: the name `Sub` is defined multiple times
| ------------- previous import of the trait `Sub` here
...
19 | struct Sub { x: f32 } //~ ERROR the name `Sub` is defined multiple times
| ^^^^^^^^^^
^^^^^^^^^^^
`Sub` redefined here
| ^^^^^^^^^^ `Sub` redefined here
|
= note: `Sub` must be defined only once in the type namespace of this module
help: You can use `as` to change the binding name of the import
...
...
@@ -35,7 +35,7 @@ error[E0255]: the name `Mul` is defined multiple times
| ------------- previous import of the trait `Mul` here
...
21 | enum Mul { A, B } //~ ERROR the name `Mul` is defined multiple times
| ^^^^^^^^
^^^^^^^^^
`Mul` redefined here
| ^^^^^^^^ `Mul` redefined here
|
= note: `Mul` must be defined only once in the type namespace of this module
help: You can use `as` to change the binding name of the import
...
...
@@ -50,7 +50,7 @@ error[E0255]: the name `Div` is defined multiple times
| ------------- previous import of the trait `Div` here
...
23 | mod Div { } //~ ERROR the name `Div` is defined multiple times
| ^^^^^^^
^^^^
`Div` redefined here
| ^^^^^^^ `Div` redefined here
|
= note: `Div` must be defined only once in the type namespace of this module
help: You can use `as` to change the binding name of the import
...
...
@@ -65,7 +65,7 @@ error[E0255]: the name `Rem` is defined multiple times
| ------------- previous import of the trait `Rem` here
...
25 | trait Rem { } //~ ERROR the name `Rem` is defined multiple times
| ^^^^^^^^^
^^^^^
`Rem` redefined here
| ^^^^^^^^^ `Rem` redefined here
|
= note: `Rem` must be defined only once in the type namespace of this module
help: You can use `as` to change the binding name of the import
...
...
src/test/ui/resolve-conflict-item-vs-import.stderr
浏览文件 @
61181aee
...
...
@@ -5,7 +5,7 @@ error[E0255]: the name `transmute` is defined multiple times
| ------------------- previous import of the value `transmute` here
12 |
13 | fn transmute() {}
| ^^^^^^^^^^^^^^
^^^
`transmute` redefined here
| ^^^^^^^^^^^^^^ `transmute` redefined here
|
= note: `transmute` must be defined only once in the value namespace of this module
help: You can use `as` to change the binding name of the import
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录