Skip to content

Commit f5046d5

Browse files
committed
tests: Reproduce the issue with missing MIR for ambiguous reexports
1 parent 9bc8b40 commit f5046d5

File tree

3 files changed

+55
-0
lines changed

3 files changed

+55
-0
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
//@ build-fail
2+
//@ aux-crate: ambiguous_reachable_extern=ambiguous-reachable-extern.rs
3+
4+
#![allow(ambiguous_glob_imports)]
5+
6+
fn main() {
7+
ambiguous_reachable_extern::generic::<u8>();
8+
}
9+
10+
//~? ERROR missing optimized MIR
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
error: missing optimized MIR for `ambiguous_reachable_extern::m1::generic::<u8>` in the crate `ambiguous_reachable_extern`
2+
|
3+
note: missing optimized MIR for this item (was the crate `ambiguous_reachable_extern` compiled with `--emit=metadata`?)
4+
--> $DIR/auxiliary/ambiguous-reachable-extern.rs:2:5
5+
|
6+
LL | pub fn generic<T>() {
7+
| ^^^^^^^^^^^^^^^^^^^
8+
9+
error: aborting due to 1 previous error
10+
11+
Future incompatibility report: Future breakage diagnostic:
12+
warning: `generic` is ambiguous
13+
--> $DIR/ambiguous-reachable.rs:7:33
14+
|
15+
LL | ambiguous_reachable_extern::generic::<u8>();
16+
| ^^^^^^^ ambiguous name
17+
|
18+
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
19+
= note: for more information, see issue #114095 <https://github.com/rust-lang/rust/issues/114095>
20+
= note: ambiguous because of multiple glob imports of a name in the same module
21+
note: `generic` could refer to the function defined here
22+
--> $DIR/auxiliary/ambiguous-reachable-extern.rs:13:9
23+
|
24+
LL | pub use m1::*;
25+
| ^^
26+
note: `generic` could also refer to the function defined here
27+
--> $DIR/auxiliary/ambiguous-reachable-extern.rs:14:9
28+
|
29+
LL | pub use m2::*;
30+
| ^^
31+
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
mod m1 {
2+
pub fn generic<T>() {
3+
let x = 10;
4+
let y = 11;
5+
println!("hello {x} world {:?}", y);
6+
}
7+
}
8+
9+
mod m2 {
10+
pub fn generic() {}
11+
}
12+
13+
pub use m1::*;
14+
pub use m2::*;

0 commit comments

Comments
 (0)