item_like_imports: Can "ambiguity error" items be reexported? #36837
Open
Description
opened on Sep 29, 2016
Is the next code well formed or not?
#![feature(item_like_imports)]
mod ty1 {
pub type A = u8;
}
mod ty2 {
pub type A = u8;
}
mod ambig {
// Create an ambiguity item in type namespace.
pub use ty1::*;
pub use ty2::*;
}
mod merge {
pub use ambig::*; // <- reexports an ambiguity error, or reexports nothing?
pub use ty1::*; // <- does this contribute to the ambiguity error or create a valid name?
}
fn main() {
let _: merge::A; // <- Valid or an ambiguity error?
}
Currently the behavior of this code depends on whether the "merge" step is done in the same crate or in some other crate.
In a single crate scenario the snippet above fails to compile with A is ambiguous
error.
If merge
is moved to another crate, then all erroneous resolutions are filtered away and are not represented in metadata, pub use ambig::*
becomes an empty import and merge::A
unambiguously means ty1::A
.
Supposedly, local and cross-crate behavior should be the same.
cc @jseyfried @nrc
Activity