diff --git a/tests/ui/imports/ambiguous-reachable.rs b/tests/ui/imports/ambiguous-reachable.rs new file mode 100644 index 000000000000..1ca31c402ae6 --- /dev/null +++ b/tests/ui/imports/ambiguous-reachable.rs @@ -0,0 +1,10 @@ +//@ build-fail +//@ aux-crate: ambiguous_reachable_extern=ambiguous-reachable-extern.rs + +#![allow(ambiguous_glob_imports)] + +fn main() { + ambiguous_reachable_extern::generic::(); +} + +//~? ERROR missing optimized MIR diff --git a/tests/ui/imports/ambiguous-reachable.stderr b/tests/ui/imports/ambiguous-reachable.stderr new file mode 100644 index 000000000000..5ba00970a23a --- /dev/null +++ b/tests/ui/imports/ambiguous-reachable.stderr @@ -0,0 +1,31 @@ +error: missing optimized MIR for `ambiguous_reachable_extern::m1::generic::` in the crate `ambiguous_reachable_extern` + | +note: missing optimized MIR for this item (was the crate `ambiguous_reachable_extern` compiled with `--emit=metadata`?) + --> $DIR/auxiliary/ambiguous-reachable-extern.rs:2:5 + | +LL | pub fn generic() { + | ^^^^^^^^^^^^^^^^^^^ + +error: aborting due to 1 previous error + +Future incompatibility report: Future breakage diagnostic: +warning: `generic` is ambiguous + --> $DIR/ambiguous-reachable.rs:7:33 + | +LL | ambiguous_reachable_extern::generic::(); + | ^^^^^^^ ambiguous name + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #114095 + = note: ambiguous because of multiple glob imports of a name in the same module +note: `generic` could refer to the function defined here + --> $DIR/auxiliary/ambiguous-reachable-extern.rs:13:9 + | +LL | pub use m1::*; + | ^^ +note: `generic` could also refer to the function defined here + --> $DIR/auxiliary/ambiguous-reachable-extern.rs:14:9 + | +LL | pub use m2::*; + | ^^ + diff --git a/tests/ui/imports/auxiliary/ambiguous-reachable-extern.rs b/tests/ui/imports/auxiliary/ambiguous-reachable-extern.rs new file mode 100644 index 000000000000..af81812560e3 --- /dev/null +++ b/tests/ui/imports/auxiliary/ambiguous-reachable-extern.rs @@ -0,0 +1,14 @@ +mod m1 { + pub fn generic() { + let x = 10; + let y = 11; + println!("hello {x} world {:?}", y); + } +} + +mod m2 { + pub fn generic() {} +} + +pub use m1::*; +pub use m2::*;