diff options
| author | bors <bors@rust-lang.org> | 2025-02-07 03:36:38 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2025-02-07 03:36:38 +0000 |
| commit | f37c19062c7e7dceff77eca8f70fb222e4d36590 (patch) | |
| tree | 225585d0efecf24655cd973134f4eb345dc19562 /tests | |
| parent | 942db6782f4a28c55b0b75b38fd4394d0483390f (diff) | |
| parent | b1be2d5494f20ebc9a678acbde72168660038a7f (diff) | |
| download | rust-f37c19062c7e7dceff77eca8f70fb222e4d36590.tar.gz rust-f37c19062c7e7dceff77eca8f70fb222e4d36590.zip | |
Auto merge of #136658 - matthiaskrgr:rollup-tg1vmex, r=matthiaskrgr
Rollup of 7 pull requests Successful merges: - #133925 (disallow `repr()` on invalid items) - #136069 (Simplify slice indexing in next trait solver) - #136152 (Stabilize `map_many_mut` feature) - #136219 (Misc. `rustc_hir` cleanups 🧹) - #136580 (Couple of changes to run rustc in miri) - #136636 (Couple of minor cleanups to the diagnostic infrastructure) - #136645 (Clippy subtree update) r? `@ghost` `@rustbot` modify labels: rollup
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/crashes/132391.rs | 8 | ||||
| -rw-r--r-- | tests/ui/feature-gates/feature-gate-fn_align.rs | 5 | ||||
| -rw-r--r-- | tests/ui/feature-gates/feature-gate-fn_align.stderr | 12 | ||||
| -rw-r--r-- | tests/ui/repr/attr-usage-repr.rs | 31 | ||||
| -rw-r--r-- | tests/ui/repr/attr-usage-repr.stderr | 36 |
5 files changed, 67 insertions, 25 deletions
diff --git a/tests/crashes/132391.rs b/tests/crashes/132391.rs deleted file mode 100644 index 6c8c2c3a878..00000000000 --- a/tests/crashes/132391.rs +++ /dev/null @@ -1,8 +0,0 @@ -//@ known-bug: #123291 - -trait MyTrait { - #[repr(align)] - fn myfun(); -} - -pub fn main() {} diff --git a/tests/ui/feature-gates/feature-gate-fn_align.rs b/tests/ui/feature-gates/feature-gate-fn_align.rs index ea873dba269..06784a45d76 100644 --- a/tests/ui/feature-gates/feature-gate-fn_align.rs +++ b/tests/ui/feature-gates/feature-gate-fn_align.rs @@ -2,3 +2,8 @@ #[repr(align(16))] //~ ERROR `repr(align)` attributes on functions are unstable fn requires_alignment() {} + +trait MyTrait { + #[repr(align)] //~ ERROR `repr(align)` attributes on functions are unstable + fn myfun(); +} diff --git a/tests/ui/feature-gates/feature-gate-fn_align.stderr b/tests/ui/feature-gates/feature-gate-fn_align.stderr index eec332792b7..cd9900c6051 100644 --- a/tests/ui/feature-gates/feature-gate-fn_align.stderr +++ b/tests/ui/feature-gates/feature-gate-fn_align.stderr @@ -8,6 +8,16 @@ LL | #[repr(align(16))] = help: add `#![feature(fn_align)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error: aborting due to 1 previous error +error[E0658]: `repr(align)` attributes on functions are unstable + --> $DIR/feature-gate-fn_align.rs:7:12 + | +LL | #[repr(align)] + | ^^^^^ + | + = note: see issue #82232 <https://github.com/rust-lang/rust/issues/82232> for more information + = help: add `#![feature(fn_align)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date + +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0658`. diff --git a/tests/ui/repr/attr-usage-repr.rs b/tests/ui/repr/attr-usage-repr.rs index dc0d4f5be2e..d8515a12e05 100644 --- a/tests/ui/repr/attr-usage-repr.rs +++ b/tests/ui/repr/attr-usage-repr.rs @@ -16,18 +16,39 @@ struct SSimd([f64; 2]); struct SInt(f64, f64); #[repr(C)] -enum EExtern { A, B } +enum EExtern { + A, + B, +} #[repr(align(8))] -enum EAlign { A, B } +enum EAlign { + A, + B, +} #[repr(packed)] //~ ERROR: attribute should be applied to a struct -enum EPacked { A, B } +enum EPacked { + A, + B, +} #[repr(simd)] //~ ERROR: attribute should be applied to a struct -enum ESimd { A, B } +enum ESimd { + A, + B, +} #[repr(i8)] -enum EInt { A, B } +enum EInt { + A, + B, +} + +#[repr()] //~ attribute should be applied to a struct, enum, function, associated function, or union [E0517] +type SirThisIsAType = i32; + +#[repr()] +struct EmptyReprArgumentList(i32); fn main() {} diff --git a/tests/ui/repr/attr-usage-repr.stderr b/tests/ui/repr/attr-usage-repr.stderr index 42f65625a46..a25e68c483f 100644 --- a/tests/ui/repr/attr-usage-repr.stderr +++ b/tests/ui/repr/attr-usage-repr.stderr @@ -15,21 +15,35 @@ LL | struct SInt(f64, f64); | ---------------------- not an enum error[E0517]: attribute should be applied to a struct or union - --> $DIR/attr-usage-repr.rs:24:8 + --> $DIR/attr-usage-repr.rs:30:8 | -LL | #[repr(packed)] - | ^^^^^^ -LL | enum EPacked { A, B } - | --------------------- not a struct or union +LL | #[repr(packed)] + | ^^^^^^ +LL | / enum EPacked { +LL | | A, +LL | | B, +LL | | } + | |_- not a struct or union error[E0517]: attribute should be applied to a struct - --> $DIR/attr-usage-repr.rs:27:8 + --> $DIR/attr-usage-repr.rs:36:8 | -LL | #[repr(simd)] - | ^^^^ -LL | enum ESimd { A, B } - | ------------------- not a struct +LL | #[repr(simd)] + | ^^^^ +LL | / enum ESimd { +LL | | A, +LL | | B, +LL | | } + | |_- not a struct -error: aborting due to 4 previous errors +error[E0517]: attribute should be applied to a struct, enum, function, associated function, or union + --> $DIR/attr-usage-repr.rs:48:1 + | +LL | #[repr()] + | ^^^^^^^^^ +LL | type SirThisIsAType = i32; + | -------------------------- not a struct, enum, function, associated function, or union + +error: aborting due to 5 previous errors For more information about this error, try `rustc --explain E0517`. |
