Skip to content

Commit 3774cf2

Browse files
committed
Fix tests/ui/issues/issue-7663.rs
Fixes #140780
1 parent a350eb3 commit 3774cf2

File tree

3 files changed

+76
-32
lines changed

3 files changed

+76
-32
lines changed

tests/ui/issues/issue-7663.rs

Lines changed: 0 additions & 32 deletions
This file was deleted.

tests/ui/resolve/issue-7663.rs

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
#![allow(unused_imports, dead_code)]
2+
3+
mod test1 {
4+
mod foo {
5+
pub struct P;
6+
}
7+
8+
mod bar {
9+
pub struct P;
10+
}
11+
12+
pub mod baz {
13+
use test1::foo::*;
14+
use test1::bar::*;
15+
16+
pub fn f() {
17+
let _ = P; //~ ERROR `P` is ambiguous
18+
}
19+
}
20+
}
21+
22+
mod test2 {
23+
mod foo {
24+
pub struct P;
25+
}
26+
27+
mod bar {
28+
pub struct P;
29+
}
30+
31+
pub mod baz {
32+
use test2::foo::P;
33+
use test2::bar::P; //~ ERROR the name `P` is defined multiple times
34+
}
35+
}
36+
37+
fn main() {
38+
}

tests/ui/resolve/issue-7663.stderr

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
error[E0252]: the name `P` is defined multiple times
2+
--> $DIR/issue-7663.rs:33:13
3+
|
4+
LL | use test2::foo::P;
5+
| ------------- previous import of the type `P` here
6+
LL | use test2::bar::P;
7+
| ^^^^^^^^^^^^^ `P` reimported here
8+
|
9+
= note: `P` must be defined only once in the type namespace of this module
10+
help: you can use `as` to change the binding name of the import
11+
|
12+
LL | use test2::bar::P as OtherP;
13+
| +++++++++
14+
15+
error[E0659]: `P` is ambiguous
16+
--> $DIR/issue-7663.rs:17:21
17+
|
18+
LL | let _ = P;
19+
| ^ ambiguous name
20+
|
21+
= note: ambiguous because of multiple glob imports of a name in the same module
22+
note: `P` could refer to the unit struct imported here
23+
--> $DIR/issue-7663.rs:13:13
24+
|
25+
LL | use test1::foo::*;
26+
| ^^^^^^^^^^^^^
27+
= help: consider adding an explicit import of `P` to disambiguate
28+
note: `P` could also refer to the unit struct imported here
29+
--> $DIR/issue-7663.rs:14:13
30+
|
31+
LL | use test1::bar::*;
32+
| ^^^^^^^^^^^^^
33+
= help: consider adding an explicit import of `P` to disambiguate
34+
35+
error: aborting due to 2 previous errors
36+
37+
Some errors have detailed explanations: E0252, E0659.
38+
For more information about an error, try `rustc --explain E0252`.

0 commit comments

Comments
 (0)