diff options
| author | Jieyou Xu <jieyouxu@outlook.com> | 2025-07-18 00:20:17 +0800 |
|---|---|---|
| committer | Josh Stone <jistone@redhat.com> | 2025-07-24 09:54:41 -0700 |
| commit | 43056c1614241ed06597a79b5e8f6464e6c8e11d (patch) | |
| tree | c4865edb2f819ec94c0630b9c091c4ec1f928376 /tests | |
| parent | 3df07a67c1d8c43d5927a409e4bb9bb417a6bf46 (diff) | |
| download | rust-43056c1614241ed06597a79b5e8f6464e6c8e11d.tar.gz rust-43056c1614241ed06597a79b5e8f6464e6c8e11d.zip | |
Add test demonstrating current beta `#[align]` name resolution regression
See RUST-143834. (cherry picked from commit b2e94bf020a99473cf80f05f410af8a5cfc486a6)
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/ui/attributes/fn-align-nameres-ambiguity-143834.rs | 21 | ||||
| -rw-r--r-- | tests/ui/attributes/fn-align-nameres-ambiguity-143834.stderr | 22 |
2 files changed, 43 insertions, 0 deletions
diff --git a/tests/ui/attributes/fn-align-nameres-ambiguity-143834.rs b/tests/ui/attributes/fn-align-nameres-ambiguity-143834.rs new file mode 100644 index 00000000000..5629f92c468 --- /dev/null +++ b/tests/ui/attributes/fn-align-nameres-ambiguity-143834.rs @@ -0,0 +1,21 @@ +//~ NOTE `align` could refer to a built-in attribute + +// Anti-regression test to demonstrate that at least we mitigated breakage from adding a new +// `#[align]` built-in attribute. + +// Needs edition >= 2018 macro use behavior. +//@ edition: 2018 + +macro_rules! align { + //~^ NOTE `align` could also refer to the macro defined here + () => { + /* .. */ + }; +} + +pub(crate) use align; +//~^ ERROR `align` is ambiguous +//~| NOTE ambiguous name +//~| NOTE ambiguous because of a name conflict with a builtin attribute + +fn main() {} diff --git a/tests/ui/attributes/fn-align-nameres-ambiguity-143834.stderr b/tests/ui/attributes/fn-align-nameres-ambiguity-143834.stderr new file mode 100644 index 00000000000..304537173a8 --- /dev/null +++ b/tests/ui/attributes/fn-align-nameres-ambiguity-143834.stderr @@ -0,0 +1,22 @@ +error[E0659]: `align` is ambiguous + --> $DIR/fn-align-nameres-ambiguity-143834.rs:16:16 + | +LL | pub(crate) use align; + | ^^^^^ ambiguous name + | + = note: ambiguous because of a name conflict with a builtin attribute + = note: `align` could refer to a built-in attribute +note: `align` could also refer to the macro defined here + --> $DIR/fn-align-nameres-ambiguity-143834.rs:9:1 + | +LL | / macro_rules! align { +LL | | +LL | | () => { +LL | | /* .. */ +LL | | }; +LL | | } + | |_^ + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0659`. |
