diff options
| author | bors <bors@rust-lang.org> | 2025-06-09 02:20:44 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2025-06-09 02:20:44 +0000 |
| commit | 334ba812755b974ecc46713fcdd38836b6182746 (patch) | |
| tree | 97733c915e4e9299e6da38942a60d2fb2645e72a /tests | |
| parent | c31cccb7b5cc098b1a8c1794ed38d7fdbec0ccb0 (diff) | |
| parent | e91f985717687e7a960121667cf7d8f8010a6cd0 (diff) | |
| download | rust-334ba812755b974ecc46713fcdd38836b6182746.tar.gz rust-334ba812755b974ecc46713fcdd38836b6182746.zip | |
Auto merge of #142220 - workingjubilee:rollup-idgfpof, r=workingjubilee
Rollup of 12 pull requests Successful merges: - rust-lang/rust#141803 (Remove rustc's notion of "preferred" alignment AKA `__alignof`) - rust-lang/rust#142053 (Add new Tier-3 targets: `loongarch32-unknown-none*`) - rust-lang/rust#142089 (Replace all uses of sysroot_candidates with get_or_default_sysroot) - rust-lang/rust#142108 (compiler: Add track_caller to AbiMapping::unwrap) - rust-lang/rust#142132 (`tests/ui`: A New Order [6/N]) - rust-lang/rust#142162 (UnsafePinned: update get() docs and signature to allow shared mutation) - rust-lang/rust#142171 (`tests/ui`: A New Order [7/N]) - rust-lang/rust#142179 (store `target.min_global_align` as an `Align`) - rust-lang/rust#142183 (Added test for 30904) - rust-lang/rust#142194 (Remove all unused feature gates from the compiler) - rust-lang/rust#142199 (Do not free disk space in the `mingw-check-tidy` job) - rust-lang/rust#142210 (Run `mingw-check-tidy` on auto builds) r? `@ghost` `@rustbot` modify labels: rollup
Diffstat (limited to 'tests')
49 files changed, 294 insertions, 450 deletions
diff --git a/tests/assembly/targets/targets-elf.rs b/tests/assembly/targets/targets-elf.rs index 32555911194..edf16548e7d 100644 --- a/tests/assembly/targets/targets-elf.rs +++ b/tests/assembly/targets/targets-elf.rs @@ -259,6 +259,12 @@ //@ revisions: i686_wrs_vxworks //@ [i686_wrs_vxworks] compile-flags: --target i686-wrs-vxworks //@ [i686_wrs_vxworks] needs-llvm-components: x86 +//@ revisions: loongarch32_unknown_none +//@ [loongarch32_unknown_none] compile-flags: --target loongarch32-unknown-none +//@ [loongarch32_unknown_none] needs-llvm-components: loongarch +//@ revisions: loongarch32_unknown_none_softfloat +//@ [loongarch32_unknown_none_softfloat] compile-flags: --target loongarch32-unknown-none-softfloat +//@ [loongarch32_unknown_none_softfloat] needs-llvm-components: loongarch //@ revisions: loongarch64_unknown_linux_gnu //@ [loongarch64_unknown_linux_gnu] compile-flags: --target loongarch64-unknown-linux-gnu //@ [loongarch64_unknown_linux_gnu] needs-llvm-components: loongarch diff --git a/tests/ui/abi/c-zst.aarch64-darwin.stderr b/tests/ui/abi/c-zst.aarch64-darwin.stderr index 48fa2bf29bc..5e09145a271 100644 --- a/tests/ui/abi/c-zst.aarch64-darwin.stderr +++ b/tests/ui/abi/c-zst.aarch64-darwin.stderr @@ -5,9 +5,8 @@ error: fn_abi_of(pass_zst) = FnAbi { ty: (), layout: Layout { size: Size(0 bytes), - align: AbiAndPrefAlign { + align: AbiAlign { abi: $SOME_ALIGN, - pref: $SOME_ALIGN, }, backend_repr: Memory { sized: true, @@ -34,9 +33,8 @@ error: fn_abi_of(pass_zst) = FnAbi { ty: (), layout: Layout { size: Size(0 bytes), - align: AbiAndPrefAlign { + align: AbiAlign { abi: $SOME_ALIGN, - pref: $SOME_ALIGN, }, backend_repr: Memory { sized: true, diff --git a/tests/ui/abi/c-zst.powerpc-linux.stderr b/tests/ui/abi/c-zst.powerpc-linux.stderr index bfdf94c9900..b8d6c632b97 100644 --- a/tests/ui/abi/c-zst.powerpc-linux.stderr +++ b/tests/ui/abi/c-zst.powerpc-linux.stderr @@ -5,9 +5,8 @@ error: fn_abi_of(pass_zst) = FnAbi { ty: (), layout: Layout { size: Size(0 bytes), - align: AbiAndPrefAlign { + align: AbiAlign { abi: $SOME_ALIGN, - pref: $SOME_ALIGN, }, backend_repr: Memory { sized: true, @@ -45,9 +44,8 @@ error: fn_abi_of(pass_zst) = FnAbi { ty: (), layout: Layout { size: Size(0 bytes), - align: AbiAndPrefAlign { + align: AbiAlign { abi: $SOME_ALIGN, - pref: $SOME_ALIGN, }, backend_repr: Memory { sized: true, diff --git a/tests/ui/abi/c-zst.s390x-linux.stderr b/tests/ui/abi/c-zst.s390x-linux.stderr index bfdf94c9900..b8d6c632b97 100644 --- a/tests/ui/abi/c-zst.s390x-linux.stderr +++ b/tests/ui/abi/c-zst.s390x-linux.stderr @@ -5,9 +5,8 @@ error: fn_abi_of(pass_zst) = FnAbi { ty: (), layout: Layout { size: Size(0 bytes), - align: AbiAndPrefAlign { + align: AbiAlign { abi: $SOME_ALIGN, - pref: $SOME_ALIGN, }, backend_repr: Memory { sized: true, @@ -45,9 +44,8 @@ error: fn_abi_of(pass_zst) = FnAbi { ty: (), layout: Layout { size: Size(0 bytes), - align: AbiAndPrefAlign { + align: AbiAlign { abi: $SOME_ALIGN, - pref: $SOME_ALIGN, }, backend_repr: Memory { sized: true, diff --git a/tests/ui/abi/c-zst.sparc64-linux.stderr b/tests/ui/abi/c-zst.sparc64-linux.stderr index bfdf94c9900..b8d6c632b97 100644 --- a/tests/ui/abi/c-zst.sparc64-linux.stderr +++ b/tests/ui/abi/c-zst.sparc64-linux.stderr @@ -5,9 +5,8 @@ error: fn_abi_of(pass_zst) = FnAbi { ty: (), layout: Layout { size: Size(0 bytes), - align: AbiAndPrefAlign { + align: AbiAlign { abi: $SOME_ALIGN, - pref: $SOME_ALIGN, }, backend_repr: Memory { sized: true, @@ -45,9 +44,8 @@ error: fn_abi_of(pass_zst) = FnAbi { ty: (), layout: Layout { size: Size(0 bytes), - align: AbiAndPrefAlign { + align: AbiAlign { abi: $SOME_ALIGN, - pref: $SOME_ALIGN, }, backend_repr: Memory { sized: true, diff --git a/tests/ui/abi/c-zst.x86_64-linux.stderr b/tests/ui/abi/c-zst.x86_64-linux.stderr index 48fa2bf29bc..5e09145a271 100644 --- a/tests/ui/abi/c-zst.x86_64-linux.stderr +++ b/tests/ui/abi/c-zst.x86_64-linux.stderr @@ -5,9 +5,8 @@ error: fn_abi_of(pass_zst) = FnAbi { ty: (), layout: Layout { size: Size(0 bytes), - align: AbiAndPrefAlign { + align: AbiAlign { abi: $SOME_ALIGN, - pref: $SOME_ALIGN, }, backend_repr: Memory { sized: true, @@ -34,9 +33,8 @@ error: fn_abi_of(pass_zst) = FnAbi { ty: (), layout: Layout { size: Size(0 bytes), - align: AbiAndPrefAlign { + align: AbiAlign { abi: $SOME_ALIGN, - pref: $SOME_ALIGN, }, backend_repr: Memory { sized: true, diff --git a/tests/ui/abi/c-zst.x86_64-pc-windows-gnu.stderr b/tests/ui/abi/c-zst.x86_64-pc-windows-gnu.stderr index bfdf94c9900..b8d6c632b97 100644 --- a/tests/ui/abi/c-zst.x86_64-pc-windows-gnu.stderr +++ b/tests/ui/abi/c-zst.x86_64-pc-windows-gnu.stderr @@ -5,9 +5,8 @@ error: fn_abi_of(pass_zst) = FnAbi { ty: (), layout: Layout { size: Size(0 bytes), - align: AbiAndPrefAlign { + align: AbiAlign { abi: $SOME_ALIGN, - pref: $SOME_ALIGN, }, backend_repr: Memory { sized: true, @@ -45,9 +44,8 @@ error: fn_abi_of(pass_zst) = FnAbi { ty: (), layout: Layout { size: Size(0 bytes), - align: AbiAndPrefAlign { + align: AbiAlign { abi: $SOME_ALIGN, - pref: $SOME_ALIGN, }, backend_repr: Memory { sized: true, diff --git a/tests/ui/abi/debug.stderr b/tests/ui/abi/debug.stderr index 480f3f04215..8ed6dedf4d5 100644 --- a/tests/ui/abi/debug.stderr +++ b/tests/ui/abi/debug.stderr @@ -5,9 +5,8 @@ error: fn_abi_of(test) = FnAbi { ty: u8, layout: Layout { size: Size(1 bytes), - align: AbiAndPrefAlign { + align: AbiAlign { abi: $SOME_ALIGN, - pref: $SOME_ALIGN, }, backend_repr: Scalar( Initialized { @@ -44,9 +43,8 @@ error: fn_abi_of(test) = FnAbi { ty: bool, layout: Layout { size: Size(1 bytes), - align: AbiAndPrefAlign { + align: AbiAlign { abi: $SOME_ALIGN, - pref: $SOME_ALIGN, }, backend_repr: Scalar( Initialized { @@ -103,9 +101,8 @@ error: fn_abi_of(TestFnPtr) = FnAbi { ty: bool, layout: Layout { size: Size(1 bytes), - align: AbiAndPrefAlign { + align: AbiAlign { abi: $SOME_ALIGN, - pref: $SOME_ALIGN, }, backend_repr: Scalar( Initialized { @@ -151,9 +148,8 @@ error: fn_abi_of(TestFnPtr) = FnAbi { ty: u8, layout: Layout { size: Size(1 bytes), - align: AbiAndPrefAlign { + align: AbiAlign { abi: $SOME_ALIGN, - pref: $SOME_ALIGN, }, backend_repr: Scalar( Initialized { @@ -201,9 +197,8 @@ error: fn_abi_of(test_generic) = FnAbi { ty: *const T, layout: Layout { size: $SOME_SIZE, - align: AbiAndPrefAlign { + align: AbiAlign { abi: $SOME_ALIGN, - pref: $SOME_ALIGN, }, backend_repr: Scalar( Initialized { @@ -241,9 +236,8 @@ error: fn_abi_of(test_generic) = FnAbi { ty: (), layout: Layout { size: Size(0 bytes), - align: AbiAndPrefAlign { + align: AbiAlign { abi: $SOME_ALIGN, - pref: $SOME_ALIGN, }, backend_repr: Memory { sized: true, @@ -288,9 +282,8 @@ error: ABIs are not compatible ty: u8, layout: Layout { size: Size(1 bytes), - align: AbiAndPrefAlign { + align: AbiAlign { abi: $SOME_ALIGN, - pref: $SOME_ALIGN, }, backend_repr: Scalar( Initialized { @@ -327,9 +320,8 @@ error: ABIs are not compatible ty: (), layout: Layout { size: Size(0 bytes), - align: AbiAndPrefAlign { + align: AbiAlign { abi: $SOME_ALIGN, - pref: $SOME_ALIGN, }, backend_repr: Memory { sized: true, @@ -362,9 +354,8 @@ error: ABIs are not compatible ty: u32, layout: Layout { size: $SOME_SIZE, - align: AbiAndPrefAlign { + align: AbiAlign { abi: $SOME_ALIGN, - pref: $SOME_ALIGN, }, backend_repr: Scalar( Initialized { @@ -401,9 +392,8 @@ error: ABIs are not compatible ty: (), layout: Layout { size: Size(0 bytes), - align: AbiAndPrefAlign { + align: AbiAlign { abi: $SOME_ALIGN, - pref: $SOME_ALIGN, }, backend_repr: Memory { sized: true, @@ -442,9 +432,8 @@ error: ABIs are not compatible ty: [u8; 32], layout: Layout { size: Size(32 bytes), - align: AbiAndPrefAlign { + align: AbiAlign { abi: $SOME_ALIGN, - pref: $SOME_ALIGN, }, backend_repr: Memory { sized: true, @@ -482,9 +471,8 @@ error: ABIs are not compatible ty: (), layout: Layout { size: Size(0 bytes), - align: AbiAndPrefAlign { + align: AbiAlign { abi: $SOME_ALIGN, - pref: $SOME_ALIGN, }, backend_repr: Memory { sized: true, @@ -517,9 +505,8 @@ error: ABIs are not compatible ty: [u32; 32], layout: Layout { size: Size(128 bytes), - align: AbiAndPrefAlign { + align: AbiAlign { abi: $SOME_ALIGN, - pref: $SOME_ALIGN, }, backend_repr: Memory { sized: true, @@ -557,9 +544,8 @@ error: ABIs are not compatible ty: (), layout: Layout { size: Size(0 bytes), - align: AbiAndPrefAlign { + align: AbiAlign { abi: $SOME_ALIGN, - pref: $SOME_ALIGN, }, backend_repr: Memory { sized: true, @@ -598,9 +584,8 @@ error: ABIs are not compatible ty: f32, layout: Layout { size: $SOME_SIZE, - align: AbiAndPrefAlign { + align: AbiAlign { abi: $SOME_ALIGN, - pref: $SOME_ALIGN, }, backend_repr: Scalar( Initialized { @@ -636,9 +621,8 @@ error: ABIs are not compatible ty: (), layout: Layout { size: Size(0 bytes), - align: AbiAndPrefAlign { + align: AbiAlign { abi: $SOME_ALIGN, - pref: $SOME_ALIGN, }, backend_repr: Memory { sized: true, @@ -671,9 +655,8 @@ error: ABIs are not compatible ty: u32, layout: Layout { size: $SOME_SIZE, - align: AbiAndPrefAlign { + align: AbiAlign { abi: $SOME_ALIGN, - pref: $SOME_ALIGN, }, backend_repr: Scalar( Initialized { @@ -710,9 +693,8 @@ error: ABIs are not compatible ty: (), layout: Layout { size: Size(0 bytes), - align: AbiAndPrefAlign { + align: AbiAlign { abi: $SOME_ALIGN, - pref: $SOME_ALIGN, }, backend_repr: Memory { sized: true, @@ -751,9 +733,8 @@ error: ABIs are not compatible ty: i32, layout: Layout { size: $SOME_SIZE, - align: AbiAndPrefAlign { + align: AbiAlign { abi: $SOME_ALIGN, - pref: $SOME_ALIGN, }, backend_repr: Scalar( Initialized { @@ -790,9 +771,8 @@ error: ABIs are not compatible ty: (), layout: Layout { size: Size(0 bytes), - align: AbiAndPrefAlign { + align: AbiAlign { abi: $SOME_ALIGN, - pref: $SOME_ALIGN, }, backend_repr: Memory { sized: true, @@ -825,9 +805,8 @@ error: ABIs are not compatible ty: u32, layout: Layout { size: $SOME_SIZE, - align: AbiAndPrefAlign { + align: AbiAlign { abi: $SOME_ALIGN, - pref: $SOME_ALIGN, }, backend_repr: Scalar( Initialized { @@ -864,9 +843,8 @@ error: ABIs are not compatible ty: (), layout: Layout { size: Size(0 bytes), - align: AbiAndPrefAlign { + align: AbiAlign { abi: $SOME_ALIGN, - pref: $SOME_ALIGN, }, backend_repr: Memory { sized: true, @@ -925,9 +903,8 @@ error: fn_abi_of(assoc_test) = FnAbi { ty: &S, layout: Layout { size: $SOME_SIZE, - align: AbiAndPrefAlign { + align: AbiAlign { abi: $SOME_ALIGN, - pref: $SOME_ALIGN, }, backend_repr: Scalar( Initialized { @@ -977,9 +954,8 @@ error: fn_abi_of(assoc_test) = FnAbi { ty: (), layout: Layout { size: Size(0 bytes), - align: AbiAndPrefAlign { + align: AbiAlign { abi: $SOME_ALIGN, - pref: $SOME_ALIGN, }, backend_repr: Memory { sized: true, diff --git a/tests/ui/abi/sysv64-zst.stderr b/tests/ui/abi/sysv64-zst.stderr index f91d1b5fa63..2233e8e4f62 100644 --- a/tests/ui/abi/sysv64-zst.stderr +++ b/tests/ui/abi/sysv64-zst.stderr @@ -5,9 +5,8 @@ error: fn_abi_of(pass_zst) = FnAbi { ty: (), layout: Layout { size: Size(0 bytes), - align: AbiAndPrefAlign { + align: AbiAlign { abi: $SOME_ALIGN, - pref: $SOME_ALIGN, }, backend_repr: Memory { sized: true, @@ -34,9 +33,8 @@ error: fn_abi_of(pass_zst) = FnAbi { ty: (), layout: Layout { size: Size(0 bytes), - align: AbiAndPrefAlign { + align: AbiAlign { abi: $SOME_ALIGN, - pref: $SOME_ALIGN, }, backend_repr: Memory { sized: true, diff --git a/tests/ui/custom_attribute.rs b/tests/ui/attributes/attr_unknown_custom_attr.rs index 4957184229d..cdbe48a636f 100644 --- a/tests/ui/custom_attribute.rs +++ b/tests/ui/attributes/attr_unknown_custom_attr.rs @@ -1,3 +1,5 @@ +//! Checks error handling for undefined custom attributes. + #![feature(stmt_expr_attributes)] #[foo] //~ ERROR cannot find attribute `foo` in this scope diff --git a/tests/ui/custom_attribute.stderr b/tests/ui/attributes/attr_unknown_custom_attr.stderr index 4023892d294..76c3b884a5d 100644 --- a/tests/ui/custom_attribute.stderr +++ b/tests/ui/attributes/attr_unknown_custom_attr.stderr @@ -1,17 +1,17 @@ error: cannot find attribute `foo` in this scope - --> $DIR/custom_attribute.rs:3:3 + --> $DIR/attr_unknown_custom_attr.rs:5:3 | LL | #[foo] | ^^^ error: cannot find attribute `foo` in this scope - --> $DIR/custom_attribute.rs:5:7 + --> $DIR/attr_unknown_custom_attr.rs:7:7 | LL | #[foo] | ^^^ error: cannot find attribute `foo` in this scope - --> $DIR/custom_attribute.rs:7:7 + --> $DIR/attr_unknown_custom_attr.rs:9:7 | LL | #[foo] | ^^^ diff --git a/tests/ui/crate-name-attr-used.rs b/tests/ui/attributes/crate-name-attr-validation.rs index 5d5a58c32c7..e27893c3d25 100644 --- a/tests/ui/crate-name-attr-used.rs +++ b/tests/ui/attributes/crate-name-attr-validation.rs @@ -1,3 +1,5 @@ +//! Checks proper validation of the `#![crate_name]` attribute. + //@ run-pass //@ compile-flags:--crate-name crate_name_attr_used -F unused-attributes diff --git a/tests/ui/crate-name-mismatch.rs b/tests/ui/attributes/crate-name-mismatch.rs index 7651e0f97eb..0c343d70b9c 100644 --- a/tests/ui/crate-name-mismatch.rs +++ b/tests/ui/attributes/crate-name-mismatch.rs @@ -1,3 +1,5 @@ +//! Checks error handling for mismatched `--crate-name` and `#![crate_name]` values. + //@ compile-flags: --crate-name foo #![crate_name = "bar"] diff --git a/tests/ui/crate-name-mismatch.stderr b/tests/ui/attributes/crate-name-mismatch.stderr index 511562618d5..4021fbe7c18 100644 --- a/tests/ui/crate-name-mismatch.stderr +++ b/tests/ui/attributes/crate-name-mismatch.stderr @@ -1,5 +1,5 @@ error: `--crate-name` and `#[crate_name]` are required to match, but `foo` != `bar` - --> $DIR/crate-name-mismatch.rs:3:1 + --> $DIR/crate-name-mismatch.rs:5:1 | LL | #![crate_name = "bar"] | ^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/custom-attribute-multisegment.rs b/tests/ui/attributes/custom_attr_multisegment_error.rs index 24349213902..1045282c3a3 100644 --- a/tests/ui/custom-attribute-multisegment.rs +++ b/tests/ui/attributes/custom_attr_multisegment_error.rs @@ -1,4 +1,4 @@ -// Unresolved multi-segment attributes are not treated as custom. +//! Unresolved multi-segment attributes are not treated as custom. mod existent {} diff --git a/tests/ui/custom-attribute-multisegment.stderr b/tests/ui/attributes/custom_attr_multisegment_error.stderr index 90ebe277939..02bed225d53 100644 --- a/tests/ui/custom-attribute-multisegment.stderr +++ b/tests/ui/attributes/custom_attr_multisegment_error.stderr @@ -1,5 +1,5 @@ error[E0433]: failed to resolve: could not find `nonexistent` in `existent` - --> $DIR/custom-attribute-multisegment.rs:5:13 + --> $DIR/custom_attr_multisegment_error.rs:5:13 | LL | #[existent::nonexistent] | ^^^^^^^^^^^ could not find `nonexistent` in `existent` diff --git a/tests/ui/check-cfg/well-known-values.stderr b/tests/ui/check-cfg/well-known-values.stderr index 7cda6c2eaa5..532c1ab13d1 100644 --- a/tests/ui/check-cfg/well-known-values.stderr +++ b/tests/ui/check-cfg/well-known-values.stderr @@ -138,7 +138,7 @@ warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE` LL | target_arch = "_UNEXPECTED_VALUE", | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: expected values for `target_arch` are: `aarch64`, `amdgpu`, `arm`, `arm64ec`, `avr`, `bpf`, `csky`, `hexagon`, `loongarch64`, `m68k`, `mips`, `mips32r6`, `mips64`, `mips64r6`, `msp430`, `nvptx64`, `powerpc`, `powerpc64`, `riscv32`, `riscv64`, `s390x`, `sparc`, `sparc64`, `wasm32`, `wasm64`, `x86`, `x86_64`, and `xtensa` + = note: expected values for `target_arch` are: `aarch64`, `amdgpu`, `arm`, `arm64ec`, `avr`, `bpf`, `csky`, `hexagon`, `loongarch32`, `loongarch64`, `m68k`, `mips`, `mips32r6`, `mips64`, `mips64r6`, `msp430`, `nvptx64`, `powerpc`, `powerpc64`, `riscv32`, `riscv64`, `s390x`, `sparc`, `sparc64`, `wasm32`, `wasm64`, `x86`, `x86_64`, and `xtensa` = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE` diff --git a/tests/ui/complex.rs b/tests/ui/complex.rs deleted file mode 100644 index d1da9d189ca..00000000000 --- a/tests/ui/complex.rs +++ /dev/null @@ -1,38 +0,0 @@ -//@ run-pass - -#![allow(unconditional_recursion)] -#![allow(non_camel_case_types)] -#![allow(dead_code)] -#![allow(unused_mut)] - - - -type t = isize; - -fn nothing() { } - -fn putstr(_s: String) { } - -fn putint(_i: isize) { - let mut i: isize = 33; - while i < 36 { putstr("hi".to_string()); i = i + 1; } -} - -fn zerg(i: isize) -> isize { return i; } - -fn foo(x: isize) -> isize { - let mut y: t = x + 2; - putstr("hello".to_string()); - while y < 10 { putint(y); if y * 3 == 4 { y = y + 2; nothing(); } } - let mut z: t; - z = 0x55; - foo(z); - return 0; -} - -pub fn main() { - let x: isize = 2 + 2; - println!("{}", x); - println!("hello, world"); - println!("{}", 10); -} diff --git a/tests/ui/constructor-lifetime-args.rs b/tests/ui/constructor-lifetime-args.rs deleted file mode 100644 index f5802e7d8b1..00000000000 --- a/tests/ui/constructor-lifetime-args.rs +++ /dev/null @@ -1,26 +0,0 @@ -// All lifetime parameters in struct constructors are currently considered early bound, -// i.e., `S::<ARGS>` is interpreted kinda like an associated item `S::<ARGS>::ctor`. -// This behavior is a bit weird, because if equivalent constructor were written manually -// it would get late bound lifetime parameters. -// Variant constructors behave in the same way, lifetime parameters are considered -// belonging to the enum and being early bound. -// https://github.com/rust-lang/rust/issues/30904 - -struct S<'a, 'b>(&'a u8, &'b u8); -enum E<'a, 'b> { - V(&'a u8), - U(&'b u8), -} - -fn main() { - S(&0, &0); // OK - S::<'static>(&0, &0); - //~^ ERROR struct takes 2 lifetime arguments - S::<'static, 'static, 'static>(&0, &0); - //~^ ERROR struct takes 2 lifetime arguments - E::V(&0); // OK - E::V::<'static>(&0); - //~^ ERROR enum takes 2 lifetime arguments - E::V::<'static, 'static, 'static>(&0); - //~^ ERROR enum takes 2 lifetime arguments -} diff --git a/tests/ui/auxiliary/crate-method-reexport-grrrrrrr2.rs b/tests/ui/cross-crate/auxiliary/method_reexport_aux.rs index 06413e13526..7579f033dc6 100644 --- a/tests/ui/auxiliary/crate-method-reexport-grrrrrrr2.rs +++ b/tests/ui/cross-crate/auxiliary/method_reexport_aux.rs @@ -1,4 +1,6 @@ -#![crate_name="crate_method_reexport_grrrrrrr2"] +//! Used by `tests/ui/cross-crate/cross-crate-method-reexport.rs` + +#![crate_name="method_reexport_aux"] pub use name_pool::add; diff --git a/tests/ui/crate-method-reexport-grrrrrrr.rs b/tests/ui/cross-crate/cross-crate-method-reexport.rs index aca399f4e20..e9eab99e214 100644 --- a/tests/ui/crate-method-reexport-grrrrrrr.rs +++ b/tests/ui/cross-crate/cross-crate-method-reexport.rs @@ -4,13 +4,13 @@ // name_pool::methods impl in the other crate is reachable from this // crate. -//@ aux-build:crate-method-reexport-grrrrrrr2.rs +//@ aux-build:method_reexport_aux.rs -extern crate crate_method_reexport_grrrrrrr2; +extern crate method_reexport_aux; pub fn main() { - use crate_method_reexport_grrrrrrr2::rust::add; - use crate_method_reexport_grrrrrrr2::rust::cx; + use method_reexport_aux::rust::add; + use method_reexport_aux::rust::cx; let x: Box<_> = Box::new(()); x.cx(); let y = (); diff --git a/tests/ui/default-method-parsing.rs b/tests/ui/default-method-parsing.rs deleted file mode 100644 index 84c3ab747c8..00000000000 --- a/tests/ui/default-method-parsing.rs +++ /dev/null @@ -1,7 +0,0 @@ -//@ check-pass - -trait Foo { - fn m(&self, _:isize) { } -} - -pub fn main() { } diff --git a/tests/ui/conservative_impl_trait.rs b/tests/ui/diagnostic-width/impl-trait-invalid-iterator-error.rs index b7f795eadb7..05588932395 100644 --- a/tests/ui/conservative_impl_trait.rs +++ b/tests/ui/diagnostic-width/impl-trait-invalid-iterator-error.rs @@ -1,4 +1,4 @@ -// #39872, #39553 +//! Test for #39872 and #39553 fn will_ice(something: &u32) -> impl Iterator<Item = &u32> { //~^ ERROR `()` is not an iterator diff --git a/tests/ui/conservative_impl_trait.stderr b/tests/ui/diagnostic-width/impl-trait-invalid-iterator-error.stderr index eecdb6f9266..0146fa7a28b 100644 --- a/tests/ui/conservative_impl_trait.stderr +++ b/tests/ui/diagnostic-width/impl-trait-invalid-iterator-error.stderr @@ -1,5 +1,5 @@ error[E0277]: `()` is not an iterator - --> $DIR/conservative_impl_trait.rs:3:33 + --> $DIR/impl-trait-invalid-iterator-error.rs:3:33 | LL | fn will_ice(something: &u32) -> impl Iterator<Item = &u32> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^ `()` is not an iterator diff --git a/tests/ui/crate-leading-sep.rs b/tests/ui/imports/global-path-resolution-drop.rs index 6f4dd0bcfd7..29a6afa10c9 100644 --- a/tests/ui/crate-leading-sep.rs +++ b/tests/ui/imports/global-path-resolution-drop.rs @@ -1,3 +1,5 @@ +//! Checks global path resolution of `mem::drop` using a leading `::`. + //@ run-pass #![allow(dropping_copy_types)] diff --git a/tests/ui/intrinsics/intrinsic-alignment.rs b/tests/ui/intrinsics/intrinsic-alignment.rs index a467c445d61..30a523f364c 100644 --- a/tests/ui/intrinsics/intrinsic-alignment.rs +++ b/tests/ui/intrinsics/intrinsic-alignment.rs @@ -23,18 +23,12 @@ use std::intrinsics as rusti; mod m { #[cfg(target_arch = "x86")] pub fn main() { - unsafe { - assert_eq!(crate::rusti::pref_align_of::<u64>(), 8); - assert_eq!(crate::rusti::min_align_of::<u64>(), 4); - } + assert_eq!(crate::rusti::min_align_of::<u64>(), 4); } #[cfg(not(target_arch = "x86"))] pub fn main() { - unsafe { - assert_eq!(crate::rusti::pref_align_of::<u64>(), 8); - assert_eq!(crate::rusti::min_align_of::<u64>(), 8); - } + assert_eq!(crate::rusti::min_align_of::<u64>(), 8); } } @@ -42,30 +36,21 @@ mod m { mod m { #[cfg(target_arch = "x86_64")] pub fn main() { - unsafe { - assert_eq!(crate::rusti::pref_align_of::<u64>(), 8); - assert_eq!(crate::rusti::min_align_of::<u64>(), 8); - } + assert_eq!(crate::rusti::min_align_of::<u64>(), 8); } } #[cfg(target_os = "windows")] mod m { pub fn main() { - unsafe { - assert_eq!(crate::rusti::pref_align_of::<u64>(), 8); - assert_eq!(crate::rusti::min_align_of::<u64>(), 8); - } + assert_eq!(crate::rusti::min_align_of::<u64>(), 8); } } #[cfg(target_family = "wasm")] mod m { pub fn main() { - unsafe { - assert_eq!(crate::rusti::pref_align_of::<u64>(), 8); - assert_eq!(crate::rusti::min_align_of::<u64>(), 8); - } + assert_eq!(crate::rusti::min_align_of::<u64>(), 8); } } diff --git a/tests/ui/layout/debug.stderr b/tests/ui/layout/debug.stderr index abaa16cdefa..b2ce6385ab6 100644 --- a/tests/ui/layout/debug.stderr +++ b/tests/ui/layout/debug.stderr @@ -6,9 +6,8 @@ LL | union EmptyUnion {} error: layout_of(E) = Layout { size: Size(12 bytes), - align: AbiAndPrefAlign { + align: AbiAlign { abi: Align(4 bytes), - pref: $SOME_ALIGN, }, backend_repr: Memory { sized: true, @@ -45,9 +44,8 @@ error: layout_of(E) = Layout { variants: [ Layout { size: Size(4 bytes), - align: AbiAndPrefAlign { + align: AbiAlign { abi: Align(1 bytes), - pref: $SOME_ALIGN, }, backend_repr: Memory { sized: true, @@ -67,9 +65,8 @@ error: layout_of(E) = Layout { }, Layout { size: Size(12 bytes), - align: AbiAndPrefAlign { + align: AbiAlign { abi: Align(4 bytes), - pref: $SOME_ALIGN, }, backend_repr: Memory { sized: true, @@ -108,9 +105,8 @@ LL | enum E { Foo, Bar(!, i32, i32) } error: layout_of(S) = Layout { size: Size(8 bytes), - align: AbiAndPrefAlign { + align: AbiAlign { abi: Align(4 bytes), - pref: $SOME_ALIGN, }, backend_repr: ScalarPair( Initialized { @@ -156,9 +152,8 @@ LL | struct S { f1: i32, f2: (), f3: i32 } error: layout_of(U) = Layout { size: Size(8 bytes), - align: AbiAndPrefAlign { + align: AbiAlign { abi: Align(4 bytes), - pref: $SOME_ALIGN, }, backend_repr: Memory { sized: true, @@ -182,9 +177,8 @@ LL | union U { f1: (i32, i32), f3: i32 } error: layout_of(Result<i32, i32>) = Layout { size: Size(8 bytes), - align: AbiAndPrefAlign { + align: AbiAlign { abi: Align(4 bytes), - pref: $SOME_ALIGN, }, backend_repr: ScalarPair( Initialized { @@ -234,9 +228,8 @@ error: layout_of(Result<i32, i32>) = Layout { variants: [ Layout { size: Size(8 bytes), - align: AbiAndPrefAlign { + align: AbiAlign { abi: Align(4 bytes), - pref: $SOME_ALIGN, }, backend_repr: ScalarPair( Initialized { @@ -273,9 +266,8 @@ error: layout_of(Result<i32, i32>) = Layout { }, Layout { size: Size(8 bytes), - align: AbiAndPrefAlign { + align: AbiAlign { abi: Align(4 bytes), - pref: $SOME_ALIGN, }, backend_repr: ScalarPair( Initialized { @@ -323,9 +315,8 @@ LL | type Test = Result<i32, i32>; error: layout_of(i32) = Layout { size: Size(4 bytes), - align: AbiAndPrefAlign { + align: AbiAlign { abi: Align(4 bytes), - pref: $SOME_ALIGN, }, backend_repr: Scalar( Initialized { @@ -353,9 +344,8 @@ LL | type T = impl std::fmt::Debug; error: layout_of(V) = Layout { size: Size(2 bytes), - align: AbiAndPrefAlign { + align: AbiAlign { abi: Align(2 bytes), - pref: $SOME_ALIGN, }, backend_repr: Memory { sized: true, @@ -379,9 +369,8 @@ LL | pub union V { error: layout_of(W) = Layout { size: Size(2 bytes), - align: AbiAndPrefAlign { + align: AbiAlign { abi: Align(2 bytes), - pref: $SOME_ALIGN, }, backend_repr: Memory { sized: true, @@ -405,9 +394,8 @@ LL | pub union W { error: layout_of(Y) = Layout { size: Size(0 bytes), - align: AbiAndPrefAlign { + align: AbiAlign { abi: Align(2 bytes), - pref: $SOME_ALIGN, }, backend_repr: Memory { sized: true, @@ -431,9 +419,8 @@ LL | pub union Y { error: layout_of(P1) = Layout { size: Size(4 bytes), - align: AbiAndPrefAlign { + align: AbiAlign { abi: Align(1 bytes), - pref: $SOME_ALIGN, }, backend_repr: Memory { sized: true, @@ -457,9 +444,8 @@ LL | union P1 { x: u32 } error: layout_of(P2) = Layout { size: Size(8 bytes), - align: AbiAndPrefAlign { + align: AbiAlign { abi: Align(1 bytes), - pref: $SOME_ALIGN, }, backend_repr: Memory { sized: true, @@ -483,9 +469,8 @@ LL | union P2 { x: (u32, u32) } error: layout_of(P3) = Layout { size: Size(16 bytes), - align: AbiAndPrefAlign { + align: AbiAlign { abi: Align(1 bytes), - pref: $SOME_ALIGN, }, backend_repr: Memory { sized: true, @@ -509,9 +494,8 @@ LL | union P3 { x: F32x4 } error: layout_of(P4) = Layout { size: Size(12 bytes), - align: AbiAndPrefAlign { + align: AbiAlign { abi: Align(1 bytes), - pref: $SOME_ALIGN, }, backend_repr: Memory { sized: true, @@ -535,9 +519,8 @@ LL | union P4 { x: E } error: layout_of(P5) = Layout { size: Size(1 bytes), - align: AbiAndPrefAlign { + align: AbiAlign { abi: Align(1 bytes), - pref: $SOME_ALIGN, }, backend_repr: Scalar( Union { @@ -566,9 +549,8 @@ LL | union P5 { zst: [u16; 0], byte: u8 } error: layout_of(MaybeUninit<u8>) = Layout { size: Size(1 bytes), - align: AbiAndPrefAlign { + align: AbiAlign { abi: Align(1 bytes), - pref: $SOME_ALIGN, }, backend_repr: Scalar( Union { diff --git a/tests/ui/layout/enum.stderr b/tests/ui/layout/enum.stderr index 7f0b38d0a07..f95b577bfc9 100644 --- a/tests/ui/layout/enum.stderr +++ b/tests/ui/layout/enum.stderr @@ -1,4 +1,4 @@ -error: align: AbiAndPrefAlign { abi: Align(2 bytes), pref: $PREF_ALIGN } +error: align: AbiAlign { abi: Align(2 bytes) } --> $DIR/enum.rs:9:1 | LL | enum UninhabitedVariantAlign { diff --git a/tests/ui/layout/hexagon-enum.stderr b/tests/ui/layout/hexagon-enum.stderr index 9c3a8662d4f..d910456c0e6 100644 --- a/tests/ui/layout/hexagon-enum.stderr +++ b/tests/ui/layout/hexagon-enum.stderr @@ -1,8 +1,7 @@ error: layout_of(A) = Layout { size: Size(1 bytes), - align: AbiAndPrefAlign { + align: AbiAlign { abi: Align(1 bytes), - pref: Align(1 bytes), }, backend_repr: Scalar( Initialized { @@ -45,9 +44,8 @@ error: layout_of(A) = Layout { variants: [ Layout { size: Size(1 bytes), - align: AbiAndPrefAlign { + align: AbiAlign { abi: Align(1 bytes), - pref: Align(1 bytes), }, backend_repr: Memory { sized: true, @@ -78,9 +76,8 @@ LL | enum A { Apple } error: layout_of(B) = Layout { size: Size(1 bytes), - align: AbiAndPrefAlign { + align: AbiAlign { abi: Align(1 bytes), - pref: Align(1 bytes), }, backend_repr: Scalar( Initialized { @@ -123,9 +120,8 @@ error: layout_of(B) = Layout { variants: [ Layout { size: Size(1 bytes), - align: AbiAndPrefAlign { + align: AbiAlign { abi: Align(1 bytes), - pref: Align(1 bytes), }, backend_repr: Memory { sized: true, @@ -156,9 +152,8 @@ LL | enum B { Banana = 255, } error: layout_of(C) = Layout { size: Size(2 bytes), - align: AbiAndPrefAlign { + align: AbiAlign { abi: Align(2 bytes), - pref: Align(2 bytes), }, backend_repr: Scalar( Initialized { @@ -201,9 +196,8 @@ error: layout_of(C) = Layout { variants: [ Layout { size: Size(2 bytes), - align: AbiAndPrefAlign { + align: AbiAlign { abi: Align(2 bytes), - pref: Align(2 bytes), }, backend_repr: Memory { sized: true, @@ -234,9 +228,8 @@ LL | enum C { Chaenomeles = 256, } error: layout_of(P) = Layout { size: Size(4 bytes), - align: AbiAndPrefAlign { + align: AbiAlign { abi: Align(4 bytes), - pref: Align(4 bytes), }, backend_repr: Scalar( Initialized { @@ -279,9 +272,8 @@ error: layout_of(P) = Layout { variants: [ Layout { size: Size(4 bytes), - align: AbiAndPrefAlign { + align: AbiAlign { abi: Align(4 bytes), - pref: Align(4 bytes), }, backend_repr: Memory { sized: true, @@ -312,9 +304,8 @@ LL | enum P { Peach = 0x1000_0000isize, } error: layout_of(T) = Layout { size: Size(4 bytes), - align: AbiAndPrefAlign { + align: AbiAlign { abi: Align(4 bytes), - pref: Align(4 bytes), }, backend_repr: Scalar( Initialized { @@ -357,9 +348,8 @@ error: layout_of(T) = Layout { variants: [ Layout { size: Size(4 bytes), - align: AbiAndPrefAlign { + align: AbiAlign { abi: Align(4 bytes), - pref: Align(4 bytes), }, backend_repr: Memory { sized: true, diff --git a/tests/ui/layout/issue-96158-scalarpair-payload-might-be-uninit.stderr b/tests/ui/layout/issue-96158-scalarpair-payload-might-be-uninit.stderr index ef7f0cd2d1c..2087fedeb19 100644 --- a/tests/ui/layout/issue-96158-scalarpair-payload-might-be-uninit.stderr +++ b/tests/ui/layout/issue-96158-scalarpair-payload-might-be-uninit.stderr @@ -1,8 +1,7 @@ error: layout_of(MissingPayloadField) = Layout { size: Size(2 bytes), - align: AbiAndPrefAlign { + align: AbiAlign { abi: Align(1 bytes), - pref: $PREF_ALIGN, }, backend_repr: ScalarPair( Initialized { @@ -51,9 +50,8 @@ error: layout_of(MissingPayloadField) = Layout { variants: [ Layout { size: Size(2 bytes), - align: AbiAndPrefAlign { + align: AbiAlign { abi: Align(1 bytes), - pref: $PREF_ALIGN, }, backend_repr: ScalarPair( Initialized { @@ -89,9 +87,8 @@ error: layout_of(MissingPayloadField) = Layout { }, Layout { size: Size(1 bytes), - align: AbiAndPrefAlign { + align: AbiAlign { abi: Align(1 bytes), - pref: $PREF_ALIGN, }, backend_repr: Memory { sized: true, @@ -122,9 +119,8 @@ LL | pub enum MissingPayloadField { error: layout_of(CommonPayloadField) = Layout { size: Size(2 bytes), - align: AbiAndPrefAlign { + align: AbiAlign { abi: Align(1 bytes), - pref: $PREF_ALIGN, }, backend_repr: ScalarPair( Initialized { @@ -174,9 +170,8 @@ error: layout_of(CommonPayloadField) = Layout { variants: [ Layout { size: Size(2 bytes), - align: AbiAndPrefAlign { + align: AbiAlign { abi: Align(1 bytes), - pref: $PREF_ALIGN, }, backend_repr: ScalarPair( Initialized { @@ -213,9 +208,8 @@ error: layout_of(CommonPayloadField) = Layout { }, Layout { size: Size(2 bytes), - align: AbiAndPrefAlign { + align: AbiAlign { abi: Align(1 bytes), - pref: $PREF_ALIGN, }, backend_repr: ScalarPair( Initialized { @@ -263,9 +257,8 @@ LL | pub enum CommonPayloadField { error: layout_of(CommonPayloadFieldIsMaybeUninit) = Layout { size: Size(2 bytes), - align: AbiAndPrefAlign { + align: AbiAlign { abi: Align(1 bytes), - pref: $PREF_ALIGN, }, backend_repr: ScalarPair( Initialized { @@ -314,9 +307,8 @@ error: layout_of(CommonPayloadFieldIsMaybeUninit) = Layout { variants: [ Layout { size: Size(2 bytes), - align: AbiAndPrefAlign { + align: AbiAlign { abi: Align(1 bytes), - pref: $PREF_ALIGN, }, backend_repr: ScalarPair( Initialized { @@ -352,9 +344,8 @@ error: layout_of(CommonPayloadFieldIsMaybeUninit) = Layout { }, Layout { size: Size(2 bytes), - align: AbiAndPrefAlign { + align: AbiAlign { abi: Align(1 bytes), - pref: $PREF_ALIGN, }, backend_repr: ScalarPair( Initialized { @@ -401,9 +392,8 @@ LL | pub enum CommonPayloadFieldIsMaybeUninit { error: layout_of(NicheFirst) = Layout { size: Size(2 bytes), - align: AbiAndPrefAlign { + align: AbiAlign { abi: Align(1 bytes), - pref: $PREF_ALIGN, }, backend_repr: ScalarPair( Initialized { @@ -456,9 +446,8 @@ error: layout_of(NicheFirst) = Layout { variants: [ Layout { size: Size(2 bytes), - align: AbiAndPrefAlign { + align: AbiAlign { abi: Align(1 bytes), - pref: $PREF_ALIGN, }, backend_repr: ScalarPair( Initialized { @@ -506,9 +495,8 @@ error: layout_of(NicheFirst) = Layout { }, Layout { size: Size(0 bytes), - align: AbiAndPrefAlign { + align: AbiAlign { abi: Align(1 bytes), - pref: $PREF_ALIGN, }, backend_repr: Memory { sized: true, @@ -528,9 +516,8 @@ error: layout_of(NicheFirst) = Layout { }, Layout { size: Size(0 bytes), - align: AbiAndPrefAlign { + align: AbiAlign { abi: Align(1 bytes), - pref: $PREF_ALIGN, }, backend_repr: Memory { sized: true, @@ -561,9 +548,8 @@ LL | pub enum NicheFirst { error: layout_of(NicheSecond) = Layout { size: Size(2 bytes), - align: AbiAndPrefAlign { + align: AbiAlign { abi: Align(1 bytes), - pref: $PREF_ALIGN, }, backend_repr: ScalarPair( Initialized { @@ -616,9 +602,8 @@ error: layout_of(NicheSecond) = Layout { variants: [ Layout { size: Size(2 bytes), - align: AbiAndPrefAlign { + align: AbiAlign { abi: Align(1 bytes), - pref: $PREF_ALIGN, }, backend_repr: ScalarPair( Initialized { @@ -666,9 +651,8 @@ error: layout_of(NicheSecond) = Layout { }, Layout { size: Size(0 bytes), - align: AbiAndPrefAlign { + align: AbiAlign { abi: Align(1 bytes), - pref: $PREF_ALIGN, }, backend_repr: Memory { sized: true, @@ -688,9 +672,8 @@ error: layout_of(NicheSecond) = Layout { }, Layout { size: Size(0 bytes), - align: AbiAndPrefAlign { + align: AbiAlign { abi: Align(1 bytes), - pref: $PREF_ALIGN, }, backend_repr: Memory { sized: true, diff --git a/tests/ui/layout/issue-96185-overaligned-enum.stderr b/tests/ui/layout/issue-96185-overaligned-enum.stderr index a9081afc509..6bcc5b4906b 100644 --- a/tests/ui/layout/issue-96185-overaligned-enum.stderr +++ b/tests/ui/layout/issue-96185-overaligned-enum.stderr @@ -1,8 +1,7 @@ error: layout_of(Aligned1) = Layout { size: Size(8 bytes), - align: AbiAndPrefAlign { + align: AbiAlign { abi: Align(8 bytes), - pref: $PREF_ALIGN, }, backend_repr: Memory { sized: true, @@ -39,9 +38,8 @@ error: layout_of(Aligned1) = Layout { variants: [ Layout { size: Size(8 bytes), - align: AbiAndPrefAlign { + align: AbiAlign { abi: Align(8 bytes), - pref: $PREF_ALIGN, }, backend_repr: Memory { sized: true, @@ -63,9 +61,8 @@ error: layout_of(Aligned1) = Layout { }, Layout { size: Size(8 bytes), - align: AbiAndPrefAlign { + align: AbiAlign { abi: Align(8 bytes), - pref: $PREF_ALIGN, }, backend_repr: Memory { sized: true, @@ -100,9 +97,8 @@ LL | pub enum Aligned1 { error: layout_of(Aligned2) = Layout { size: Size(1 bytes), - align: AbiAndPrefAlign { + align: AbiAlign { abi: Align(1 bytes), - pref: $PREF_ALIGN, }, backend_repr: Scalar( Initialized { @@ -145,9 +141,8 @@ error: layout_of(Aligned2) = Layout { variants: [ Layout { size: Size(1 bytes), - align: AbiAndPrefAlign { + align: AbiAlign { abi: Align(1 bytes), - pref: $PREF_ALIGN, }, backend_repr: Memory { sized: true, @@ -169,9 +164,8 @@ error: layout_of(Aligned2) = Layout { }, Layout { size: Size(1 bytes), - align: AbiAndPrefAlign { + align: AbiAlign { abi: Align(1 bytes), - pref: $PREF_ALIGN, }, backend_repr: Memory { sized: true, diff --git a/tests/ui/layout/thumb-enum.stderr b/tests/ui/layout/thumb-enum.stderr index b635d1a45bb..9bd8ced0c02 100644 --- a/tests/ui/layout/thumb-enum.stderr +++ b/tests/ui/layout/thumb-enum.stderr @@ -1,8 +1,7 @@ error: layout_of(A) = Layout { size: Size(1 bytes), - align: AbiAndPrefAlign { + align: AbiAlign { abi: Align(1 bytes), - pref: Align(4 bytes), }, backend_repr: Scalar( Initialized { @@ -45,9 +44,8 @@ error: layout_of(A) = Layout { variants: [ Layout { size: Size(1 bytes), - align: AbiAndPrefAlign { + align: AbiAlign { abi: Align(1 bytes), - pref: Align(4 bytes), }, backend_repr: Memory { sized: true, @@ -78,9 +76,8 @@ LL | enum A { Apple } error: layout_of(B) = Layout { size: Size(1 bytes), - align: AbiAndPrefAlign { + align: AbiAlign { abi: Align(1 bytes), - pref: Align(4 bytes), }, backend_repr: Scalar( Initialized { @@ -123,9 +120,8 @@ error: layout_of(B) = Layout { variants: [ Layout { size: Size(1 bytes), - align: AbiAndPrefAlign { + align: AbiAlign { abi: Align(1 bytes), - pref: Align(4 bytes), }, backend_repr: Memory { sized: true, @@ -156,9 +152,8 @@ LL | enum B { Banana = 255, } error: layout_of(C) = Layout { size: Size(2 bytes), - align: AbiAndPrefAlign { + align: AbiAlign { abi: Align(2 bytes), - pref: Align(4 bytes), }, backend_repr: Scalar( Initialized { @@ -201,9 +196,8 @@ error: layout_of(C) = Layout { variants: [ Layout { size: Size(2 bytes), - align: AbiAndPrefAlign { + align: AbiAlign { abi: Align(2 bytes), - pref: Align(4 bytes), }, backend_repr: Memory { sized: true, @@ -234,9 +228,8 @@ LL | enum C { Chaenomeles = 256, } error: layout_of(P) = Layout { size: Size(4 bytes), - align: AbiAndPrefAlign { + align: AbiAlign { abi: Align(4 bytes), - pref: Align(4 bytes), }, backend_repr: Scalar( Initialized { @@ -279,9 +272,8 @@ error: layout_of(P) = Layout { variants: [ Layout { size: Size(4 bytes), - align: AbiAndPrefAlign { + align: AbiAlign { abi: Align(4 bytes), - pref: Align(4 bytes), }, backend_repr: Memory { sized: true, @@ -312,9 +304,8 @@ LL | enum P { Peach = 0x1000_0000isize, } error: layout_of(T) = Layout { size: Size(4 bytes), - align: AbiAndPrefAlign { + align: AbiAlign { abi: Align(4 bytes), - pref: Align(4 bytes), }, backend_repr: Scalar( Initialized { @@ -357,9 +348,8 @@ error: layout_of(T) = Layout { variants: [ Layout { size: Size(4 bytes), - align: AbiAndPrefAlign { + align: AbiAlign { abi: Align(4 bytes), - pref: Align(4 bytes), }, backend_repr: Memory { sized: true, diff --git a/tests/ui/layout/zero-sized-array-enum-niche.stderr b/tests/ui/layout/zero-sized-array-enum-niche.stderr index 1ba184bdace..1707b8aff81 100644 --- a/tests/ui/layout/zero-sized-array-enum-niche.stderr +++ b/tests/ui/layout/zero-sized-array-enum-niche.stderr @@ -1,8 +1,7 @@ error: layout_of(Result<[u32; 0], bool>) = Layout { size: Size(4 bytes), - align: AbiAndPrefAlign { + align: AbiAlign { abi: Align(4 bytes), - pref: $PREF_ALIGN, }, backend_repr: Memory { sized: true, @@ -39,9 +38,8 @@ error: layout_of(Result<[u32; 0], bool>) = Layout { variants: [ Layout { size: Size(4 bytes), - align: AbiAndPrefAlign { + align: AbiAlign { abi: Align(4 bytes), - pref: $PREF_ALIGN, }, backend_repr: Memory { sized: true, @@ -65,9 +63,8 @@ error: layout_of(Result<[u32; 0], bool>) = Layout { }, Layout { size: Size(2 bytes), - align: AbiAndPrefAlign { + align: AbiAlign { abi: Align(1 bytes), - pref: $PREF_ALIGN, }, backend_repr: Memory { sized: true, @@ -111,9 +108,8 @@ LL | type AlignedResult = Result<[u32; 0], bool>; error: layout_of(MultipleAlignments) = Layout { size: Size(4 bytes), - align: AbiAndPrefAlign { + align: AbiAlign { abi: Align(4 bytes), - pref: $PREF_ALIGN, }, backend_repr: Memory { sized: true, @@ -150,9 +146,8 @@ error: layout_of(MultipleAlignments) = Layout { variants: [ Layout { size: Size(2 bytes), - align: AbiAndPrefAlign { + align: AbiAlign { abi: Align(2 bytes), - pref: $PREF_ALIGN, }, backend_repr: Memory { sized: true, @@ -176,9 +171,8 @@ error: layout_of(MultipleAlignments) = Layout { }, Layout { size: Size(4 bytes), - align: AbiAndPrefAlign { + align: AbiAlign { abi: Align(4 bytes), - pref: $PREF_ALIGN, }, backend_repr: Memory { sized: true, @@ -202,9 +196,8 @@ error: layout_of(MultipleAlignments) = Layout { }, Layout { size: Size(2 bytes), - align: AbiAndPrefAlign { + align: AbiAlign { abi: Align(1 bytes), - pref: $PREF_ALIGN, }, backend_repr: Memory { sized: true, @@ -248,9 +241,8 @@ LL | enum MultipleAlignments { error: layout_of(Result<[u32; 0], Packed<NonZero<u16>>>) = Layout { size: Size(4 bytes), - align: AbiAndPrefAlign { + align: AbiAlign { abi: Align(4 bytes), - pref: $PREF_ALIGN, }, backend_repr: Memory { sized: true, @@ -287,9 +279,8 @@ error: layout_of(Result<[u32; 0], Packed<NonZero<u16>>>) = Layout { variants: [ Layout { size: Size(4 bytes), - align: AbiAndPrefAlign { + align: AbiAlign { abi: Align(4 bytes), - pref: $PREF_ALIGN, }, backend_repr: Memory { sized: true, @@ -313,9 +304,8 @@ error: layout_of(Result<[u32; 0], Packed<NonZero<u16>>>) = Layout { }, Layout { size: Size(3 bytes), - align: AbiAndPrefAlign { + align: AbiAlign { abi: Align(1 bytes), - pref: $PREF_ALIGN, }, backend_repr: Memory { sized: true, @@ -359,9 +349,8 @@ LL | type NicheLosesToTagged = Result<[u32; 0], Packed<std::num::NonZero<u16>>>; error: layout_of(Result<[u32; 0], Packed<U16IsZero>>) = Layout { size: Size(4 bytes), - align: AbiAndPrefAlign { + align: AbiAlign { abi: Align(4 bytes), - pref: $PREF_ALIGN, }, backend_repr: Memory { sized: true, @@ -402,9 +391,8 @@ error: layout_of(Result<[u32; 0], Packed<U16IsZero>>) = Layout { variants: [ Layout { size: Size(0 bytes), - align: AbiAndPrefAlign { + align: AbiAlign { abi: Align(4 bytes), - pref: $PREF_ALIGN, }, backend_repr: Memory { sized: true, @@ -428,9 +416,8 @@ error: layout_of(Result<[u32; 0], Packed<U16IsZero>>) = Layout { }, Layout { size: Size(2 bytes), - align: AbiAndPrefAlign { + align: AbiAlign { abi: Align(1 bytes), - pref: $PREF_ALIGN, }, backend_repr: Memory { sized: true, diff --git a/tests/ui/lifetimes/constructor-lifetime-early-binding-error.rs b/tests/ui/lifetimes/constructor-lifetime-early-binding-error.rs new file mode 100644 index 00000000000..2d5a444a942 --- /dev/null +++ b/tests/ui/lifetimes/constructor-lifetime-early-binding-error.rs @@ -0,0 +1,22 @@ +//! Tests that all lifetime parameters in struct (`S`) and enum (`E`) constructors are +//! treated as early bound, similar to associated items, rather than late bound as in manual +//! constructors. + +struct S<'a, 'b>(&'a u8, &'b u8); +enum E<'a, 'b> { + V(&'a u8), + U(&'b u8), +} + +fn main() { + S(&0, &0); // OK + S::<'static>(&0, &0); + //~^ ERROR struct takes 2 lifetime arguments + S::<'static, 'static, 'static>(&0, &0); + //~^ ERROR struct takes 2 lifetime arguments + E::V(&0); // OK + E::V::<'static>(&0); + //~^ ERROR enum takes 2 lifetime arguments + E::V::<'static, 'static, 'static>(&0); + //~^ ERROR enum takes 2 lifetime arguments +} diff --git a/tests/ui/constructor-lifetime-args.stderr b/tests/ui/lifetimes/constructor-lifetime-early-binding-error.stderr index d3759f4b365..94699a3509b 100644 --- a/tests/ui/constructor-lifetime-args.stderr +++ b/tests/ui/lifetimes/constructor-lifetime-early-binding-error.stderr @@ -1,5 +1,5 @@ error[E0107]: struct takes 2 lifetime arguments but 1 lifetime argument was supplied - --> $DIR/constructor-lifetime-args.rs:17:5 + --> $DIR/constructor-lifetime-early-binding-error.rs:13:5 | LL | S::<'static>(&0, &0); | ^ ------- supplied 1 lifetime argument @@ -7,7 +7,7 @@ LL | S::<'static>(&0, &0); | expected 2 lifetime arguments | note: struct defined here, with 2 lifetime parameters: `'a`, `'b` - --> $DIR/constructor-lifetime-args.rs:9:8 + --> $DIR/constructor-lifetime-early-binding-error.rs:5:8 | LL | struct S<'a, 'b>(&'a u8, &'b u8); | ^ -- -- @@ -17,7 +17,7 @@ LL | S::<'static, 'static>(&0, &0); | +++++++++ error[E0107]: struct takes 2 lifetime arguments but 3 lifetime arguments were supplied - --> $DIR/constructor-lifetime-args.rs:19:5 + --> $DIR/constructor-lifetime-early-binding-error.rs:15:5 | LL | S::<'static, 'static, 'static>(&0, &0); | ^ --------- help: remove the lifetime argument @@ -25,13 +25,13 @@ LL | S::<'static, 'static, 'static>(&0, &0); | expected 2 lifetime arguments | note: struct defined here, with 2 lifetime parameters: `'a`, `'b` - --> $DIR/constructor-lifetime-args.rs:9:8 + --> $DIR/constructor-lifetime-early-binding-error.rs:5:8 | LL | struct S<'a, 'b>(&'a u8, &'b u8); | ^ -- -- error[E0107]: enum takes 2 lifetime arguments but 1 lifetime argument was supplied - --> $DIR/constructor-lifetime-args.rs:22:8 + --> $DIR/constructor-lifetime-early-binding-error.rs:18:8 | LL | E::V::<'static>(&0); | ^ ------- supplied 1 lifetime argument @@ -39,7 +39,7 @@ LL | E::V::<'static>(&0); | expected 2 lifetime arguments | note: enum defined here, with 2 lifetime parameters: `'a`, `'b` - --> $DIR/constructor-lifetime-args.rs:10:6 + --> $DIR/constructor-lifetime-early-binding-error.rs:6:6 | LL | enum E<'a, 'b> { | ^ -- -- @@ -49,7 +49,7 @@ LL | E::V::<'static, 'static>(&0); | +++++++++ error[E0107]: enum takes 2 lifetime arguments but 3 lifetime arguments were supplied - --> $DIR/constructor-lifetime-args.rs:24:8 + --> $DIR/constructor-lifetime-early-binding-error.rs:20:8 | LL | E::V::<'static, 'static, 'static>(&0); | ^ --------- help: remove the lifetime argument @@ -57,7 +57,7 @@ LL | E::V::<'static, 'static, 'static>(&0); | expected 2 lifetime arguments | note: enum defined here, with 2 lifetime parameters: `'a`, `'b` - --> $DIR/constructor-lifetime-args.rs:10:6 + --> $DIR/constructor-lifetime-early-binding-error.rs:6:6 | LL | enum E<'a, 'b> { | ^ -- -- diff --git a/tests/ui/crate_type_flag.rs b/tests/ui/linking/crate-type-invalid-flag-error.rs index 03bea3638e1..3f84184c989 100644 --- a/tests/ui/crate_type_flag.rs +++ b/tests/ui/linking/crate-type-invalid-flag-error.rs @@ -1,3 +1,5 @@ +// Test for #70183 that --crate-type flag display valid value. + //@ compile-flags: --crate-type dynlib fn main() {} diff --git a/tests/ui/crate_type_flag.stderr b/tests/ui/linking/crate-type-invalid-flag-error.stderr index 26a3e1fbd68..26a3e1fbd68 100644 --- a/tests/ui/crate_type_flag.stderr +++ b/tests/ui/linking/crate-type-invalid-flag-error.stderr diff --git a/tests/ui/repr/repr-c-dead-variants.aarch64-unknown-linux-gnu.stderr b/tests/ui/repr/repr-c-dead-variants.aarch64-unknown-linux-gnu.stderr index c11acc98637..63d685951d9 100644 --- a/tests/ui/repr/repr-c-dead-variants.aarch64-unknown-linux-gnu.stderr +++ b/tests/ui/repr/repr-c-dead-variants.aarch64-unknown-linux-gnu.stderr @@ -1,8 +1,7 @@ error: layout_of(Univariant) = Layout { size: Size(4 bytes), - align: AbiAndPrefAlign { + align: AbiAlign { abi: Align(4 bytes), - pref: $SOME_ALIGN, }, backend_repr: Scalar( Initialized { @@ -45,9 +44,8 @@ error: layout_of(Univariant) = Layout { variants: [ Layout { size: Size(4 bytes), - align: AbiAndPrefAlign { + align: AbiAlign { abi: Align(4 bytes), - pref: $SOME_ALIGN, }, backend_repr: Scalar( Initialized { @@ -88,9 +86,8 @@ LL | enum Univariant { error: layout_of(TwoVariants) = Layout { size: Size(8 bytes), - align: AbiAndPrefAlign { + align: AbiAlign { abi: Align(4 bytes), - pref: $SOME_ALIGN, }, backend_repr: ScalarPair( Initialized { @@ -139,9 +136,8 @@ error: layout_of(TwoVariants) = Layout { variants: [ Layout { size: Size(8 bytes), - align: AbiAndPrefAlign { + align: AbiAlign { abi: Align(4 bytes), - pref: $SOME_ALIGN, }, backend_repr: ScalarPair( Initialized { @@ -177,9 +173,8 @@ error: layout_of(TwoVariants) = Layout { }, Layout { size: Size(8 bytes), - align: AbiAndPrefAlign { + align: AbiAlign { abi: Align(4 bytes), - pref: $SOME_ALIGN, }, backend_repr: ScalarPair( Initialized { @@ -226,9 +221,8 @@ LL | enum TwoVariants { error: layout_of(DeadBranchHasOtherField) = Layout { size: Size(16 bytes), - align: AbiAndPrefAlign { + align: AbiAlign { abi: Align(8 bytes), - pref: $SOME_ALIGN, }, backend_repr: Memory { sized: true, @@ -265,9 +259,8 @@ error: layout_of(DeadBranchHasOtherField) = Layout { variants: [ Layout { size: Size(16 bytes), - align: AbiAndPrefAlign { + align: AbiAlign { abi: Align(8 bytes), - pref: $SOME_ALIGN, }, backend_repr: Memory { sized: true, @@ -295,9 +288,8 @@ error: layout_of(DeadBranchHasOtherField) = Layout { }, Layout { size: Size(16 bytes), - align: AbiAndPrefAlign { + align: AbiAlign { abi: Align(8 bytes), - pref: $SOME_ALIGN, }, backend_repr: Memory { sized: true, diff --git a/tests/ui/repr/repr-c-dead-variants.armebv7r-none-eabi.stderr b/tests/ui/repr/repr-c-dead-variants.armebv7r-none-eabi.stderr index a7888155dea..555471be027 100644 --- a/tests/ui/repr/repr-c-dead-variants.armebv7r-none-eabi.stderr +++ b/tests/ui/repr/repr-c-dead-variants.armebv7r-none-eabi.stderr @@ -1,8 +1,7 @@ error: layout_of(Univariant) = Layout { size: Size(1 bytes), - align: AbiAndPrefAlign { + align: AbiAlign { abi: Align(1 bytes), - pref: $SOME_ALIGN, }, backend_repr: Scalar( Initialized { @@ -45,9 +44,8 @@ error: layout_of(Univariant) = Layout { variants: [ Layout { size: Size(1 bytes), - align: AbiAndPrefAlign { + align: AbiAlign { abi: Align(1 bytes), - pref: $SOME_ALIGN, }, backend_repr: Scalar( Initialized { @@ -88,9 +86,8 @@ LL | enum Univariant { error: layout_of(TwoVariants) = Layout { size: Size(2 bytes), - align: AbiAndPrefAlign { + align: AbiAlign { abi: Align(1 bytes), - pref: $SOME_ALIGN, }, backend_repr: ScalarPair( Initialized { @@ -139,9 +136,8 @@ error: layout_of(TwoVariants) = Layout { variants: [ Layout { size: Size(2 bytes), - align: AbiAndPrefAlign { + align: AbiAlign { abi: Align(1 bytes), - pref: $SOME_ALIGN, }, backend_repr: ScalarPair( Initialized { @@ -177,9 +173,8 @@ error: layout_of(TwoVariants) = Layout { }, Layout { size: Size(2 bytes), - align: AbiAndPrefAlign { + align: AbiAlign { abi: Align(1 bytes), - pref: $SOME_ALIGN, }, backend_repr: ScalarPair( Initialized { @@ -226,9 +221,8 @@ LL | enum TwoVariants { error: layout_of(DeadBranchHasOtherField) = Layout { size: Size(16 bytes), - align: AbiAndPrefAlign { + align: AbiAlign { abi: Align(8 bytes), - pref: $SOME_ALIGN, }, backend_repr: Memory { sized: true, @@ -265,9 +259,8 @@ error: layout_of(DeadBranchHasOtherField) = Layout { variants: [ Layout { size: Size(16 bytes), - align: AbiAndPrefAlign { + align: AbiAlign { abi: Align(8 bytes), - pref: $SOME_ALIGN, }, backend_repr: Memory { sized: true, @@ -295,9 +288,8 @@ error: layout_of(DeadBranchHasOtherField) = Layout { }, Layout { size: Size(16 bytes), - align: AbiAndPrefAlign { + align: AbiAlign { abi: Align(8 bytes), - pref: $SOME_ALIGN, }, backend_repr: Memory { sized: true, diff --git a/tests/ui/repr/repr-c-dead-variants.i686-pc-windows-msvc.stderr b/tests/ui/repr/repr-c-dead-variants.i686-pc-windows-msvc.stderr index c11acc98637..63d685951d9 100644 --- a/tests/ui/repr/repr-c-dead-variants.i686-pc-windows-msvc.stderr +++ b/tests/ui/repr/repr-c-dead-variants.i686-pc-windows-msvc.stderr @@ -1,8 +1,7 @@ error: layout_of(Univariant) = Layout { size: Size(4 bytes), - align: AbiAndPrefAlign { + align: AbiAlign { abi: Align(4 bytes), - pref: $SOME_ALIGN, }, backend_repr: Scalar( Initialized { @@ -45,9 +44,8 @@ error: layout_of(Univariant) = Layout { variants: [ Layout { size: Size(4 bytes), - align: AbiAndPrefAlign { + align: AbiAlign { abi: Align(4 bytes), - pref: $SOME_ALIGN, }, backend_repr: Scalar( Initialized { @@ -88,9 +86,8 @@ LL | enum Univariant { error: layout_of(TwoVariants) = Layout { size: Size(8 bytes), - align: AbiAndPrefAlign { + align: AbiAlign { abi: Align(4 bytes), - pref: $SOME_ALIGN, }, backend_repr: ScalarPair( Initialized { @@ -139,9 +136,8 @@ error: layout_of(TwoVariants) = Layout { variants: [ Layout { size: Size(8 bytes), - align: AbiAndPrefAlign { + align: AbiAlign { abi: Align(4 bytes), - pref: $SOME_ALIGN, }, backend_repr: ScalarPair( Initialized { @@ -177,9 +173,8 @@ error: layout_of(TwoVariants) = Layout { }, Layout { size: Size(8 bytes), - align: AbiAndPrefAlign { + align: AbiAlign { abi: Align(4 bytes), - pref: $SOME_ALIGN, }, backend_repr: ScalarPair( Initialized { @@ -226,9 +221,8 @@ LL | enum TwoVariants { error: layout_of(DeadBranchHasOtherField) = Layout { size: Size(16 bytes), - align: AbiAndPrefAlign { + align: AbiAlign { abi: Align(8 bytes), - pref: $SOME_ALIGN, }, backend_repr: Memory { sized: true, @@ -265,9 +259,8 @@ error: layout_of(DeadBranchHasOtherField) = Layout { variants: [ Layout { size: Size(16 bytes), - align: AbiAndPrefAlign { + align: AbiAlign { abi: Align(8 bytes), - pref: $SOME_ALIGN, }, backend_repr: Memory { sized: true, @@ -295,9 +288,8 @@ error: layout_of(DeadBranchHasOtherField) = Layout { }, Layout { size: Size(16 bytes), - align: AbiAndPrefAlign { + align: AbiAlign { abi: Align(8 bytes), - pref: $SOME_ALIGN, }, backend_repr: Memory { sized: true, diff --git a/tests/ui/repr/repr-c-dead-variants.x86_64-unknown-linux-gnu.stderr b/tests/ui/repr/repr-c-dead-variants.x86_64-unknown-linux-gnu.stderr index c11acc98637..63d685951d9 100644 --- a/tests/ui/repr/repr-c-dead-variants.x86_64-unknown-linux-gnu.stderr +++ b/tests/ui/repr/repr-c-dead-variants.x86_64-unknown-linux-gnu.stderr @@ -1,8 +1,7 @@ error: layout_of(Univariant) = Layout { size: Size(4 bytes), - align: AbiAndPrefAlign { + align: AbiAlign { abi: Align(4 bytes), - pref: $SOME_ALIGN, }, backend_repr: Scalar( Initialized { @@ -45,9 +44,8 @@ error: layout_of(Univariant) = Layout { variants: [ Layout { size: Size(4 bytes), - align: AbiAndPrefAlign { + align: AbiAlign { abi: Align(4 bytes), - pref: $SOME_ALIGN, }, backend_repr: Scalar( Initialized { @@ -88,9 +86,8 @@ LL | enum Univariant { error: layout_of(TwoVariants) = Layout { size: Size(8 bytes), - align: AbiAndPrefAlign { + align: AbiAlign { abi: Align(4 bytes), - pref: $SOME_ALIGN, }, backend_repr: ScalarPair( Initialized { @@ -139,9 +136,8 @@ error: layout_of(TwoVariants) = Layout { variants: [ Layout { size: Size(8 bytes), - align: AbiAndPrefAlign { + align: AbiAlign { abi: Align(4 bytes), - pref: $SOME_ALIGN, }, backend_repr: ScalarPair( Initialized { @@ -177,9 +173,8 @@ error: layout_of(TwoVariants) = Layout { }, Layout { size: Size(8 bytes), - align: AbiAndPrefAlign { + align: AbiAlign { abi: Align(4 bytes), - pref: $SOME_ALIGN, }, backend_repr: ScalarPair( Initialized { @@ -226,9 +221,8 @@ LL | enum TwoVariants { error: layout_of(DeadBranchHasOtherField) = Layout { size: Size(16 bytes), - align: AbiAndPrefAlign { + align: AbiAlign { abi: Align(8 bytes), - pref: $SOME_ALIGN, }, backend_repr: Memory { sized: true, @@ -265,9 +259,8 @@ error: layout_of(DeadBranchHasOtherField) = Layout { variants: [ Layout { size: Size(16 bytes), - align: AbiAndPrefAlign { + align: AbiAlign { abi: Align(8 bytes), - pref: $SOME_ALIGN, }, backend_repr: Memory { sized: true, @@ -295,9 +288,8 @@ error: layout_of(DeadBranchHasOtherField) = Layout { }, Layout { size: Size(16 bytes), - align: AbiAndPrefAlign { + align: AbiAlign { abi: Align(8 bytes), - pref: $SOME_ALIGN, }, backend_repr: Memory { sized: true, diff --git a/tests/ui/repr/repr-c-int-dead-variants.stderr b/tests/ui/repr/repr-c-int-dead-variants.stderr index f63574182c2..d88a842f884 100644 --- a/tests/ui/repr/repr-c-int-dead-variants.stderr +++ b/tests/ui/repr/repr-c-int-dead-variants.stderr @@ -1,8 +1,7 @@ error: layout_of(UnivariantU8) = Layout { size: Size(1 bytes), - align: AbiAndPrefAlign { + align: AbiAlign { abi: Align(1 bytes), - pref: $SOME_ALIGN, }, backend_repr: Scalar( Initialized { @@ -45,9 +44,8 @@ error: layout_of(UnivariantU8) = Layout { variants: [ Layout { size: Size(1 bytes), - align: AbiAndPrefAlign { + align: AbiAlign { abi: Align(1 bytes), - pref: $SOME_ALIGN, }, backend_repr: Scalar( Initialized { @@ -88,9 +86,8 @@ LL | enum UnivariantU8 { error: layout_of(TwoVariantsU8) = Layout { size: Size(2 bytes), - align: AbiAndPrefAlign { + align: AbiAlign { abi: Align(1 bytes), - pref: $SOME_ALIGN, }, backend_repr: ScalarPair( Initialized { @@ -139,9 +136,8 @@ error: layout_of(TwoVariantsU8) = Layout { variants: [ Layout { size: Size(2 bytes), - align: AbiAndPrefAlign { + align: AbiAlign { abi: Align(1 bytes), - pref: $SOME_ALIGN, }, backend_repr: ScalarPair( Initialized { @@ -177,9 +173,8 @@ error: layout_of(TwoVariantsU8) = Layout { }, Layout { size: Size(2 bytes), - align: AbiAndPrefAlign { + align: AbiAlign { abi: Align(1 bytes), - pref: $SOME_ALIGN, }, backend_repr: ScalarPair( Initialized { @@ -226,9 +221,8 @@ LL | enum TwoVariantsU8 { error: layout_of(DeadBranchHasOtherFieldU8) = Layout { size: Size(16 bytes), - align: AbiAndPrefAlign { + align: AbiAlign { abi: Align(8 bytes), - pref: $SOME_ALIGN, }, backend_repr: Memory { sized: true, @@ -265,9 +259,8 @@ error: layout_of(DeadBranchHasOtherFieldU8) = Layout { variants: [ Layout { size: Size(16 bytes), - align: AbiAndPrefAlign { + align: AbiAlign { abi: Align(8 bytes), - pref: $SOME_ALIGN, }, backend_repr: Memory { sized: true, @@ -295,9 +288,8 @@ error: layout_of(DeadBranchHasOtherFieldU8) = Layout { }, Layout { size: Size(16 bytes), - align: AbiAndPrefAlign { + align: AbiAlign { abi: Align(8 bytes), - pref: $SOME_ALIGN, }, backend_repr: Memory { sized: true, diff --git a/tests/ui/deep.rs b/tests/ui/runtime/deep_recursion.rs index 5a631d068b1..bf220f174a1 100644 --- a/tests/ui/deep.rs +++ b/tests/ui/runtime/deep_recursion.rs @@ -1,3 +1,5 @@ +//! Checks deep recursion behavior. + //@ run-pass //@ ignore-emscripten apparently blows the stack diff --git a/tests/ui/custom-test-frameworks-simple.rs b/tests/ui/test-attrs/custom_test_frameworks_simple.rs index 3fb7de6b26b..54a4e4095a7 100644 --- a/tests/ui/custom-test-frameworks-simple.rs +++ b/tests/ui/test-attrs/custom_test_frameworks_simple.rs @@ -1,3 +1,5 @@ +//! Checks run with a custom test framework and indexed test functions. + //@ compile-flags: --test //@ run-pass diff --git a/tests/ui/default-method-simple.rs b/tests/ui/traits/default_method_simple.rs index e5fbedfaece..96fad94f57a 100644 --- a/tests/ui/default-method-simple.rs +++ b/tests/ui/traits/default_method_simple.rs @@ -1,6 +1,6 @@ -//@ run-pass +//! Checks basic default method functionality. -#![allow(dead_code)] +//@ run-pass trait Foo { fn f(&self) { @@ -10,9 +10,7 @@ trait Foo { fn g(&self); } -struct A { - x: isize -} +struct A; impl Foo for A { fn g(&self) { @@ -21,6 +19,6 @@ impl Foo for A { } pub fn main() { - let a = A { x: 1 }; + let a = A; a.f(); } diff --git a/tests/ui/type/pattern_types/or_patterns.stderr b/tests/ui/type/pattern_types/or_patterns.stderr index 58ca585f4a9..a417e502e35 100644 --- a/tests/ui/type/pattern_types/or_patterns.stderr +++ b/tests/ui/type/pattern_types/or_patterns.stderr @@ -41,9 +41,8 @@ LL | let _: NonNegOneI8 = -128; error: layout_of((i8) is (i8::MIN..=-1 | 1..)) = Layout { size: Size(1 bytes), - align: AbiAndPrefAlign { + align: AbiAlign { abi: Align(1 bytes), - pref: $SOME_ALIGN, }, backend_repr: Scalar( Initialized { @@ -80,9 +79,8 @@ LL | type NonNullI8 = pattern_type!(i8 is ..0 | 1..); error: layout_of((i8) is (i8::MIN..=-2 | 0..)) = Layout { size: Size(1 bytes), - align: AbiAndPrefAlign { + align: AbiAlign { abi: Align(1 bytes), - pref: $SOME_ALIGN, }, backend_repr: Scalar( Initialized { diff --git a/tests/ui/type/pattern_types/range_patterns.stderr b/tests/ui/type/pattern_types/range_patterns.stderr index 7b9e1fe9dd1..abd8b87fffc 100644 --- a/tests/ui/type/pattern_types/range_patterns.stderr +++ b/tests/ui/type/pattern_types/range_patterns.stderr @@ -1,8 +1,7 @@ error: layout_of(NonZero<u32>) = Layout { size: Size(4 bytes), - align: AbiAndPrefAlign { + align: AbiAlign { abi: Align(4 bytes), - pref: $SOME_ALIGN, }, backend_repr: Scalar( Initialized { @@ -46,9 +45,8 @@ LL | type X = std::num::NonZeroU32; error: layout_of((u32) is 1..) = Layout { size: Size(4 bytes), - align: AbiAndPrefAlign { + align: AbiAlign { abi: Align(4 bytes), - pref: $SOME_ALIGN, }, backend_repr: Scalar( Initialized { @@ -85,9 +83,8 @@ LL | type Y = pattern_type!(u32 is 1..); error: layout_of(Option<(u32) is 1..>) = Layout { size: Size(4 bytes), - align: AbiAndPrefAlign { + align: AbiAlign { abi: Align(4 bytes), - pref: $SOME_ALIGN, }, backend_repr: Scalar( Initialized { @@ -125,9 +122,8 @@ error: layout_of(Option<(u32) is 1..>) = Layout { variants: [ Layout { size: Size(0 bytes), - align: AbiAndPrefAlign { + align: AbiAlign { abi: Align(1 bytes), - pref: $SOME_ALIGN, }, backend_repr: Memory { sized: true, @@ -147,9 +143,8 @@ error: layout_of(Option<(u32) is 1..>) = Layout { }, Layout { size: Size(4 bytes), - align: AbiAndPrefAlign { + align: AbiAlign { abi: Align(4 bytes), - pref: $SOME_ALIGN, }, backend_repr: Scalar( Initialized { @@ -199,9 +194,8 @@ LL | type Z = Option<pattern_type!(u32 is 1..)>; error: layout_of(Option<NonZero<u32>>) = Layout { size: Size(4 bytes), - align: AbiAndPrefAlign { + align: AbiAlign { abi: Align(4 bytes), - pref: $SOME_ALIGN, }, backend_repr: Scalar( Initialized { @@ -239,9 +233,8 @@ error: layout_of(Option<NonZero<u32>>) = Layout { variants: [ Layout { size: Size(0 bytes), - align: AbiAndPrefAlign { + align: AbiAlign { abi: Align(1 bytes), - pref: $SOME_ALIGN, }, backend_repr: Memory { sized: true, @@ -261,9 +254,8 @@ error: layout_of(Option<NonZero<u32>>) = Layout { }, Layout { size: Size(4 bytes), - align: AbiAndPrefAlign { + align: AbiAlign { abi: Align(4 bytes), - pref: $SOME_ALIGN, }, backend_repr: Scalar( Initialized { @@ -313,9 +305,8 @@ LL | type A = Option<std::num::NonZeroU32>; error: layout_of(NonZeroU32New) = Layout { size: Size(4 bytes), - align: AbiAndPrefAlign { + align: AbiAlign { abi: Align(4 bytes), - pref: $SOME_ALIGN, }, backend_repr: Scalar( Initialized { @@ -387,9 +378,8 @@ LL | type WRAP2 = pattern_type!(u32 is 5..2); error: layout_of((i8) is -10..=10) = Layout { size: Size(1 bytes), - align: AbiAndPrefAlign { + align: AbiAlign { abi: Align(1 bytes), - pref: $SOME_ALIGN, }, backend_repr: Scalar( Initialized { @@ -426,9 +416,8 @@ LL | type SIGN = pattern_type!(i8 is -10..=10); error: layout_of((i8) is i8::MIN..=0) = Layout { size: Size(1 bytes), - align: AbiAndPrefAlign { + align: AbiAlign { abi: Align(1 bytes), - pref: $SOME_ALIGN, }, backend_repr: Scalar( Initialized { diff --git a/tests/ui/unboxed-closures/fn-traits-hrtb-coercion.rs b/tests/ui/unboxed-closures/fn-traits-hrtb-coercion.rs new file mode 100644 index 00000000000..4a08bf28bf3 --- /dev/null +++ b/tests/ui/unboxed-closures/fn-traits-hrtb-coercion.rs @@ -0,0 +1,39 @@ +//! Test for issue <github.com/rust-lang/rust/issues/30904> +//! Related to higher-ranked lifetime inference with unboxed closures and FnOnce. + +#![feature(fn_traits, unboxed_closures)] + +fn test<F: for<'x> FnOnce<(&'x str,)>>(_: F) {} + +struct Compose<F, G>(F, G); + +impl<T, F, G> FnOnce<(T,)> for Compose<F, G> +where + F: FnOnce<(T,)>, + G: FnOnce<(F::Output,)>, +{ + type Output = G::Output; + extern "rust-call" fn call_once(self, (x,): (T,)) -> G::Output { + (self.1)((self.0)(x)) + } +} + +struct Str<'a>(&'a str); + +fn mk_str<'a>(s: &'a str) -> Str<'a> { + Str(s) +} + +fn main() { + let _: for<'a> fn(&'a str) -> Str<'a> = mk_str; + let _: for<'a> fn(&'a str) -> Str<'a> = Str; + //~^ ERROR: mismatched types + + test(|_: &str| {}); + test(mk_str); + test(Str); + + test(Compose(|_: &str| {}, |_| {})); + test(Compose(mk_str, |_| {})); + test(Compose(Str, |_| {})); +} diff --git a/tests/ui/unboxed-closures/fn-traits-hrtb-coercion.stderr b/tests/ui/unboxed-closures/fn-traits-hrtb-coercion.stderr new file mode 100644 index 00000000000..a31d99f45d5 --- /dev/null +++ b/tests/ui/unboxed-closures/fn-traits-hrtb-coercion.stderr @@ -0,0 +1,14 @@ +error[E0308]: mismatched types + --> $DIR/fn-traits-hrtb-coercion.rs:29:45 + | +LL | let _: for<'a> fn(&'a str) -> Str<'a> = Str; + | ------------------------------ ^^^ one type is more general than the other + | | + | expected due to this + | + = note: expected fn pointer `for<'a> fn(&'a _) -> Str<'a>` + found struct constructor `fn(&_) -> Str<'_> {Str::<'_>}` + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0308`. |
