-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
A-resolveArea: Name/path resolution done by `rustc_resolve` specificallyArea: Name/path resolution done by `rustc_resolve` specifically
Milestone
Description
Here is some code (derived from something I actually saw recently in rustc):
pub mod a {
pub enum E {
A,
B,
#[cfg(show_bug)] C(int),
}
pub mod b {
pub fn key(e: ::a::E) -> StrBuf {
match e {
A => "A",
B => "B",
#[cfg(show_bug)] C(_) => "C",
}.to_strbuf()
}
}
}
fn main() {
println!("Hello World {}", a::b::key(a::A));
}
Now the bug:
% rustc /tmp/e.rs && ./e
Hello World A
% rustc --cfg show_bug /tmp/e.rs && ./e
/tmp/e.rs:12:34: 12:35 error: unresolved enum variant, struct or const `C`
/tmp/e.rs:12 #[cfg(show_bug)] C(_) => "C",
^
error: aborting due to previous error
(The workaround is to explicitly import the enum variant with the field. It does not suffice to just do use a::EnumType
; see comments below.)
Metadata
Metadata
Assignees
Labels
A-resolveArea: Name/path resolution done by `rustc_resolve` specificallyArea: Name/path resolution done by `rustc_resolve` specifically