Closed
Description
Given the following code:
use self::A::*;
use self::B::*;
enum A {
V
}
enum B {
V
}
use V;
fn main() {}
The current output is:
Compiling playground v0.0.1 (/playground)
error[[E0659]](https://doc.rust-lang.org/nightly/error-index.html#E0659): `V` is ambiguous
--> src/main.rs:12:5
|
12 | [use V;](https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021#)
| ^ ambiguous name
|
= note: ambiguous because of multiple glob imports of a name in the same module
note: `V` could refer to the variant imported here
--> src/main.rs:1:5
|
1 | [use self::A::*;](https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021#)
| ^^^^^^^^^^
= help: consider adding an explicit import of `V` to disambiguate
note: `V` could also refer to the variant imported here
--> src/main.rs:2:5
|
2 | [use self::B::*;](https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021#)
| ^^^^^^^^^^
= help: consider adding an explicit import of `V` to disambiguate
error[[E0659]](https://doc.rust-lang.org/nightly/error-index.html#E0659): `V` is ambiguous
--> src/main.rs:12:5
|
12 | [use V;](https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021#)
| ^ ambiguous name
|
= note: ambiguous because of multiple glob imports of a name in the same module
note: `V` could refer to the unit variant imported here
--> src/main.rs:1:5
|
1 | [use self::A::*;](https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021#)
| ^^^^^^^^^^
= help: consider adding an explicit import of `V` to disambiguate
note: `V` could also refer to the unit variant imported here
--> src/main.rs:2:5
|
2 | [use self::B::*;](https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021#)
| ^^^^^^^^^^
= help: consider adding an explicit import of `V` to disambiguate
warning: unused import: `self::B::*`
--> src/main.rs:2:5
|
2 | [use self::B::*;](https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021#)
| ^^^^^^^^^^
|
= note: `#[warn(unused_imports)]` on by default
warning: unused import: `V`
--> src/main.rs:12:5
|
12 | [use V;](https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021#)
| ^
For more information about this error, try `rustc --explain E0659`.
warning: `playground` (bin "playground") generated 2 warnings
error: could not compile `playground` due to 2 previous errors; 2 warnings emitted
There are duplicated diagnostics in output, Ideally the output should look like:
error[[E0659]](https://doc.rust-lang.org/nightly/error-index.html#E0659): `V` is ambiguous
--> src/main.rs:12:5
|
12 | [use V;](https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021#)
| ^ ambiguous name
|
= note: ambiguous because of multiple glob imports of a name in the same module
note: `V` could refer to the variant imported here
--> src/main.rs:1:5
|
1 | [use self::A::*;](https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021#)
| ^^^^^^^^^^
= help: consider adding an explicit import of `V` to disambiguate
note: `V` could also refer to the variant imported here
--> src/main.rs:2:5
|
2 | [use self::B::*;](https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021#)
| ^^^^^^^^^^
= help: consider adding an explicit import of `V` to disambiguate
warning: unused import: `self::B::*`
--> src/main.rs:2:5
|
2 | [use self::B::*;](https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021#)
| ^^^^^^^^^^
|
= note: `#[warn(unused_imports)]` on by default
warning: unused import: `V`
--> src/main.rs:12:5
|
12 | [use V;](https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021#)
| ^