diff options
Diffstat (limited to 'tests/ui/attributes')
| -rw-r--r-- | tests/ui/attributes/fn-align-nameres-ambiguity-143834.rs | 10 | ||||
| -rw-r--r-- | tests/ui/attributes/fn-align-nameres-ambiguity-143834.stderr | 22 | ||||
| -rw-r--r-- | tests/ui/attributes/malformed-fn-align.rs | 17 | ||||
| -rw-r--r-- | tests/ui/attributes/malformed-fn-align.stderr | 62 |
4 files changed, 46 insertions, 65 deletions
diff --git a/tests/ui/attributes/fn-align-nameres-ambiguity-143834.rs b/tests/ui/attributes/fn-align-nameres-ambiguity-143834.rs index 5629f92c468..536d6ff43fb 100644 --- a/tests/ui/attributes/fn-align-nameres-ambiguity-143834.rs +++ b/tests/ui/attributes/fn-align-nameres-ambiguity-143834.rs @@ -1,21 +1,19 @@ -//~ 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. +// +// See https://github.com/rust-lang/rust/issues/143834. + +//@ check-pass // 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 deleted file mode 100644 index 304537173a8..00000000000 --- a/tests/ui/attributes/fn-align-nameres-ambiguity-143834.stderr +++ /dev/null @@ -1,22 +0,0 @@ -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`. diff --git a/tests/ui/attributes/malformed-fn-align.rs b/tests/ui/attributes/malformed-fn-align.rs index f5ab9555e56..da5284fd4bd 100644 --- a/tests/ui/attributes/malformed-fn-align.rs +++ b/tests/ui/attributes/malformed-fn-align.rs @@ -1,25 +1,30 @@ +// ignore-tidy-linelength + +// FIXME(#82232, #143834): temporarily renamed to mitigate `#[align]` nameres ambiguity +#![feature(rustc_attrs)] #![feature(fn_align)] + #![crate_type = "lib"] trait MyTrait { - #[align] //~ ERROR malformed `align` attribute input + #[rustc_align] //~ ERROR malformed `rustc_align` attribute input fn myfun1(); - #[align(1, 2)] //~ ERROR malformed `align` attribute input + #[rustc_align(1, 2)] //~ ERROR malformed `rustc_align` attribute input fn myfun2(); } -#[align = 16] //~ ERROR malformed `align` attribute input +#[rustc_align = 16] //~ ERROR malformed `rustc_align` attribute input fn f1() {} -#[align("hello")] //~ ERROR invalid alignment value: not an unsuffixed integer +#[rustc_align("hello")] //~ ERROR invalid alignment value: not an unsuffixed integer fn f2() {} -#[align(0)] //~ ERROR invalid alignment value: not a power of two +#[rustc_align(0)] //~ ERROR invalid alignment value: not a power of two fn f3() {} #[repr(align(16))] //~ ERROR `#[repr(align(...))]` is not supported on function items fn f4() {} -#[align(16)] //~ ERROR `#[align(...)]` is not supported on struct items +#[rustc_align(16)] //~ ERROR `#[rustc_align(...)]` is not supported on struct items struct S1; diff --git a/tests/ui/attributes/malformed-fn-align.stderr b/tests/ui/attributes/malformed-fn-align.stderr index b769d0b457d..c5986efaa34 100644 --- a/tests/ui/attributes/malformed-fn-align.stderr +++ b/tests/ui/attributes/malformed-fn-align.stderr @@ -1,63 +1,63 @@ -error[E0539]: malformed `align` attribute input - --> $DIR/malformed-fn-align.rs:5:5 +error[E0539]: malformed `rustc_align` attribute input + --> $DIR/malformed-fn-align.rs:10:5 | -LL | #[align] - | ^^^^^^^^ +LL | #[rustc_align] + | ^^^^^^^^^^^^^^ | | | expected this to be a list - | help: must be of the form: `#[align(<alignment in bytes>)]` + | help: must be of the form: `#[rustc_align(<alignment in bytes>)]` -error[E0805]: malformed `align` attribute input - --> $DIR/malformed-fn-align.rs:8:5 +error[E0805]: malformed `rustc_align` attribute input + --> $DIR/malformed-fn-align.rs:13:5 | -LL | #[align(1, 2)] - | ^^^^^^^------^ - | | | - | | expected a single argument here - | help: must be of the form: `#[align(<alignment in bytes>)]` +LL | #[rustc_align(1, 2)] + | ^^^^^^^^^^^^^------^ + | | | + | | expected a single argument here + | help: must be of the form: `#[rustc_align(<alignment in bytes>)]` -error[E0539]: malformed `align` attribute input - --> $DIR/malformed-fn-align.rs:12:1 +error[E0539]: malformed `rustc_align` attribute input + --> $DIR/malformed-fn-align.rs:17:1 | -LL | #[align = 16] - | ^^^^^^^^^^^^^ +LL | #[rustc_align = 16] + | ^^^^^^^^^^^^^^^^^^^ | | | expected this to be a list - | help: must be of the form: `#[align(<alignment in bytes>)]` + | help: must be of the form: `#[rustc_align(<alignment in bytes>)]` error[E0589]: invalid alignment value: not an unsuffixed integer - --> $DIR/malformed-fn-align.rs:15:9 + --> $DIR/malformed-fn-align.rs:20:15 | -LL | #[align("hello")] - | ^^^^^^^ +LL | #[rustc_align("hello")] + | ^^^^^^^ error[E0589]: invalid alignment value: not a power of two - --> $DIR/malformed-fn-align.rs:18:9 + --> $DIR/malformed-fn-align.rs:23:15 | -LL | #[align(0)] - | ^ +LL | #[rustc_align(0)] + | ^ error: `#[repr(align(...))]` is not supported on function items - --> $DIR/malformed-fn-align.rs:21:8 + --> $DIR/malformed-fn-align.rs:26:8 | LL | #[repr(align(16))] | ^^^^^^^^^ | -help: use `#[align(...)]` instead - --> $DIR/malformed-fn-align.rs:21:8 +help: use `#[rustc_align(...)]` instead + --> $DIR/malformed-fn-align.rs:26:8 | LL | #[repr(align(16))] | ^^^^^^^^^ -error: `#[align(...)]` is not supported on struct items - --> $DIR/malformed-fn-align.rs:24:1 +error: `#[rustc_align(...)]` is not supported on struct items + --> $DIR/malformed-fn-align.rs:29:1 | -LL | #[align(16)] - | ^^^^^^^^^^^^ +LL | #[rustc_align(16)] + | ^^^^^^^^^^^^^^^^^^ | help: use `#[repr(align(...))]` instead | -LL - #[align(16)] +LL - #[rustc_align(16)] LL + #[repr(align(16))] | |
