Skip to content

Commit e1bd8d7

Browse files
Rollup merge of #144189 - lqd:test-144168, r=petrochenkov
Add non-regression test for #144168 This is a non-regression test for issue #144168, reduced from `zerocopy`, to go with #144172 since it had no test yet, and we didn't want to delay it from landing. Closes #144168 I've checked that the test does fail without #144172.
2 parents 8834ffe + 8f77d54 commit e1bd8d7

File tree

2 files changed

+97
-0
lines changed

2 files changed

+97
-0
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// Regression test for issue #144168 where some `_` bindings were incorrectly only allowed once per
2+
// module, failing with "error[E0428]: the name `_` is defined multiple times".
3+
4+
// This weird/complex setup is reduced from `zerocopy-0.8.25` where the issue was encountered.
5+
6+
#![crate_type = "lib"]
7+
8+
macro_rules! impl_for_transmute_from {
9+
() => {
10+
const _: () = {};
11+
};
12+
}
13+
14+
mod impls {
15+
use super::*;
16+
impl_for_transmute_from!();
17+
impl_for_transmute_from!();
18+
const _: () = todo!(); //~ ERROR: evaluation panicked
19+
const _: () = todo!(); //~ ERROR: evaluation panicked
20+
const _: () = todo!(); //~ ERROR: evaluation panicked
21+
const _: () = todo!(); //~ ERROR: evaluation panicked
22+
const _: () = todo!(); //~ ERROR: evaluation panicked
23+
}
24+
use X as Y; //~ ERROR: unresolved import
25+
use Z as W; //~ ERROR: unresolved import
26+
27+
const _: () = todo!(); //~ ERROR: evaluation panicked
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
error[E0432]: unresolved import `X`
2+
--> $DIR/underscore-bindings-disambiguators.rs:24:5
3+
|
4+
LL | use X as Y;
5+
| -^^^^^
6+
| |
7+
| no `X` in the root
8+
| help: a similar name exists in the module: `_`
9+
10+
error[E0432]: unresolved import `Z`
11+
--> $DIR/underscore-bindings-disambiguators.rs:25:5
12+
|
13+
LL | use Z as W;
14+
| -^^^^^
15+
| |
16+
| no `Z` in the root
17+
| help: a similar name exists in the module: `_`
18+
19+
error[E0080]: evaluation panicked: not yet implemented
20+
--> $DIR/underscore-bindings-disambiguators.rs:18:19
21+
|
22+
LL | const _: () = todo!();
23+
| ^^^^^^^ evaluation of `impls::_` failed here
24+
|
25+
= note: this error originates in the macro `todo` (in Nightly builds, run with -Z macro-backtrace for more info)
26+
27+
error[E0080]: evaluation panicked: not yet implemented
28+
--> $DIR/underscore-bindings-disambiguators.rs:19:19
29+
|
30+
LL | const _: () = todo!();
31+
| ^^^^^^^ evaluation of `impls::_` failed here
32+
|
33+
= note: this error originates in the macro `todo` (in Nightly builds, run with -Z macro-backtrace for more info)
34+
35+
error[E0080]: evaluation panicked: not yet implemented
36+
--> $DIR/underscore-bindings-disambiguators.rs:20:19
37+
|
38+
LL | const _: () = todo!();
39+
| ^^^^^^^ evaluation of `impls::_` failed here
40+
|
41+
= note: this error originates in the macro `todo` (in Nightly builds, run with -Z macro-backtrace for more info)
42+
43+
error[E0080]: evaluation panicked: not yet implemented
44+
--> $DIR/underscore-bindings-disambiguators.rs:21:19
45+
|
46+
LL | const _: () = todo!();
47+
| ^^^^^^^ evaluation of `impls::_` failed here
48+
|
49+
= note: this error originates in the macro `todo` (in Nightly builds, run with -Z macro-backtrace for more info)
50+
51+
error[E0080]: evaluation panicked: not yet implemented
52+
--> $DIR/underscore-bindings-disambiguators.rs:22:19
53+
|
54+
LL | const _: () = todo!();
55+
| ^^^^^^^ evaluation of `impls::_` failed here
56+
|
57+
= note: this error originates in the macro `todo` (in Nightly builds, run with -Z macro-backtrace for more info)
58+
59+
error[E0080]: evaluation panicked: not yet implemented
60+
--> $DIR/underscore-bindings-disambiguators.rs:27:15
61+
|
62+
LL | const _: () = todo!();
63+
| ^^^^^^^ evaluation of `_` failed here
64+
|
65+
= note: this error originates in the macro `todo` (in Nightly builds, run with -Z macro-backtrace for more info)
66+
67+
error: aborting due to 8 previous errors
68+
69+
Some errors have detailed explanations: E0080, E0432.
70+
For more information about an error, try `rustc --explain E0080`.

0 commit comments

Comments
 (0)