Skip to content

Commit b2e94bf

Browse files
committed
Add test demonstrating current beta #[align] name resolution regression
See RUST-143834.
1 parent 8231065 commit b2e94bf

File tree

2 files changed

+43
-0
lines changed

2 files changed

+43
-0
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
//~ NOTE `align` could refer to a built-in attribute
2+
3+
// Anti-regression test to demonstrate that at least we mitigated breakage from adding a new
4+
// `#[align]` built-in attribute.
5+
6+
// Needs edition >= 2018 macro use behavior.
7+
//@ edition: 2018
8+
9+
macro_rules! align {
10+
//~^ NOTE `align` could also refer to the macro defined here
11+
() => {
12+
/* .. */
13+
};
14+
}
15+
16+
pub(crate) use align;
17+
//~^ ERROR `align` is ambiguous
18+
//~| NOTE ambiguous name
19+
//~| NOTE ambiguous because of a name conflict with a builtin attribute
20+
21+
fn main() {}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
error[E0659]: `align` is ambiguous
2+
--> $DIR/fn-align-nameres-ambiguity-143834.rs:16:16
3+
|
4+
LL | pub(crate) use align;
5+
| ^^^^^ ambiguous name
6+
|
7+
= note: ambiguous because of a name conflict with a builtin attribute
8+
= note: `align` could refer to a built-in attribute
9+
note: `align` could also refer to the macro defined here
10+
--> $DIR/fn-align-nameres-ambiguity-143834.rs:9:1
11+
|
12+
LL | / macro_rules! align {
13+
LL | |
14+
LL | | () => {
15+
LL | | /* .. */
16+
LL | | };
17+
LL | | }
18+
| |_^
19+
20+
error: aborting due to 1 previous error
21+
22+
For more information about this error, try `rustc --explain E0659`.

0 commit comments

Comments
 (0)