Skip to content

Commit 93704f2

Browse files
petrochenkovnikomatsakis
authored andcommitted
Add a couple more tests
1 parent e6c93e7 commit 93704f2

3 files changed

+31
-1
lines changed

src/test/ui/imports/extern-prelude-extern-crate-restricted-shadowing.rs

+9
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,13 @@ mod m {
1414
}
1515
}
1616

17+
macro_rules! define_other_core {
18+
() => {
19+
extern crate std as core;
20+
//~^ ERROR macro-expanded `extern crate` items cannot shadow names passed with `--extern`
21+
}
22+
}
23+
24+
define_other_core!();
25+
1726
fn main() {}

src/test/ui/imports/extern-prelude-extern-crate-restricted-shadowing.stderr

+10-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
error: macro-expanded `extern crate` items cannot shadow names passed with `--extern`
2+
--> $DIR/extern-prelude-extern-crate-restricted-shadowing.rs:19:9
3+
|
4+
LL | extern crate std as core;
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^
6+
...
7+
LL | define_other_core!();
8+
| --------------------- in this macro invocation
9+
110
error[E0659]: `Vec` is ambiguous (macro-expanded name vs less macro-expanded name from outer scope during import/macro resolution)
211
--> $DIR/extern-prelude-extern-crate-restricted-shadowing.rs:13:9
312
|
@@ -14,6 +23,6 @@ LL | extern crate std as Vec;
1423
LL | define_vec!();
1524
| -------------- in this macro invocation
1625

17-
error: aborting due to previous error
26+
error: aborting due to 2 previous errors
1827

1928
For more information about this error, try `rustc --explain E0659`.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// compile-pass
2+
// aux-build:two_macros.rs
3+
4+
extern crate two_macros as core;
5+
6+
mod m {
7+
fn check() {
8+
core::m!(); // OK
9+
}
10+
}
11+
12+
fn main() {}

0 commit comments

Comments
 (0)