Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Glob import with auto-derive #75061

Closed
truchi opened this issue Aug 2, 2020 · 2 comments
Closed

Glob import with auto-derive #75061

truchi opened this issue Aug 2, 2020 · 2 comments
Labels
A-resolve Area: Path resolution C-bug Category: This is a bug. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@truchi
Copy link

truchi commented Aug 2, 2020

I tried this code:

#[derive(Copy, Clone)] // Or anything really...
pub enum A {
    A,
    B,
}
pub use A::*; // `A` is ambiguous

I expected this code to work the same as:

pub enum A {
    A,
    B,
}
impl Copy for A {}
impl Clone for A {
    fn clone(&self) -> A { *self }
}
pub use A::*; // No issue here

Instead, this happened: 😢

Meta

rustc --version --verbose: (Same on stable btw)

binary: rustc
commit-hash: 6c8927b0cf80ceee19386026cf9d7fd4fd9d486f
commit-date: 2020-07-26
host: x86_64-unknown-linux-gnu
release: 1.47.0-nightly
LLVM version: 10.0

Backtrace

error[E0659]: `A` is ambiguous (glob import vs macro-expanded name in the same module during import/macro resolution)
 --> src/main.rs:6:9
  |
6 | pub use A::*;
  |         ^ ambiguous name
  |
note: `A` could refer to the enum defined here
 --> src/main.rs:2:1
  |
2 | / pub enum A {
3 | |     A,
4 | |     B,
5 | | }
  | |_^
note: `A` could also refer to the variant imported here
 --> src/main.rs:6:9
  |
6 | pub use A::*;
  |         ^^^^
  = help: consider adding an explicit import of `A` to disambiguate

error: aborting due to previous error

Question on users

Hope this helps!
Below 20 IQ Rust noob

❤️

@truchi truchi added the C-bug Category: This is a bug. label Aug 2, 2020
@Mark-Simulacrum Mark-Simulacrum added the A-resolve Area: Path resolution label Aug 2, 2020
@JohnTitor JohnTitor added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Aug 6, 2020
@SNCPlay42
Copy link
Contributor

This is a duplicate of #62769

@Dylan-DPC
Copy link
Member

Closing this as duplicate

@Dylan-DPC Dylan-DPC closed this as not planned Won't fix, can't repro, duplicate, stale Apr 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-resolve Area: Path resolution C-bug Category: This is a bug. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

5 participants