diff options
Diffstat (limited to 'tests')
1264 files changed, 13602 insertions, 7276 deletions
diff --git a/tests/assembly/aarch64-pointer-auth.rs b/tests/assembly/aarch64-pointer-auth.rs index 344e9e74bc2..8c006982679 100644 --- a/tests/assembly/aarch64-pointer-auth.rs +++ b/tests/assembly/aarch64-pointer-auth.rs @@ -1,5 +1,6 @@ // Test that PAC instructions are emitted when branch-protection is specified. +//@ add-core-stubs //@ revisions: PACRET PAUTHLR_NOP PAUTHLR //@ assembly-output: emit-asm //@ needs-llvm-components: aarch64 @@ -14,8 +15,8 @@ #![no_core] #![crate_type = "lib"] -#[lang = "sized"] -trait Sized {} +extern crate minicore; +use minicore::*; // PACRET: hint #25 // PACRET: hint #29 diff --git a/tests/assembly/cmse.rs b/tests/assembly/cmse.rs index e0ada8dc2f1..2984df92225 100644 --- a/tests/assembly/cmse.rs +++ b/tests/assembly/cmse.rs @@ -1,3 +1,4 @@ +//@ add-core-stubs //@ revisions: hard soft //@ assembly-output: emit-asm //@ [hard] compile-flags: --target thumbv8m.main-none-eabihf --crate-type lib -Copt-level=1 @@ -7,10 +8,9 @@ #![crate_type = "lib"] #![feature(abi_c_cmse_nonsecure_call, cmse_nonsecure_entry, no_core, lang_items)] #![no_core] -#[lang = "sized"] -pub trait Sized {} -#[lang = "copy"] -pub trait Copy {} + +extern crate minicore; +use minicore::*; // CHECK-LABEL: __acle_se_entry_point: // CHECK-NEXT: entry_point: diff --git a/tests/assembly/dwarf-mixed-versions-lto.rs b/tests/assembly/dwarf-mixed-versions-lto.rs index 5b8e5ff4f4a..f1fc0814c9d 100644 --- a/tests/assembly/dwarf-mixed-versions-lto.rs +++ b/tests/assembly/dwarf-mixed-versions-lto.rs @@ -1,5 +1,6 @@ // This test ensures that if LTO occurs between crates with different DWARF versions, we // will choose the highest DWARF version for the final binary. This matches Clang's behavior. +// Note: `.2byte` directive is used on MIPS. //@ only-linux //@ aux-build:dwarf-mixed-versions-lto-aux.rs @@ -14,6 +15,6 @@ fn main() { } // CHECK: .section .debug_info -// CHECK-NOT: {{\.(short|hword)}} 2 -// CHECK-NOT: {{\.(short|hword)}} 4 -// CHECK: {{\.(short|hword)}} 5 +// CHECK-NOT: {{\.(short|hword|2byte)}} 2 +// CHECK-NOT: {{\.(short|hword|2byte)}} 4 +// CHECK: {{\.(short|hword|2byte)}} 5 diff --git a/tests/assembly/dwarf4.rs b/tests/assembly/dwarf4.rs index 22be8e5603f..6013adf3386 100644 --- a/tests/assembly/dwarf4.rs +++ b/tests/assembly/dwarf4.rs @@ -1,5 +1,6 @@ // Makes sure that `-Z dwarf-version=4` causes `rustc` to emit DWARF version 4. //@ assembly-output: emit-asm +//@ add-core-stubs //@ compile-flags: -g --target x86_64-unknown-linux-gnu -Z dwarf-version=4 -Copt-level=0 //@ needs-llvm-components: x86 @@ -7,10 +8,8 @@ #![crate_type = "rlib"] #![no_core] -#[lang = "sized"] -trait Sized {} -#[lang = "copy"] -trait Copy {} +extern crate minicore; +use minicore::*; pub fn wibble() {} diff --git a/tests/assembly/dwarf5.rs b/tests/assembly/dwarf5.rs index 35f2716e9fa..9cd596e7834 100644 --- a/tests/assembly/dwarf5.rs +++ b/tests/assembly/dwarf5.rs @@ -1,4 +1,5 @@ // Makes sure that `-Z dwarf-version=5` causes `rustc` to emit DWARF version 5. +//@ add-core-stubs //@ assembly-output: emit-asm //@ compile-flags: -g --target x86_64-unknown-linux-gnu -Z dwarf-version=5 -Copt-level=0 //@ needs-llvm-components: x86 @@ -7,10 +8,8 @@ #![crate_type = "rlib"] #![no_core] -#[lang = "sized"] -trait Sized {} -#[lang = "copy"] -trait Copy {} +extern crate minicore; +use minicore::*; pub fn wibble() {} diff --git a/tests/assembly/pic-relocation-model.rs b/tests/assembly/pic-relocation-model.rs index 73db94791ec..d35cd968389 100644 --- a/tests/assembly/pic-relocation-model.rs +++ b/tests/assembly/pic-relocation-model.rs @@ -1,3 +1,4 @@ +//@ add-core-stubs //@ revisions: x64 //@ assembly-output: emit-asm //@ [x64] compile-flags: --target x86_64-unknown-linux-gnu -Crelocation-model=pic @@ -7,10 +8,8 @@ #![no_core] #![crate_type = "rlib"] -#[lang = "sized"] -trait Sized {} -#[lang = "copy"] -trait Copy {} +extern crate minicore; +use minicore::*; // CHECK-LABEL: call_other_fn: // CHECK: {{(jmpq|callq)}} *other_fn@GOTPCREL(%rip) diff --git a/tests/assembly/pie-relocation-model.rs b/tests/assembly/pie-relocation-model.rs index e632b4dd582..5c74b34eb31 100644 --- a/tests/assembly/pie-relocation-model.rs +++ b/tests/assembly/pie-relocation-model.rs @@ -1,3 +1,4 @@ +//@ add-core-stubs //@ revisions: x64 //@ assembly-output: emit-asm //@ [x64] compile-flags: --target x86_64-unknown-linux-gnu -Crelocation-model=pie @@ -7,10 +8,8 @@ #![no_core] #![crate_type = "rlib"] -#[lang = "sized"] -trait Sized {} -#[lang = "copy"] -trait Copy {} +extern crate minicore; +use minicore::*; // CHECK-LABEL: call_other_fn: // With PIE local functions are called "directly". diff --git a/tests/assembly/powerpc64-struct-abi.rs b/tests/assembly/powerpc64-struct-abi.rs index 0332eb94d8a..eb27afc4f23 100644 --- a/tests/assembly/powerpc64-struct-abi.rs +++ b/tests/assembly/powerpc64-struct-abi.rs @@ -1,3 +1,4 @@ +//@ add-core-stubs //@ revisions: elfv1-be elfv2-be elfv2-le aix //@ assembly-output: emit-asm //@ compile-flags: -Copt-level=3 @@ -20,21 +21,9 @@ #![no_core] #![crate_type = "lib"] -#[lang = "sized"] -trait Sized {} +extern crate minicore; +use minicore::*; -#[lang = "copy"] -trait Copy {} - -#[lang = "freeze"] -trait Freeze {} - -#[lang = "unpin"] -trait Unpin {} - -impl Copy for u8 {} -impl Copy for u16 {} -impl Copy for u32 {} impl Copy for FiveU32s {} impl Copy for FiveU16s {} impl Copy for ThreeU8s {} diff --git a/tests/assembly/riscv-soft-abi-with-float-features.rs b/tests/assembly/riscv-soft-abi-with-float-features.rs index 8ccfa72a7b6..72cbd3841c1 100644 --- a/tests/assembly/riscv-soft-abi-with-float-features.rs +++ b/tests/assembly/riscv-soft-abi-with-float-features.rs @@ -1,3 +1,4 @@ +//@ add-core-stubs //@ assembly-output: emit-asm //@ compile-flags: --target riscv64imac-unknown-none-elf -Ctarget-feature=+f,+d //@ needs-llvm-components: riscv @@ -9,15 +10,8 @@ #![crate_type = "lib"] #![no_core] -#[lang = "sized"] -trait Sized {} - -#[lang = "copy"] -trait Copy {} - -impl Copy for f16 {} -impl Copy for f32 {} -impl Copy for f64 {} +extern crate minicore; +use minicore::*; // This test checks that the floats are all returned in `a0` as required by the `lp64` ABI. diff --git a/tests/assembly/rust-abi-arg-attr.rs b/tests/assembly/rust-abi-arg-attr.rs index e55a53fbdeb..5b5eeb29f0f 100644 --- a/tests/assembly/rust-abi-arg-attr.rs +++ b/tests/assembly/rust-abi-arg-attr.rs @@ -51,10 +51,7 @@ enum Ordering { } #[rustc_intrinsic] -#[rustc_intrinsic_must_be_overridden] -fn three_way_compare<T: Copy>(lhs: T, rhs: T) -> Ordering { - loop {} -} +fn three_way_compare<T: Copy>(lhs: T, rhs: T) -> Ordering; // ^^^^^ core diff --git a/tests/assembly/s390x-backchain-toggle.rs b/tests/assembly/s390x-backchain-toggle.rs index 7ef0292d911..83c7b82d0d4 100644 --- a/tests/assembly/s390x-backchain-toggle.rs +++ b/tests/assembly/s390x-backchain-toggle.rs @@ -1,3 +1,4 @@ +//@ add-core-stubs //@ revisions: enable-backchain disable-backchain //@ assembly-output: emit-asm //@ compile-flags: -Copt-level=3 --crate-type=lib --target=s390x-unknown-linux-gnu @@ -8,8 +9,8 @@ #![no_std] #![no_core] -#[lang = "sized"] -trait Sized {} +extern crate minicore; +use minicore::*; extern "C" { fn extern_func(); diff --git a/tests/assembly/simd-bitmask.rs b/tests/assembly/simd-bitmask.rs index 4a829c4dd98..a632791153b 100644 --- a/tests/assembly/simd-bitmask.rs +++ b/tests/assembly/simd-bitmask.rs @@ -1,3 +1,4 @@ +//@ add-core-stubs //@ revisions: x86 x86-avx2 x86-avx512 aarch64 //@ [x86] compile-flags: --target=x86_64-unknown-linux-gnu -C llvm-args=-x86-asm-syntax=intel //@ [x86] needs-llvm-components: x86 @@ -16,12 +17,8 @@ #![no_core] #![allow(non_camel_case_types)] -// Because we don't have core yet. -#[lang = "sized"] -pub trait Sized {} - -#[lang = "copy"] -trait Copy {} +extern crate minicore; +use minicore::*; #[repr(simd)] pub struct m8x16([i8; 16]); diff --git a/tests/assembly/simd-intrinsic-gather.rs b/tests/assembly/simd-intrinsic-gather.rs index 3152de35f29..8c17a58046d 100644 --- a/tests/assembly/simd-intrinsic-gather.rs +++ b/tests/assembly/simd-intrinsic-gather.rs @@ -1,3 +1,4 @@ +//@ add-core-stubs //@ revisions: x86-avx512 //@ [x86-avx512] compile-flags: --target=x86_64-unknown-linux-gnu -C llvm-args=-x86-asm-syntax=intel //@ [x86-avx512] compile-flags: -C target-feature=+avx512f,+avx512vl,+avx512bw,+avx512dq @@ -9,12 +10,8 @@ #![no_core] #![allow(non_camel_case_types)] -// Because we don't have core yet. -#[lang = "sized"] -pub trait Sized {} - -#[lang = "copy"] -trait Copy {} +extern crate minicore; +use minicore::*; #[repr(simd)] pub struct f64x4([f64; 4]); diff --git a/tests/assembly/simd-intrinsic-mask-load.rs b/tests/assembly/simd-intrinsic-mask-load.rs index efe3e3752fa..a0d0514c014 100644 --- a/tests/assembly/simd-intrinsic-mask-load.rs +++ b/tests/assembly/simd-intrinsic-mask-load.rs @@ -1,3 +1,4 @@ +//@ add-core-stubs //@ revisions: x86-avx2 x86-avx512 //@ [x86-avx2] compile-flags: --target=x86_64-unknown-linux-gnu -C llvm-args=-x86-asm-syntax=intel //@ [x86-avx2] compile-flags: -C target-feature=+avx2 @@ -12,13 +13,8 @@ #![no_core] #![allow(non_camel_case_types)] -// Because we don't have core yet. -#[lang = "sized"] -pub trait Sized {} - -#[lang = "copy"] -trait Copy {} -impl<T: ?Sized> Copy for *const T {} +extern crate minicore; +use minicore::*; #[repr(simd)] pub struct i8x16([i8; 16]); diff --git a/tests/assembly/simd-intrinsic-mask-reduce.rs b/tests/assembly/simd-intrinsic-mask-reduce.rs index 4d4adda6c24..959c4ddefdb 100644 --- a/tests/assembly/simd-intrinsic-mask-reduce.rs +++ b/tests/assembly/simd-intrinsic-mask-reduce.rs @@ -1,4 +1,5 @@ // verify that simd mask reductions do not introduce additional bit shift operations +//@ add-core-stubs //@ revisions: x86 aarch64 //@ [x86] compile-flags: --target=x86_64-unknown-linux-gnu -C llvm-args=-x86-asm-syntax=intel // Set the base cpu explicitly, in case the default has been changed. @@ -13,12 +14,8 @@ #![no_core] #![allow(non_camel_case_types)] -// Because we don't have core yet. -#[lang = "sized"] -pub trait Sized {} - -#[lang = "copy"] -trait Copy {} +extern crate minicore; +use minicore::*; #[repr(simd)] pub struct mask8x16([i8; 16]); diff --git a/tests/assembly/simd-intrinsic-mask-store.rs b/tests/assembly/simd-intrinsic-mask-store.rs index f5d924f24a7..4be9194943c 100644 --- a/tests/assembly/simd-intrinsic-mask-store.rs +++ b/tests/assembly/simd-intrinsic-mask-store.rs @@ -1,3 +1,4 @@ +//@ add-core-stubs //@ revisions: x86-avx2 x86-avx512 //@ [x86-avx2] compile-flags: --target=x86_64-unknown-linux-gnu -C llvm-args=-x86-asm-syntax=intel //@ [x86-avx2] compile-flags: -C target-feature=+avx2 @@ -12,13 +13,8 @@ #![no_core] #![allow(non_camel_case_types)] -// Because we don't have core yet. -#[lang = "sized"] -pub trait Sized {} - -#[lang = "copy"] -trait Copy {} -impl<T: ?Sized> Copy for *mut T {} +extern crate minicore; +use minicore::*; #[repr(simd)] pub struct i8x16([i8; 16]); diff --git a/tests/assembly/simd-intrinsic-scatter.rs b/tests/assembly/simd-intrinsic-scatter.rs index 5f52ababd19..715de04af4d 100644 --- a/tests/assembly/simd-intrinsic-scatter.rs +++ b/tests/assembly/simd-intrinsic-scatter.rs @@ -1,3 +1,4 @@ +//@ add-core-stubs //@ revisions: x86-avx512 //@ [x86-avx512] compile-flags: --target=x86_64-unknown-linux-gnu -C llvm-args=-x86-asm-syntax=intel //@ [x86-avx512] compile-flags: -C target-feature=+avx512f,+avx512vl,+avx512bw,+avx512dq @@ -9,12 +10,8 @@ #![no_core] #![allow(non_camel_case_types)] -// Because we don't have core yet. -#[lang = "sized"] -pub trait Sized {} - -#[lang = "copy"] -trait Copy {} +extern crate minicore; +use minicore::*; #[repr(simd)] pub struct f64x4([f64; 4]); diff --git a/tests/assembly/simd-intrinsic-select.rs b/tests/assembly/simd-intrinsic-select.rs index 74784a77213..7f1e42662bf 100644 --- a/tests/assembly/simd-intrinsic-select.rs +++ b/tests/assembly/simd-intrinsic-select.rs @@ -1,3 +1,4 @@ +//@ add-core-stubs //@ revisions: x86-avx2 x86-avx512 aarch64 //@ [x86-avx2] compile-flags: --target=x86_64-unknown-linux-gnu -C llvm-args=-x86-asm-syntax=intel //@ [x86-avx2] compile-flags: -C target-feature=+avx2 @@ -14,12 +15,8 @@ #![no_core] #![allow(non_camel_case_types)] -// Because we don't have core yet. -#[lang = "sized"] -pub trait Sized {} - -#[lang = "copy"] -trait Copy {} +extern crate minicore; +use minicore::*; #[repr(simd)] pub struct i8x16([i8; 16]); diff --git a/tests/assembly/sparc-struct-abi.rs b/tests/assembly/sparc-struct-abi.rs index 3a254f17964..b1594428811 100644 --- a/tests/assembly/sparc-struct-abi.rs +++ b/tests/assembly/sparc-struct-abi.rs @@ -2,6 +2,7 @@ // - float structure members are passes in floating point registers // (#86163) +//@ add-core-stubs //@ assembly-output: emit-asm //@ needs-llvm-components: sparc //@ compile-flags: --target=sparcv9-sun-solaris -Copt-level=3 @@ -9,11 +10,8 @@ #![feature(no_core, lang_items)] #![no_core] -#[lang = "sized"] -pub trait Sized {} -#[lang = "copy"] -pub trait Copy {} -impl Copy for f32 {} +extern crate minicore; +use minicore::*; #[repr(C)] pub struct Franta { diff --git a/tests/assembly/stack-probes.rs b/tests/assembly/stack-probes.rs index e0931157ce1..de245431f47 100644 --- a/tests/assembly/stack-probes.rs +++ b/tests/assembly/stack-probes.rs @@ -1,3 +1,4 @@ +//@ add-core-stubs //@ revisions: x86_64 i686 aarch64 //@ assembly-output: emit-asm //@[x86_64] compile-flags: --target x86_64-unknown-linux-gnu -C llvm-args=-x86-asm-syntax=intel @@ -11,12 +12,8 @@ #![crate_type = "lib"] #![no_core] -#[lang = "sized"] -trait Sized {} -#[lang = "copy"] -trait Copy {} - -impl Copy for u8 {} +extern crate minicore; +use minicore::*; // Check that inline-asm stack probes are generated correctly. // To avoid making this test fragile to slight asm changes, diff --git a/tests/assembly/stack-protector/stack-protector-heuristics-effect.rs b/tests/assembly/stack-protector/stack-protector-heuristics-effect.rs index 57fc601a2e0..91c83fa2f5b 100644 --- a/tests/assembly/stack-protector/stack-protector-heuristics-effect.rs +++ b/tests/assembly/stack-protector/stack-protector-heuristics-effect.rs @@ -19,7 +19,7 @@ #![allow(incomplete_features)] #![feature(unsized_locals, unsized_fn_params)] -// CHECK-LABEL: emptyfn: +// CHECK-LABEL: emptyfn{{:|\[}} #[no_mangle] pub fn emptyfn() { // all: __stack_chk_fail @@ -29,7 +29,7 @@ pub fn emptyfn() { // missing-NOT: __stack_chk_fail } -// CHECK-LABEL: array_char +// CHECK-LABEL: array_char{{:|\[}} #[no_mangle] pub fn array_char(f: fn(*const char)) { let a = ['c'; 1]; @@ -47,7 +47,7 @@ pub fn array_char(f: fn(*const char)) { // missing-NOT: __stack_chk_fail } -// CHECK-LABEL: array_u8_1 +// CHECK-LABEL: array_u8_1{{:|\[}} #[no_mangle] pub fn array_u8_1(f: fn(*const u8)) { let a = [0u8; 1]; @@ -63,7 +63,7 @@ pub fn array_u8_1(f: fn(*const u8)) { // missing-NOT: __stack_chk_fail } -// CHECK-LABEL: array_u8_small: +// CHECK-LABEL: array_u8_small{{:|\[}} #[no_mangle] pub fn array_u8_small(f: fn(*const u8)) { let a = [0u8; 2]; @@ -80,7 +80,7 @@ pub fn array_u8_small(f: fn(*const u8)) { // missing-NOT: __stack_chk_fail } -// CHECK-LABEL: array_u8_large: +// CHECK-LABEL: array_u8_large{{:|\[}} #[no_mangle] pub fn array_u8_large(f: fn(*const u8)) { let a = [0u8; 9]; @@ -99,7 +99,7 @@ pub fn array_u8_large(f: fn(*const u8)) { #[derive(Copy, Clone)] pub struct ByteSizedNewtype(u8); -// CHECK-LABEL: array_bytesizednewtype_9: +// CHECK-LABEL: array_bytesizednewtype_9{{:|\[}} #[no_mangle] pub fn array_bytesizednewtype_9(f: fn(*const ByteSizedNewtype)) { let a = [ByteSizedNewtype(0); 9]; @@ -115,7 +115,7 @@ pub fn array_bytesizednewtype_9(f: fn(*const ByteSizedNewtype)) { // missing-NOT: __stack_chk_fail } -// CHECK-LABEL: local_var_addr_used_indirectly +// CHECK-LABEL: local_var_addr_used_indirectly{{:|\[}} #[no_mangle] pub fn local_var_addr_used_indirectly(f: fn(bool)) { let a = 5; @@ -142,7 +142,7 @@ pub fn local_var_addr_used_indirectly(f: fn(bool)) { // missing-NOT: __stack_chk_fail } -// CHECK-LABEL: local_string_addr_taken +// CHECK-LABEL: local_string_addr_taken{{:|\[}} #[no_mangle] pub fn local_string_addr_taken(f: fn(&String)) { let x = String::new(); @@ -168,7 +168,7 @@ impl SelfByRef for i32 { } } -// CHECK-LABEL: local_var_addr_taken_used_locally_only +// CHECK-LABEL: local_var_addr_taken_used_locally_only{{:|\[}} #[no_mangle] pub fn local_var_addr_taken_used_locally_only(factory: fn() -> i32, sink: fn(i32)) { let x = factory(); @@ -195,7 +195,7 @@ pub struct Gigastruct { members: u64, } -// CHECK-LABEL: local_large_var_moved +// CHECK-LABEL: local_large_var_moved{{:|\[}} #[no_mangle] pub fn local_large_var_moved(f: fn(Gigastruct)) { let x = Gigastruct { does: 0, not: 1, have: 2, array: 3, members: 4 }; @@ -224,7 +224,7 @@ pub fn local_large_var_moved(f: fn(Gigastruct)) { // missing-NOT: __stack_chk_fail } -// CHECK-LABEL: local_large_var_cloned +// CHECK-LABEL: local_large_var_cloned{{:|\[}} #[no_mangle] pub fn local_large_var_cloned(f: fn(Gigastruct)) { f(Gigastruct { does: 0, not: 1, have: 2, array: 3, members: 4 }); @@ -281,7 +281,7 @@ extern "C" { fn alloca(size: usize) -> *mut (); } -// CHECK-LABEL: alloca_small_compile_time_constant_arg +// CHECK-LABEL: alloca_small_compile_time_constant_arg{{:|\[}} #[no_mangle] pub fn alloca_small_compile_time_constant_arg(f: fn(*mut ())) { f(unsafe { alloca(8) }); @@ -293,7 +293,7 @@ pub fn alloca_small_compile_time_constant_arg(f: fn(*mut ())) { // missing-NOT: __stack_chk_fail } -// CHECK-LABEL: alloca_large_compile_time_constant_arg +// CHECK-LABEL: alloca_large_compile_time_constant_arg{{:|\[}} #[no_mangle] pub fn alloca_large_compile_time_constant_arg(f: fn(*mut ())) { f(unsafe { alloca(9) }); @@ -305,7 +305,7 @@ pub fn alloca_large_compile_time_constant_arg(f: fn(*mut ())) { // missing-NOT: __stack_chk_fail } -// CHECK-LABEL: alloca_dynamic_arg +// CHECK-LABEL: alloca_dynamic_arg{{:|\[}} #[no_mangle] pub fn alloca_dynamic_arg(f: fn(*mut ()), n: usize) { f(unsafe { alloca(n) }); @@ -324,7 +324,7 @@ pub fn alloca_dynamic_arg(f: fn(*mut ()), n: usize) { // this is support for the "unsized locals" unstable feature: // https://doc.rust-lang.org/unstable-book/language-features/unsized-locals.html. -// CHECK-LABEL: unsized_fn_param +// CHECK-LABEL: unsized_fn_param{{:|\[}} #[no_mangle] pub fn unsized_fn_param(s: [u8], l: bool, f: fn([u8])) { let n = if l { 1 } else { 2 }; @@ -344,7 +344,7 @@ pub fn unsized_fn_param(s: [u8], l: bool, f: fn([u8])) { // missing-NOT: __stack_chk_fail } -// CHECK-LABEL: unsized_local +// CHECK-LABEL: unsized_local{{:|\[}} #[no_mangle] pub fn unsized_local(s: &[u8], l: bool, f: fn(&mut [u8])) { let n = if l { 1 } else { 2 }; diff --git a/tests/assembly/stack-protector/stack-protector-target-support.rs b/tests/assembly/stack-protector/stack-protector-target-support.rs index 74a609dcdcc..a937256a60f 100644 --- a/tests/assembly/stack-protector/stack-protector-target-support.rs +++ b/tests/assembly/stack-protector/stack-protector-target-support.rs @@ -1,8 +1,9 @@ // Test that stack smash protection code is emitted for all tier1 and tier2 // targets, with the exception of nvptx64-nvidia-cuda // +//@ add-core-stubs //@ revisions: r1 r2 r3 r4 r5 r6 r7 r8 r9 r10 r11 r12 r13 r14 r15 r16 r17 r18 r19 r20 r21 r22 r23 -//@ revisions: r24 r25 r26 r27 r28 r29 r30 r31 r32 r33 r35 r36 r37 r38 r39 r40 r41 r42 r43 r44 +//@ revisions: r24 r25 r26 r27 r28 r29 r30 r31 r32 r33 r36 r37 r38 r39 r40 r41 r42 r43 r44 //@ revisions: r45 r46 r47 r48 r49 r50 r51 r52 r53 r54 r55 r56 r57 r58 r59 r60 r61 r62 r63 r64 r65 //@ revisions: r66 r67 r68 r69 r70 r71 r72 r73 r74 r75 r76 r77 r78 r79 r80 r81 r82 r83 r84 r85 //@ assembly-output: emit-asm @@ -72,9 +73,6 @@ //@ [r32] needs-llvm-components: arm //@ [r33] compile-flags: --target armv7-unknown-linux-musleabihf //@ [r33] needs-llvm-components: arm - -//@ [r35] compile-flags: --target i586-pc-windows-msvc -//@ [r35] needs-llvm-components: x86 //@ [r36] compile-flags: --target i586-unknown-linux-gnu //@ [r36] needs-llvm-components: x86 //@ [r37] compile-flags: --target i586-unknown-linux-musl @@ -183,10 +181,8 @@ #![crate_type = "lib"] #![no_core] -#[lang = "sized"] -trait Sized {} -#[lang = "copy"] -trait Copy {} +extern crate minicore; +use minicore::*; #[no_mangle] pub fn foo() { @@ -196,7 +192,6 @@ pub fn foo() { // r3: calll @__security_check_cookie // r7: callq __security_check_cookie // r13: bl __security_check_cookie - // r35: calll @__security_check_cookie // cuda doesn't support stack-smash protection // r49-NOT: __security_check_cookie diff --git a/tests/assembly/static-relocation-model.rs b/tests/assembly/static-relocation-model.rs index eafdfd485ba..53fa18852b6 100644 --- a/tests/assembly/static-relocation-model.rs +++ b/tests/assembly/static-relocation-model.rs @@ -1,3 +1,4 @@ +//@ add-core-stubs //@ revisions: x64 A64 ppc64le //@ assembly-output: emit-asm //@ [x64] compile-flags: --target x86_64-unknown-linux-gnu -Crelocation-model=static @@ -11,20 +12,8 @@ #![no_core] #![crate_type = "rlib"] -#[lang = "sized"] -trait Sized {} - -#[lang = "copy"] -trait Copy {} - -#[lang = "sync"] -trait Sync {} - -#[lang = "drop_in_place"] -fn drop_in_place<T>(_: *mut T) {} - -impl Copy for u8 {} -impl Sync for u8 {} +extern crate minicore; +use minicore::*; #[no_mangle] pub static PIERIS: u8 = 42; diff --git a/tests/assembly/target-feature-multiple.rs b/tests/assembly/target-feature-multiple.rs index 83c38568647..bc432d21931 100644 --- a/tests/assembly/target-feature-multiple.rs +++ b/tests/assembly/target-feature-multiple.rs @@ -1,3 +1,4 @@ +//@ add-core-stubs //@ assembly-output: emit-asm //@ needs-llvm-components: x86 //@ revisions: TWOFLAGS SINGLEFLAG @@ -19,11 +20,8 @@ #![crate_type = "lib"] #![no_core] -#[lang = "sized"] -trait Sized {} -#[lang = "copy"] -trait Copy {} -impl Copy for u32 {} +extern crate minicore; +use minicore::*; // Use of these requires target features to be enabled extern "unadjusted" { diff --git a/tests/assembly/targets/targets-amdgpu.rs b/tests/assembly/targets/targets-amdgpu.rs index 501eed2e247..1d10b8fc315 100644 --- a/tests/assembly/targets/targets-amdgpu.rs +++ b/tests/assembly/targets/targets-amdgpu.rs @@ -1,3 +1,4 @@ +//@ add-core-stubs //@ assembly-output: emit-asm // ignore-tidy-linelength //@ revisions: amdgcn_amd_amdhsa @@ -11,8 +12,8 @@ #![no_core] #![crate_type = "lib"] -#[lang = "sized"] -trait Sized {} +extern crate minicore; +use minicore::*; pub fn test() -> u8 { 42 diff --git a/tests/assembly/targets/targets-elf.rs b/tests/assembly/targets/targets-elf.rs index 3e73d2c6eb7..dc564c60f80 100644 --- a/tests/assembly/targets/targets-elf.rs +++ b/tests/assembly/targets/targets-elf.rs @@ -1,3 +1,4 @@ +//@ add-core-stubs //@ assembly-output: emit-asm // ignore-tidy-linelength //@ revisions: aarch64_be_unknown_linux_gnu @@ -709,8 +710,8 @@ #![no_core] #![crate_type = "lib"] -#[lang = "sized"] -trait Sized {} +extern crate minicore; +use minicore::*; // Force linkage to ensure code is actually generated #[no_mangle] diff --git a/tests/assembly/targets/targets-macho.rs b/tests/assembly/targets/targets-macho.rs index 25e9059afeb..92bde1c6971 100644 --- a/tests/assembly/targets/targets-macho.rs +++ b/tests/assembly/targets/targets-macho.rs @@ -1,3 +1,4 @@ +//@ add-core-stubs //@ assembly-output: emit-asm // ignore-tidy-linelength //@ revisions: aarch64_apple_darwin @@ -80,8 +81,8 @@ #![no_core] #![crate_type = "lib"] -#[lang = "sized"] -trait Sized {} +extern crate minicore; +use minicore::*; // Force linkage to ensure code is actually generated #[no_mangle] diff --git a/tests/assembly/targets/targets-nvptx.rs b/tests/assembly/targets/targets-nvptx.rs index 9048191affa..49c12aebaaa 100644 --- a/tests/assembly/targets/targets-nvptx.rs +++ b/tests/assembly/targets/targets-nvptx.rs @@ -1,3 +1,4 @@ +//@ add-core-stubs //@ assembly-output: emit-asm // ignore-tidy-linelength //@ revisions: nvptx64_nvidia_cuda @@ -11,8 +12,8 @@ #![no_core] #![crate_type = "lib"] -#[lang = "sized"] -trait Sized {} +extern crate minicore; +use minicore::*; pub fn test() -> u8 { 42 diff --git a/tests/assembly/targets/targets-pe.rs b/tests/assembly/targets/targets-pe.rs index b74d0181c4d..de29b9af502 100644 --- a/tests/assembly/targets/targets-pe.rs +++ b/tests/assembly/targets/targets-pe.rs @@ -1,3 +1,4 @@ +//@ add-core-stubs //@ assembly-output: emit-asm // ignore-tidy-linelength //@ revisions: aarch64_pc_windows_msvc @@ -24,9 +25,6 @@ //@ revisions: bpfel_unknown_none //@ [bpfel_unknown_none] compile-flags: --target bpfel-unknown-none //@ [bpfel_unknown_none] needs-llvm-components: bpf -//@ revisions: i586_pc_windows_msvc -//@ [i586_pc_windows_msvc] compile-flags: --target i586-pc-windows-msvc -//@ [i586_pc_windows_msvc] needs-llvm-components: x86 //@ revisions: i686_pc_windows_gnu //@ [i686_pc_windows_gnu] compile-flags: --target i686-pc-windows-gnu //@ [i686_pc_windows_gnu] needs-llvm-components: x86 @@ -95,8 +93,8 @@ #![no_core] #![crate_type = "lib"] -#[lang = "sized"] -trait Sized {} +extern crate minicore; +use minicore::*; pub fn test() -> u8 { 42 diff --git a/tests/auxiliary/minicore.rs b/tests/auxiliary/minicore.rs index 0aa8b6b8f89..03aa8476508 100644 --- a/tests/auxiliary/minicore.rs +++ b/tests/auxiliary/minicore.rs @@ -25,7 +25,8 @@ naked_functions, f16, f128, - asm_experimental_arch + asm_experimental_arch, + unboxed_closures )] #![allow(unused, improper_ctypes_definitions, internal_features)] #![no_std] @@ -61,7 +62,7 @@ pub auto trait Unpin {} impl_marker_trait!( Copy => [ - bool, char, + char, bool, isize, i8, i16, i32, i64, i128, usize, u8, u16, u32, u64, u128, f16, f32, f64, f128, @@ -102,6 +103,9 @@ pub struct UnsafeCell<T: ?Sized> { } impl<T: ?Sized> !Freeze for UnsafeCell<T> {} +#[lang = "tuple_trait"] +pub trait Tuple {} + #[rustc_builtin_macro] pub macro asm("assembly template", $(operands,)* $(options($(option),*))?) { /* compiler built-in */ @@ -129,3 +133,61 @@ macro_rules! stringify { /* compiler built-in */ }; } + +#[lang = "add"] +pub trait Add<Rhs = Self> { + type Output; + + fn add(self, _: Rhs) -> Self::Output; +} + +impl Add<isize> for isize { + type Output = isize; + + fn add(self, other: isize) -> isize { + 7 // avoid needing to add all of the overflow handling and panic language items + } +} + +#[lang = "sync"] +trait Sync {} +impl Sync for u8 {} + +#[lang = "drop_in_place"] +fn drop_in_place<T>(_: *mut T) {} + +#[lang = "fn_once"] +pub trait FnOnce<Args: Tuple> { + #[lang = "fn_once_output"] + type Output; + + extern "rust-call" fn call_once(self, args: Args) -> Self::Output; +} + +#[lang = "fn_mut"] +pub trait FnMut<Args: Tuple>: FnOnce<Args> { + extern "rust-call" fn call_mut(&mut self, args: Args) -> Self::Output; +} + +#[lang = "fn"] +pub trait Fn<Args: Tuple>: FnMut<Args> { + extern "rust-call" fn call(&self, args: Args) -> Self::Output; +} + +#[lang = "dispatch_from_dyn"] +trait DispatchFromDyn<T> {} + +impl<'a, T: ?Sized + Unsize<U>, U: ?Sized> DispatchFromDyn<&'a U> for &'a T {} + +#[lang = "unsize"] +trait Unsize<T: ?Sized> {} + +#[lang = "coerce_unsized"] +pub trait CoerceUnsized<T: ?Sized> {} + +impl<'a, 'b: 'a, T: ?Sized + Unsize<U>, U: ?Sized> CoerceUnsized<&'a U> for &'b T {} + +#[lang = "drop"] +trait Drop { + fn drop(&mut self); +} diff --git a/tests/codegen/aarch64-softfloat.rs b/tests/codegen/aarch64-softfloat.rs index 85380a6c472..4f5366e047f 100644 --- a/tests/codegen/aarch64-softfloat.rs +++ b/tests/codegen/aarch64-softfloat.rs @@ -1,15 +1,12 @@ +//@ add-core-stubs //@ compile-flags: --target aarch64-unknown-none-softfloat -Zmerge-functions=disabled //@ needs-llvm-components: aarch64 #![crate_type = "lib"] #![feature(no_core, lang_items)] #![no_core] -#[lang = "sized"] -trait Sized {} -#[lang = "copy"] -trait Copy {} -impl Copy for f32 {} -impl Copy for f64 {} +extern crate minicore; +use minicore::*; // CHECK: i64 @pass_f64_C(i64 {{[^,]*}}) #[no_mangle] diff --git a/tests/codegen/aarch64-struct-align-128.rs b/tests/codegen/aarch64-struct-align-128.rs index 3fed19d96b1..ba1d19680f4 100644 --- a/tests/codegen/aarch64-struct-align-128.rs +++ b/tests/codegen/aarch64-struct-align-128.rs @@ -1,5 +1,6 @@ // Test that structs aligned to 128 bits are passed with the correct ABI on aarch64. +//@ add-core-stubs //@ revisions: linux darwin win //@[linux] compile-flags: --target aarch64-unknown-linux-gnu //@[darwin] compile-flags: --target aarch64-apple-darwin @@ -12,12 +13,8 @@ #![crate_type = "lib"] #![no_core] -#[lang = "sized"] -trait Sized {} -#[lang = "freeze"] -trait Freeze {} -#[lang = "copy"] -trait Copy {} +extern crate minicore; +use minicore::*; // Passed as `[i64 x 2]`, since it's an aggregate with size <= 128 bits, align < 128 bits. #[repr(C)] diff --git a/tests/codegen/abi-efiapi.rs b/tests/codegen/abi-efiapi.rs index 986d042268a..1736f0daf0f 100644 --- a/tests/codegen/abi-efiapi.rs +++ b/tests/codegen/abi-efiapi.rs @@ -1,5 +1,6 @@ // Checks if the correct annotation for the efiapi ABI is passed to llvm. +//@ add-core-stubs //@ revisions:x86_64 i686 aarch64 arm riscv //@[x86_64] compile-flags: --target x86_64-unknown-uefi //@[x86_64] needs-llvm-components: aarch64 arm riscv @@ -17,12 +18,8 @@ #![feature(no_core, lang_items)] #![no_core] -#[lang = "sized"] -trait Sized {} -#[lang = "freeze"] -trait Freeze {} -#[lang = "copy"] -trait Copy {} +extern crate minicore; +use minicore::*; //x86_64: define win64cc void @has_efiapi //i686: define void @has_efiapi diff --git a/tests/codegen/abi-repr-ext.rs b/tests/codegen/abi-repr-ext.rs index b06d225ed70..1da28a94d9d 100644 --- a/tests/codegen/abi-repr-ext.rs +++ b/tests/codegen/abi-repr-ext.rs @@ -1,3 +1,4 @@ +//@ add-core-stubs //@ compile-flags: -Copt-level=3 //@ revisions:x86_64 i686 aarch64-apple aarch64-windows aarch64-linux arm riscv @@ -24,12 +25,8 @@ #![no_std] #![no_core] -#[lang = "sized"] -trait Sized {} -#[lang = "freeze"] -trait Freeze {} -#[lang = "copy"] -trait Copy {} +extern crate minicore; +use minicore::*; #[repr(i8)] pub enum Type { diff --git a/tests/codegen/abi-sysv64.rs b/tests/codegen/abi-sysv64.rs index ec555ee5f1d..7ade17f2bae 100644 --- a/tests/codegen/abi-sysv64.rs +++ b/tests/codegen/abi-sysv64.rs @@ -2,6 +2,7 @@ // llvm. Also checks that the abi-sysv64 feature gate allows usage // of the sysv64 abi. // +//@ add-core-stubs //@ needs-llvm-components: x86 //@ compile-flags: -C no-prepopulate-passes --target=x86_64-unknown-linux-gnu -Copt-level=0 @@ -9,11 +10,8 @@ #![no_core] #![feature(abi_x86_interrupt, no_core, lang_items)] -#[lang = "sized"] -trait Sized {} -#[lang = "copy"] -trait Copy {} -impl Copy for i64 {} +extern crate minicore; +use minicore::*; // CHECK: define x86_64_sysvcc i64 @has_sysv64_abi #[no_mangle] diff --git a/tests/codegen/abi-win64-zst.rs b/tests/codegen/abi-win64-zst.rs index 825a5c1b09c..e46f9666d42 100644 --- a/tests/codegen/abi-win64-zst.rs +++ b/tests/codegen/abi-win64-zst.rs @@ -1,3 +1,4 @@ +//@ add-core-stubs //@ compile-flags: -Z merge-functions=disabled //@ add-core-stubs diff --git a/tests/codegen/abi-x86-interrupt.rs b/tests/codegen/abi-x86-interrupt.rs index b8f3ebb99dd..255ccba2c11 100644 --- a/tests/codegen/abi-x86-interrupt.rs +++ b/tests/codegen/abi-x86-interrupt.rs @@ -2,6 +2,7 @@ // llvm. Also checks that the abi_x86_interrupt feature gate allows usage // of the x86-interrupt abi. +//@ add-core-stubs //@ needs-llvm-components: x86 //@ compile-flags: -C no-prepopulate-passes --target=x86_64-unknown-linux-gnu -Copt-level=0 @@ -9,11 +10,8 @@ #![no_core] #![feature(abi_x86_interrupt, no_core, lang_items)] -#[lang = "sized"] -trait Sized {} -#[lang = "copy"] -trait Copy {} -impl Copy for i64 {} +extern crate minicore; +use minicore::*; // CHECK: define x86_intrcc i64 @has_x86_interrupt_abi #[no_mangle] diff --git a/tests/codegen/asm/critical.rs b/tests/codegen/asm/critical.rs new file mode 100644 index 00000000000..8c039900cab --- /dev/null +++ b/tests/codegen/asm/critical.rs @@ -0,0 +1,37 @@ +//@ only-x86_64 +//@ compile-flags: -C no-prepopulate-passes +#![feature(asm_goto)] +#![feature(asm_goto_with_outputs)] +#![crate_type = "lib"] +use std::arch::asm; + +// Regression test for #137867. Check that critical edges have been split before code generation, +// and so all stores to the asm output occur on disjoint paths without any of them jumping to +// another callbr label. +// +// CHECK-LABEL: @f( +// CHECK: [[OUT:%.*]] = callbr i32 asm +// CHECK-NEXT: to label %[[BB0:.*]] [label %[[BB1:.*]], label %[[BB2:.*]]], +// CHECK: [[BB1]]: +// CHECK-NEXT: store i32 [[OUT]], ptr %a +// CHECK-NEXT: br label %[[BBR:.*]] +// CHECK: [[BB2]]: +// CHECK-NEXT: store i32 [[OUT]], ptr %a +// CHECK-NEXT: br label %[[BBR]] +// CHECK: [[BB0]]: +// CHECK-NEXT: store i32 [[OUT]], ptr %a +// CHECK-NEXT: br label %[[BBR]] +// CHECK: [[BBR]]: +// CHECK-NEXT: [[RET:%.*]] = load i32, ptr %a +// CHECK-NEXT: ret i32 [[RET]] +#[unsafe(no_mangle)] +pub unsafe fn f(mut a: u32) -> u32 { + asm!( + "jmp {} + jmp {}", + label {}, + label {}, + inout("eax") a, + ); + a +} diff --git a/tests/codegen/avr/avr-func-addrspace.rs b/tests/codegen/avr/avr-func-addrspace.rs index 2ec7c86b5f4..2ae2f40d7b3 100644 --- a/tests/codegen/avr/avr-func-addrspace.rs +++ b/tests/codegen/avr/avr-func-addrspace.rs @@ -1,3 +1,4 @@ +//@ add-core-stubs //@ compile-flags: -Copt-level=3 --target=avr-none -C target-cpu=atmega328p --crate-type=rlib -C panic=abort //@ needs-llvm-components: avr @@ -13,45 +14,8 @@ #![crate_type = "lib"] #![no_core] -#[lang = "sized"] -pub trait Sized {} -#[lang = "copy"] -pub trait Copy {} -impl<T: ?Sized> Copy for *const T {} -#[lang = "legacy_receiver"] -pub trait LegacyReceiver {} -#[lang = "tuple_trait"] -pub trait Tuple {} - -pub struct Result<T, E> { - _a: T, - _b: E, -} - -impl Copy for usize {} -impl Copy for &usize {} - -#[lang = "drop_in_place"] -pub unsafe fn drop_in_place<T: ?Sized>(_: *mut T) {} - -#[lang = "fn_once"] -pub trait FnOnce<Args: Tuple> { - #[lang = "fn_once_output"] - type Output; - - extern "rust-call" fn call_once(self, args: Args) -> Self::Output; -} - -#[lang = "fn_mut"] -pub trait FnMut<Args: Tuple>: FnOnce<Args> { - extern "rust-call" fn call_mut(&mut self, args: Args) -> Self::Output; -} - -#[lang = "fn"] -pub trait Fn<Args: Tuple>: FnOnce<Args> { - /// Performs the call operation. - extern "rust-call" fn call(&self, args: Args) -> Self::Output; -} +extern crate minicore; +use minicore::*; extern "rust-intrinsic" { pub fn transmute<Src, Dst>(src: Src) -> Dst; diff --git a/tests/codegen/branch-protection-old-llvm.rs b/tests/codegen/branch-protection-old-llvm.rs index 1846f35479d..14b34ac5018 100644 --- a/tests/codegen/branch-protection-old-llvm.rs +++ b/tests/codegen/branch-protection-old-llvm.rs @@ -1,5 +1,6 @@ // Test that the correct module flags are emitted with different branch protection flags. +//@ add-core-stubs //@ revisions: BTI PACRET LEAF BKEY NONE //@ needs-llvm-components: aarch64 //@ [BTI] compile-flags: -Z branch-protection=bti @@ -13,8 +14,8 @@ #![feature(no_core, lang_items)] #![no_core] -#[lang = "sized"] -trait Sized {} +extern crate minicore; +use minicore::*; // A basic test function. pub fn test() {} diff --git a/tests/codegen/branch-protection.rs b/tests/codegen/branch-protection.rs index 945bad05625..ae14eae9ae0 100644 --- a/tests/codegen/branch-protection.rs +++ b/tests/codegen/branch-protection.rs @@ -1,5 +1,6 @@ // Test that the correct module flags are emitted with different branch protection flags. +//@ add-core-stubs //@ revisions: BTI PACRET LEAF BKEY PAUTHLR PAUTHLR_BKEY PAUTHLR_LEAF PAUTHLR_BTI NONE //@ needs-llvm-components: aarch64 //@ [BTI] compile-flags: -Z branch-protection=bti @@ -17,8 +18,8 @@ #![feature(no_core, lang_items)] #![no_core] -#[lang = "sized"] -trait Sized {} +extern crate minicore; +use minicore::*; // A basic test function. // CHECK: @test(){{.*}} [[ATTR:#[0-9]+]] { diff --git a/tests/codegen/cast-target-abi.rs b/tests/codegen/cast-target-abi.rs index a0801eb9826..186198bc631 100644 --- a/tests/codegen/cast-target-abi.rs +++ b/tests/codegen/cast-target-abi.rs @@ -1,4 +1,5 @@ // ignore-tidy-linelength +//@ add-core-stubs //@ revisions:aarch64 loongarch64 powerpc64 sparc64 x86_64 //@ min-llvm-version: 19 //@ compile-flags: -Copt-level=3 -Cno-prepopulate-passes -Zlint-llvm-ir -Cllvm-args=-lint-abort-on-error @@ -21,12 +22,8 @@ #![no_std] #![no_core] -#[lang = "sized"] -trait Sized {} -#[lang = "freeze"] -trait Freeze {} -#[lang = "copy"] -trait Copy {} +extern crate minicore; +use minicore::*; // This struct will be passed as a single `i64` or `i32`. // This may be (if `i64)) larger than the Rust layout, which is just `{ i16, i16 }`. diff --git a/tests/codegen/cf-protection.rs b/tests/codegen/cf-protection.rs index 244d1eb2544..f1349a5dcb9 100644 --- a/tests/codegen/cf-protection.rs +++ b/tests/codegen/cf-protection.rs @@ -1,5 +1,6 @@ // Test that the correct module flags are emitted with different control-flow protection flags. +//@ add-core-stubs //@ revisions: undefined none branch return full //@ needs-llvm-components: x86 //@ [undefined] compile-flags: @@ -13,8 +14,8 @@ #![feature(no_core, lang_items)] #![no_core] -#[lang = "sized"] -trait Sized {} +extern crate minicore; +use minicore::*; // A basic test function. pub fn test() {} diff --git a/tests/codegen/cffi/ffi-out-of-bounds-loads.rs b/tests/codegen/cffi/ffi-out-of-bounds-loads.rs index ae8d8383f5b..404f6237849 100644 --- a/tests/codegen/cffi/ffi-out-of-bounds-loads.rs +++ b/tests/codegen/cffi/ffi-out-of-bounds-loads.rs @@ -1,3 +1,4 @@ +//@ add-core-stubs //@ revisions: linux apple //@ min-llvm-version: 19 //@ compile-flags: -Copt-level=0 -Cno-prepopulate-passes -Zlint-llvm-ir -Cllvm-args=-lint-abort-on-error @@ -14,12 +15,8 @@ #![no_std] #![no_core] -#[lang = "sized"] -trait Sized {} -#[lang = "freeze"] -trait Freeze {} -#[lang = "copy"] -trait Copy {} +extern crate minicore; +use minicore::*; #[repr(C)] struct S { diff --git a/tests/codegen/comparison-operators-2-struct.rs b/tests/codegen/comparison-operators-2-struct.rs new file mode 100644 index 00000000000..e179066ebfd --- /dev/null +++ b/tests/codegen/comparison-operators-2-struct.rs @@ -0,0 +1,61 @@ +//@ compile-flags: -C opt-level=1 +//@ min-llvm-version: 20 + +// The `derive(PartialOrd)` for a 2-field type doesn't override `lt`/`le`/`gt`/`ge`. +// This double-checks that the `Option<Ordering>` intermediate values used +// in the operators for such a type all optimize away. + +#![crate_type = "lib"] + +use std::cmp::Ordering; + +#[derive(PartialOrd, PartialEq)] +pub struct Foo(i32, u32); + +// CHECK-LABEL: @check_lt( +// CHECK-SAME: i32{{.+}}%[[A0:.+]], i32{{.+}}%[[A1:.+]], i32{{.+}}%[[B0:.+]], i32{{.+}}%[[B1:.+]]) +#[no_mangle] +pub fn check_lt(a: Foo, b: Foo) -> bool { + // CHECK-DAG: %[[EQ:.+]] = icmp eq i32 %[[A0]], %[[B0]] + // CHECK-DAG: %[[R0:.+]] = icmp slt i32 %[[A0]], %[[B0]] + // CHECK-DAG: %[[R1:.+]] = icmp ult i32 %[[A1]], %[[B1]] + // CHECK: %[[R:.+]] = select i1 %[[EQ]], i1 %[[R1]], i1 %[[R0]] + // CHECK-NEXT: ret i1 %[[R]] + a < b +} + +// CHECK-LABEL: @check_le( +// CHECK-SAME: i32{{.+}}%[[A0:.+]], i32{{.+}}%[[A1:.+]], i32{{.+}}%[[B0:.+]], i32{{.+}}%[[B1:.+]]) +#[no_mangle] +pub fn check_le(a: Foo, b: Foo) -> bool { + // CHECK-DAG: %[[EQ:.+]] = icmp eq i32 %[[A0]], %[[B0]] + // CHECK-DAG: %[[R0:.+]] = icmp sle i32 %[[A0]], %[[B0]] + // CHECK-DAG: %[[R1:.+]] = icmp ule i32 %[[A1]], %[[B1]] + // CHECK: %[[R:.+]] = select i1 %[[EQ]], i1 %[[R1]], i1 %[[R0]] + // CHECK-NEXT: ret i1 %[[R]] + a <= b +} + +// CHECK-LABEL: @check_gt( +// CHECK-SAME: i32{{.+}}%[[A0:.+]], i32{{.+}}%[[A1:.+]], i32{{.+}}%[[B0:.+]], i32{{.+}}%[[B1:.+]]) +#[no_mangle] +pub fn check_gt(a: Foo, b: Foo) -> bool { + // CHECK-DAG: %[[EQ:.+]] = icmp eq i32 %[[A0]], %[[B0]] + // CHECK-DAG: %[[R0:.+]] = icmp sgt i32 %[[A0]], %[[B0]] + // CHECK-DAG: %[[R1:.+]] = icmp ugt i32 %[[A1]], %[[B1]] + // CHECK: %[[R:.+]] = select i1 %[[EQ]], i1 %[[R1]], i1 %[[R0]] + // CHECK-NEXT: ret i1 %[[R]] + a > b +} + +// CHECK-LABEL: @check_ge( +// CHECK-SAME: i32{{.+}}%[[A0:.+]], i32{{.+}}%[[A1:.+]], i32{{.+}}%[[B0:.+]], i32{{.+}}%[[B1:.+]]) +#[no_mangle] +pub fn check_ge(a: Foo, b: Foo) -> bool { + // CHECK-DAG: %[[EQ:.+]] = icmp eq i32 %[[A0]], %[[B0]] + // CHECK-DAG: %[[R0:.+]] = icmp sge i32 %[[A0]], %[[B0]] + // CHECK-DAG: %[[R1:.+]] = icmp uge i32 %[[A1]], %[[B1]] + // CHECK: %[[R:.+]] = select i1 %[[EQ]], i1 %[[R1]], i1 %[[R0]] + // CHECK-NEXT: ret i1 %[[R]] + a >= b +} diff --git a/tests/codegen/comparison-operators-2-tuple.rs b/tests/codegen/comparison-operators-2-tuple.rs index 8e2915e84eb..91a99f9b91f 100644 --- a/tests/codegen/comparison-operators-2-tuple.rs +++ b/tests/codegen/comparison-operators-2-tuple.rs @@ -1,5 +1,6 @@ //@ compile-flags: -C opt-level=1 -Z merge-functions=disabled //@ only-x86_64 +//@ min-llvm-version: 20 #![crate_type = "lib"] @@ -65,12 +66,7 @@ pub fn check_ge_direct(a: TwoTuple, b: TwoTuple) -> bool { } // -// These ones are harder, since there are more intermediate values to remove. -// -// `<` seems to be getting lucky right now, so test that doesn't regress. -// -// The others, however, aren't managing to optimize away the extra `select`s yet. -// See <https://github.com/rust-lang/rust/issues/106107> for more about this. +// These used to not optimize as well, but thanks to LLVM 20 they work now 🎉 // // CHECK-LABEL: @check_lt_via_cmp @@ -89,11 +85,11 @@ pub fn check_lt_via_cmp(a: TwoTuple, b: TwoTuple) -> bool { // CHECK-SAME: (i16 noundef %[[A0:.+]], i16 noundef %[[A1:.+]], i16 noundef %[[B0:.+]], i16 noundef %[[B1:.+]]) #[no_mangle] pub fn check_le_via_cmp(a: TwoTuple, b: TwoTuple) -> bool { - // FIXME-CHECK-DAG: %[[EQ:.+]] = icmp eq i16 %[[A0]], %[[B0]] - // FIXME-CHECK-DAG: %[[CMP0:.+]] = icmp sle i16 %[[A0]], %[[B0]] - // FIXME-CHECK-DAG: %[[CMP1:.+]] = icmp ule i16 %[[A1]], %[[B1]] - // FIXME-CHECK: %[[R:.+]] = select i1 %[[EQ]], i1 %[[CMP1]], i1 %[[CMP0]] - // FIXME-CHECK: ret i1 %[[R]] + // CHECK-DAG: %[[EQ:.+]] = icmp eq i16 %[[A0]], %[[B0]] + // CHECK-DAG: %[[CMP0:.+]] = icmp sle i16 %[[A0]], %[[B0]] + // CHECK-DAG: %[[CMP1:.+]] = icmp ule i16 %[[A1]], %[[B1]] + // CHECK: %[[R:.+]] = select i1 %[[EQ]], i1 %[[CMP1]], i1 %[[CMP0]] + // CHECK: ret i1 %[[R]] Ord::cmp(&a, &b).is_le() } @@ -101,11 +97,11 @@ pub fn check_le_via_cmp(a: TwoTuple, b: TwoTuple) -> bool { // CHECK-SAME: (i16 noundef %[[A0:.+]], i16 noundef %[[A1:.+]], i16 noundef %[[B0:.+]], i16 noundef %[[B1:.+]]) #[no_mangle] pub fn check_gt_via_cmp(a: TwoTuple, b: TwoTuple) -> bool { - // FIXME-CHECK-DAG: %[[EQ:.+]] = icmp eq i16 %[[A0]], %[[B0]] - // FIXME-CHECK-DAG: %[[CMP0:.+]] = icmp sgt i16 %[[A0]], %[[B0]] - // FIXME-CHECK-DAG: %[[CMP1:.+]] = icmp ugt i16 %[[A1]], %[[B1]] - // FIXME-CHECK: %[[R:.+]] = select i1 %[[EQ]], i1 %[[CMP1]], i1 %[[CMP0]] - // FIXME-CHECK: ret i1 %[[R]] + // CHECK-DAG: %[[EQ:.+]] = icmp eq i16 %[[A0]], %[[B0]] + // CHECK-DAG: %[[CMP0:.+]] = icmp sgt i16 %[[A0]], %[[B0]] + // CHECK-DAG: %[[CMP1:.+]] = icmp ugt i16 %[[A1]], %[[B1]] + // CHECK: %[[R:.+]] = select i1 %[[EQ]], i1 %[[CMP1]], i1 %[[CMP0]] + // CHECK: ret i1 %[[R]] Ord::cmp(&a, &b).is_gt() } @@ -113,10 +109,10 @@ pub fn check_gt_via_cmp(a: TwoTuple, b: TwoTuple) -> bool { // CHECK-SAME: (i16 noundef %[[A0:.+]], i16 noundef %[[A1:.+]], i16 noundef %[[B0:.+]], i16 noundef %[[B1:.+]]) #[no_mangle] pub fn check_ge_via_cmp(a: TwoTuple, b: TwoTuple) -> bool { - // FIXME-CHECK-DAG: %[[EQ:.+]] = icmp eq i16 %[[A0]], %[[B0]] - // FIXME-CHECK-DAG: %[[CMP0:.+]] = icmp sge i16 %[[A0]], %[[B0]] - // FIXME-CHECK-DAG: %[[CMP1:.+]] = icmp uge i16 %[[A1]], %[[B1]] - // FIXME-CHECK: %[[R:.+]] = select i1 %[[EQ]], i1 %[[CMP1]], i1 %[[CMP0]] - // FIXME-CHECK: ret i1 %[[R]] + // CHECK-DAG: %[[EQ:.+]] = icmp eq i16 %[[A0]], %[[B0]] + // CHECK-DAG: %[[CMP0:.+]] = icmp sge i16 %[[A0]], %[[B0]] + // CHECK-DAG: %[[CMP1:.+]] = icmp uge i16 %[[A1]], %[[B1]] + // CHECK: %[[R:.+]] = select i1 %[[EQ]], i1 %[[CMP1]], i1 %[[CMP0]] + // CHECK: ret i1 %[[R]] Ord::cmp(&a, &b).is_ge() } diff --git a/tests/codegen/default-requires-uwtable.rs b/tests/codegen/default-requires-uwtable.rs index 3cb35cea022..54a6e171db6 100644 --- a/tests/codegen/default-requires-uwtable.rs +++ b/tests/codegen/default-requires-uwtable.rs @@ -1,3 +1,4 @@ +//@ add-core-stubs //@ revisions: WINDOWS_ ANDROID_ //@ compile-flags: -C panic=abort -Copt-level=0 //@ [WINDOWS_] compile-flags: --target=x86_64-pc-windows-msvc @@ -9,8 +10,8 @@ #![crate_type = "lib"] #![no_core] -#[lang = "sized"] -trait Sized {} +extern crate minicore; +use minicore::*; // CHECK: attributes #{{.*}} uwtable pub fn foo() {} diff --git a/tests/codegen/enum/enum-two-variants-match.rs b/tests/codegen/enum/enum-two-variants-match.rs new file mode 100644 index 00000000000..e5978bfc761 --- /dev/null +++ b/tests/codegen/enum/enum-two-variants-match.rs @@ -0,0 +1,51 @@ +//@ compile-flags: -Copt-level=3 -C no-prepopulate-passes +//@ min-llvm-version: 19 (for trunc nuw) +//@ only-x86_64 (because these discriminants are isize) + +#![crate_type = "lib"] + +// CHECK-LABEL: @option_match +#[no_mangle] +pub fn option_match(x: Option<i32>) -> u16 { + // CHECK: %x = alloca [8 x i8] + // CHECK: store i32 %0, ptr %x + // CHECK: %[[TAG:.+]] = load i32, ptr %x + // CHECK-SAME: !range ![[ZERO_ONE_32:[0-9]+]] + // CHECK: %[[DISCR:.+]] = zext i32 %[[TAG]] to i64 + // CHECK: %[[COND:.+]] = trunc nuw i64 %[[DISCR]] to i1 + // CHECK: br i1 %[[COND]], label %[[TRUE:[a-z0-9]+]], label %[[FALSE:[a-z0-9]+]] + + // CHECK: [[TRUE]]: + // CHECK: store i16 13 + + // CHECK: [[FALSE]]: + // CHECK: store i16 42 + match x { + Some(_) => 13, + None => 42, + } +} + +// CHECK-LABEL: @result_match +#[no_mangle] +pub fn result_match(x: Result<u64, i64>) -> u16 { + // CHECK: %x = alloca [16 x i8] + // CHECK: store i64 %0, ptr %x + // CHECK: %[[DISCR:.+]] = load i64, ptr %x + // CHECK-SAME: !range ![[ZERO_ONE_64:[0-9]+]] + // CHECK: %[[COND:.+]] = trunc nuw i64 %[[DISCR]] to i1 + // CHECK: br i1 %[[COND]], label %[[TRUE:[a-z0-9]+]], label %[[FALSE:[a-z0-9]+]] + + // CHECK: [[TRUE]]: + // CHECK: store i16 13 + + // CHECK: [[FALSE]]: + // CHECK: store i16 42 + match x { + Err(_) => 13, + Ok(_) => 42, + } +} + +// CHECK: ![[ZERO_ONE_32]] = !{i32 0, i32 2} +// CHECK: ![[ZERO_ONE_64]] = !{i64 0, i64 2} diff --git a/tests/codegen/fastcall-inreg.rs b/tests/codegen/fastcall-inreg.rs index 00b390bf1bf..066943d6e7e 100644 --- a/tests/codegen/fastcall-inreg.rs +++ b/tests/codegen/fastcall-inreg.rs @@ -2,6 +2,7 @@ // as "inreg" like the C/C++ compilers for the platforms. // x86 only. +//@ add-core-stubs //@ compile-flags: --target i686-unknown-linux-gnu -Cno-prepopulate-passes -Copt-level=3 //@ needs-llvm-components: x86 @@ -9,10 +10,8 @@ #![no_core] #![feature(no_core, lang_items)] -#[lang = "sized"] -trait Sized {} -#[lang = "copy"] -trait Copy {} +extern crate minicore; +use minicore::*; pub mod tests { // CHECK: @f1(i32 inreg noundef %_1, i32 inreg noundef %_2, i32 noundef %_3) diff --git a/tests/codegen/fixed-x18.rs b/tests/codegen/fixed-x18.rs index 4997a39a726..a5767cfa456 100644 --- a/tests/codegen/fixed-x18.rs +++ b/tests/codegen/fixed-x18.rs @@ -1,6 +1,7 @@ // Test that the `reserve-x18` target feature is (not) emitted when // the `-Zfixed-x18` flag is (not) set. +//@ add-core-stubs //@ revisions: unset set //@ needs-llvm-components: aarch64 //@ compile-flags: --target aarch64-unknown-none @@ -10,8 +11,8 @@ #![feature(no_core, lang_items)] #![no_core] -#[lang = "sized"] -trait Sized {} +extern crate minicore; +use minicore::*; #[no_mangle] pub fn foo() { diff --git a/tests/codegen/frame-pointer.rs b/tests/codegen/frame-pointer.rs index da81c2e9cd9..1f7c9a59c98 100644 --- a/tests/codegen/frame-pointer.rs +++ b/tests/codegen/frame-pointer.rs @@ -1,3 +1,4 @@ +//@ add-core-stubs //@ compile-flags: --crate-type=rlib -Copt-level=0 //@ revisions: aarch64-apple aarch64-linux force x64-apple x64-linux //@ [aarch64-apple] needs-llvm-components: aarch64 @@ -13,11 +14,9 @@ #![feature(no_core, lang_items)] #![no_core] -#[lang = "sized"] -trait Sized {} -#[lang = "copy"] -trait Copy {} -impl Copy for u32 {} + +extern crate minicore; +use minicore::*; // CHECK: define i32 @peach{{.*}}[[PEACH_ATTRS:\#[0-9]+]] { #[no_mangle] diff --git a/tests/codegen/function-return.rs b/tests/codegen/function-return.rs index 2b9de4e1478..4127f516038 100644 --- a/tests/codegen/function-return.rs +++ b/tests/codegen/function-return.rs @@ -1,6 +1,7 @@ // Test that the `fn_ret_thunk_extern` function attribute is (not) emitted when // the `-Zfunction-return={keep,thunk-extern}` flag is (not) set. +//@ add-core-stubs //@ revisions: unset keep thunk-extern keep-thunk-extern thunk-extern-keep //@ needs-llvm-components: x86 //@ compile-flags: --target x86_64-unknown-linux-gnu @@ -13,8 +14,8 @@ #![feature(no_core, lang_items)] #![no_core] -#[lang = "sized"] -trait Sized {} +extern crate minicore; +use minicore::*; #[no_mangle] pub fn foo() { diff --git a/tests/codegen/gpu-kernel-abi.rs b/tests/codegen/gpu-kernel-abi.rs index fba17936494..8ac376d9338 100644 --- a/tests/codegen/gpu-kernel-abi.rs +++ b/tests/codegen/gpu-kernel-abi.rs @@ -1,17 +1,14 @@ // Checks that the gpu-kernel calling convention correctly translates to LLVM calling conventions. +//@ add-core-stubs //@ revisions: nvptx //@ [nvptx] compile-flags: --crate-type=rlib --target=nvptx64-nvidia-cuda //@ [nvptx] needs-llvm-components: nvptx #![feature(no_core, lang_items, abi_gpu_kernel)] #![no_core] -#[lang = "sized"] -trait Sized {} -#[lang = "freeze"] -trait Freeze {} -#[lang = "copy"] -trait Copy {} +extern crate minicore; +use minicore::*; // nvptx: define ptx_kernel void @fun(i32 #[no_mangle] diff --git a/tests/codegen/intrinsics/cold_path2.rs b/tests/codegen/intrinsics/cold_path2.rs index 1e7e0478f4f..54ee473e620 100644 --- a/tests/codegen/intrinsics/cold_path2.rs +++ b/tests/codegen/intrinsics/cold_path2.rs @@ -26,7 +26,8 @@ pub fn test(x: Option<bool>) { } // CHECK-LABEL: @test( - // CHECK: br i1 %1, label %bb2, label %bb1, !prof ![[NUM:[0-9]+]] + // CHECK: %[[IS_NONE:.+]] = icmp eq i8 %0, 2 + // CHECK: br i1 %[[IS_NONE]], label %bb2, label %bb1, !prof ![[NUM:[0-9]+]] // CHECK: bb1: // CHECK: path_a // CHECK: bb2: diff --git a/tests/codegen/intrinsics/nontemporal.rs b/tests/codegen/intrinsics/nontemporal.rs index af8892d30e7..1d4fae83c29 100644 --- a/tests/codegen/intrinsics/nontemporal.rs +++ b/tests/codegen/intrinsics/nontemporal.rs @@ -1,3 +1,4 @@ +//@ add-core-stubs //@ compile-flags: -Copt-level=3 //@revisions: with_nontemporal without_nontemporal //@[with_nontemporal] compile-flags: --target aarch64-unknown-linux-gnu @@ -14,13 +15,8 @@ #![no_core] #![crate_type = "lib"] -#[lang = "sized"] -pub trait Sized {} -#[lang = "copy"] -pub trait Copy {} - -impl Copy for u32 {} -impl<T> Copy for *mut T {} +extern crate minicore; +use minicore::*; extern "rust-intrinsic" { pub fn nontemporal_store<T>(ptr: *mut T, val: T); diff --git a/tests/codegen/intrinsics/transmute.rs b/tests/codegen/intrinsics/transmute.rs index ff297b27065..4849b88c09c 100644 --- a/tests/codegen/intrinsics/transmute.rs +++ b/tests/codegen/intrinsics/transmute.rs @@ -10,6 +10,7 @@ use std::intrinsics::mir::*; use std::intrinsics::{transmute, transmute_unchecked}; use std::mem::MaybeUninit; +use std::num::NonZero; // FIXME(LLVM18REMOVED): `trunc nuw` doesn't exist in LLVM 18, so once we no // longer support it the optional flag checks can be changed to required. @@ -470,3 +471,27 @@ pub unsafe fn check_from_overalign(x: HighAlignScalar) -> u64 { // CHECK: ret i64 %[[VAL]] transmute(x) } + +#[repr(transparent)] +struct Level1(std::num::NonZero<u32>); +#[repr(transparent)] +struct Level2(Level1); +#[repr(transparent)] +struct Level3(Level2); + +// CHECK-LABEL: @repeatedly_transparent_transmute +// CHECK-SAME: (i32{{.+}}%[[ARG:[^)]+]]) +#[no_mangle] +#[custom_mir(dialect = "runtime", phase = "optimized")] +pub unsafe fn repeatedly_transparent_transmute(x: NonZero<u32>) -> Level3 { + // CHECK: start + // CHECK-NEXT: ret i32 %[[ARG]] + mir! { + { + let A = CastTransmute::<NonZero<u32>, Level1>(x); + let B = CastTransmute::<Level1, Level2>(A); + RET = CastTransmute::<Level2, Level3>(B); + Return() + } + } +} diff --git a/tests/codegen/issues/issue-101082.rs b/tests/codegen/issues/issue-101082.rs index 048b69d207b..7fb850ca253 100644 --- a/tests/codegen/issues/issue-101082.rs +++ b/tests/codegen/issues/issue-101082.rs @@ -1,5 +1,6 @@ //@ compile-flags: -Copt-level=3 //@ revisions: host x86-64-v3 +//@ min-llvm-version: 20 // This particular CPU regressed in #131563 //@[x86-64-v3] only-x86_64 diff --git a/tests/codegen/issues/issue-114312.rs b/tests/codegen/issues/issue-114312.rs index e9418249089..61355dd5873 100644 --- a/tests/codegen/issues/issue-114312.rs +++ b/tests/codegen/issues/issue-114312.rs @@ -15,7 +15,6 @@ pub enum Expr { #[no_mangle] pub extern "C" fn issue_114312(expr: Expr) { // CHECK-LABEL: @issue_114312( - // CHECK-NOT: readonly // CHECK-SAME: byval // CHECK-NEXT: start: // CHECK-NEXT: ret void diff --git a/tests/codegen/issues/issue-122600-ptr-discriminant-update.rs b/tests/codegen/issues/issue-122600-ptr-discriminant-update.rs index fdb8f06df80..fbea4ee8979 100644 --- a/tests/codegen/issues/issue-122600-ptr-discriminant-update.rs +++ b/tests/codegen/issues/issue-122600-ptr-discriminant-update.rs @@ -3,6 +3,11 @@ #![crate_type = "lib"] +// The bug here was that it was loading and storing the whole value. +// It's ok for it to load the discriminant, +// to preserve the UB from `unreachable_unchecked`, +// but it better only store the constant discriminant of `B`. + pub enum State { A([u8; 753]), B([u8; 753]), @@ -11,9 +16,27 @@ pub enum State { // CHECK-LABEL: @update #[no_mangle] pub unsafe fn update(s: *mut State) { - // CHECK-NEXT: start: - // CHECK-NEXT: store i8 - // CHECK-NEXT: ret + // CHECK-NOT: alloca + + // CHECK-NOT: load + // CHECK-NOT: store + // CHECK-NOT: memcpy + // CHECK-NOT: 75{{3|4}} + + // CHECK: %[[TAG:.+]] = load i8, ptr %s, align 1 + // CHECK-NEXT: trunc nuw i8 %[[TAG]] to i1 + + // CHECK-NOT: load + // CHECK-NOT: store + // CHECK-NOT: memcpy + // CHECK-NOT: 75{{3|4}} + + // CHECK: store i8 1, ptr %s, align 1 + + // CHECK-NOT: load + // CHECK-NOT: store + // CHECK-NOT: memcpy + // CHECK-NOT: 75{{3|4}} let State::A(v) = s.read() else { std::hint::unreachable_unchecked() }; s.write(State::B(v)); } diff --git a/tests/codegen/issues/issue-84268.rs b/tests/codegen/issues/issue-84268.rs index 8a8ea9d1ccf..1dc55a909ad 100644 --- a/tests/codegen/issues/issue-84268.rs +++ b/tests/codegen/issues/issue-84268.rs @@ -1,10 +1,7 @@ //@ compile-flags: -Copt-level=3 --crate-type=rlib -#![feature(intrinsics, repr_simd)] +#![feature(core_intrinsics, repr_simd)] -extern "rust-intrinsic" { - fn simd_fabs<T>(x: T) -> T; - fn simd_eq<T, U>(x: T, y: T) -> U; -} +use std::intrinsics::simd::{simd_eq, simd_fabs}; #[repr(simd)] pub struct V([f32; 4]); diff --git a/tests/codegen/issues/looping-over-ne-bytes-133528.rs b/tests/codegen/issues/looping-over-ne-bytes-133528.rs new file mode 100644 index 00000000000..35acf765d69 --- /dev/null +++ b/tests/codegen/issues/looping-over-ne-bytes-133528.rs @@ -0,0 +1,17 @@ +//@ compile-flags: -Copt-level=3 +//@ min-llvm-version: 20 +#![crate_type = "lib"] + +/// Ensure the function is properly optimized +/// In the issue #133528, the function was not getting optimized +/// whereas, a version with `bytes` wrapped into a `black_box` was optimized +/// It was probably a LLVM bug that was fixed in LLVM 20 + +// CHECK-LABEL: @looping_over_ne_bytes +// CHECK: icmp eq i64 %input, -1 +// CHECK-NEXT: ret i1 +#[no_mangle] +fn looping_over_ne_bytes(input: u64) -> bool { + let bytes = input.to_ne_bytes(); + bytes.iter().all(|x| *x == !0) +} diff --git a/tests/codegen/issues/str-to-string-128690.rs b/tests/codegen/issues/str-to-string-128690.rs index 8b416306ba6..d9e69764be2 100644 --- a/tests/codegen/issues/str-to-string-128690.rs +++ b/tests/codegen/issues/str-to-string-128690.rs @@ -2,25 +2,27 @@ #![crate_type = "lib"] //! Make sure str::to_string is specialized not to use fmt machinery. +//! +//! Note that the `CHECK-NOT`s here try to match on calls to functions under `core::fmt`. // CHECK-LABEL: define {{(dso_local )?}}void @one_ref #[no_mangle] pub fn one_ref(input: &str) -> String { - // CHECK-NOT: {{(call|invoke).*}}fmt + // CHECK-NOT: {{(call|invoke)}}{{.*}}@{{.*}}core{{.*}}fmt{{.*}} input.to_string() } // CHECK-LABEL: define {{(dso_local )?}}void @two_ref #[no_mangle] pub fn two_ref(input: &&str) -> String { - // CHECK-NOT: {{(call|invoke).*}}fmt + // CHECK-NOT: {{(call|invoke)}}{{.*}}@{{.*}}core{{.*}}fmt{{.*}} input.to_string() } // CHECK-LABEL: define {{(dso_local )?}}void @thirteen_ref #[no_mangle] pub fn thirteen_ref(input: &&&&&&&&&&&&&str) -> String { - // CHECK-NOT: {{(call|invoke).*}}fmt + // CHECK-NOT: {{(call|invoke)}}{{.*}}@{{.*}}core{{.*}}fmt{{.*}} input.to_string() } @@ -31,6 +33,6 @@ pub fn thirteen_ref(input: &&&&&&&&&&&&&str) -> String { // CHECK-LABEL: define {{(dso_local )?}}void @fourteen_ref #[no_mangle] pub fn fourteen_ref(input: &&&&&&&&&&&&&&str) -> String { - // CHECK: {{(call|invoke).*}}fmt + // CHECK: {{(call|invoke)}}{{.*}}@{{.*}}core{{.*}}fmt{{.*}} input.to_string() } diff --git a/tests/codegen/loongarch-abi/loongarch64-lp64d-abi.rs b/tests/codegen/loongarch-abi/loongarch64-lp64d-abi.rs index b11bd657c18..93c8d60930b 100644 --- a/tests/codegen/loongarch-abi/loongarch64-lp64d-abi.rs +++ b/tests/codegen/loongarch-abi/loongarch64-lp64d-abi.rs @@ -1,3 +1,4 @@ +//@ add-core-stubs //@ compile-flags: -Copt-level=3 -C no-prepopulate-passes --target loongarch64-unknown-linux-gnu //@ needs-llvm-components: loongarch @@ -6,12 +7,8 @@ #![no_std] #![no_core] -#[lang = "sized"] -trait Sized {} -#[lang = "freeze"] -trait Freeze {} -#[lang = "copy"] -trait Copy {} +extern crate minicore; +use minicore::*; // CHECK: define void @f_fpr_tracking(double %0, double %1, double %2, double %3, double %4, double %5, double %6, double %7, i8 noundef zeroext %i) #[no_mangle] diff --git a/tests/codegen/macos/i686-macosx-deployment-target.rs b/tests/codegen/macos/i686-macosx-deployment-target.rs index 1f44bdfc648..cfa91e61cb0 100644 --- a/tests/codegen/macos/i686-macosx-deployment-target.rs +++ b/tests/codegen/macos/i686-macosx-deployment-target.rs @@ -1,19 +1,15 @@ -// // Checks that we correctly modify the target when MACOSX_DEPLOYMENT_TARGET is set. // See issue #60235. +//@ add-core-stubs //@ compile-flags: -Copt-level=3 --target=i686-apple-darwin --crate-type=rlib //@ needs-llvm-components: x86 //@ rustc-env:MACOSX_DEPLOYMENT_TARGET=10.14 #![feature(no_core, lang_items)] #![no_core] -#[lang = "sized"] -trait Sized {} -#[lang = "freeze"] -trait Freeze {} -#[lang = "copy"] -trait Copy {} +extern crate minicore; +use minicore::*; #[repr(C)] pub struct Bool { diff --git a/tests/codegen/macos/i686-no-macosx-deployment-target.rs b/tests/codegen/macos/i686-no-macosx-deployment-target.rs index a09773e0b9e..25ec5f6acbb 100644 --- a/tests/codegen/macos/i686-no-macosx-deployment-target.rs +++ b/tests/codegen/macos/i686-no-macosx-deployment-target.rs @@ -1,19 +1,15 @@ -// // Checks that we leave the target alone MACOSX_DEPLOYMENT_TARGET is unset. // See issue #60235. +//@ add-core-stubs //@ compile-flags: -Copt-level=3 --target=i686-apple-darwin --crate-type=rlib //@ needs-llvm-components: x86 //@ unset-rustc-env:MACOSX_DEPLOYMENT_TARGET #![feature(no_core, lang_items)] #![no_core] -#[lang = "sized"] -trait Sized {} -#[lang = "freeze"] -trait Freeze {} -#[lang = "copy"] -trait Copy {} +extern crate minicore; +use minicore::*; #[repr(C)] pub struct Bool { diff --git a/tests/codegen/macos/x86_64-macosx-deployment-target.rs b/tests/codegen/macos/x86_64-macosx-deployment-target.rs index bd8c027a9fb..8ea95ba0575 100644 --- a/tests/codegen/macos/x86_64-macosx-deployment-target.rs +++ b/tests/codegen/macos/x86_64-macosx-deployment-target.rs @@ -1,19 +1,15 @@ -// // Checks that we correctly modify the target when MACOSX_DEPLOYMENT_TARGET is set. // See issue #60235. +//@ add-core-stubs //@ compile-flags: -Copt-level=3 --target=x86_64-apple-darwin --crate-type=rlib //@ needs-llvm-components: x86 //@ rustc-env:MACOSX_DEPLOYMENT_TARGET=10.14 #![feature(no_core, lang_items)] #![no_core] -#[lang = "sized"] -trait Sized {} -#[lang = "freeze"] -trait Freeze {} -#[lang = "copy"] -trait Copy {} +extern crate minicore; +use minicore::*; #[repr(C)] pub struct Bool { diff --git a/tests/codegen/macos/x86_64-no-macosx-deployment-target.rs b/tests/codegen/macos/x86_64-no-macosx-deployment-target.rs index ff4a8fc46f9..474094957ae 100644 --- a/tests/codegen/macos/x86_64-no-macosx-deployment-target.rs +++ b/tests/codegen/macos/x86_64-no-macosx-deployment-target.rs @@ -1,19 +1,15 @@ -// // Checks that we leave the target alone when MACOSX_DEPLOYMENT_TARGET is unset. // See issue #60235. +//@ add-core-stubs //@ compile-flags: -Copt-level=3 --target=x86_64-apple-darwin --crate-type=rlib //@ needs-llvm-components: x86 //@ unset-rustc-env:MACOSX_DEPLOYMENT_TARGET #![feature(no_core, lang_items)] #![no_core] -#[lang = "sized"] -trait Sized {} -#[lang = "freeze"] -trait Freeze {} -#[lang = "copy"] -trait Copy {} +extern crate minicore; +use minicore::*; #[repr(C)] pub struct Bool { diff --git a/tests/codegen/naked-fn/instruction-set.rs b/tests/codegen/naked-fn/instruction-set.rs index 5b790b2034c..a7b4c22a59b 100644 --- a/tests/codegen/naked-fn/instruction-set.rs +++ b/tests/codegen/naked-fn/instruction-set.rs @@ -1,3 +1,4 @@ +//@ add-core-stubs //@ revisions: arm-mode thumb-mode //@ [arm-mode] compile-flags: --target armv5te-none-eabi //@ [thumb-mode] compile-flags: --target thumbv5te-none-eabi @@ -8,15 +9,8 @@ #![feature(no_core, lang_items, rustc_attrs, naked_functions)] #![no_core] -#[rustc_builtin_macro] -macro_rules! naked_asm { - () => {}; -} - -#[lang = "sized"] -trait Sized {} -#[lang = "copy"] -trait Copy {} +extern crate minicore; +use minicore::*; // arm-mode: .arm // thumb-mode: .thumb diff --git a/tests/codegen/naked-fn/naked-functions.rs b/tests/codegen/naked-fn/naked-functions.rs index f505d27d48c..6483e27c97a 100644 --- a/tests/codegen/naked-fn/naked-functions.rs +++ b/tests/codegen/naked-fn/naked-functions.rs @@ -1,3 +1,4 @@ +//@ add-core-stubs //@ revisions: linux win macos thumb // //@[linux] compile-flags: --target x86_64-unknown-linux-gnu @@ -13,15 +14,8 @@ #![feature(no_core, lang_items, rustc_attrs, naked_functions)] #![no_core] -#[rustc_builtin_macro] -macro_rules! naked_asm { - () => {}; -} - -#[lang = "sized"] -trait Sized {} -#[lang = "copy"] -trait Copy {} +extern crate minicore; +use minicore::*; // linux,win: .intel_syntax // diff --git a/tests/codegen/no-jump-tables.rs b/tests/codegen/no-jump-tables.rs index 654da2cec11..e49de7e9dc1 100644 --- a/tests/codegen/no-jump-tables.rs +++ b/tests/codegen/no-jump-tables.rs @@ -1,6 +1,7 @@ // Test that the `no-jump-tables` function attribute are (not) emitted when // the `-Zno-jump-tables` flag is (not) set. +//@ add-core-stubs //@ revisions: unset set //@ needs-llvm-components: x86 //@ compile-flags: --target x86_64-unknown-linux-gnu @@ -10,8 +11,8 @@ #![feature(no_core, lang_items)] #![no_core] -#[lang = "sized"] -trait Sized {} +extern crate minicore; +use minicore::*; #[no_mangle] pub fn foo() { diff --git a/tests/codegen/overaligned-constant.rs b/tests/codegen/overaligned-constant.rs index e5540aca387..0f5977880f2 100644 --- a/tests/codegen/overaligned-constant.rs +++ b/tests/codegen/overaligned-constant.rs @@ -9,14 +9,14 @@ struct S(i32); struct SmallStruct(f32, Option<S>, &'static [f32]); -// CHECK: @0 = private unnamed_addr constant +// CHECK: [[const:@.*]] = private unnamed_addr constant // CHECK-SAME: , align 8 #[no_mangle] pub fn overaligned_constant() { // CHECK-LABEL: @overaligned_constant // CHECK: [[full:%_.*]] = alloca [32 x i8], align 8 - // CHECK: call void @llvm.memcpy.p0.p0.i64(ptr align 8 [[full]], ptr align 8 @0, i64 32, i1 false) + // CHECK: call void @llvm.memcpy.p0.p0.i64(ptr align 8 [[full]], ptr align 8 [[const]], i64 32, i1 false) let mut s = S(1); s.0 = 3; diff --git a/tests/codegen/pattern_type_symbols.rs b/tests/codegen/pattern_type_symbols.rs index b504a3508f9..e86a9ef27de 100644 --- a/tests/codegen/pattern_type_symbols.rs +++ b/tests/codegen/pattern_type_symbols.rs @@ -16,7 +16,7 @@ pub fn bar() { // CHECK: call pattern_type_symbols::foo::<u32> // CHECK: call void @_RINvC[[CRATE_IDENT:[a-zA-Z0-9]{12}]]_20pattern_type_symbols3foomEB2_ foo::<u32>(); - // CHECK: call pattern_type_symbols::foo::<(u32, [(); 0], [(); 999999999], [(); true])> - // CHECK: call void @_RINvC[[CRATE_IDENT]]_20pattern_type_symbols3fooTmAum0_Aum3b9ac9ff_Aub1_EEB2_ + // CHECK: call pattern_type_symbols::foo::<(u32, [(); 0], [(); 999999999])> + // CHECK: call void @_RINvC[[CRATE_IDENT]]_20pattern_type_symbols3fooTmAum0_Aum3b9ac9ff_EEB2_ foo::<NanoU32>(); } diff --git a/tests/codegen/powerpc64le-struct-align-128.rs b/tests/codegen/powerpc64le-struct-align-128.rs index 3981cd12129..c1c1ac26485 100644 --- a/tests/codegen/powerpc64le-struct-align-128.rs +++ b/tests/codegen/powerpc64le-struct-align-128.rs @@ -1,6 +1,7 @@ // Test that structs aligned to 128 bits are passed with the correct ABI on powerpc64le. // This is similar to aarch64-struct-align-128.rs, but for ppc. +//@ add-core-stubs //@ compile-flags: --target powerpc64le-unknown-linux-gnu //@ needs-llvm-components: powerpc @@ -8,12 +9,8 @@ #![crate_type = "lib"] #![no_core] -#[lang = "sized"] -trait Sized {} -#[lang = "freeze"] -trait Freeze {} -#[lang = "copy"] -trait Copy {} +extern crate minicore; +use minicore::*; #[repr(C)] pub struct Align8 { diff --git a/tests/codegen/regparm-inreg.rs b/tests/codegen/regparm-inreg.rs index 82e15731128..8dae3a83e4e 100644 --- a/tests/codegen/regparm-inreg.rs +++ b/tests/codegen/regparm-inreg.rs @@ -2,6 +2,7 @@ // marks function arguments as "inreg" like the C/C++ compilers for the platforms. // x86 only. +//@ add-core-stubs //@ compile-flags: --target i686-unknown-linux-gnu -Cno-prepopulate-passes -Copt-level=3 //@ needs-llvm-components: x86 @@ -14,10 +15,9 @@ #![crate_type = "lib"] #![no_core] #![feature(no_core, lang_items, repr_simd)] -#[lang = "sized"] -trait Sized {} -#[lang = "copy"] -trait Copy {} + +extern crate minicore; +use minicore::*; pub mod tests { // regparm doesn't work for "fastcall" calling conv (only 2 inregs) diff --git a/tests/codegen/repr/transparent-byval-struct-ptr.rs b/tests/codegen/repr/transparent-byval-struct-ptr.rs index f9cfeb90390..0918884144f 100644 --- a/tests/codegen/repr/transparent-byval-struct-ptr.rs +++ b/tests/codegen/repr/transparent-byval-struct-ptr.rs @@ -1,3 +1,4 @@ +//@ add-core-stubs //@ revisions: i686-linux i686-freebsd x64-linux x64-apple //@ compile-flags: -Copt-level=3 -C no-prepopulate-passes @@ -21,14 +22,9 @@ #![no_std] #![no_core] -#[lang = "sized"] -trait Sized {} -#[lang = "freeze"] -trait Freeze {} -#[lang = "copy"] -trait Copy {} +extern crate minicore; +use minicore::*; -impl Copy for [u32; 16] {} impl Copy for BigS {} impl Copy for BigU {} diff --git a/tests/codegen/repr/transparent-imm-array.rs b/tests/codegen/repr/transparent-imm-array.rs index f790d093cf4..6dad0447784 100644 --- a/tests/codegen/repr/transparent-imm-array.rs +++ b/tests/codegen/repr/transparent-imm-array.rs @@ -1,3 +1,4 @@ +//@ add-core-stubs //@ revisions: arm-linux arm-android armv7-linux armv7-android mips thumb sparc //@ compile-flags: -Copt-level=3 -C no-prepopulate-passes @@ -27,14 +28,8 @@ #![no_std] #![no_core] -#[lang = "sized"] -trait Sized {} -#[lang = "freeze"] -trait Freeze {} -#[lang = "copy"] -trait Copy {} - -impl Copy for [u32; 16] {} +extern crate minicore; +use minicore::*; impl Copy for BigS {} impl Copy for BigU {} diff --git a/tests/codegen/repr/transparent-mips64.rs b/tests/codegen/repr/transparent-mips64.rs index 7282654b856..98901350154 100644 --- a/tests/codegen/repr/transparent-mips64.rs +++ b/tests/codegen/repr/transparent-mips64.rs @@ -1,3 +1,4 @@ +//@ add-core-stubs //@ revisions: mips64 mips64el //@ compile-flags: -Copt-level=3 -C no-prepopulate-passes @@ -13,14 +14,9 @@ #![no_std] #![no_core] -#[lang = "sized"] -trait Sized {} -#[lang = "freeze"] -trait Freeze {} -#[lang = "copy"] -trait Copy {} +extern crate minicore; +use minicore::*; -impl Copy for [u32; 16] {} impl Copy for BigS {} impl Copy for BigU {} diff --git a/tests/codegen/repr/transparent-opaque-ptr.rs b/tests/codegen/repr/transparent-opaque-ptr.rs index 798b7e01bba..7911370c478 100644 --- a/tests/codegen/repr/transparent-opaque-ptr.rs +++ b/tests/codegen/repr/transparent-opaque-ptr.rs @@ -1,3 +1,4 @@ +//@ add-core-stubs //@ revisions: aarch64-linux aarch64-darwin wasm32-wasip1 //@ compile-flags: -Copt-level=3 -C no-prepopulate-passes @@ -19,14 +20,9 @@ #![no_std] #![no_core] -#[lang = "sized"] -trait Sized {} -#[lang = "freeze"] -trait Freeze {} -#[lang = "copy"] -trait Copy {} +extern crate minicore; +use minicore::*; -impl Copy for [u32; 16] {} impl Copy for BigS {} impl Copy for BigU {} diff --git a/tests/codegen/repr/transparent-sparc64.rs b/tests/codegen/repr/transparent-sparc64.rs index 05c090bd672..62bfc8a5fce 100644 --- a/tests/codegen/repr/transparent-sparc64.rs +++ b/tests/codegen/repr/transparent-sparc64.rs @@ -1,3 +1,4 @@ +//@ add-core-stubs //@ compile-flags: -Copt-level=3 -C no-prepopulate-passes --target sparc64-unknown-linux-gnu //@ needs-llvm-components: sparc @@ -8,14 +9,8 @@ #![no_std] #![no_core] -#[lang = "sized"] -trait Sized {} -#[lang = "freeze"] -trait Freeze {} -#[lang = "copy"] -trait Copy {} - -impl Copy for [u32; 16] {} +extern crate minicore; +use minicore::*; impl Copy for BigS {} impl Copy for BigU {} diff --git a/tests/codegen/repr/transparent-sysv64.rs b/tests/codegen/repr/transparent-sysv64.rs index 99c855db962..3efc3f7c391 100644 --- a/tests/codegen/repr/transparent-sysv64.rs +++ b/tests/codegen/repr/transparent-sysv64.rs @@ -1,3 +1,4 @@ +//@ add-core-stubs //@ revisions: linux apple win //@ compile-flags: -Copt-level=3 -C no-prepopulate-passes @@ -13,12 +14,8 @@ #![no_std] #![no_core] -#[lang = "sized"] -trait Sized {} -#[lang = "freeze"] -trait Freeze {} -#[lang = "copy"] -trait Copy {} +extern crate minicore; +use minicore::*; #[repr(C)] pub struct Rgb8 { diff --git a/tests/codegen/riscv-abi/riscv64-lp64-lp64f-lp64d-abi.rs b/tests/codegen/riscv-abi/riscv64-lp64-lp64f-lp64d-abi.rs index 46f747ad407..df99f6969fc 100644 --- a/tests/codegen/riscv-abi/riscv64-lp64-lp64f-lp64d-abi.rs +++ b/tests/codegen/riscv-abi/riscv64-lp64-lp64f-lp64d-abi.rs @@ -1,3 +1,4 @@ +//@ add-core-stubs //@ compile-flags: --target riscv64gc-unknown-linux-gnu -Copt-level=3 -C no-prepopulate-passes -C panic=abort //@ needs-llvm-components: riscv @@ -6,19 +7,8 @@ #![feature(no_core, lang_items)] #![allow(improper_ctypes)] -#[lang = "sized"] -trait Sized {} -#[lang = "copy"] -trait Copy {} -impl Copy for bool {} -impl Copy for i8 {} -impl Copy for u8 {} -impl Copy for i32 {} -impl Copy for i64 {} -impl Copy for u64 {} -impl Copy for f32 {} -impl Copy for f64 {} -impl<T> Copy for *mut T {} +extern crate minicore; +use minicore::*; // CHECK: define void @f_void() #[no_mangle] diff --git a/tests/codegen/riscv-abi/riscv64-lp64d-abi.rs b/tests/codegen/riscv-abi/riscv64-lp64d-abi.rs index bef8fe0c044..d768ab9381a 100644 --- a/tests/codegen/riscv-abi/riscv64-lp64d-abi.rs +++ b/tests/codegen/riscv-abi/riscv64-lp64d-abi.rs @@ -1,3 +1,4 @@ +//@ add-core-stubs //@ compile-flags: -Copt-level=3 -C no-prepopulate-passes --target riscv64gc-unknown-linux-gnu //@ needs-llvm-components: riscv @@ -6,12 +7,8 @@ #![no_std] #![no_core] -#[lang = "sized"] -trait Sized {} -#[lang = "freeze"] -trait Freeze {} -#[lang = "copy"] -trait Copy {} +extern crate minicore; +use minicore::*; // CHECK: define void @f_fpr_tracking(double %0, double %1, double %2, double %3, double %4, double %5, double %6, double %7, i8 noundef zeroext %i) #[no_mangle] diff --git a/tests/codegen/riscv-abi/riscv64-lp64f-lp64d-abi.rs b/tests/codegen/riscv-abi/riscv64-lp64f-lp64d-abi.rs index 214370f424c..361f0322690 100644 --- a/tests/codegen/riscv-abi/riscv64-lp64f-lp64d-abi.rs +++ b/tests/codegen/riscv-abi/riscv64-lp64f-lp64d-abi.rs @@ -1,3 +1,4 @@ +//@ add-core-stubs //@ compile-flags: -Copt-level=3 -C no-prepopulate-passes --target riscv64gc-unknown-linux-gnu //@ needs-llvm-components: riscv @@ -6,12 +7,8 @@ #![no_std] #![no_core] -#[lang = "sized"] -trait Sized {} -#[lang = "freeze"] -trait Freeze {} -#[lang = "copy"] -trait Copy {} +extern crate minicore; +use minicore::*; // CHECK: define void @f_fpr_tracking(float %0, float %1, float %2, float %3, float %4, float %5, float %6, float %7, i8 noundef zeroext %i) #[no_mangle] diff --git a/tests/codegen/riscv-target-abi.rs b/tests/codegen/riscv-target-abi.rs index 88da4ece7ba..d41fcb4dd84 100644 --- a/tests/codegen/riscv-target-abi.rs +++ b/tests/codegen/riscv-target-abi.rs @@ -1,3 +1,4 @@ +//@ add-core-stubs //@ revisions:riscv64gc riscv32gc riscv32imac //@[riscv64gc] compile-flags: --target=riscv64gc-unknown-linux-gnu @@ -16,5 +17,5 @@ #![crate_type = "lib"] #![no_core] -#[lang = "sized"] -trait Sized {} +extern crate minicore; +use minicore::*; diff --git a/tests/codegen/sanitizer/aarch64-shadow-call-stack-with-fixed-x18.rs b/tests/codegen/sanitizer/aarch64-shadow-call-stack-with-fixed-x18.rs index e2e14ab14a8..e1d7dc2d631 100644 --- a/tests/codegen/sanitizer/aarch64-shadow-call-stack-with-fixed-x18.rs +++ b/tests/codegen/sanitizer/aarch64-shadow-call-stack-with-fixed-x18.rs @@ -1,3 +1,4 @@ +//@ add-core-stubs //@ revisions: aarch64 android //@[aarch64] compile-flags: --target aarch64-unknown-none -Zfixed-x18 -Zsanitizer=shadow-call-stack //@[aarch64] needs-llvm-components: aarch64 @@ -9,8 +10,8 @@ #![feature(no_core, lang_items)] #![no_core] -#[lang = "sized"] -trait Sized {} +extern crate minicore; +use minicore::*; // CHECK: ; Function Attrs:{{.*}}shadowcallstack #[no_mangle] diff --git a/tests/codegen/sanitizer/kasan-emits-instrumentation.rs b/tests/codegen/sanitizer/kasan-emits-instrumentation.rs index 56ee875286a..774c9ab53f1 100644 --- a/tests/codegen/sanitizer/kasan-emits-instrumentation.rs +++ b/tests/codegen/sanitizer/kasan-emits-instrumentation.rs @@ -1,5 +1,6 @@ // Verifies that `-Zsanitizer=kernel-address` emits sanitizer instrumentation. +//@ add-core-stubs //@ compile-flags: -Zsanitizer=kernel-address -Copt-level=0 //@ revisions: aarch64 riscv64imac riscv64gc x86_64 //@[aarch64] compile-flags: --target aarch64-unknown-none @@ -15,13 +16,8 @@ #![feature(no_core, no_sanitize, lang_items)] #![no_core] -#[lang = "sized"] -trait Sized {} - -#[lang = "copy"] -trait Copy {} - -impl Copy for u8 {} +extern crate minicore; +use minicore::*; // CHECK-LABEL: ; kasan_emits_instrumentation::unsanitized // CHECK-NEXT: ; Function Attrs: diff --git a/tests/codegen/sanitizer/kcfi/add-cfi-normalize-integers-flag.rs b/tests/codegen/sanitizer/kcfi/add-cfi-normalize-integers-flag.rs index d48e4016a16..0be1ff19774 100644 --- a/tests/codegen/sanitizer/kcfi/add-cfi-normalize-integers-flag.rs +++ b/tests/codegen/sanitizer/kcfi/add-cfi-normalize-integers-flag.rs @@ -1,5 +1,6 @@ // Verifies that "cfi-normalize-integers" module flag is added. // +//@ add-core-stubs //@ revisions: aarch64 x86_64 //@ [aarch64] compile-flags: --target aarch64-unknown-none //@ [aarch64] needs-llvm-components: aarch64 @@ -11,10 +12,8 @@ #![crate_type = "lib"] #![no_core] -#[lang = "sized"] -trait Sized {} -#[lang = "copy"] -trait Copy {} +extern crate minicore; +use minicore::*; pub fn foo() {} diff --git a/tests/codegen/sanitizer/kcfi/add-kcfi-flag.rs b/tests/codegen/sanitizer/kcfi/add-kcfi-flag.rs index 013de74f8d6..eabe0409c9a 100644 --- a/tests/codegen/sanitizer/kcfi/add-kcfi-flag.rs +++ b/tests/codegen/sanitizer/kcfi/add-kcfi-flag.rs @@ -1,5 +1,6 @@ // Verifies that "kcfi" module flag is added. // +//@ add-core-stubs //@ revisions: aarch64 x86_64 //@ [aarch64] compile-flags: --target aarch64-unknown-none //@ [aarch64] needs-llvm-components: aarch64 @@ -11,10 +12,8 @@ #![crate_type = "lib"] #![no_core] -#[lang = "sized"] -trait Sized {} -#[lang = "copy"] -trait Copy {} +extern crate minicore; +use minicore::*; pub fn foo() {} diff --git a/tests/codegen/sanitizer/kcfi/add-kcfi-offset-flag.rs b/tests/codegen/sanitizer/kcfi/add-kcfi-offset-flag.rs index b4924719f4c..2f18c9d84b9 100644 --- a/tests/codegen/sanitizer/kcfi/add-kcfi-offset-flag.rs +++ b/tests/codegen/sanitizer/kcfi/add-kcfi-offset-flag.rs @@ -1,5 +1,6 @@ // Verifies that "kcfi-offset" module flag is added. // +//@ add-core-stubs //@ revisions: aarch64 x86_64 //@ [aarch64] compile-flags: --target aarch64-unknown-none //@ [aarch64] needs-llvm-components: aarch64 @@ -11,10 +12,8 @@ #![crate_type = "lib"] #![no_core] -#[lang = "sized"] -trait Sized {} -#[lang = "copy"] -trait Copy {} +extern crate minicore; +use minicore::*; pub fn foo() {} diff --git a/tests/codegen/sanitizer/kcfi/emit-kcfi-operand-bundle-attr-no-sanitize.rs b/tests/codegen/sanitizer/kcfi/emit-kcfi-operand-bundle-attr-no-sanitize.rs index ba2e397f6da..6b40918dd3a 100644 --- a/tests/codegen/sanitizer/kcfi/emit-kcfi-operand-bundle-attr-no-sanitize.rs +++ b/tests/codegen/sanitizer/kcfi/emit-kcfi-operand-bundle-attr-no-sanitize.rs @@ -1,5 +1,6 @@ // Verifies that KCFI operand bundles are omitted. // +//@ add-core-stubs //@ revisions: aarch64 x86_64 //@ [aarch64] compile-flags: --target aarch64-unknown-none //@ [aarch64] needs-llvm-components: aarch64 @@ -11,12 +12,8 @@ #![feature(no_core, no_sanitize, lang_items)] #![no_core] -#[lang = "sized"] -trait Sized {} -#[lang = "copy"] -trait Copy {} - -impl Copy for i32 {} +extern crate minicore; +use minicore::*; #[no_sanitize(kcfi)] pub fn foo(f: fn(i32) -> i32, arg: i32) -> i32 { diff --git a/tests/codegen/sanitizer/kcfi/emit-kcfi-operand-bundle-itanium-cxx-abi-generalized.rs b/tests/codegen/sanitizer/kcfi/emit-kcfi-operand-bundle-itanium-cxx-abi-generalized.rs index 4e95bdf4d7c..942b50deb02 100644 --- a/tests/codegen/sanitizer/kcfi/emit-kcfi-operand-bundle-itanium-cxx-abi-generalized.rs +++ b/tests/codegen/sanitizer/kcfi/emit-kcfi-operand-bundle-itanium-cxx-abi-generalized.rs @@ -1,5 +1,6 @@ // Verifies that generalized KCFI type metadata for functions are emitted. // +//@ add-core-stubs //@ revisions: aarch64 x86_64 //@ [aarch64] compile-flags: --target aarch64-unknown-none //@ [aarch64] needs-llvm-components: aarch64 @@ -11,12 +12,8 @@ #![feature(no_core, lang_items)] #![no_core] -#[lang = "sized"] -trait Sized {} -#[lang = "copy"] -trait Copy {} - -impl Copy for i32 {} +extern crate minicore; +use minicore::*; pub fn foo(f: fn(i32) -> i32, arg: i32) -> i32 { // CHECK-LABEL: define{{.*}}foo diff --git a/tests/codegen/sanitizer/kcfi/emit-kcfi-operand-bundle-itanium-cxx-abi-normalized-generalized.rs b/tests/codegen/sanitizer/kcfi/emit-kcfi-operand-bundle-itanium-cxx-abi-normalized-generalized.rs index 31b43b50988..c89d9bdd121 100644 --- a/tests/codegen/sanitizer/kcfi/emit-kcfi-operand-bundle-itanium-cxx-abi-normalized-generalized.rs +++ b/tests/codegen/sanitizer/kcfi/emit-kcfi-operand-bundle-itanium-cxx-abi-normalized-generalized.rs @@ -1,5 +1,6 @@ // Verifies that normalized and generalized KCFI type metadata for functions are emitted. // +//@ add-core-stubs //@ revisions: aarch64 x86_64 //@ [aarch64] compile-flags: --target aarch64-unknown-none //@ [aarch64] needs-llvm-components: aarch64 @@ -11,12 +12,8 @@ #![feature(no_core, lang_items)] #![no_core] -#[lang = "sized"] -trait Sized {} -#[lang = "copy"] -trait Copy {} - -impl Copy for i32 {} +extern crate minicore; +use minicore::*; pub fn foo(f: fn(i32) -> i32, arg: i32) -> i32 { // CHECK-LABEL: define{{.*}}foo diff --git a/tests/codegen/sanitizer/kcfi/emit-kcfi-operand-bundle-itanium-cxx-abi-normalized.rs b/tests/codegen/sanitizer/kcfi/emit-kcfi-operand-bundle-itanium-cxx-abi-normalized.rs index 4755f6062aa..220cae1a4fa 100644 --- a/tests/codegen/sanitizer/kcfi/emit-kcfi-operand-bundle-itanium-cxx-abi-normalized.rs +++ b/tests/codegen/sanitizer/kcfi/emit-kcfi-operand-bundle-itanium-cxx-abi-normalized.rs @@ -1,5 +1,6 @@ // Verifies that normalized KCFI type metadata for functions are emitted. // +//@ add-core-stubs //@ revisions: aarch64 x86_64 //@ [aarch64] compile-flags: --target aarch64-unknown-none //@ [aarch64] needs-llvm-components: aarch64 @@ -11,12 +12,8 @@ #![feature(no_core, lang_items)] #![no_core] -#[lang = "sized"] -trait Sized {} -#[lang = "copy"] -trait Copy {} - -impl Copy for i32 {} +extern crate minicore; +use minicore::*; pub fn foo(f: fn(i32) -> i32, arg: i32) -> i32 { // CHECK-LABEL: define{{.*}}foo diff --git a/tests/codegen/sanitizer/kcfi/emit-kcfi-operand-bundle-itanium-cxx-abi.rs b/tests/codegen/sanitizer/kcfi/emit-kcfi-operand-bundle-itanium-cxx-abi.rs index be9760bd9af..bb9a0005903 100644 --- a/tests/codegen/sanitizer/kcfi/emit-kcfi-operand-bundle-itanium-cxx-abi.rs +++ b/tests/codegen/sanitizer/kcfi/emit-kcfi-operand-bundle-itanium-cxx-abi.rs @@ -1,5 +1,6 @@ // Verifies that KCFI type metadata for functions are emitted. // +//@ add-core-stubs //@ revisions: aarch64 x86_64 //@ [aarch64] compile-flags: --target aarch64-unknown-none //@ [aarch64] needs-llvm-components: aarch64 @@ -11,12 +12,8 @@ #![feature(no_core, lang_items)] #![no_core] -#[lang = "sized"] -trait Sized {} -#[lang = "copy"] -trait Copy {} - -impl Copy for i32 {} +extern crate minicore; +use minicore::*; pub fn foo(f: fn(i32) -> i32, arg: i32) -> i32 { // CHECK-LABEL: define{{.*}}foo diff --git a/tests/codegen/sanitizer/kcfi/emit-kcfi-operand-bundle.rs b/tests/codegen/sanitizer/kcfi/emit-kcfi-operand-bundle.rs index c9c94cdb329..8b844b99142 100644 --- a/tests/codegen/sanitizer/kcfi/emit-kcfi-operand-bundle.rs +++ b/tests/codegen/sanitizer/kcfi/emit-kcfi-operand-bundle.rs @@ -1,5 +1,6 @@ // Verifies that KCFI operand bundles are emitted. // +//@ add-core-stubs //@ revisions: aarch64 x86_64 //@ [aarch64] compile-flags: --target aarch64-unknown-none //@ [aarch64] needs-llvm-components: aarch64 @@ -11,12 +12,8 @@ #![feature(no_core, lang_items)] #![no_core] -#[lang = "sized"] -trait Sized {} -#[lang = "copy"] -trait Copy {} - -impl Copy for i32 {} +extern crate minicore; +use minicore::*; pub fn foo(f: fn(i32) -> i32, arg: i32) -> i32 { // CHECK-LABEL: define{{.*}}foo{{.*}}!{{<unknown kind #36>|kcfi_type}} !{{[0-9]+}} diff --git a/tests/codegen/sanitizer/kcfi/emit-type-metadata-trait-objects.rs b/tests/codegen/sanitizer/kcfi/emit-type-metadata-trait-objects.rs index 5ab55a46726..15c107bea15 100644 --- a/tests/codegen/sanitizer/kcfi/emit-type-metadata-trait-objects.rs +++ b/tests/codegen/sanitizer/kcfi/emit-type-metadata-trait-objects.rs @@ -1,5 +1,6 @@ // Verifies that type metadata identifiers for trait objects are emitted correctly. // +//@ add-core-stubs //@ revisions: aarch64 x86_64 //@ [aarch64] compile-flags: --target aarch64-unknown-none //@ [aarch64] needs-llvm-components: aarch64 @@ -11,29 +12,8 @@ #![feature(arbitrary_self_types, no_core, lang_items)] #![no_core] -#[lang = "sized"] -trait Sized {} -#[lang = "copy"] -trait Copy {} -impl<T: ?Sized> Copy for &T {} -#[lang = "legacy_receiver"] -trait LegacyReceiver {} -#[lang = "dispatch_from_dyn"] -trait DispatchFromDyn<T> {} -impl<'a, T: ?Sized + Unsize<U>, U: ?Sized> DispatchFromDyn<&'a U> for &'a T {} -#[lang = "unsize"] -trait Unsize<T: ?Sized> {} -#[lang = "coerce_unsized"] -pub trait CoerceUnsized<T: ?Sized> {} -impl<'a, 'b: 'a, T: ?Sized + Unsize<U>, U: ?Sized> CoerceUnsized<&'a U> for &'b T {} -#[lang = "freeze"] -trait Freeze {} -#[lang = "drop_in_place"] -fn drop_in_place_fn<T>() {} -#[lang = "drop"] -trait Drop { - fn drop(&mut self); -} +extern crate minicore; +use minicore::*; pub trait Trait1 { fn foo(&self); diff --git a/tests/codegen/sanitizer/riscv64-shadow-call-stack.rs b/tests/codegen/sanitizer/riscv64-shadow-call-stack.rs index 5833b832ba4..945e46218d0 100644 --- a/tests/codegen/sanitizer/riscv64-shadow-call-stack.rs +++ b/tests/codegen/sanitizer/riscv64-shadow-call-stack.rs @@ -1,3 +1,4 @@ +//@ add-core-stubs //@ compile-flags: --target riscv64imac-unknown-none-elf -Zsanitizer=shadow-call-stack //@ needs-llvm-components: riscv @@ -6,8 +7,8 @@ #![feature(no_core, lang_items)] #![no_core] -#[lang = "sized"] -trait Sized {} +extern crate minicore; +use minicore::*; // CHECK: ; Function Attrs:{{.*}}shadowcallstack // CHECK: define dso_local void @foo() unnamed_addr #0 diff --git a/tests/codegen/simd-intrinsic/simd-intrinsic-float-abs.rs b/tests/codegen/simd-intrinsic/simd-intrinsic-float-abs.rs index 4a5a6391c05..485ba92272d 100644 --- a/tests/codegen/simd-intrinsic/simd-intrinsic-float-abs.rs +++ b/tests/codegen/simd-intrinsic/simd-intrinsic-float-abs.rs @@ -1,10 +1,11 @@ //@ compile-flags: -C no-prepopulate-passes #![crate_type = "lib"] - -#![feature(repr_simd, intrinsics)] +#![feature(repr_simd, core_intrinsics)] #![allow(non_camel_case_types)] +use std::intrinsics::simd::simd_fabs; + #[repr(simd)] #[derive(Copy, Clone, PartialEq, Debug)] pub struct f32x2(pub [f32; 2]); @@ -21,10 +22,6 @@ pub struct f32x8(pub [f32; 8]); #[derive(Copy, Clone, PartialEq, Debug)] pub struct f32x16(pub [f32; 16]); -extern "rust-intrinsic" { - fn simd_fabs<T>(x: T) -> T; -} - // CHECK-LABEL: @fabs_32x2 #[no_mangle] pub unsafe fn fabs_32x2(a: f32x2) -> f32x2 { diff --git a/tests/codegen/simd-intrinsic/simd-intrinsic-float-ceil.rs b/tests/codegen/simd-intrinsic/simd-intrinsic-float-ceil.rs index 89e54f579ff..e8bda7c29c4 100644 --- a/tests/codegen/simd-intrinsic/simd-intrinsic-float-ceil.rs +++ b/tests/codegen/simd-intrinsic/simd-intrinsic-float-ceil.rs @@ -1,10 +1,11 @@ //@ compile-flags: -C no-prepopulate-passes #![crate_type = "lib"] - -#![feature(repr_simd, intrinsics)] +#![feature(repr_simd, core_intrinsics)] #![allow(non_camel_case_types)] +use std::intrinsics::simd::simd_ceil; + #[repr(simd)] #[derive(Copy, Clone, PartialEq, Debug)] pub struct f32x2(pub [f32; 2]); @@ -21,10 +22,6 @@ pub struct f32x8(pub [f32; 8]); #[derive(Copy, Clone, PartialEq, Debug)] pub struct f32x16(pub [f32; 16]); -extern "rust-intrinsic" { - fn simd_ceil<T>(x: T) -> T; -} - // CHECK-LABEL: @ceil_32x2 #[no_mangle] pub unsafe fn ceil_32x2(a: f32x2) -> f32x2 { diff --git a/tests/codegen/simd-intrinsic/simd-intrinsic-float-cos.rs b/tests/codegen/simd-intrinsic/simd-intrinsic-float-cos.rs index b40fd5365de..8dc967bc3ad 100644 --- a/tests/codegen/simd-intrinsic/simd-intrinsic-float-cos.rs +++ b/tests/codegen/simd-intrinsic/simd-intrinsic-float-cos.rs @@ -1,10 +1,11 @@ //@ compile-flags: -C no-prepopulate-passes #![crate_type = "lib"] - -#![feature(repr_simd, intrinsics)] +#![feature(repr_simd, core_intrinsics)] #![allow(non_camel_case_types)] +use std::intrinsics::simd::simd_fcos; + #[repr(simd)] #[derive(Copy, Clone, PartialEq, Debug)] pub struct f32x2(pub [f32; 2]); @@ -21,10 +22,6 @@ pub struct f32x8(pub [f32; 8]); #[derive(Copy, Clone, PartialEq, Debug)] pub struct f32x16(pub [f32; 16]); -extern "rust-intrinsic" { - fn simd_fcos<T>(x: T) -> T; -} - // CHECK-LABEL: @fcos_32x2 #[no_mangle] pub unsafe fn fcos_32x2(a: f32x2) -> f32x2 { diff --git a/tests/codegen/simd-intrinsic/simd-intrinsic-float-exp.rs b/tests/codegen/simd-intrinsic/simd-intrinsic-float-exp.rs index fef003dde5b..00caca2f294 100644 --- a/tests/codegen/simd-intrinsic/simd-intrinsic-float-exp.rs +++ b/tests/codegen/simd-intrinsic/simd-intrinsic-float-exp.rs @@ -1,10 +1,11 @@ //@ compile-flags: -C no-prepopulate-passes #![crate_type = "lib"] - -#![feature(repr_simd, intrinsics)] +#![feature(repr_simd, core_intrinsics)] #![allow(non_camel_case_types)] +use std::intrinsics::simd::simd_fexp; + #[repr(simd)] #[derive(Copy, Clone, PartialEq, Debug)] pub struct f32x2(pub [f32; 2]); @@ -21,10 +22,6 @@ pub struct f32x8(pub [f32; 8]); #[derive(Copy, Clone, PartialEq, Debug)] pub struct f32x16(pub [f32; 16]); -extern "rust-intrinsic" { - fn simd_fexp<T>(x: T) -> T; -} - // CHECK-LABEL: @exp_32x2 #[no_mangle] pub unsafe fn exp_32x2(a: f32x2) -> f32x2 { diff --git a/tests/codegen/simd-intrinsic/simd-intrinsic-float-exp2.rs b/tests/codegen/simd-intrinsic/simd-intrinsic-float-exp2.rs index 779c0fc403a..eda4053189c 100644 --- a/tests/codegen/simd-intrinsic/simd-intrinsic-float-exp2.rs +++ b/tests/codegen/simd-intrinsic/simd-intrinsic-float-exp2.rs @@ -1,10 +1,11 @@ //@ compile-flags: -C no-prepopulate-passes #![crate_type = "lib"] - -#![feature(repr_simd, intrinsics)] +#![feature(repr_simd, core_intrinsics)] #![allow(non_camel_case_types)] +use std::intrinsics::simd::simd_fexp2; + #[repr(simd)] #[derive(Copy, Clone, PartialEq, Debug)] pub struct f32x2(pub [f32; 2]); @@ -21,10 +22,6 @@ pub struct f32x8(pub [f32; 8]); #[derive(Copy, Clone, PartialEq, Debug)] pub struct f32x16(pub [f32; 16]); -extern "rust-intrinsic" { - fn simd_fexp2<T>(x: T) -> T; -} - // CHECK-LABEL: @exp2_32x2 #[no_mangle] pub unsafe fn exp2_32x2(a: f32x2) -> f32x2 { diff --git a/tests/codegen/simd-intrinsic/simd-intrinsic-float-floor.rs b/tests/codegen/simd-intrinsic/simd-intrinsic-float-floor.rs index b2bd27a5b75..ad69d4cdd88 100644 --- a/tests/codegen/simd-intrinsic/simd-intrinsic-float-floor.rs +++ b/tests/codegen/simd-intrinsic/simd-intrinsic-float-floor.rs @@ -1,10 +1,11 @@ //@ compile-flags: -C no-prepopulate-passes #![crate_type = "lib"] - -#![feature(repr_simd, intrinsics)] +#![feature(repr_simd, core_intrinsics)] #![allow(non_camel_case_types)] +use std::intrinsics::simd::simd_floor; + #[repr(simd)] #[derive(Copy, Clone, PartialEq, Debug)] pub struct f32x2(pub [f32; 2]); @@ -21,10 +22,6 @@ pub struct f32x8(pub [f32; 8]); #[derive(Copy, Clone, PartialEq, Debug)] pub struct f32x16(pub [f32; 16]); -extern "rust-intrinsic" { - fn simd_floor<T>(x: T) -> T; -} - // CHECK-LABEL: @floor_32x2 #[no_mangle] pub unsafe fn floor_32x2(a: f32x2) -> f32x2 { diff --git a/tests/codegen/simd-intrinsic/simd-intrinsic-float-fma.rs b/tests/codegen/simd-intrinsic/simd-intrinsic-float-fma.rs index 37f4782626a..cbeefdc31c0 100644 --- a/tests/codegen/simd-intrinsic/simd-intrinsic-float-fma.rs +++ b/tests/codegen/simd-intrinsic/simd-intrinsic-float-fma.rs @@ -1,10 +1,11 @@ //@ compile-flags: -C no-prepopulate-passes #![crate_type = "lib"] - -#![feature(repr_simd, intrinsics)] +#![feature(repr_simd, core_intrinsics)] #![allow(non_camel_case_types)] +use std::intrinsics::simd::simd_fma; + #[repr(simd)] #[derive(Copy, Clone, PartialEq, Debug)] pub struct f32x2(pub [f32; 2]); @@ -21,10 +22,6 @@ pub struct f32x8(pub [f32; 8]); #[derive(Copy, Clone, PartialEq, Debug)] pub struct f32x16(pub [f32; 16]); -extern "rust-intrinsic" { - fn simd_fma<T>(x: T, b: T, c: T) -> T; -} - // CHECK-LABEL: @fma_32x2 #[no_mangle] pub unsafe fn fma_32x2(a: f32x2, b: f32x2, c: f32x2) -> f32x2 { diff --git a/tests/codegen/simd-intrinsic/simd-intrinsic-float-fsqrt.rs b/tests/codegen/simd-intrinsic/simd-intrinsic-float-fsqrt.rs index 336adf6db73..618daa4b44d 100644 --- a/tests/codegen/simd-intrinsic/simd-intrinsic-float-fsqrt.rs +++ b/tests/codegen/simd-intrinsic/simd-intrinsic-float-fsqrt.rs @@ -1,10 +1,11 @@ //@ compile-flags: -C no-prepopulate-passes #![crate_type = "lib"] - -#![feature(repr_simd, intrinsics)] +#![feature(repr_simd, core_intrinsics)] #![allow(non_camel_case_types)] +use std::intrinsics::simd::simd_fsqrt; + #[repr(simd)] #[derive(Copy, Clone, PartialEq, Debug)] pub struct f32x2(pub [f32; 2]); @@ -21,10 +22,6 @@ pub struct f32x8(pub [f32; 8]); #[derive(Copy, Clone, PartialEq, Debug)] pub struct f32x16(pub [f32; 16]); -extern "rust-intrinsic" { - fn simd_fsqrt<T>(x: T) -> T; -} - // CHECK-LABEL: @fsqrt_32x2 #[no_mangle] pub unsafe fn fsqrt_32x2(a: f32x2) -> f32x2 { diff --git a/tests/codegen/simd-intrinsic/simd-intrinsic-float-log.rs b/tests/codegen/simd-intrinsic/simd-intrinsic-float-log.rs index 8e97abc3a66..98a481e4004 100644 --- a/tests/codegen/simd-intrinsic/simd-intrinsic-float-log.rs +++ b/tests/codegen/simd-intrinsic/simd-intrinsic-float-log.rs @@ -1,10 +1,11 @@ //@ compile-flags: -C no-prepopulate-passes #![crate_type = "lib"] - -#![feature(repr_simd, intrinsics)] +#![feature(repr_simd, core_intrinsics)] #![allow(non_camel_case_types)] +use std::intrinsics::simd::simd_flog; + #[repr(simd)] #[derive(Copy, Clone, PartialEq, Debug)] pub struct f32x2(pub [f32; 2]); @@ -21,10 +22,6 @@ pub struct f32x8(pub [f32; 8]); #[derive(Copy, Clone, PartialEq, Debug)] pub struct f32x16(pub [f32; 16]); -extern "rust-intrinsic" { - fn simd_flog<T>(x: T) -> T; -} - // CHECK-LABEL: @log_32x2 #[no_mangle] pub unsafe fn log_32x2(a: f32x2) -> f32x2 { diff --git a/tests/codegen/simd-intrinsic/simd-intrinsic-float-log10.rs b/tests/codegen/simd-intrinsic/simd-intrinsic-float-log10.rs index 1d4d4dc24e9..9108cd963f0 100644 --- a/tests/codegen/simd-intrinsic/simd-intrinsic-float-log10.rs +++ b/tests/codegen/simd-intrinsic/simd-intrinsic-float-log10.rs @@ -1,10 +1,11 @@ //@ compile-flags: -C no-prepopulate-passes #![crate_type = "lib"] - -#![feature(repr_simd, intrinsics)] +#![feature(repr_simd, core_intrinsics)] #![allow(non_camel_case_types)] +use std::intrinsics::simd::simd_flog10; + #[repr(simd)] #[derive(Copy, Clone, PartialEq, Debug)] pub struct f32x2(pub [f32; 2]); @@ -21,10 +22,6 @@ pub struct f32x8(pub [f32; 8]); #[derive(Copy, Clone, PartialEq, Debug)] pub struct f32x16(pub [f32; 16]); -extern "rust-intrinsic" { - fn simd_flog10<T>(x: T) -> T; -} - // CHECK-LABEL: @log10_32x2 #[no_mangle] pub unsafe fn log10_32x2(a: f32x2) -> f32x2 { diff --git a/tests/codegen/simd-intrinsic/simd-intrinsic-float-log2.rs b/tests/codegen/simd-intrinsic/simd-intrinsic-float-log2.rs index 28f2f151617..2b20850dbd9 100644 --- a/tests/codegen/simd-intrinsic/simd-intrinsic-float-log2.rs +++ b/tests/codegen/simd-intrinsic/simd-intrinsic-float-log2.rs @@ -1,10 +1,11 @@ //@ compile-flags: -C no-prepopulate-passes #![crate_type = "lib"] - -#![feature(repr_simd, intrinsics)] +#![feature(repr_simd, core_intrinsics)] #![allow(non_camel_case_types)] +use std::intrinsics::simd::simd_flog2; + #[repr(simd)] #[derive(Copy, Clone, PartialEq, Debug)] pub struct f32x2(pub [f32; 2]); @@ -21,10 +22,6 @@ pub struct f32x8(pub [f32; 8]); #[derive(Copy, Clone, PartialEq, Debug)] pub struct f32x16(pub [f32; 16]); -extern "rust-intrinsic" { - fn simd_flog2<T>(x: T) -> T; -} - // CHECK-LABEL: @log2_32x2 #[no_mangle] pub unsafe fn log2_32x2(a: f32x2) -> f32x2 { diff --git a/tests/codegen/simd-intrinsic/simd-intrinsic-float-minmax.rs b/tests/codegen/simd-intrinsic/simd-intrinsic-float-minmax.rs index 50c51bebe37..ce07b212e84 100644 --- a/tests/codegen/simd-intrinsic/simd-intrinsic-float-minmax.rs +++ b/tests/codegen/simd-intrinsic/simd-intrinsic-float-minmax.rs @@ -1,19 +1,15 @@ //@ compile-flags: -C no-prepopulate-passes #![crate_type = "lib"] - -#![feature(repr_simd, intrinsics)] +#![feature(repr_simd, core_intrinsics)] #![allow(non_camel_case_types)] +use std::intrinsics::simd::{simd_fmax, simd_fmin}; + #[repr(simd)] #[derive(Copy, Clone, PartialEq, Debug)] pub struct f32x4(pub [f32; 4]); -extern "rust-intrinsic" { - fn simd_fmin<T>(x: T, y: T) -> T; - fn simd_fmax<T>(x: T, y: T) -> T; -} - // CHECK-LABEL: @fmin #[no_mangle] pub unsafe fn fmin(a: f32x4, b: f32x4) -> f32x4 { diff --git a/tests/codegen/simd-intrinsic/simd-intrinsic-float-pow.rs b/tests/codegen/simd-intrinsic/simd-intrinsic-float-pow.rs deleted file mode 100644 index 3527f71c00b..00000000000 --- a/tests/codegen/simd-intrinsic/simd-intrinsic-float-pow.rs +++ /dev/null @@ -1,87 +0,0 @@ -//@ compile-flags: -C no-prepopulate-passes - -#![crate_type = "lib"] - -#![feature(repr_simd, intrinsics)] -#![allow(non_camel_case_types)] - -#[repr(simd)] -#[derive(Copy, Clone, PartialEq, Debug)] -pub struct f32x2(pub [f32; 2]); - -#[repr(simd)] -#[derive(Copy, Clone, PartialEq, Debug)] -pub struct f32x4(pub [f32; 4]); - -#[repr(simd)] -#[derive(Copy, Clone, PartialEq, Debug)] -pub struct f32x8(pub [f32; 8]); - -#[repr(simd)] -#[derive(Copy, Clone, PartialEq, Debug)] -pub struct f32x16(pub [f32; 16]); - -extern "rust-intrinsic" { - fn simd_fpow<T>(x: T, b: T) -> T; -} - -// CHECK-LABEL: @fpow_32x2 -#[no_mangle] -pub unsafe fn fpow_32x2(a: f32x2, b: f32x2) -> f32x2 { - // CHECK: call <2 x float> @llvm.pow.v2f32 - simd_fpow(a, b) -} - -// CHECK-LABEL: @fpow_32x4 -#[no_mangle] -pub unsafe fn fpow_32x4(a: f32x4, b: f32x4) -> f32x4 { - // CHECK: call <4 x float> @llvm.pow.v4f32 - simd_fpow(a, b) -} - -// CHECK-LABEL: @fpow_32x8 -#[no_mangle] -pub unsafe fn fpow_32x8(a: f32x8, b: f32x8) -> f32x8 { - // CHECK: call <8 x float> @llvm.pow.v8f32 - simd_fpow(a, b) -} - -// CHECK-LABEL: @fpow_32x16 -#[no_mangle] -pub unsafe fn fpow_32x16(a: f32x16, b: f32x16) -> f32x16 { - // CHECK: call <16 x float> @llvm.pow.v16f32 - simd_fpow(a, b) -} - -#[repr(simd)] -#[derive(Copy, Clone, PartialEq, Debug)] -pub struct f64x2(pub [f64; 2]); - -#[repr(simd)] -#[derive(Copy, Clone, PartialEq, Debug)] -pub struct f64x4(pub [f64; 4]); - -#[repr(simd)] -#[derive(Copy, Clone, PartialEq, Debug)] -pub struct f64x8(pub [f64; 8]); - -// CHECK-LABEL: @fpow_64x4 -#[no_mangle] -pub unsafe fn fpow_64x4(a: f64x4, b: f64x4) -> f64x4 { - // CHECK: call <4 x double> @llvm.pow.v4f64 - simd_fpow(a, b) -} - -// CHECK-LABEL: @fpow_64x2 -#[no_mangle] -pub unsafe fn fpow_64x2(a: f64x2, b: f64x2) -> f64x2 { - // CHECK: call <2 x double> @llvm.pow.v2f64 - simd_fpow(a, b) -} - -// CHECK-LABEL: @fpow_64x8 -#[no_mangle] -pub unsafe fn fpow_64x8(a: f64x8, b: f64x8) -> f64x8 { - // CHECK: call <8 x double> @llvm.pow.v8f64 - simd_fpow(a, b) -} diff --git a/tests/codegen/simd-intrinsic/simd-intrinsic-float-powi.rs b/tests/codegen/simd-intrinsic/simd-intrinsic-float-powi.rs deleted file mode 100644 index 4f0b5e4e01a..00000000000 --- a/tests/codegen/simd-intrinsic/simd-intrinsic-float-powi.rs +++ /dev/null @@ -1,87 +0,0 @@ -//@ compile-flags: -C no-prepopulate-passes - -#![crate_type = "lib"] - -#![feature(repr_simd, intrinsics)] -#![allow(non_camel_case_types)] - -#[repr(simd)] -#[derive(Copy, Clone, PartialEq, Debug)] -pub struct f32x2(pub [f32; 2]); - -#[repr(simd)] -#[derive(Copy, Clone, PartialEq, Debug)] -pub struct f32x4(pub [f32; 4]); - -#[repr(simd)] -#[derive(Copy, Clone, PartialEq, Debug)] -pub struct f32x8(pub [f32; 8]); - -#[repr(simd)] -#[derive(Copy, Clone, PartialEq, Debug)] -pub struct f32x16(pub [f32; 16]); - -extern "rust-intrinsic" { - fn simd_fpowi<T>(x: T, b: i32) -> T; -} - -// CHECK-LABEL: @fpowi_32x2 -#[no_mangle] -pub unsafe fn fpowi_32x2(a: f32x2, b: i32) -> f32x2 { - // CHECK: call <2 x float> @llvm.powi.v2f32 - simd_fpowi(a, b) -} - -// CHECK-LABEL: @fpowi_32x4 -#[no_mangle] -pub unsafe fn fpowi_32x4(a: f32x4, b: i32) -> f32x4 { - // CHECK: call <4 x float> @llvm.powi.v4f32 - simd_fpowi(a, b) -} - -// CHECK-LABEL: @fpowi_32x8 -#[no_mangle] -pub unsafe fn fpowi_32x8(a: f32x8, b: i32) -> f32x8 { - // CHECK: call <8 x float> @llvm.powi.v8f32 - simd_fpowi(a, b) -} - -// CHECK-LABEL: @fpowi_32x16 -#[no_mangle] -pub unsafe fn fpowi_32x16(a: f32x16, b: i32) -> f32x16 { - // CHECK: call <16 x float> @llvm.powi.v16f32 - simd_fpowi(a, b) -} - -#[repr(simd)] -#[derive(Copy, Clone, PartialEq, Debug)] -pub struct f64x2(pub [f64; 2]); - -#[repr(simd)] -#[derive(Copy, Clone, PartialEq, Debug)] -pub struct f64x4(pub [f64; 4]); - -#[repr(simd)] -#[derive(Copy, Clone, PartialEq, Debug)] -pub struct f64x8(pub [f64; 8]); - -// CHECK-LABEL: @fpowi_64x4 -#[no_mangle] -pub unsafe fn fpowi_64x4(a: f64x4, b: i32) -> f64x4 { - // CHECK: call <4 x double> @llvm.powi.v4f64 - simd_fpowi(a, b) -} - -// CHECK-LABEL: @fpowi_64x2 -#[no_mangle] -pub unsafe fn fpowi_64x2(a: f64x2, b: i32) -> f64x2 { - // CHECK: call <2 x double> @llvm.powi.v2f64 - simd_fpowi(a, b) -} - -// CHECK-LABEL: @fpowi_64x8 -#[no_mangle] -pub unsafe fn fpowi_64x8(a: f64x8, b: i32) -> f64x8 { - // CHECK: call <8 x double> @llvm.powi.v8f64 - simd_fpowi(a, b) -} diff --git a/tests/codegen/simd-intrinsic/simd-intrinsic-float-sin.rs b/tests/codegen/simd-intrinsic/simd-intrinsic-float-sin.rs index 4173809e3a9..7de26b415bb 100644 --- a/tests/codegen/simd-intrinsic/simd-intrinsic-float-sin.rs +++ b/tests/codegen/simd-intrinsic/simd-intrinsic-float-sin.rs @@ -1,10 +1,11 @@ //@ compile-flags: -C no-prepopulate-passes #![crate_type = "lib"] - -#![feature(repr_simd, intrinsics)] +#![feature(repr_simd, core_intrinsics)] #![allow(non_camel_case_types)] +use std::intrinsics::simd::simd_fsin; + #[repr(simd)] #[derive(Copy, Clone, PartialEq, Debug)] pub struct f32x2(pub [f32; 2]); @@ -21,10 +22,6 @@ pub struct f32x8(pub [f32; 8]); #[derive(Copy, Clone, PartialEq, Debug)] pub struct f32x16(pub [f32; 16]); -extern "rust-intrinsic" { - fn simd_fsin<T>(x: T) -> T; -} - // CHECK-LABEL: @fsin_32x2 #[no_mangle] pub unsafe fn fsin_32x2(a: f32x2) -> f32x2 { diff --git a/tests/codegen/simd-intrinsic/simd-intrinsic-generic-arithmetic-saturating.rs b/tests/codegen/simd-intrinsic/simd-intrinsic-generic-arithmetic-saturating.rs index a5afa27876a..ecf5eb24ee5 100644 --- a/tests/codegen/simd-intrinsic/simd-intrinsic-generic-arithmetic-saturating.rs +++ b/tests/codegen/simd-intrinsic/simd-intrinsic-generic-arithmetic-saturating.rs @@ -1,71 +1,71 @@ //@ compile-flags: -C no-prepopulate-passes -// #![crate_type = "lib"] - -#![feature(repr_simd, intrinsics)] +#![feature(repr_simd, core_intrinsics)] #![allow(non_camel_case_types)] #![deny(unused)] -// signed integer types +use std::intrinsics::simd::{simd_saturating_add, simd_saturating_sub}; -#[repr(simd)] #[derive(Copy, Clone)] pub struct i8x2([i8; 2]); -#[repr(simd)] #[derive(Copy, Clone)] pub struct i8x4([i8; 4]); -#[repr(simd)] #[derive(Copy, Clone)] pub struct i8x8([i8; 8]); -#[repr(simd)] #[derive(Copy, Clone)] pub struct i8x16([i8; 16]); -#[repr(simd)] #[derive(Copy, Clone)] pub struct i8x32([i8; 32]); -#[repr(simd)] #[derive(Copy, Clone)] pub struct i8x64([i8; 64]); +#[rustfmt::skip] +mod types { + // signed integer types -#[repr(simd)] #[derive(Copy, Clone)] pub struct i16x2([i16; 2]); -#[repr(simd)] #[derive(Copy, Clone)] pub struct i16x4([i16; 4]); -#[repr(simd)] #[derive(Copy, Clone)] pub struct i16x8([i16; 8]); -#[repr(simd)] #[derive(Copy, Clone)] pub struct i16x16([i16; 16]); -#[repr(simd)] #[derive(Copy, Clone)] pub struct i16x32([i16; 32]); + #[repr(simd)] #[derive(Copy, Clone)] pub struct i8x2([i8; 2]); + #[repr(simd)] #[derive(Copy, Clone)] pub struct i8x4([i8; 4]); + #[repr(simd)] #[derive(Copy, Clone)] pub struct i8x8([i8; 8]); + #[repr(simd)] #[derive(Copy, Clone)] pub struct i8x16([i8; 16]); + #[repr(simd)] #[derive(Copy, Clone)] pub struct i8x32([i8; 32]); + #[repr(simd)] #[derive(Copy, Clone)] pub struct i8x64([i8; 64]); -#[repr(simd)] #[derive(Copy, Clone)] pub struct i32x2([i32; 2]); -#[repr(simd)] #[derive(Copy, Clone)] pub struct i32x4([i32; 4]); -#[repr(simd)] #[derive(Copy, Clone)] pub struct i32x8([i32; 8]); -#[repr(simd)] #[derive(Copy, Clone)] pub struct i32x16([i32; 16]); + #[repr(simd)] #[derive(Copy, Clone)] pub struct i16x2([i16; 2]); + #[repr(simd)] #[derive(Copy, Clone)] pub struct i16x4([i16; 4]); + #[repr(simd)] #[derive(Copy, Clone)] pub struct i16x8([i16; 8]); + #[repr(simd)] #[derive(Copy, Clone)] pub struct i16x16([i16; 16]); + #[repr(simd)] #[derive(Copy, Clone)] pub struct i16x32([i16; 32]); -#[repr(simd)] #[derive(Copy, Clone)] pub struct i64x2([i64; 2]); -#[repr(simd)] #[derive(Copy, Clone)] pub struct i64x4([i64; 4]); -#[repr(simd)] #[derive(Copy, Clone)] pub struct i64x8([i64; 8]); + #[repr(simd)] #[derive(Copy, Clone)] pub struct i32x2([i32; 2]); + #[repr(simd)] #[derive(Copy, Clone)] pub struct i32x4([i32; 4]); + #[repr(simd)] #[derive(Copy, Clone)] pub struct i32x8([i32; 8]); + #[repr(simd)] #[derive(Copy, Clone)] pub struct i32x16([i32; 16]); -#[repr(simd)] #[derive(Copy, Clone)] pub struct i128x2([i128; 2]); -#[repr(simd)] #[derive(Copy, Clone)] pub struct i128x4([i128; 4]); + #[repr(simd)] #[derive(Copy, Clone)] pub struct i64x2([i64; 2]); + #[repr(simd)] #[derive(Copy, Clone)] pub struct i64x4([i64; 4]); + #[repr(simd)] #[derive(Copy, Clone)] pub struct i64x8([i64; 8]); -// unsigned integer types + #[repr(simd)] #[derive(Copy, Clone)] pub struct i128x2([i128; 2]); + #[repr(simd)] #[derive(Copy, Clone)] pub struct i128x4([i128; 4]); -#[repr(simd)] #[derive(Copy, Clone)] pub struct u8x2([u8; 2]); -#[repr(simd)] #[derive(Copy, Clone)] pub struct u8x4([u8; 4]); -#[repr(simd)] #[derive(Copy, Clone)] pub struct u8x8([u8; 8]); -#[repr(simd)] #[derive(Copy, Clone)] pub struct u8x16([u8; 16]); -#[repr(simd)] #[derive(Copy, Clone)] pub struct u8x32([u8; 32]); -#[repr(simd)] #[derive(Copy, Clone)] pub struct u8x64([u8; 64]); + // unsigned integer types -#[repr(simd)] #[derive(Copy, Clone)] pub struct u16x2([u16; 2]); -#[repr(simd)] #[derive(Copy, Clone)] pub struct u16x4([u16; 4]); -#[repr(simd)] #[derive(Copy, Clone)] pub struct u16x8([u16; 8]); -#[repr(simd)] #[derive(Copy, Clone)] pub struct u16x16([u16; 16]); -#[repr(simd)] #[derive(Copy, Clone)] pub struct u16x32([u16; 32]); + #[repr(simd)] #[derive(Copy, Clone)] pub struct u8x2([u8; 2]); + #[repr(simd)] #[derive(Copy, Clone)] pub struct u8x4([u8; 4]); + #[repr(simd)] #[derive(Copy, Clone)] pub struct u8x8([u8; 8]); + #[repr(simd)] #[derive(Copy, Clone)] pub struct u8x16([u8; 16]); + #[repr(simd)] #[derive(Copy, Clone)] pub struct u8x32([u8; 32]); + #[repr(simd)] #[derive(Copy, Clone)] pub struct u8x64([u8; 64]); -#[repr(simd)] #[derive(Copy, Clone)] pub struct u32x2([u32; 2]); -#[repr(simd)] #[derive(Copy, Clone)] pub struct u32x4([u32; 4]); -#[repr(simd)] #[derive(Copy, Clone)] pub struct u32x8([u32; 8]); -#[repr(simd)] #[derive(Copy, Clone)] pub struct u32x16([u32; 16]); + #[repr(simd)] #[derive(Copy, Clone)] pub struct u16x2([u16; 2]); + #[repr(simd)] #[derive(Copy, Clone)] pub struct u16x4([u16; 4]); + #[repr(simd)] #[derive(Copy, Clone)] pub struct u16x8([u16; 8]); + #[repr(simd)] #[derive(Copy, Clone)] pub struct u16x16([u16; 16]); + #[repr(simd)] #[derive(Copy, Clone)] pub struct u16x32([u16; 32]); -#[repr(simd)] #[derive(Copy, Clone)] pub struct u64x2([u64; 2]); -#[repr(simd)] #[derive(Copy, Clone)] pub struct u64x4([u64; 4]); -#[repr(simd)] #[derive(Copy, Clone)] pub struct u64x8([u64; 8]); + #[repr(simd)] #[derive(Copy, Clone)] pub struct u32x2([u32; 2]); + #[repr(simd)] #[derive(Copy, Clone)] pub struct u32x4([u32; 4]); + #[repr(simd)] #[derive(Copy, Clone)] pub struct u32x8([u32; 8]); + #[repr(simd)] #[derive(Copy, Clone)] pub struct u32x16([u32; 16]); -#[repr(simd)] #[derive(Copy, Clone)] pub struct u128x2([u128; 2]); -#[repr(simd)] #[derive(Copy, Clone)] pub struct u128x4([u128; 4]); + #[repr(simd)] #[derive(Copy, Clone)] pub struct u64x2([u64; 2]); + #[repr(simd)] #[derive(Copy, Clone)] pub struct u64x4([u64; 4]); + #[repr(simd)] #[derive(Copy, Clone)] pub struct u64x8([u64; 8]); -extern "rust-intrinsic" { - fn simd_saturating_add<T>(x: T, y: T) -> T; - fn simd_saturating_sub<T>(x: T, y: T) -> T; + #[repr(simd)] #[derive(Copy, Clone)] pub struct u128x2([u128; 2]); + #[repr(simd)] #[derive(Copy, Clone)] pub struct u128x4([u128; 4]); } +use types::*; + // NOTE(eddyb) `%{{x|0}}` is used because on some targets (e.g. WASM) // SIMD vectors are passed directly, resulting in `%x` being a vector, // while on others they're passed indirectly, resulting in `%x` being @@ -213,8 +213,6 @@ pub unsafe fn sadd_i128x4(x: i128x4, y: i128x4) -> i128x4 { simd_saturating_add(x, y) } - - // CHECK-LABEL: @uadd_u8x2 #[no_mangle] pub unsafe fn uadd_u8x2(x: u8x2, y: u8x2) -> u8x2 { @@ -355,10 +353,6 @@ pub unsafe fn uadd_u128x4(x: u128x4, y: u128x4) -> u128x4 { simd_saturating_add(x, y) } - - - - // CHECK-LABEL: @ssub_i8x2 #[no_mangle] pub unsafe fn ssub_i8x2(x: i8x2, y: i8x2) -> i8x2 { @@ -499,8 +493,6 @@ pub unsafe fn ssub_i128x4(x: i128x4, y: i128x4) -> i128x4 { simd_saturating_sub(x, y) } - - // CHECK-LABEL: @usub_u8x2 #[no_mangle] pub unsafe fn usub_u8x2(x: u8x2, y: u8x2) -> u8x2 { diff --git a/tests/codegen/simd-intrinsic/simd-intrinsic-generic-bitmask.rs b/tests/codegen/simd-intrinsic/simd-intrinsic-generic-bitmask.rs index e9112f1f321..a2c40aa91b5 100644 --- a/tests/codegen/simd-intrinsic/simd-intrinsic-generic-bitmask.rs +++ b/tests/codegen/simd-intrinsic/simd-intrinsic-generic-bitmask.rs @@ -2,10 +2,11 @@ // #![crate_type = "lib"] - -#![feature(repr_simd, intrinsics)] +#![feature(repr_simd, core_intrinsics)] #![allow(non_camel_case_types)] +use std::intrinsics::simd::simd_bitmask; + #[repr(simd)] #[derive(Copy, Clone)] pub struct u32x2([u32; 2]); @@ -18,10 +19,6 @@ pub struct i32x2([i32; 2]); #[derive(Copy, Clone)] pub struct i8x16([i8; 16]); -extern "rust-intrinsic" { - fn simd_bitmask<T, U>(x: T) -> U; -} - // NOTE(eddyb) `%{{x|1}}` is used because on some targets (e.g. WASM) // SIMD vectors are passed directly, resulting in `%x` being a vector, // while on others they're passed indirectly, resulting in `%x` being diff --git a/tests/codegen/simd-intrinsic/simd-intrinsic-generic-gather.rs b/tests/codegen/simd-intrinsic/simd-intrinsic-generic-gather.rs index 7f99f695bf4..9bb46a3546b 100644 --- a/tests/codegen/simd-intrinsic/simd-intrinsic-generic-gather.rs +++ b/tests/codegen/simd-intrinsic/simd-intrinsic-generic-gather.rs @@ -3,10 +3,11 @@ //@ compile-flags: -C no-prepopulate-passes #![crate_type = "lib"] - -#![feature(repr_simd, intrinsics)] +#![feature(repr_simd, core_intrinsics)] #![allow(non_camel_case_types)] +use std::intrinsics::simd::simd_gather; + #[repr(simd)] #[derive(Copy, Clone, PartialEq, Debug)] pub struct Vec2<T>(pub [T; 2]); @@ -15,14 +16,13 @@ pub struct Vec2<T>(pub [T; 2]); #[derive(Copy, Clone, PartialEq, Debug)] pub struct Vec4<T>(pub [T; 4]); -extern "rust-intrinsic" { - fn simd_gather<T, P, M>(value: T, pointers: P, mask: M) -> T; -} - // CHECK-LABEL: @gather_f32x2 #[no_mangle] -pub unsafe fn gather_f32x2(pointers: Vec2<*const f32>, mask: Vec2<i32>, - values: Vec2<f32>) -> Vec2<f32> { +pub unsafe fn gather_f32x2( + pointers: Vec2<*const f32>, + mask: Vec2<i32>, + values: Vec2<f32>, +) -> Vec2<f32> { // CHECK: [[A:%[0-9]+]] = lshr <2 x i32> {{.*}}, {{<i32 31, i32 31>|splat \(i32 31\)}} // CHECK: [[B:%[0-9]+]] = trunc <2 x i32> [[A]] to <2 x i1> // CHECK: call <2 x float> @llvm.masked.gather.v2f32.v2p0(<2 x ptr> {{.*}}, i32 {{.*}}, <2 x i1> [[B]], <2 x float> {{.*}}) @@ -31,8 +31,11 @@ pub unsafe fn gather_f32x2(pointers: Vec2<*const f32>, mask: Vec2<i32>, // CHECK-LABEL: @gather_pf32x2 #[no_mangle] -pub unsafe fn gather_pf32x2(pointers: Vec2<*const *const f32>, mask: Vec2<i32>, - values: Vec2<*const f32>) -> Vec2<*const f32> { +pub unsafe fn gather_pf32x2( + pointers: Vec2<*const *const f32>, + mask: Vec2<i32>, + values: Vec2<*const f32>, +) -> Vec2<*const f32> { // CHECK: [[A:%[0-9]+]] = lshr <2 x i32> {{.*}}, {{<i32 31, i32 31>|splat \(i32 31\)}} // CHECK: [[B:%[0-9]+]] = trunc <2 x i32> [[A]] to <2 x i1> // CHECK: call <2 x ptr> @llvm.masked.gather.v2p0.v2p0(<2 x ptr> {{.*}}, i32 {{.*}}, <2 x i1> [[B]], <2 x ptr> {{.*}}) diff --git a/tests/codegen/simd-intrinsic/simd-intrinsic-generic-masked-load.rs b/tests/codegen/simd-intrinsic/simd-intrinsic-generic-masked-load.rs index 7f46630e920..fcc4cb5d630 100644 --- a/tests/codegen/simd-intrinsic/simd-intrinsic-generic-masked-load.rs +++ b/tests/codegen/simd-intrinsic/simd-intrinsic-generic-masked-load.rs @@ -1,10 +1,11 @@ //@ compile-flags: -C no-prepopulate-passes #![crate_type = "lib"] - -#![feature(repr_simd, intrinsics)] +#![feature(repr_simd, core_intrinsics)] #![allow(non_camel_case_types)] +use std::intrinsics::simd::simd_masked_load; + #[repr(simd)] #[derive(Copy, Clone, PartialEq, Debug)] pub struct Vec2<T>(pub [T; 2]); @@ -13,14 +14,9 @@ pub struct Vec2<T>(pub [T; 2]); #[derive(Copy, Clone, PartialEq, Debug)] pub struct Vec4<T>(pub [T; 4]); -extern "rust-intrinsic" { - fn simd_masked_load<M, P, T>(mask: M, pointer: P, values: T) -> T; -} - // CHECK-LABEL: @load_f32x2 #[no_mangle] -pub unsafe fn load_f32x2(mask: Vec2<i32>, pointer: *const f32, - values: Vec2<f32>) -> Vec2<f32> { +pub unsafe fn load_f32x2(mask: Vec2<i32>, pointer: *const f32, values: Vec2<f32>) -> Vec2<f32> { // CHECK: [[A:%[0-9]+]] = lshr <2 x i32> {{.*}}, {{<i32 31, i32 31>|splat \(i32 31\)}} // CHECK: [[B:%[0-9]+]] = trunc <2 x i32> [[A]] to <2 x i1> // CHECK: call <2 x float> @llvm.masked.load.v2f32.p0(ptr {{.*}}, i32 4, <2 x i1> [[B]], <2 x float> {{.*}}) @@ -29,8 +25,11 @@ pub unsafe fn load_f32x2(mask: Vec2<i32>, pointer: *const f32, // CHECK-LABEL: @load_pf32x4 #[no_mangle] -pub unsafe fn load_pf32x4(mask: Vec4<i32>, pointer: *const *const f32, - values: Vec4<*const f32>) -> Vec4<*const f32> { +pub unsafe fn load_pf32x4( + mask: Vec4<i32>, + pointer: *const *const f32, + values: Vec4<*const f32>, +) -> Vec4<*const f32> { // CHECK: [[A:%[0-9]+]] = lshr <4 x i32> {{.*}}, {{<i32 31, i32 31, i32 31, i32 31>|splat \(i32 31\)}} // CHECK: [[B:%[0-9]+]] = trunc <4 x i32> [[A]] to <4 x i1> // CHECK: call <4 x ptr> @llvm.masked.load.v4p0.p0(ptr {{.*}}, i32 {{.*}}, <4 x i1> [[B]], <4 x ptr> {{.*}}) diff --git a/tests/codegen/simd-intrinsic/simd-intrinsic-generic-masked-store.rs b/tests/codegen/simd-intrinsic/simd-intrinsic-generic-masked-store.rs index 0d43234f1e2..04f4a0c6382 100644 --- a/tests/codegen/simd-intrinsic/simd-intrinsic-generic-masked-store.rs +++ b/tests/codegen/simd-intrinsic/simd-intrinsic-generic-masked-store.rs @@ -1,10 +1,11 @@ //@ compile-flags: -C no-prepopulate-passes #![crate_type = "lib"] - -#![feature(repr_simd, intrinsics)] +#![feature(repr_simd, core_intrinsics)] #![allow(non_camel_case_types)] +use std::intrinsics::simd::simd_masked_store; + #[repr(simd)] #[derive(Copy, Clone, PartialEq, Debug)] pub struct Vec2<T>(pub [T; 2]); @@ -13,10 +14,6 @@ pub struct Vec2<T>(pub [T; 2]); #[derive(Copy, Clone, PartialEq, Debug)] pub struct Vec4<T>(pub [T; 4]); -extern "rust-intrinsic" { - fn simd_masked_store<M, P, T>(mask: M, pointer: P, values: T) -> (); -} - // CHECK-LABEL: @store_f32x2 #[no_mangle] pub unsafe fn store_f32x2(mask: Vec2<i32>, pointer: *mut f32, values: Vec2<f32>) { diff --git a/tests/codegen/simd-intrinsic/simd-intrinsic-generic-scatter.rs b/tests/codegen/simd-intrinsic/simd-intrinsic-generic-scatter.rs index ef7827bd96f..9506f8f6d3a 100644 --- a/tests/codegen/simd-intrinsic/simd-intrinsic-generic-scatter.rs +++ b/tests/codegen/simd-intrinsic/simd-intrinsic-generic-scatter.rs @@ -3,10 +3,11 @@ //@ compile-flags: -C no-prepopulate-passes #![crate_type = "lib"] - -#![feature(repr_simd, intrinsics)] +#![feature(repr_simd, core_intrinsics)] #![allow(non_camel_case_types)] +use std::intrinsics::simd::simd_scatter; + #[repr(simd)] #[derive(Copy, Clone, PartialEq, Debug)] pub struct Vec2<T>(pub [T; 2]); @@ -15,25 +16,22 @@ pub struct Vec2<T>(pub [T; 2]); #[derive(Copy, Clone, PartialEq, Debug)] pub struct Vec4<T>(pub [T; 4]); -extern "rust-intrinsic" { - fn simd_scatter<T, P, M>(value: T, pointers: P, mask: M); -} - // CHECK-LABEL: @scatter_f32x2 #[no_mangle] -pub unsafe fn scatter_f32x2(pointers: Vec2<*mut f32>, mask: Vec2<i32>, - values: Vec2<f32>) { +pub unsafe fn scatter_f32x2(pointers: Vec2<*mut f32>, mask: Vec2<i32>, values: Vec2<f32>) { // CHECK: [[A:%[0-9]+]] = lshr <2 x i32> {{.*}}, {{<i32 31, i32 31>|splat \(i32 31\)}} // CHECK: [[B:%[0-9]+]] = trunc <2 x i32> [[A]] to <2 x i1> // CHECK: call void @llvm.masked.scatter.v2f32.v2p0(<2 x float> {{.*}}, <2 x ptr> {{.*}}, i32 {{.*}}, <2 x i1> [[B]] simd_scatter(values, pointers, mask) } - // CHECK-LABEL: @scatter_pf32x2 #[no_mangle] -pub unsafe fn scatter_pf32x2(pointers: Vec2<*mut *const f32>, mask: Vec2<i32>, - values: Vec2<*const f32>) { +pub unsafe fn scatter_pf32x2( + pointers: Vec2<*mut *const f32>, + mask: Vec2<i32>, + values: Vec2<*const f32>, +) { // CHECK: [[A:%[0-9]+]] = lshr <2 x i32> {{.*}}, {{<i32 31, i32 31>|splat \(i32 31\)}} // CHECK: [[B:%[0-9]+]] = trunc <2 x i32> [[A]] to <2 x i1> // CHECK: call void @llvm.masked.scatter.v2p0.v2p0(<2 x ptr> {{.*}}, <2 x ptr> {{.*}}, i32 {{.*}}, <2 x i1> [[B]] diff --git a/tests/codegen/simd-intrinsic/simd-intrinsic-generic-select.rs b/tests/codegen/simd-intrinsic/simd-intrinsic-generic-select.rs index 33ed2b437f9..71279d9f0ea 100644 --- a/tests/codegen/simd-intrinsic/simd-intrinsic-generic-select.rs +++ b/tests/codegen/simd-intrinsic/simd-intrinsic-generic-select.rs @@ -1,10 +1,11 @@ //@ compile-flags: -C no-prepopulate-passes #![crate_type = "lib"] - -#![feature(repr_simd, intrinsics)] +#![feature(repr_simd, core_intrinsics)] #![allow(non_camel_case_types)] +use std::intrinsics::simd::{simd_select, simd_select_bitmask}; + #[repr(simd)] #[derive(Copy, Clone, PartialEq, Debug)] pub struct f32x4(pub [f32; 4]); @@ -21,11 +22,6 @@ pub struct b8x4(pub [i8; 4]); #[derive(Copy, Clone, PartialEq, Debug)] pub struct i32x4([i32; 4]); -extern "rust-intrinsic" { - fn simd_select<T, U>(x: T, a: U, b: U) -> U; - fn simd_select_bitmask<T, U>(x: T, a: U, b: U) -> U; -} - // CHECK-LABEL: @select_m8 #[no_mangle] pub unsafe fn select_m8(m: b8x4, a: f32x4, b: f32x4) -> f32x4 { diff --git a/tests/codegen/simd-intrinsic/simd-intrinsic-mask-reduce.rs b/tests/codegen/simd-intrinsic/simd-intrinsic-mask-reduce.rs index 92067db9b15..269fe41225e 100644 --- a/tests/codegen/simd-intrinsic/simd-intrinsic-mask-reduce.rs +++ b/tests/codegen/simd-intrinsic/simd-intrinsic-mask-reduce.rs @@ -1,10 +1,11 @@ //@ compile-flags: -C no-prepopulate-passes -// #![crate_type = "lib"] -#![feature(repr_simd, intrinsics)] +#![feature(repr_simd, core_intrinsics)] #![allow(non_camel_case_types)] +use std::intrinsics::simd::{simd_reduce_all, simd_reduce_any}; + #[repr(simd)] #[derive(Copy, Clone)] pub struct mask32x2([i32; 2]); @@ -13,11 +14,6 @@ pub struct mask32x2([i32; 2]); #[derive(Copy, Clone)] pub struct mask8x16([i8; 16]); -extern "rust-intrinsic" { - fn simd_reduce_all<T>(x: T) -> bool; - fn simd_reduce_any<T>(x: T) -> bool; -} - // NOTE(eddyb) `%{{x|1}}` is used because on some targets (e.g. WASM) // SIMD vectors are passed directly, resulting in `%x` being a vector, // while on others they're passed indirectly, resulting in `%x` being diff --git a/tests/codegen/simd-intrinsic/simd-intrinsic-transmute-array.rs b/tests/codegen/simd-intrinsic/simd-intrinsic-transmute-array.rs index 0d21d510557..d3853361de9 100644 --- a/tests/codegen/simd-intrinsic/simd-intrinsic-transmute-array.rs +++ b/tests/codegen/simd-intrinsic/simd-intrinsic-transmute-array.rs @@ -12,7 +12,7 @@ #![crate_type = "lib"] #![allow(non_camel_case_types)] -#![feature(repr_simd, intrinsics)] +#![feature(repr_simd, core_intrinsics)] #[repr(simd)] #[derive(Copy, Clone)] diff --git a/tests/codegen/simd/simd_arith_offset.rs b/tests/codegen/simd/simd_arith_offset.rs index e14fce1d418..b8af6fce332 100644 --- a/tests/codegen/simd/simd_arith_offset.rs +++ b/tests/codegen/simd/simd_arith_offset.rs @@ -3,11 +3,9 @@ // #![crate_type = "lib"] -#![feature(repr_simd, intrinsics)] +#![feature(repr_simd, core_intrinsics)] -extern "rust-intrinsic" { - pub(crate) fn simd_arith_offset<T, U>(ptrs: T, offsets: U) -> T; -} +use std::intrinsics::simd::simd_arith_offset; /// A vector of *const T. #[derive(Debug, Copy, Clone)] diff --git a/tests/codegen/slice-init.rs b/tests/codegen/slice-init.rs index b36a5b5de3d..950e0b0c10d 100644 --- a/tests/codegen/slice-init.rs +++ b/tests/codegen/slice-init.rs @@ -2,8 +2,6 @@ #![crate_type = "lib"] -use std::mem::MaybeUninit; - // CHECK-LABEL: @zero_sized_elem #[no_mangle] pub fn zero_sized_elem() { @@ -78,64 +76,31 @@ pub fn u16_init_one_bytes() -> [u16; N] { [const { u16::from_be_bytes([1, 1]) }; N] } +// FIXME: undef bytes can just be initialized with the same value as the +// defined bytes, if the defines bytes are all the same. // CHECK-LABEL: @option_none_init #[no_mangle] pub fn option_none_init() -> [Option<u8>; N] { // CHECK-NOT: select - // CHECK-NOT: br - // CHECK-NOT: switch - // CHECK-NOT: icmp - // CHECK: call void @llvm.memset.p0 - [const { None }; N] -} - -// If there is partial provenance or some bytes are initialized and some are not, -// we can't really do better than initialize bytes or groups of bytes together. -// CHECK-LABEL: @option_maybe_uninit_init -#[no_mangle] -pub fn option_maybe_uninit_init() -> [MaybeUninit<u16>; N] { - // CHECK-NOT: select // CHECK: br label %repeat_loop_header{{.*}} // CHECK-NOT: switch // CHECK: icmp // CHECK-NOT: call void @llvm.memset.p0 - [const { - let mut val: MaybeUninit<u16> = MaybeUninit::uninit(); - let ptr = val.as_mut_ptr() as *mut u8; - unsafe { - ptr.write(0); - } - val - }; N] + [None; N] } -#[repr(packed)] -struct Packed { - start: u8, - ptr: &'static (), - rest: u16, - rest2: u8, -} +use std::mem::MaybeUninit; -// If there is partial provenance or some bytes are initialized and some are not, -// we can't really do better than initialize bytes or groups of bytes together. -// CHECK-LABEL: @option_maybe_uninit_provenance +// FIXME: This could be optimized into a memset. +// Regression test for <https://github.com/rust-lang/rust/issues/137892>. #[no_mangle] -pub fn option_maybe_uninit_provenance() -> [MaybeUninit<Packed>; N] { +pub fn half_uninit() -> [(u128, MaybeUninit<u128>); N] { // CHECK-NOT: select // CHECK: br label %repeat_loop_header{{.*}} // CHECK-NOT: switch // CHECK: icmp // CHECK-NOT: call void @llvm.memset.p0 - [const { - let mut val: MaybeUninit<Packed> = MaybeUninit::uninit(); - unsafe { - let ptr = &raw mut (*val.as_mut_ptr()).ptr; - static HAS_ADDR: () = (); - ptr.write_unaligned(&HAS_ADDR); - } - val - }; N] + [const { (0, MaybeUninit::uninit()) }; N] } // Use an opaque function to prevent rustc from removing useless drops. diff --git a/tests/codegen/some-abis-do-extend-params-to-32-bits.rs b/tests/codegen/some-abis-do-extend-params-to-32-bits.rs index 10970cacdcf..6ca6697588f 100644 --- a/tests/codegen/some-abis-do-extend-params-to-32-bits.rs +++ b/tests/codegen/some-abis-do-extend-params-to-32-bits.rs @@ -1,3 +1,4 @@ +//@ add-core-stubs //@ compile-flags: -Cno-prepopulate-passes -Copt-level=0 //@ revisions:x86_64 i686 aarch64-apple aarch64-windows aarch64-linux arm riscv @@ -24,12 +25,8 @@ #![no_std] #![no_core] -#[lang = "sized"] -trait Sized {} -#[lang = "freeze"] -trait Freeze {} -#[lang = "copy"] -trait Copy {} +extern crate minicore; +use minicore::*; // The patterns in this file are written in the style of a table to make the // uniformities and distinctions more apparent. diff --git a/tests/codegen/sparc-struct-abi.rs b/tests/codegen/sparc-struct-abi.rs index 0a8720c4fca..32d2c5bb0ef 100644 --- a/tests/codegen/sparc-struct-abi.rs +++ b/tests/codegen/sparc-struct-abi.rs @@ -1,17 +1,14 @@ // Checks that we correctly codegen extern "C" functions returning structs. // See issues #52638 and #86163. +//@ add-core-stubs //@ compile-flags: -Copt-level=3 --target=sparc64-unknown-linux-gnu --crate-type=rlib //@ needs-llvm-components: sparc #![feature(no_core, lang_items)] #![no_core] -#[lang = "sized"] -trait Sized {} -#[lang = "freeze"] -trait Freeze {} -#[lang = "copy"] -trait Copy {} +extern crate minicore; +use minicore::*; #[repr(C)] pub struct Bool { diff --git a/tests/codegen/stack-probes-inline.rs b/tests/codegen/stack-probes-inline.rs index c5073b9cc22..746272b0994 100644 --- a/tests/codegen/stack-probes-inline.rs +++ b/tests/codegen/stack-probes-inline.rs @@ -1,6 +1,7 @@ // Check the "probe-stack" attribute for targets with `StackProbeType::Inline`, // or `StackProbeType::InlineOrCall` when running on newer LLVM. +//@ add-core-stubs //@ compile-flags: -C no-prepopulate-passes //@ revisions: aarch64 powerpc powerpc64 powerpc64le s390x i686 x86_64 //@[aarch64] compile-flags: --target aarch64-unknown-linux-gnu @@ -22,8 +23,8 @@ #![feature(no_core, lang_items)] #![no_core] -#[lang = "sized"] -trait Sized {} +extern crate minicore; +use minicore::*; #[no_mangle] pub fn foo() { diff --git a/tests/codegen/target-feature-inline-closure.rs b/tests/codegen/target-feature-inline-closure.rs index 73bdbc0e1a8..5d54444f994 100644 --- a/tests/codegen/target-feature-inline-closure.rs +++ b/tests/codegen/target-feature-inline-closure.rs @@ -12,7 +12,7 @@ use std::arch::x86_64::*; #[cfg(target_arch = "x86_64")] #[target_feature(enable = "avx")] fn with_avx(x: __m256) -> __m256 { - // CHECK: fadd + // CHECK: fadd <8 x float> let add = { #[inline(always)] |x, y| unsafe { _mm256_add_ps(x, y) } @@ -24,14 +24,10 @@ fn with_avx(x: __m256) -> __m256 { #[no_mangle] #[cfg(target_arch = "x86_64")] unsafe fn without_avx(x: __m256) -> __m256 { - // CHECK-NOT: fadd + // CHECK-NOT: fadd <8 x float> let add = { #[inline(always)] |x, y| unsafe { _mm256_add_ps(x, y) } }; add(x, x) } - -// Don't allow the above CHECK-NOT to accidentally match a commit hash in the -// compiler version. -// CHECK-LABEL: rustc version diff --git a/tests/codegen/target-feature-overrides.rs b/tests/codegen/target-feature-overrides.rs index f38a1ae72de..0fc1e0136b3 100644 --- a/tests/codegen/target-feature-overrides.rs +++ b/tests/codegen/target-feature-overrides.rs @@ -1,3 +1,4 @@ +//@ add-core-stubs //@ revisions: COMPAT INCOMPAT //@ needs-llvm-components: x86 //@ compile-flags: --target=x86_64-unknown-linux-gnu -Copt-level=3 @@ -9,10 +10,8 @@ #![crate_type = "lib"] #![no_core] -#[lang = "sized"] -trait Sized {} -#[lang = "copy"] -trait Copy {} +extern crate minicore; +use minicore::*; extern "C" { fn peach() -> u32; diff --git a/tests/codegen/tied-features-strength.rs b/tests/codegen/tied-features-strength.rs index 1b2b63c3d1a..8b1f3b14fc3 100644 --- a/tests/codegen/tied-features-strength.rs +++ b/tests/codegen/tied-features-strength.rs @@ -1,4 +1,5 @@ // ignore-tidy-linelength +//@ add-core-stubs //@ revisions: ENABLE_SVE DISABLE_SVE DISABLE_NEON ENABLE_NEON //@ compile-flags: --crate-type=rlib --target=aarch64-unknown-linux-gnu //@ needs-llvm-components: aarch64 @@ -22,7 +23,7 @@ #![feature(no_core, lang_items)] #![no_core] -#[lang = "sized"] -trait Sized {} +extern crate minicore; +use minicore::*; pub fn test() {} diff --git a/tests/codegen/try_question_mark_nop.rs b/tests/codegen/try_question_mark_nop.rs index 751d7ca9311..ca15e510173 100644 --- a/tests/codegen/try_question_mark_nop.rs +++ b/tests/codegen/try_question_mark_nop.rs @@ -16,8 +16,8 @@ use std::ptr::NonNull; #[no_mangle] pub fn option_nop_match_32(x: Option<u32>) -> Option<u32> { // CHECK: start: - // TWENTY-NEXT: %trunc = trunc nuw i32 %0 to i1 - // TWENTY-NEXT: %.2 = select i1 %trunc, i32 %1, i32 undef + // TWENTY-NEXT: %[[IS_SOME:.+]] = trunc nuw i32 %0 to i1 + // TWENTY-NEXT: %.2 = select i1 %[[IS_SOME]], i32 %1, i32 undef // CHECK-NEXT: [[REG1:%.*]] = insertvalue { i32, i32 } poison, i32 %0, 0 // NINETEEN-NEXT: [[REG2:%.*]] = insertvalue { i32, i32 } [[REG1]], i32 %1, 1 // TWENTY-NEXT: [[REG2:%.*]] = insertvalue { i32, i32 } [[REG1]], i32 %.2, 1 @@ -32,8 +32,8 @@ pub fn option_nop_match_32(x: Option<u32>) -> Option<u32> { #[no_mangle] pub fn option_nop_traits_32(x: Option<u32>) -> Option<u32> { // CHECK: start: - // TWENTY-NEXT: %trunc = trunc nuw i32 %0 to i1 - // TWENTY-NEXT: %.1 = select i1 %trunc, i32 %1, i32 undef + // TWENTY-NEXT: %[[IS_SOME:.+]] = trunc nuw i32 %0 to i1 + // TWENTY-NEXT: %.1 = select i1 %[[IS_SOME]], i32 %1, i32 undef // CHECK-NEXT: insertvalue { i32, i32 } // CHECK-NEXT: insertvalue { i32, i32 } // CHECK-NEXT: ret { i32, i32 } diff --git a/tests/codegen/uninhabited-transparent-return-abi.rs b/tests/codegen/uninhabited-transparent-return-abi.rs index 6e8b1683163..face1577c3f 100644 --- a/tests/codegen/uninhabited-transparent-return-abi.rs +++ b/tests/codegen/uninhabited-transparent-return-abi.rs @@ -24,7 +24,7 @@ extern "Rust" { pub fn test_uninhabited_ret_by_ref() { // CHECK: %_1 = alloca [24 x i8], align {{8|4}} // CHECK-NEXT: call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %_1) - // CHECK-NEXT: call void @opaque(ptr noalias nocapture noundef nonnull sret([24 x i8]) align {{8|4}} dereferenceable(24) %_1) #2 + // CHECK-NEXT: call void @opaque({{.*}} sret([24 x i8]) {{.*}} %_1) #2 // CHECK-NEXT: unreachable unsafe { opaque(); @@ -36,7 +36,7 @@ pub fn test_uninhabited_ret_by_ref() { pub fn test_uninhabited_ret_by_ref_with_arg(rsi: u32) { // CHECK: %_2 = alloca [24 x i8], align {{8|4}} // CHECK-NEXT: call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %_2) - // CHECK-NEXT: call void @opaque_with_arg(ptr noalias nocapture noundef nonnull sret([24 x i8]) align {{8|4}} dereferenceable(24) %_2, i32 noundef %rsi) #2 + // CHECK-NEXT: call void @opaque_with_arg({{.*}} sret([24 x i8]) {{.*}} %_2, i32 noundef %rsi) #2 // CHECK-NEXT: unreachable unsafe { opaque_with_arg(rsi); diff --git a/tests/codegen/uninit-consts.rs b/tests/codegen/uninit-consts.rs index 649927b87b4..a58008e171e 100644 --- a/tests/codegen/uninit-consts.rs +++ b/tests/codegen/uninit-consts.rs @@ -11,15 +11,15 @@ pub struct PartiallyUninit { y: MaybeUninit<[u8; 10]>, } -// CHECK: [[FULLY_UNINIT:@[0-9]+]] = private unnamed_addr constant <{ [10 x i8] }> undef +// CHECK: [[FULLY_UNINIT:@.*]] = private unnamed_addr constant <{ [10 x i8] }> undef -// CHECK: [[PARTIALLY_UNINIT:@[0-9]+]] = private unnamed_addr constant <{ [4 x i8], [12 x i8] }> <{ [4 x i8] c"{{\\EF\\BE\\AD\\DE|\\DE\\AD\\BE\\EF}}", [12 x i8] undef }>, align 4 +// CHECK: [[PARTIALLY_UNINIT:@.*]] = private unnamed_addr constant <{ [4 x i8], [12 x i8] }> <{ [4 x i8] c"{{\\EF\\BE\\AD\\DE|\\DE\\AD\\BE\\EF}}", [12 x i8] undef }>, align 4 // This shouldn't contain undef, since it contains more chunks // than the default value of uninit_const_chunk_threshold. -// CHECK: [[UNINIT_PADDING_HUGE:@[0-9]+]] = private unnamed_addr constant <{ [32768 x i8] }> <{ [32768 x i8] c"{{.+}}" }>, align 4 +// CHECK: [[UNINIT_PADDING_HUGE:@.*]] = private unnamed_addr constant <{ [32768 x i8] }> <{ [32768 x i8] c"{{.+}}" }>, align 4 -// CHECK: [[FULLY_UNINIT_HUGE:@[0-9]+]] = private unnamed_addr constant <{ [16384 x i8] }> undef +// CHECK: [[FULLY_UNINIT_HUGE:@.*]] = private unnamed_addr constant <{ [16384 x i8] }> undef // CHECK-LABEL: @fully_uninit #[no_mangle] diff --git a/tests/codegen/virtual-call-attrs-issue-137646.rs b/tests/codegen/virtual-call-attrs-issue-137646.rs new file mode 100644 index 00000000000..5e453947f27 --- /dev/null +++ b/tests/codegen/virtual-call-attrs-issue-137646.rs @@ -0,0 +1,37 @@ +//! Regression test for https://github.com/rust-lang/rust/issues/137646. +//! Since we don't know the exact implementation of the virtual call, +//! it might write to parameters, we can't infer the readonly attribute. +//@ compile-flags: -C opt-level=3 -C no-prepopulate-passes + +#![crate_type = "lib"] +#![feature(rustc_attrs)] + +pub trait Trait { + #[rustc_nounwind] + fn m(&self, _: (i32, i32, i32)) {} +} + +#[no_mangle] +pub fn foo(trait_: &dyn Trait) { + // CHECK-LABEL: @foo( + // CHECK: call void + // CHECK-NOT: readonly + trait_.m((1, 1, 1)); +} + +#[no_mangle] +#[rustc_nounwind] +pub fn foo_nounwind(trait_: &dyn Trait) { + // CHECK-LABEL: @foo_nounwind( + // FIXME: Here should be invoke. + // COM: CHECK: invoke + trait_.m((1, 1, 1)); +} + +#[no_mangle] +pub extern "C" fn c_nounwind(trait_: &dyn Trait) { + // CHECK-LABEL: @c_nounwind( + // FIXME: Here should be invoke. + // COM: CHECK: invoke + trait_.m((1, 1, 1)); +} diff --git a/tests/crashes/117877.rs b/tests/crashes/117877.rs deleted file mode 100644 index b1effc0cbcb..00000000000 --- a/tests/crashes/117877.rs +++ /dev/null @@ -1,13 +0,0 @@ -//@ known-bug: #117877 -//@ edition:2021 -//@ needs-rustc-debug-assertions -//@ only-x86_64 -#![feature(asm_const)] - -use std::arch::asm; - -async unsafe fn foo<'a>() { - asm!("/* {0} */", const N); -} - -fn main() {} diff --git a/tests/crashes/129095.rs b/tests/crashes/129095.rs index d82474e18e7..b1bb74708c2 100644 --- a/tests/crashes/129095.rs +++ b/tests/crashes/129095.rs @@ -1,10 +1,13 @@ //@ known-bug: rust-lang/rust#129095 //@ compile-flags: -Zmir-enable-passes=+GVN -Zmir-enable-passes=+Inline -Zvalidate-mir +#![feature(adt_const_params, unsized_const_params)] +#![allow(incomplete_features)] + pub fn function_with_bytes<const BYTES: &'static [u8; 4]>() -> &'static [u8] { BYTES } pub fn main() { - assert_eq!(function_with_bytes::<b"AAAAb">(), &[0x41, 0x41, 0x41, 0x41]); + assert_eq!(function_with_bytes::<b"AAAAA">(), &[0x41, 0x41, 0x41, 0x41]); } diff --git a/tests/crashes/132960.rs b/tests/crashes/132960.rs index 87d0ee7dede..c23a3393429 100644 --- a/tests/crashes/132960.rs +++ b/tests/crashes/132960.rs @@ -1,6 +1,6 @@ //@ known-bug: #132960 -#![feature(adt_const_params, const_ptr_read, generic_const_exprs)] +#![feature(adt_const_params, const_ptr_read, generic_const_exprs, unsized_const_params)] const fn concat_strs<const A: &'static str, const B: &'static str>() -> &'static str where diff --git a/tests/crashes/132981.rs b/tests/crashes/132981.rs deleted file mode 100644 index 916c1559240..00000000000 --- a/tests/crashes/132981.rs +++ /dev/null @@ -1,11 +0,0 @@ -//@ known-bug: #132981 -//@compile-flags: -Clink-dead-code=true --crate-type lib -//@ only-x86_64 -//@ ignore-windows -// The set of targets this crashes on is really fiddly, because it is deep in our ABI logic. It -// crashes on x86_64-unknown-linux-gnu, and i686-pc-windows-msvc, but not on -// x86_64-pc-windows-msvc. If you are trying to fix this crash, don't pay too much attention to the -// directives. - -#![feature(rust_cold_cc)] -pub extern "rust-cold" fn foo(_: [usize; 3]) {} diff --git a/tests/crashes/133426.rs b/tests/crashes/133426.rs deleted file mode 100644 index 307a94c0f6c..00000000000 --- a/tests/crashes/133426.rs +++ /dev/null @@ -1,12 +0,0 @@ -//@ known-bug: #133426 - -fn a( - _: impl Iterator< - Item = [(); { - match *todo!() { ! }; - }], - >, -) { -} - -fn b(_: impl Iterator<Item = { match 0 { ! } }>) {} diff --git a/tests/crashes/134654.rs b/tests/crashes/134654.rs index 8a8d18359e9..f2323fe4ecd 100644 --- a/tests/crashes/134654.rs +++ b/tests/crashes/134654.rs @@ -2,6 +2,9 @@ //@ compile-flags: -Zmir-enable-passes=+GVN -Zmir-enable-passes=+Inline -Zvalidate-mir //@ only-x86_64 +#![feature(adt_const_params, unsized_const_params)] +#![allow(incomplete_features)] + fn function_with_bytes<const BYTES: &'static [u8; 0xa9008fb6c9d81e42_0e25730562a601c8_u128]>() -> &'static [u8] { BYTES diff --git a/tests/crashes/135128.rs b/tests/crashes/135128.rs index 2ce17df824a..a8fd1ae1ff5 100644 --- a/tests/crashes/135128.rs +++ b/tests/crashes/135128.rs @@ -1,6 +1,8 @@ //@ known-bug: #135128 //@ compile-flags: -Copt-level=1 --edition=2021 +#![feature(trivial_bounds)] + async fn return_str() -> str where str: Sized, diff --git a/tests/crashes/135570.rs b/tests/crashes/135570.rs index a9eda97ef9d..7919ceb26d5 100644 --- a/tests/crashes/135570.rs +++ b/tests/crashes/135570.rs @@ -2,6 +2,9 @@ //@compile-flags: -Zvalidate-mir -Zmir-enable-passes=+Inline -Copt-level=0 -Zmir-enable-passes=+GVN //@ only-x86_64 +#![feature(adt_const_params, unsized_const_params)] +#![allow(incomplete_features)] + fn function_with_bytes<const BYTES: &'static [u8; 0xc7b889180b67b07d_bc1a3c88783d35b5_u128]>( ) -> &'static [u8] { BYTES diff --git a/tests/debuginfo/unsized.rs b/tests/debuginfo/unsized.rs index acfe511be7c..17c5e463fba 100644 --- a/tests/debuginfo/unsized.rs +++ b/tests/debuginfo/unsized.rs @@ -18,12 +18,6 @@ // gdb-command:print _box // gdb-check:$4 = alloc::boxed::Box<unsized::Foo<dyn core::fmt::Debug>, alloc::alloc::Global> {pointer: [...], vtable: [...]} -// gdb-command:print tuple_slice -// gdb-check:$5 = &(i32, i32, [i32]) {data_ptr: [...], length: 2} - -// gdb-command:print tuple_dyn -// gdb-check:$6 = &(i32, i32, dyn core::fmt::Debug) {pointer: [...], vtable: [...]} - // === CDB TESTS =================================================================================== // cdb-command: g @@ -48,17 +42,6 @@ // cdb-check:[+0x000] pointer : 0x[...] [Type: unsized::Foo<dyn$<core::fmt::Debug> > *] // cdb-check:[...] vtable : 0x[...] [Type: unsigned [...]int[...] (*)[4]] -// cdb-command:dx tuple_slice -// cdb-check:tuple_slice [Type: ref$<tuple$<i32,i32,slice2$<i32> > >] -// cdb-check: [+0x000] data_ptr : 0x[...] [Type: tuple$<i32,i32,slice2$<i32> > *] -// cdb-check: [...] length : 0x2 [Type: unsigned [...]int[...] - -// cdb-command:dx tuple_dyn -// cdb-check:tuple_dyn [Type: ref$<tuple$<i32,i32,dyn$<core::fmt::Debug> > >] -// cdb-check: [+0x000] pointer : 0x[...] [Type: tuple$<i32,i32,dyn$<core::fmt::Debug> > *] -// cdb-check: [...] vtable : 0x[...] [Type: unsigned [...]int[...] (*)[4]] - -#![feature(unsized_tuple_coercion)] #![feature(omit_gdb_pretty_printer_section)] #![omit_gdb_pretty_printer_section] @@ -77,10 +60,6 @@ fn main() { let c: &Foo<dyn std::fmt::Debug> = &Foo { value: 7i32 }; let _box: Box<Foo<dyn std::fmt::Debug>> = Box::new(Foo { value: 8i32 }); - // Also check unsized tuples - let tuple_slice: &(i32, i32, [i32]) = &(0, 1, [2, 3]); - let tuple_dyn: &(i32, i32, dyn std::fmt::Debug) = &(0, 1, &3u64); - zzz(); // #break } diff --git a/tests/incremental/issue-61530.rs b/tests/incremental/issue-61530.rs index 71ac39d0e03..673556a9d02 100644 --- a/tests/incremental/issue-61530.rs +++ b/tests/incremental/issue-61530.rs @@ -1,14 +1,12 @@ -#![feature(repr_simd, intrinsics)] +#![feature(repr_simd, core_intrinsics)] //@ revisions:rpass1 rpass2 +use std::intrinsics::simd::simd_shuffle; + #[repr(simd)] struct I32x2([i32; 2]); -extern "rust-intrinsic" { - fn simd_shuffle<T, I, U>(x: T, y: T, idx: I) -> U; -} - #[repr(simd)] struct SimdShuffleIdx<const LEN: usize>([u32; LEN]); diff --git a/tests/mir-opt/inline/dont_ice_on_generic_rust_call.call.Inline.panic-abort.diff b/tests/mir-opt/inline/dont_ice_on_generic_rust_call.call.Inline.panic-abort.diff index 757617e5940..0615f8132af 100644 --- a/tests/mir-opt/inline/dont_ice_on_generic_rust_call.call.Inline.panic-abort.diff +++ b/tests/mir-opt/inline/dont_ice_on_generic_rust_call.call.Inline.panic-abort.diff @@ -7,23 +7,42 @@ let mut _0: (); let mut _3: &mut std::boxed::Box<dyn std::ops::FnMut<I, Output = ()>>; let mut _4: I; ++ scope 1 (inlined <Box<dyn FnMut<I, Output = ()>> as FnMut<I>>::call_mut) { ++ let mut _5: &mut dyn std::ops::FnMut<I, Output = ()>; ++ let mut _6: std::boxed::Box<dyn std::ops::FnMut<I, Output = ()>>; ++ let mut _7: *const dyn std::ops::FnMut<I, Output = ()>; ++ } bb0: { StorageLive(_3); _3 = &mut _1; StorageLive(_4); _4 = move _2; - _0 = <Box<dyn FnMut<I, Output = ()>> as FnMut<I>>::call_mut(move _3, move _4) -> [return: bb1, unwind unreachable]; +- _0 = <Box<dyn FnMut<I, Output = ()>> as FnMut<I>>::call_mut(move _3, move _4) -> [return: bb1, unwind unreachable]; ++ StorageLive(_6); ++ StorageLive(_7); ++ StorageLive(_5); ++ _6 = copy (*_3); ++ _7 = copy ((_6.0: std::ptr::Unique<dyn std::ops::FnMut<I, Output = ()>>).0: std::ptr::NonNull<dyn std::ops::FnMut<I, Output = ()>>) as *const dyn std::ops::FnMut<I, Output = ()> (Transmute); ++ _5 = &mut (*_7); ++ _0 = <dyn FnMut<I, Output = ()> as FnMut<I>>::call_mut(move _5, move _4) -> [return: bb2, unwind unreachable]; } bb1: { - StorageDead(_4); - StorageDead(_3); - drop(_1) -> [return: bb2, unwind unreachable]; +- StorageDead(_4); +- StorageDead(_3); +- drop(_1) -> [return: bb2, unwind unreachable]; ++ return; } bb2: { - return; +- return; ++ StorageDead(_5); ++ StorageDead(_7); ++ StorageDead(_6); ++ StorageDead(_4); ++ StorageDead(_3); ++ drop(_1) -> [return: bb1, unwind unreachable]; } } diff --git a/tests/mir-opt/inline/dont_ice_on_generic_rust_call.call.Inline.panic-unwind.diff b/tests/mir-opt/inline/dont_ice_on_generic_rust_call.call.Inline.panic-unwind.diff index b82961c2815..21b20329d4f 100644 --- a/tests/mir-opt/inline/dont_ice_on_generic_rust_call.call.Inline.panic-unwind.diff +++ b/tests/mir-opt/inline/dont_ice_on_generic_rust_call.call.Inline.panic-unwind.diff @@ -7,31 +7,54 @@ let mut _0: (); let mut _3: &mut std::boxed::Box<dyn std::ops::FnMut<I, Output = ()>>; let mut _4: I; ++ scope 1 (inlined <Box<dyn FnMut<I, Output = ()>> as FnMut<I>>::call_mut) { ++ let mut _5: &mut dyn std::ops::FnMut<I, Output = ()>; ++ let mut _6: std::boxed::Box<dyn std::ops::FnMut<I, Output = ()>>; ++ let mut _7: *const dyn std::ops::FnMut<I, Output = ()>; ++ } bb0: { StorageLive(_3); _3 = &mut _1; StorageLive(_4); _4 = move _2; - _0 = <Box<dyn FnMut<I, Output = ()>> as FnMut<I>>::call_mut(move _3, move _4) -> [return: bb1, unwind: bb3]; +- _0 = <Box<dyn FnMut<I, Output = ()>> as FnMut<I>>::call_mut(move _3, move _4) -> [return: bb1, unwind: bb3]; ++ StorageLive(_6); ++ StorageLive(_7); ++ StorageLive(_5); ++ _6 = copy (*_3); ++ _7 = copy ((_6.0: std::ptr::Unique<dyn std::ops::FnMut<I, Output = ()>>).0: std::ptr::NonNull<dyn std::ops::FnMut<I, Output = ()>>) as *const dyn std::ops::FnMut<I, Output = ()> (Transmute); ++ _5 = &mut (*_7); ++ _0 = <dyn FnMut<I, Output = ()> as FnMut<I>>::call_mut(move _5, move _4) -> [return: bb4, unwind: bb2]; } bb1: { - StorageDead(_4); - StorageDead(_3); - drop(_1) -> [return: bb2, unwind: bb4]; +- StorageDead(_4); +- StorageDead(_3); +- drop(_1) -> [return: bb2, unwind: bb4]; ++ return; } - bb2: { - return; +- bb2: { +- return; ++ bb2 (cleanup): { ++ drop(_1) -> [return: bb3, unwind terminate(cleanup)]; } bb3 (cleanup): { - drop(_1) -> [return: bb4, unwind terminate(cleanup)]; +- drop(_1) -> [return: bb4, unwind terminate(cleanup)]; ++ resume; } - bb4 (cleanup): { - resume; +- bb4 (cleanup): { +- resume; ++ bb4: { ++ StorageDead(_5); ++ StorageDead(_7); ++ StorageDead(_6); ++ StorageDead(_4); ++ StorageDead(_3); ++ drop(_1) -> [return: bb1, unwind: bb3]; } } diff --git a/tests/mir-opt/inline/dont_ice_on_generic_rust_call.rs b/tests/mir-opt/inline/dont_ice_on_generic_rust_call.rs index abc0ef5c61d..ac0c3ddac76 100644 --- a/tests/mir-opt/inline/dont_ice_on_generic_rust_call.rs +++ b/tests/mir-opt/inline/dont_ice_on_generic_rust_call.rs @@ -8,6 +8,6 @@ use std::marker::Tuple; // EMIT_MIR dont_ice_on_generic_rust_call.call.Inline.diff pub fn call<I: Tuple>(mut mock: Box<dyn FnMut<I, Output = ()>>, input: I) { // CHECK-LABEL: fn call( - // CHECK-NOT: inlined + // CHECK: (inlined <Box<dyn FnMut<I, Output = ()>> as FnMut<I>>::call_mut) mock.call_mut(input) } diff --git a/tests/mir-opt/inline/inline_box_fn.call.Inline.panic-abort.diff b/tests/mir-opt/inline/inline_box_fn.call.Inline.panic-abort.diff index 4fa04b05e89..ecea7a97513 100644 --- a/tests/mir-opt/inline/inline_box_fn.call.Inline.panic-abort.diff +++ b/tests/mir-opt/inline/inline_box_fn.call.Inline.panic-abort.diff @@ -7,6 +7,11 @@ let _2: (); let mut _3: &std::boxed::Box<dyn std::ops::Fn(i32)>; let mut _4: (i32,); ++ scope 1 (inlined <Box<dyn Fn(i32)> as Fn<(i32,)>>::call) { ++ let mut _5: &dyn std::ops::Fn(i32); ++ let mut _6: std::boxed::Box<dyn std::ops::Fn(i32)>; ++ let mut _7: *const dyn std::ops::Fn(i32); ++ } bb0: { StorageLive(_2); @@ -14,19 +19,34 @@ _3 = &_1; StorageLive(_4); _4 = (const 1_i32,); - _2 = <Box<dyn Fn(i32)> as Fn<(i32,)>>::call(move _3, move _4) -> [return: bb1, unwind unreachable]; +- _2 = <Box<dyn Fn(i32)> as Fn<(i32,)>>::call(move _3, move _4) -> [return: bb1, unwind unreachable]; ++ StorageLive(_6); ++ StorageLive(_7); ++ StorageLive(_5); ++ _6 = copy (*_3); ++ _7 = copy ((_6.0: std::ptr::Unique<dyn std::ops::Fn(i32)>).0: std::ptr::NonNull<dyn std::ops::Fn(i32)>) as *const dyn std::ops::Fn(i32) (Transmute); ++ _5 = &(*_7); ++ _2 = <dyn Fn(i32) as Fn<(i32,)>>::call(move _5, move _4) -> [return: bb2, unwind unreachable]; } bb1: { ++ return; ++ } ++ ++ bb2: { ++ StorageDead(_5); ++ StorageDead(_7); ++ StorageDead(_6); StorageDead(_4); StorageDead(_3); StorageDead(_2); _0 = const (); - drop(_1) -> [return: bb2, unwind unreachable]; - } - - bb2: { - return; +- drop(_1) -> [return: bb2, unwind unreachable]; +- } +- +- bb2: { +- return; ++ drop(_1) -> [return: bb1, unwind unreachable]; } } diff --git a/tests/mir-opt/inline/inline_box_fn.call.Inline.panic-unwind.diff b/tests/mir-opt/inline/inline_box_fn.call.Inline.panic-unwind.diff index 47fd0ed0799..3a4a528e879 100644 --- a/tests/mir-opt/inline/inline_box_fn.call.Inline.panic-unwind.diff +++ b/tests/mir-opt/inline/inline_box_fn.call.Inline.panic-unwind.diff @@ -7,6 +7,11 @@ let _2: (); let mut _3: &std::boxed::Box<dyn std::ops::Fn(i32)>; let mut _4: (i32,); ++ scope 1 (inlined <Box<dyn Fn(i32)> as Fn<(i32,)>>::call) { ++ let mut _5: &dyn std::ops::Fn(i32); ++ let mut _6: std::boxed::Box<dyn std::ops::Fn(i32)>; ++ let mut _7: *const dyn std::ops::Fn(i32); ++ } bb0: { StorageLive(_2); @@ -14,27 +19,47 @@ _3 = &_1; StorageLive(_4); _4 = (const 1_i32,); - _2 = <Box<dyn Fn(i32)> as Fn<(i32,)>>::call(move _3, move _4) -> [return: bb1, unwind: bb3]; +- _2 = <Box<dyn Fn(i32)> as Fn<(i32,)>>::call(move _3, move _4) -> [return: bb1, unwind: bb3]; ++ StorageLive(_6); ++ StorageLive(_7); ++ StorageLive(_5); ++ _6 = copy (*_3); ++ _7 = copy ((_6.0: std::ptr::Unique<dyn std::ops::Fn(i32)>).0: std::ptr::NonNull<dyn std::ops::Fn(i32)>) as *const dyn std::ops::Fn(i32) (Transmute); ++ _5 = &(*_7); ++ _2 = <dyn Fn(i32) as Fn<(i32,)>>::call(move _5, move _4) -> [return: bb4, unwind: bb2]; } bb1: { - StorageDead(_4); - StorageDead(_3); - StorageDead(_2); - _0 = const (); - drop(_1) -> [return: bb2, unwind: bb4]; +- StorageDead(_4); +- StorageDead(_3); +- StorageDead(_2); +- _0 = const (); +- drop(_1) -> [return: bb2, unwind: bb4]; ++ return; } - bb2: { - return; +- bb2: { +- return; ++ bb2 (cleanup): { ++ drop(_1) -> [return: bb3, unwind terminate(cleanup)]; } bb3 (cleanup): { - drop(_1) -> [return: bb4, unwind terminate(cleanup)]; +- drop(_1) -> [return: bb4, unwind terminate(cleanup)]; ++ resume; } - bb4 (cleanup): { - resume; +- bb4 (cleanup): { +- resume; ++ bb4: { ++ StorageDead(_5); ++ StorageDead(_7); ++ StorageDead(_6); ++ StorageDead(_4); ++ StorageDead(_3); ++ StorageDead(_2); ++ _0 = const (); ++ drop(_1) -> [return: bb1, unwind: bb3]; } } diff --git a/tests/mir-opt/inline/inline_box_fn.rs b/tests/mir-opt/inline/inline_box_fn.rs index bb2da3ac515..e9ab3bef01f 100644 --- a/tests/mir-opt/inline/inline_box_fn.rs +++ b/tests/mir-opt/inline/inline_box_fn.rs @@ -5,6 +5,6 @@ // EMIT_MIR inline_box_fn.call.Inline.diff fn call(x: Box<dyn Fn(i32)>) { // CHECK-LABEL: fn call( - // CHECK-NOT: inlined + // CHECK: (inlined <Box<dyn Fn(i32)> as Fn<(i32,)>>::call) x(1); } diff --git a/tests/mir-opt/inline/inline_cycle.two.Inline.panic-abort.diff b/tests/mir-opt/inline/inline_cycle.two.Inline.panic-abort.diff index 8a6eec3352a..c878b8b6324 100644 --- a/tests/mir-opt/inline/inline_cycle.two.Inline.panic-abort.diff +++ b/tests/mir-opt/inline/inline_cycle.two.Inline.panic-abort.diff @@ -5,9 +5,15 @@ let mut _0: (); let _1: (); + let mut _2: fn() {f}; ++ let mut _4: (); + scope 1 (inlined call::<fn() {f}>) { + debug f => _2; + let _3: (); ++ scope 2 (inlined <fn() {f} as FnOnce<()>>::call_once - shim(fn() {f})) { ++ scope 3 (inlined f) { ++ let _5: (); ++ } ++ } + } bb0: { @@ -16,10 +22,15 @@ + StorageLive(_2); + _2 = f; + StorageLive(_3); -+ _3 = <fn() {f} as FnOnce<()>>::call_once(move _2, const ()) -> [return: bb1, unwind unreachable]; ++ StorageLive(_4); ++ _4 = const (); ++ StorageLive(_5); ++ _5 = call::<fn() {f}>(f) -> [return: bb1, unwind unreachable]; } bb1: { ++ StorageDead(_5); ++ StorageDead(_4); + StorageDead(_3); + StorageDead(_2); StorageDead(_1); diff --git a/tests/mir-opt/inline/inline_cycle.two.Inline.panic-unwind.diff b/tests/mir-opt/inline/inline_cycle.two.Inline.panic-unwind.diff index a24649c1ebd..072b7ab3fa4 100644 --- a/tests/mir-opt/inline/inline_cycle.two.Inline.panic-unwind.diff +++ b/tests/mir-opt/inline/inline_cycle.two.Inline.panic-unwind.diff @@ -5,9 +5,15 @@ let mut _0: (); let _1: (); + let mut _2: fn() {f}; ++ let mut _4: (); + scope 1 (inlined call::<fn() {f}>) { + debug f => _2; + let _3: (); ++ scope 2 (inlined <fn() {f} as FnOnce<()>>::call_once - shim(fn() {f})) { ++ scope 3 (inlined f) { ++ let _5: (); ++ } ++ } + } bb0: { @@ -16,10 +22,15 @@ + StorageLive(_2); + _2 = f; + StorageLive(_3); -+ _3 = <fn() {f} as FnOnce<()>>::call_once(move _2, const ()) -> [return: bb1, unwind continue]; ++ StorageLive(_4); ++ _4 = const (); ++ StorageLive(_5); ++ _5 = call::<fn() {f}>(f) -> [return: bb1, unwind continue]; } bb1: { ++ StorageDead(_5); ++ StorageDead(_4); + StorageDead(_3); + StorageDead(_2); StorageDead(_1); diff --git a/tests/mir-opt/inline/inline_diverging.h.Inline.panic-abort.diff b/tests/mir-opt/inline/inline_diverging.h.Inline.panic-abort.diff index 338dca85e5c..75fc2ea16e3 100644 --- a/tests/mir-opt/inline/inline_diverging.h.Inline.panic-abort.diff +++ b/tests/mir-opt/inline/inline_diverging.h.Inline.panic-abort.diff @@ -5,6 +5,7 @@ let mut _0: (); let _1: (!, !); + let mut _2: fn() -> ! {sleep}; ++ let mut _7: (); + scope 1 (inlined call_twice::<!, fn() -> ! {sleep}>) { + debug f => _2; + let mut _3: &fn() -> ! {sleep}; @@ -17,6 +18,10 @@ + debug b => _6; + } + } ++ scope 4 (inlined <fn() -> ! {sleep} as Fn<()>>::call - shim(fn() -> ! {sleep})) { ++ scope 5 (inlined sleep) { ++ } ++ } + } bb0: { @@ -28,24 +33,13 @@ + StorageLive(_6); + StorageLive(_3); + _3 = &_2; -+ _4 = <fn() -> ! {sleep} as Fn<()>>::call(move _3, const ()) -> [return: bb1, unwind unreachable]; ++ StorageLive(_7); ++ _7 = const (); ++ goto -> bb1; + } + + bb1: { -+ StorageDead(_3); -+ StorageLive(_5); -+ _5 = &_2; -+ _6 = <fn() -> ! {sleep} as Fn<()>>::call(move _5, const ()) -> [return: bb2, unwind unreachable]; -+ } -+ -+ bb2: { -+ StorageDead(_5); -+ _1 = (copy _4, copy _6); -+ drop(_2) -> [return: bb3, unwind unreachable]; -+ } -+ -+ bb3: { -+ unreachable; ++ goto -> bb1; } } diff --git a/tests/mir-opt/inline/inline_diverging.h.Inline.panic-unwind.diff b/tests/mir-opt/inline/inline_diverging.h.Inline.panic-unwind.diff index a77cb913bfd..407cb24df67 100644 --- a/tests/mir-opt/inline/inline_diverging.h.Inline.panic-unwind.diff +++ b/tests/mir-opt/inline/inline_diverging.h.Inline.panic-unwind.diff @@ -5,6 +5,7 @@ let mut _0: (); let _1: (!, !); + let mut _2: fn() -> ! {sleep}; ++ let mut _8: (); + scope 1 (inlined call_twice::<!, fn() -> ! {sleep}>) { + debug f => _2; + let mut _3: &fn() -> ! {sleep}; @@ -18,6 +19,10 @@ + debug b => _6; + } + } ++ scope 4 (inlined <fn() -> ! {sleep} as Fn<()>>::call - shim(fn() -> ! {sleep})) { ++ scope 5 (inlined sleep) { ++ } ++ } + } bb0: { @@ -29,40 +34,13 @@ + StorageLive(_4); + StorageLive(_3); + _3 = &_2; -+ _4 = <fn() -> ! {sleep} as Fn<()>>::call(move _3, const ()) -> [return: bb1, unwind: bb5]; ++ StorageLive(_8); ++ _8 = const (); ++ goto -> bb1; + } + + bb1: { -+ StorageDead(_3); -+ StorageLive(_5); -+ _5 = &_2; -+ _6 = <fn() -> ! {sleep} as Fn<()>>::call(move _5, const ()) -> [return: bb2, unwind: bb4]; -+ } -+ -+ bb2: { -+ StorageDead(_5); -+ StorageLive(_7); -+ _7 = move _4; -+ _1 = (move _7, copy _6); -+ StorageDead(_7); -+ StorageDead(_4); -+ drop(_2) -> [return: bb3, unwind continue]; -+ } -+ -+ bb3: { -+ unreachable; -+ } -+ -+ bb4 (cleanup): { -+ drop(_4) -> [return: bb5, unwind terminate(cleanup)]; -+ } -+ -+ bb5 (cleanup): { -+ drop(_2) -> [return: bb6, unwind terminate(cleanup)]; -+ } -+ -+ bb6 (cleanup): { -+ resume; ++ goto -> bb1; } } diff --git a/tests/mir-opt/inline/inline_diverging.rs b/tests/mir-opt/inline/inline_diverging.rs index e1cea3618f1..04ff943e746 100644 --- a/tests/mir-opt/inline/inline_diverging.rs +++ b/tests/mir-opt/inline/inline_diverging.rs @@ -26,7 +26,8 @@ pub fn g(i: i32) -> u32 { pub fn h() { // CHECK-LABEL: fn h( // CHECK: (inlined call_twice::<!, fn() -> ! {sleep}>) - // CHECK-NOT: inlined + // CHECK: (inlined <fn() -> ! {sleep} as Fn<()>>::call - shim(fn() -> ! {sleep})) + // CHECK: (inlined sleep) call_twice(sleep); } diff --git a/tests/mir-opt/inline/issue_78442.bar.Inline.panic-abort.diff b/tests/mir-opt/inline/issue_78442.bar.Inline.panic-abort.diff index b9f268df351..14a0c639c3a 100644 --- a/tests/mir-opt/inline/issue_78442.bar.Inline.panic-abort.diff +++ b/tests/mir-opt/inline/issue_78442.bar.Inline.panic-abort.diff @@ -10,6 +10,10 @@ let mut _5: (); + scope 1 (inlined hide_foo) { + } ++ scope 2 (inlined <fn() {foo} as Fn<()>>::call - shim(fn() {foo})) { ++ scope 3 (inlined foo) { ++ } ++ } bb0: { StorageLive(_2); @@ -23,22 +27,20 @@ StorageLive(_5); _5 = (); - _2 = <fn() {foo} as Fn<()>>::call(move _3, move _5) -> [return: bb2, unwind unreachable]; -+ _2 = <fn() {foo} as Fn<()>>::call(move _3, move _5) -> [return: bb1, unwind unreachable]; - } - +- } +- - bb2: { -+ bb1: { StorageDead(_5); StorageDead(_3); StorageDead(_4); StorageDead(_2); _0 = const (); - drop(_1) -> [return: bb3, unwind unreachable]; -+ drop(_1) -> [return: bb2, unwind unreachable]; ++ drop(_1) -> [return: bb1, unwind unreachable]; } - bb3: { -+ bb2: { ++ bb1: { return; } } diff --git a/tests/mir-opt/inline/issue_78442.bar.Inline.panic-unwind.diff b/tests/mir-opt/inline/issue_78442.bar.Inline.panic-unwind.diff index 8495164df9c..e0a273eb13f 100644 --- a/tests/mir-opt/inline/issue_78442.bar.Inline.panic-unwind.diff +++ b/tests/mir-opt/inline/issue_78442.bar.Inline.panic-unwind.diff @@ -10,6 +10,10 @@ let mut _5: (); + scope 1 (inlined hide_foo) { + } ++ scope 2 (inlined <fn() {foo} as Fn<()>>::call - shim(fn() {foo})) { ++ scope 3 (inlined foo) { ++ } ++ } bb0: { StorageLive(_2); @@ -23,33 +27,29 @@ StorageLive(_5); _5 = (); - _2 = <fn() {foo} as Fn<()>>::call(move _3, move _5) -> [return: bb2, unwind: bb4]; -+ _2 = <fn() {foo} as Fn<()>>::call(move _3, move _5) -> [return: bb1, unwind: bb3]; - } - +- } +- - bb2: { -+ bb1: { StorageDead(_5); StorageDead(_3); StorageDead(_4); StorageDead(_2); _0 = const (); - drop(_1) -> [return: bb3, unwind: bb5]; -+ drop(_1) -> [return: bb2, unwind: bb4]; ++ drop(_1) -> [return: bb1, unwind: bb2]; } - bb3: { -+ bb2: { ++ bb1: { return; } - bb4 (cleanup): { - drop(_1) -> [return: bb5, unwind terminate(cleanup)]; -+ bb3 (cleanup): { -+ drop(_1) -> [return: bb4, unwind terminate(cleanup)]; - } - +- } +- - bb5 (cleanup): { -+ bb4 (cleanup): { ++ bb2 (cleanup): { resume; } } diff --git a/tests/mir-opt/inline/issue_78442.rs b/tests/mir-opt/inline/issue_78442.rs index 4eb5c142034..a142d457377 100644 --- a/tests/mir-opt/inline/issue_78442.rs +++ b/tests/mir-opt/inline/issue_78442.rs @@ -9,10 +9,9 @@ pub fn bar<P>( _baz: P, ) { // CHECK-LABEL: fn bar( - // CHECK: let mut {{.*}}: &fn() {foo}; - // CHECK: let {{.*}}: fn() {foo}; // CHECK: (inlined hide_foo) - // CHECK-NOT: inlined + // CHECK: (inlined <fn() {foo} as Fn<()>>::call - shim(fn() {foo})) + // CHECK: (inlined foo) hide_foo()(); } diff --git a/tests/mir-opt/inline_fn_call_for_fn_def.rs b/tests/mir-opt/inline_fn_call_for_fn_def.rs new file mode 100644 index 00000000000..7601feda573 --- /dev/null +++ b/tests/mir-opt/inline_fn_call_for_fn_def.rs @@ -0,0 +1,19 @@ +//@ test-mir-pass: Inline +//@ compile-flags: --crate-type=lib -C panic=abort + +// EMIT_MIR inline_fn_call_for_fn_def.test.Inline.diff + +fn inline_fn(x: impl FnOnce() -> i32) -> i32 { + x() +} + +fn yield_number() -> i32 { + 64 +} + +fn test() -> i32 { + // CHECK: (inlined inline_fn::<fn() -> i32 {yield_number}>) + // CHECK: (inlined <fn() -> i32 {yield_number} as FnOnce<()>>::call_once - shim(fn() -> i32 {yield_number})) + // CHECK: (inlined yield_number) + inline_fn(yield_number) +} diff --git a/tests/mir-opt/inline_fn_call_for_fn_def.test.Inline.diff b/tests/mir-opt/inline_fn_call_for_fn_def.test.Inline.diff new file mode 100644 index 00000000000..aef7aa23970 --- /dev/null +++ b/tests/mir-opt/inline_fn_call_for_fn_def.test.Inline.diff @@ -0,0 +1,34 @@ +- // MIR for `test` before Inline ++ // MIR for `test` after Inline + + fn test() -> i32 { + let mut _0: i32; +- +- bb0: { +- _0 = inline_fn::<fn() -> i32 {yield_number}>(yield_number) -> [return: bb1, unwind unreachable]; ++ let mut _1: fn() -> i32 {yield_number}; ++ scope 1 (inlined inline_fn::<fn() -> i32 {yield_number}>) { ++ let mut _2: fn() -> i32 {yield_number}; ++ let mut _3: (); ++ scope 2 (inlined <fn() -> i32 {yield_number} as FnOnce<()>>::call_once - shim(fn() -> i32 {yield_number})) { ++ scope 3 (inlined yield_number) { ++ } ++ } + } + +- bb1: { ++ bb0: { ++ StorageLive(_1); ++ _1 = yield_number; ++ StorageLive(_2); ++ _2 = move _1; ++ StorageLive(_3); ++ _3 = (); ++ _0 = const 64_i32; ++ StorageDead(_3); ++ StorageDead(_2); ++ StorageDead(_1); + return; + } + } + diff --git a/tests/mir-opt/issues/issue_59352.num_to_digit.PreCodegen.after.panic-abort.mir b/tests/mir-opt/issues/issue_59352.num_to_digit.PreCodegen.after.32bit.panic-abort.mir index 5876c55c52b..5876c55c52b 100644 --- a/tests/mir-opt/issues/issue_59352.num_to_digit.PreCodegen.after.panic-abort.mir +++ b/tests/mir-opt/issues/issue_59352.num_to_digit.PreCodegen.after.32bit.panic-abort.mir diff --git a/tests/mir-opt/issues/issue_59352.num_to_digit.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/issues/issue_59352.num_to_digit.PreCodegen.after.32bit.panic-unwind.mir index f1185353a43..f1185353a43 100644 --- a/tests/mir-opt/issues/issue_59352.num_to_digit.PreCodegen.after.panic-unwind.mir +++ b/tests/mir-opt/issues/issue_59352.num_to_digit.PreCodegen.after.32bit.panic-unwind.mir diff --git a/tests/mir-opt/issues/issue_59352.num_to_digit.PreCodegen.after.64bit.panic-abort.mir b/tests/mir-opt/issues/issue_59352.num_to_digit.PreCodegen.after.64bit.panic-abort.mir new file mode 100644 index 00000000000..5876c55c52b --- /dev/null +++ b/tests/mir-opt/issues/issue_59352.num_to_digit.PreCodegen.after.64bit.panic-abort.mir @@ -0,0 +1,68 @@ +// MIR for `num_to_digit` after PreCodegen + +fn num_to_digit(_1: char) -> u32 { + debug num => _1; + let mut _0: u32; + let mut _4: std::option::Option<u32>; + scope 1 (inlined char::methods::<impl char>::is_digit) { + let _2: std::option::Option<u32>; + scope 2 (inlined Option::<u32>::is_some) { + let mut _3: isize; + } + } + scope 3 (inlined #[track_caller] Option::<u32>::unwrap) { + let mut _5: isize; + let mut _6: !; + scope 4 { + } + } + + bb0: { + StorageLive(_2); + _2 = char::methods::<impl char>::to_digit(copy _1, const 8_u32) -> [return: bb1, unwind unreachable]; + } + + bb1: { + StorageLive(_3); + _3 = discriminant(_2); + StorageDead(_2); + switchInt(move _3) -> [1: bb2, otherwise: bb7]; + } + + bb2: { + StorageDead(_3); + StorageLive(_4); + _4 = char::methods::<impl char>::to_digit(move _1, const 8_u32) -> [return: bb3, unwind unreachable]; + } + + bb3: { + StorageLive(_5); + _5 = discriminant(_4); + switchInt(move _5) -> [0: bb4, 1: bb5, otherwise: bb6]; + } + + bb4: { + _6 = option::unwrap_failed() -> unwind unreachable; + } + + bb5: { + _0 = move ((_4 as Some).0: u32); + StorageDead(_5); + StorageDead(_4); + goto -> bb8; + } + + bb6: { + unreachable; + } + + bb7: { + StorageDead(_3); + _0 = const 0_u32; + goto -> bb8; + } + + bb8: { + return; + } +} diff --git a/tests/mir-opt/issues/issue_59352.num_to_digit.PreCodegen.after.64bit.panic-unwind.mir b/tests/mir-opt/issues/issue_59352.num_to_digit.PreCodegen.after.64bit.panic-unwind.mir new file mode 100644 index 00000000000..f1185353a43 --- /dev/null +++ b/tests/mir-opt/issues/issue_59352.num_to_digit.PreCodegen.after.64bit.panic-unwind.mir @@ -0,0 +1,68 @@ +// MIR for `num_to_digit` after PreCodegen + +fn num_to_digit(_1: char) -> u32 { + debug num => _1; + let mut _0: u32; + let mut _4: std::option::Option<u32>; + scope 1 (inlined char::methods::<impl char>::is_digit) { + let _2: std::option::Option<u32>; + scope 2 (inlined Option::<u32>::is_some) { + let mut _3: isize; + } + } + scope 3 (inlined #[track_caller] Option::<u32>::unwrap) { + let mut _5: isize; + let mut _6: !; + scope 4 { + } + } + + bb0: { + StorageLive(_2); + _2 = char::methods::<impl char>::to_digit(copy _1, const 8_u32) -> [return: bb1, unwind continue]; + } + + bb1: { + StorageLive(_3); + _3 = discriminant(_2); + StorageDead(_2); + switchInt(move _3) -> [1: bb2, otherwise: bb7]; + } + + bb2: { + StorageDead(_3); + StorageLive(_4); + _4 = char::methods::<impl char>::to_digit(move _1, const 8_u32) -> [return: bb3, unwind continue]; + } + + bb3: { + StorageLive(_5); + _5 = discriminant(_4); + switchInt(move _5) -> [0: bb4, 1: bb5, otherwise: bb6]; + } + + bb4: { + _6 = option::unwrap_failed() -> unwind continue; + } + + bb5: { + _0 = move ((_4 as Some).0: u32); + StorageDead(_5); + StorageDead(_4); + goto -> bb8; + } + + bb6: { + unreachable; + } + + bb7: { + StorageDead(_3); + _0 = const 0_u32; + goto -> bb8; + } + + bb8: { + return; + } +} diff --git a/tests/mir-opt/issues/issue_59352.rs b/tests/mir-opt/issues/issue_59352.rs index 9024dc976e4..516a712f1db 100644 --- a/tests/mir-opt/issues/issue_59352.rs +++ b/tests/mir-opt/issues/issue_59352.rs @@ -1,4 +1,6 @@ // EMIT_MIR_FOR_EACH_PANIC_STRATEGY +// EMIT_MIR_FOR_EACH_BIT_WIDTH + // This test is a mirror of codegen/issue-59352.rs. // The LLVM inliner doesn't inline `char::method::is_digit()` and so it doesn't recognize this case // as effectively `if x.is_some() { x.unwrap() } else { 0 }`. diff --git a/tests/mir-opt/issues/issue_75439.rs b/tests/mir-opt/issues/issue_75439.rs index ea763dd1b10..d7883f0dc71 100644 --- a/tests/mir-opt/issues/issue_75439.rs +++ b/tests/mir-opt/issues/issue_75439.rs @@ -1,10 +1,14 @@ -// skip-filecheck // EMIT_MIR issue_75439.foo.MatchBranchSimplification.diff //@ ignore-endian-big use std::mem::transmute; pub fn foo(bytes: [u8; 16]) -> Option<[u8; 4]> { + // CHECK-LABEL: fn foo( + // CHECK: bb2: { + // CHECK-NEXT: 0: [[bb:bb[0-9]+]], + // CHECK-SAME: {{[0-9]+}}: [[bb]], + // big endian `u32`s let dwords: [u32; 4] = unsafe { transmute(bytes) }; const FF: u32 = 0x0000_ffff_u32.to_be(); diff --git a/tests/mir-opt/pattern_types.main.PreCodegen.after.mir b/tests/mir-opt/pattern_types.main.PreCodegen.after.mir index 5ff90de9615..cc01f51973c 100644 --- a/tests/mir-opt/pattern_types.main.PreCodegen.after.mir +++ b/tests/mir-opt/pattern_types.main.PreCodegen.after.mir @@ -3,9 +3,9 @@ fn main() -> () { let mut _0: (); scope 1 { - debug x => const 2_u32 is 1..=; + debug x => const 2_u32 is 1..; scope 2 { - debug y => const {transmute(0x00000000): (u32) is 1..=}; + debug y => const {transmute(0x00000000): (u32) is 1..}; } } diff --git a/tests/mir-opt/pattern_types.rs b/tests/mir-opt/pattern_types.rs index 0369ccf9a9d..d5847b95f73 100644 --- a/tests/mir-opt/pattern_types.rs +++ b/tests/mir-opt/pattern_types.rs @@ -5,8 +5,8 @@ use std::pat::pattern_type; // EMIT_MIR pattern_types.main.PreCodegen.after.mir fn main() { - // CHECK: debug x => const 2_u32 is 1..= + // CHECK: debug x => const 2_u32 is 1.. let x: pattern_type!(u32 is 1..) = unsafe { std::mem::transmute(2) }; - // CHECK: debug y => const {transmute(0x00000000): (u32) is 1..=} + // CHECK: debug y => const {transmute(0x00000000): (u32) is 1..} let y: pattern_type!(u32 is 1..) = unsafe { std::mem::transmute(0) }; } diff --git a/tests/mir-opt/pre-codegen/derived_ord.demo_le.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/derived_ord.demo_le.PreCodegen.after.mir new file mode 100644 index 00000000000..49314a64c3f --- /dev/null +++ b/tests/mir-opt/pre-codegen/derived_ord.demo_le.PreCodegen.after.mir @@ -0,0 +1,89 @@ +// MIR for `demo_le` after PreCodegen + +fn demo_le(_1: &MultiField, _2: &MultiField) -> bool { + debug a => _1; + debug b => _2; + let mut _0: bool; + scope 1 (inlined <MultiField as PartialOrd>::le) { + let mut _11: std::option::Option<std::cmp::Ordering>; + scope 2 (inlined Option::<std::cmp::Ordering>::is_some_and::<fn(std::cmp::Ordering) -> bool {std::cmp::Ordering::is_le}>) { + let _12: std::cmp::Ordering; + scope 3 { + scope 4 (inlined <fn(std::cmp::Ordering) -> bool {std::cmp::Ordering::is_le} as FnOnce<(std::cmp::Ordering,)>>::call_once - shim(fn(std::cmp::Ordering) -> bool {std::cmp::Ordering::is_le})) { + scope 5 (inlined std::cmp::Ordering::is_le) { + let mut _13: i8; + scope 6 (inlined std::cmp::Ordering::as_raw) { + } + } + } + } + } + scope 7 (inlined <MultiField as PartialOrd>::partial_cmp) { + let mut _6: std::option::Option<std::cmp::Ordering>; + let mut _7: i8; + scope 8 { + } + scope 9 (inlined std::cmp::impls::<impl PartialOrd for char>::partial_cmp) { + let mut _3: char; + let mut _4: char; + let mut _5: std::cmp::Ordering; + } + scope 10 (inlined std::cmp::impls::<impl PartialOrd for i16>::partial_cmp) { + let mut _8: i16; + let mut _9: i16; + let mut _10: std::cmp::Ordering; + } + } + } + + bb0: { + StorageLive(_12); + StorageLive(_11); + StorageLive(_5); + StorageLive(_7); + StorageLive(_3); + _3 = copy ((*_1).0: char); + StorageLive(_4); + _4 = copy ((*_2).0: char); + _5 = Cmp(move _3, move _4); + StorageDead(_4); + StorageDead(_3); + _6 = Option::<std::cmp::Ordering>::Some(copy _5); + _7 = discriminant(_5); + switchInt(move _7) -> [0: bb1, otherwise: bb2]; + } + + bb1: { + StorageLive(_10); + StorageLive(_8); + _8 = copy ((*_1).1: i16); + StorageLive(_9); + _9 = copy ((*_2).1: i16); + _10 = Cmp(move _8, move _9); + StorageDead(_9); + StorageDead(_8); + _11 = Option::<std::cmp::Ordering>::Some(move _10); + StorageDead(_10); + StorageDead(_7); + StorageDead(_5); + goto -> bb3; + } + + bb2: { + _11 = copy _6; + StorageDead(_7); + StorageDead(_5); + goto -> bb3; + } + + bb3: { + _12 = move ((_11 as Some).0: std::cmp::Ordering); + StorageLive(_13); + _13 = discriminant(_12); + _0 = Le(move _13, const 0_i8); + StorageDead(_13); + StorageDead(_11); + StorageDead(_12); + return; + } +} diff --git a/tests/mir-opt/pre-codegen/derived_ord.rs b/tests/mir-opt/pre-codegen/derived_ord.rs index bad751edf84..73ae923a6cb 100644 --- a/tests/mir-opt/pre-codegen/derived_ord.rs +++ b/tests/mir-opt/pre-codegen/derived_ord.rs @@ -1,4 +1,3 @@ -// skip-filecheck //@ compile-flags: -O -Zmir-opt-level=2 -Cdebuginfo=0 #![crate_type = "lib"] @@ -6,4 +5,29 @@ #[derive(PartialOrd, PartialEq)] pub struct MultiField(char, i16); +// Because this isn't derived by the impl, it's not on the `{impl#0}-partial_cmp`, +// and thus we need to call it to see what the inlined generic one produces. +pub fn demo_le(a: &MultiField, b: &MultiField) -> bool { + // CHECK-LABEL: fn demo_le + // CHECK: inlined <MultiField as PartialOrd>::le + // CHECK: inlined{{.+}}is_some_and + // CHECK: inlined <MultiField as PartialOrd>::partial_cmp + + // CHECK: [[A0:_[0-9]+]] = copy ((*_1).0: char); + // CHECK: [[B0:_[0-9]+]] = copy ((*_2).0: char); + // CHECK: Cmp(move [[A0]], move [[B0]]); + + // CHECK: [[D0:_[0-9]+]] = discriminant({{.+}}); + // CHECK: switchInt(move [[D0]]) -> [0: bb{{[0-9]+}}, otherwise: bb{{[0-9]+}}]; + + // CHECK: [[A1:_[0-9]+]] = copy ((*_1).1: i16); + // CHECK: [[B1:_[0-9]+]] = copy ((*_2).1: i16); + // CHECK: Cmp(move [[A1]], move [[B1]]); + + // CHECK: [[D1:_[0-9]+]] = discriminant({{.+}}); + // CHECK: _0 = Le(move [[D1]], const 0_i8); + *a <= *b +} + // EMIT_MIR derived_ord.{impl#0}-partial_cmp.PreCodegen.after.mir +// EMIT_MIR derived_ord.demo_le.PreCodegen.after.mir diff --git a/tests/mir-opt/pre-codegen/derived_ord.{impl#0}-partial_cmp.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/derived_ord.{impl#0}-partial_cmp.PreCodegen.after.mir index 5f4ec1de270..de25eebee77 100644 --- a/tests/mir-opt/pre-codegen/derived_ord.{impl#0}-partial_cmp.PreCodegen.after.mir +++ b/tests/mir-opt/pre-codegen/derived_ord.{impl#0}-partial_cmp.PreCodegen.after.mir @@ -1,6 +1,6 @@ -// MIR for `<impl at $DIR/derived_ord.rs:6:10: 6:20>::partial_cmp` after PreCodegen +// MIR for `<impl at $DIR/derived_ord.rs:5:10: 5:20>::partial_cmp` after PreCodegen -fn <impl at $DIR/derived_ord.rs:6:10: 6:20>::partial_cmp(_1: &MultiField, _2: &MultiField) -> Option<std::cmp::Ordering> { +fn <impl at $DIR/derived_ord.rs:5:10: 5:20>::partial_cmp(_1: &MultiField, _2: &MultiField) -> Option<std::cmp::Ordering> { debug self => _1; debug other => _2; let mut _0: std::option::Option<std::cmp::Ordering>; diff --git a/tests/mir-opt/pre-codegen/loops.mapped.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/loops.mapped.PreCodegen.after.mir index 4977f39ccef..d22ea54004c 100644 --- a/tests/mir-opt/pre-codegen/loops.mapped.PreCodegen.after.mir +++ b/tests/mir-opt/pre-codegen/loops.mapped.PreCodegen.after.mir @@ -29,6 +29,10 @@ fn mapped(_1: impl Iterator<Item = T>, _2: impl Fn(T) -> U) -> () { let mut _12: U; scope 6 { debug x => _10; + scope 7 (inlined ops::function::impls::<impl FnOnce<(T,)> for &mut impl Fn(T) -> U>::call_once) { + debug self => _8; + debug args => _11; + } } } } @@ -85,7 +89,7 @@ fn mapped(_1: impl Iterator<Item = T>, _2: impl Fn(T) -> U) -> () { StorageLive(_12); StorageLive(_11); _11 = (copy _10,); - _12 = <&mut impl Fn(T) -> U as FnOnce<(T,)>>::call_once(move _8, move _11) -> [return: bb7, unwind: bb10]; + _12 = <impl Fn(T) -> U as FnMut<(T,)>>::call_mut(move _8, move _11) -> [return: bb7, unwind: bb10]; } bb7: { diff --git a/tests/pretty/hir-pretty-attr.pp b/tests/pretty/hir-pretty-attr.pp new file mode 100644 index 00000000000..586810b0046 --- /dev/null +++ b/tests/pretty/hir-pretty-attr.pp @@ -0,0 +1,11 @@ +#[prelude_import] +use ::std::prelude::rust_2015::*; +#[macro_use] +extern crate std; +//@ pretty-compare-only +//@ pretty-mode:hir +//@ pp-exact:hir-pretty-attr.pp + +#[attr="Repr([ReprC, ReprPacked(Align(4 bytes)), ReprTransparent])")] +struct Example { +} diff --git a/tests/pretty/hir-pretty-attr.rs b/tests/pretty/hir-pretty-attr.rs new file mode 100644 index 00000000000..eb5a677024a --- /dev/null +++ b/tests/pretty/hir-pretty-attr.rs @@ -0,0 +1,7 @@ +//@ pretty-compare-only +//@ pretty-mode:hir +//@ pp-exact:hir-pretty-attr.pp + +#[repr(C, packed(4))] +#[repr(transparent)] +struct Example {} diff --git a/tests/pretty/pin-ergonomics.rs b/tests/pretty/pin-ergonomics.rs new file mode 100644 index 00000000000..47ffc97b118 --- /dev/null +++ b/tests/pretty/pin-ergonomics.rs @@ -0,0 +1,24 @@ +//@ pp-exact + +#![feature(pin_ergonomics)] +#![allow(dead_code, incomplete_features)] + +struct Foo; + +impl Foo { + fn baz(&pin mut self) {} + + fn baz_const(&pin const self) {} + + fn baz_lt<'a>(&'a pin mut self) {} + + fn baz_const_lt(&'_ pin const self) {} +} + +fn foo(_: &pin mut Foo) {} +fn foo_lt<'a>(_: &'a pin mut Foo) {} + +fn foo_const(_: &pin const Foo) {} +fn foo_const_lt(_: &'_ pin const Foo) {} + +fn main() {} diff --git a/tests/run-make/README.md b/tests/run-make/README.md index 40359903473..5cdd2fdc523 100644 --- a/tests/run-make/README.md +++ b/tests/run-make/README.md @@ -1,32 +1,17 @@ # The `run-make` test suite -The `run-make` test suite contains tests which are the most flexible out of all -the [rust-lang/rust](https://github.com/rust-lang/rust) test suites. `run-make` -tests can basically contain arbitrary code, and are supported by the -[`run_make_support`] library. +The `run-make` test suite contains tests which are the most flexible out of all the [rust-lang/rust](https://github.com/rust-lang/rust) test suites. `run-make` tests can basically contain arbitrary code, and are supported by the [`run_make_support`] library. ## Infrastructure -There are two kinds of run-make tests: +A `run-make` test is a test recipe source file `rmake.rs` accompanied by its parent directory (e.g. `tests/run-make/foo/rmake.rs` is the `foo` `run-make` test). -1. The new `rmake.rs` version: this allows run-make tests to be written in Rust - (with `rmake.rs` as the main test file). -2. The legacy `Makefile` version: this is what run-make tests were written with - before support for `rmake.rs` was introduced. +The implementation for collecting and building the `rmake.rs` recipes are in [`src/tools/compiletest/src/runtest.rs`](../../src/tools/compiletest/src/runtest.rs), in `run_rmake_test`. -The implementation for collecting and building the `rmake.rs` recipes (or -`Makefile`s) are in -[`src/tools/compiletest/src/runtest.rs`](../../src/tools/compiletest/src/runtest.rs), -in `run_rmake_v2_test` and `run_rmake_legacy_test`. - -### Rust-based `run-make` tests: `rmake.rs` - -The setup for the `rmake.rs` version is a 3-stage process: +The setup for the `rmake.rs` can be summarized as a 3-stage process: 1. First, we build the [`run_make_support`] library in bootstrap as a tool lib. -2. Then, we compile the `rmake.rs` "recipe" linking the support library and its - dependencies in, and provide a bunch of env vars. We setup a directory - structure within `build/<target>/test/run-make/` +2. Then, we compile the `rmake.rs` "recipe" linking the support library and its dependencies in, and provide a bunch of env vars. We setup a directory structure within `build/<target>/test/run-make/` ``` <test-name>/ @@ -34,15 +19,8 @@ The setup for the `rmake.rs` version is a 3-stage process: rmake_out/ # sources from test sources copied over ``` - and copy non-`rmake.rs` input support files over to `rmake_out/`. The - support library is made available as an [*extern prelude*][extern_prelude]. -3. Finally, we run the recipe binary and set `rmake_out/` as the working - directory. + and copy non-`rmake.rs` input support files over to `rmake_out/`. The support library is made available as an [*extern prelude*][extern_prelude]. +3. Finally, we run the recipe binary and set `rmake_out/` as the working directory. [`run_make_support`]: ../../src/tools/run-make-support [extern_prelude]: https://doc.rust-lang.org/reference/names/preludes.html#extern-prelude - -### Formatting - -Note that files under `tests/` are not formatted by `./x fmt`, -use `rustfmt tests/path/to/file.rs` to format a specific file if desired. diff --git a/tests/run-make/a-b-a-linker-guard/rmake.rs b/tests/run-make/a-b-a-linker-guard/rmake.rs index ee6d655bc76..4428685a6cf 100644 --- a/tests/run-make/a-b-a-linker-guard/rmake.rs +++ b/tests/run-make/a-b-a-linker-guard/rmake.rs @@ -1,7 +1,8 @@ -// ignore-tidy-linelength +// Test that if we build `b` against a version of `a` that has +// one set of types, it will not run with a dylib that has a different set of types. -// Test that if we build `b` against a version of `a` that has one set of types, it will not run -// with a dylib that has a different set of types. +//@ ignore-cross-compile +// Reason: the compiled binary is executed use run_make_support::{run, run_fail, rustc}; diff --git a/tests/run-make/broken-pipe-no-ice/rmake.rs b/tests/run-make/broken-pipe-no-ice/rmake.rs index 54d13b62f4a..3e54b576fd4 100644 --- a/tests/run-make/broken-pipe-no-ice/rmake.rs +++ b/tests/run-make/broken-pipe-no-ice/rmake.rs @@ -11,12 +11,12 @@ // Internal Compiler Error strangely, but it doesn't even go through normal diagnostic infra. Very // strange. -#![feature(anonymous_pipe)] - use std::io::Read; use std::process::{Command, Stdio}; -use run_make_support::env_var; +// FIXME(#137532): replace `os_pipe` dependency with std `anonymous_pipe` once that stabilizes and +// reaches beta. +use run_make_support::{env_var, os_pipe}; #[derive(Debug, PartialEq)] enum Binary { @@ -25,7 +25,7 @@ enum Binary { } fn check_broken_pipe_handled_gracefully(bin: Binary, mut cmd: Command) { - let (reader, writer) = std::io::pipe().unwrap(); + let (reader, writer) = os_pipe::pipe().unwrap(); drop(reader); // close read-end cmd.stdout(writer).stderr(Stdio::piped()); diff --git a/tests/run-make/const_fn_mir/dump.mir b/tests/run-make/const_fn_mir/dump.mir index b1802c990cf..2b5c684bbef 100644 --- a/tests/run-make/const_fn_mir/dump.mir +++ b/tests/run-make/const_fn_mir/dump.mir @@ -1,5 +1,6 @@ // WARNING: This output format is intended for human consumers only // and is subject to change without notice. Knock yourself out. +// HINT: See also -Z dump-mir for MIR at specific points during compilation. fn foo() -> i32 { let mut _0: i32; let mut _1: (i32, bool); diff --git a/tests/run-make/cross-lang-lto/rmake.rs b/tests/run-make/cross-lang-lto/rmake.rs index dc376b561e4..50d37460d8d 100644 --- a/tests/run-make/cross-lang-lto/rmake.rs +++ b/tests/run-make/cross-lang-lto/rmake.rs @@ -3,8 +3,6 @@ // -Clinker-plugin-lto. // See https://github.com/rust-lang/rust/pull/50000 -#![feature(path_file_prefix)] - use std::path::PathBuf; use run_make_support::{ @@ -92,10 +90,17 @@ fn check_bitcode(instructions: LibBuild) { llvm_ar().extract().arg(&instructions.output).run(); } - for object in shallow_find_files(cwd(), |path| { - has_prefix(path, instructions.output.file_prefix().unwrap().to_str().unwrap()) + let objects = shallow_find_files(cwd(), |path| { + let mut output_path = instructions.output.clone(); + output_path.set_extension(""); + has_prefix(path, output_path.file_name().unwrap().to_str().unwrap()) && has_extension(path, "o") - }) { + }); + assert!(!objects.is_empty()); + println!("objects: {:#?}", objects); + + for object in objects { + println!("reading bitcode: {}", object.display()); // All generated object files should be LLVM bitcode files - this will fail otherwise. llvm_bcanalyzer().input(object).run(); } diff --git a/tests/run-make/include-all-symbols-linking/lib.rs b/tests/run-make/include-all-symbols-linking/lib.rs index 99508bcdaf3..73186ee99e3 100644 --- a/tests/run-make/include-all-symbols-linking/lib.rs +++ b/tests/run-make/include-all-symbols-linking/lib.rs @@ -1,5 +1,6 @@ mod foo { - #[link_section = ".rodata.STATIC"] + #[cfg_attr(target_os = "linux", link_section = ".rodata.STATIC")] + #[cfg_attr(target_vendor = "apple", link_section = "__DATA,STATIC")] #[used] static STATIC: [u32; 10] = [1; 10]; } diff --git a/tests/run-make/include-all-symbols-linking/rmake.rs b/tests/run-make/include-all-symbols-linking/rmake.rs index 77fd71ab20d..bab510fb5be 100644 --- a/tests/run-make/include-all-symbols-linking/rmake.rs +++ b/tests/run-make/include-all-symbols-linking/rmake.rs @@ -7,15 +7,20 @@ // See https://github.com/rust-lang/rust/pull/95604 // See https://github.com/rust-lang/rust/issues/47384 -//@ only-linux -// Reason: differences in object file formats on OSX and Windows -// causes errors in the llvm_objdump step +//@ ignore-wasm differences in object file formats causes errors in the llvm_objdump step. +//@ ignore-windows differences in object file formats causes errors in the llvm_objdump step. -use run_make_support::{dynamic_lib_name, llvm_objdump, llvm_readobj, rustc}; +use run_make_support::{dynamic_lib_name, llvm_objdump, llvm_readobj, rustc, target}; fn main() { rustc().crate_type("lib").input("lib.rs").run(); - rustc().crate_type("cdylib").link_args("-Tlinker.ld").input("main.rs").run(); + let mut main = rustc(); + main.crate_type("cdylib"); + if target().contains("linux") { + main.link_args("-Tlinker.ld"); + } + main.input("main.rs").run(); + // Ensure `#[used]` and `KEEP`-ed section is there llvm_objdump() .arg("--full-contents") diff --git a/tests/run-make/issue-107495-archive-permissions/rmake.rs b/tests/run-make/issue-107495-archive-permissions/rmake.rs index f210b7c737b..228cfb0864e 100644 --- a/tests/run-make/issue-107495-archive-permissions/rmake.rs +++ b/tests/run-make/issue-107495-archive-permissions/rmake.rs @@ -1,12 +1,9 @@ -#![feature(rustc_private)] - -#[cfg(unix)] -extern crate libc; - #[cfg(unix)] use std::os::unix::fs::PermissionsExt; use std::path::Path; +#[cfg(unix)] +use run_make_support::libc; use run_make_support::{aux_build, rfs}; fn main() { diff --git a/tests/run-make/linker-warning/rmake.rs b/tests/run-make/linker-warning/rmake.rs index 30387af428c..73ad248b6f3 100644 --- a/tests/run-make/linker-warning/rmake.rs +++ b/tests/run-make/linker-warning/rmake.rs @@ -60,6 +60,8 @@ fn main() { regex::escape(run_make_support::build_root().to_str().unwrap()), "/build-root", ) + .normalize(r#""[^"]*\/symbols.o""#, "\"/symbols.o\"") + .normalize(r#""[^"]*\/raw-dylibs""#, "\"/raw-dylibs\"") .run(); } diff --git a/tests/run-make/linker-warning/short-error.txt b/tests/run-make/linker-warning/short-error.txt index dd3b742bbfd..a7f48af885a 100644 --- a/tests/run-make/linker-warning/short-error.txt +++ b/tests/run-make/linker-warning/short-error.txt @@ -1,6 +1,6 @@ error: linking with `./fake-linker` failed: exit status: 1 | - = note: "./fake-linker" "-m64" "/tmp/rustc/symbols.o" "<2 object files omitted>" "-Wl,--as-needed" "-Wl,-Bstatic" "<sysroot>/lib/rustlib/x86_64-unknown-linux-gnu/lib/{libstd-*,libpanic_unwind-*,libobject-*,libmemchr-*,libaddr2line-*,libgimli-*,librustc_demangle-*,libstd_detect-*,libhashbrown-*,librustc_std_workspace_alloc-*,libminiz_oxide-*,libadler2-*,libunwind-*,libcfg_if-*,liblibc-*,liballoc-*,librustc_std_workspace_core-*,libcore-*,libcompiler_builtins-*}.rlib" "-Wl,-Bdynamic" "-lgcc_s" "-lutil" "-lrt" "-lpthread" "-lm" "-ldl" "-lc" "-Wl,--eh-frame-hdr" "-Wl,-z,noexecstack" "-L" "/build-root/test/run-make/linker-warning/rmake_out" "-L" "<sysroot>/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-o" "main" "-Wl,--gc-sections" "-pie" "-Wl,-z,relro,-z,now" "-nodefaultlibs" "run_make_error" + = note: "./fake-linker" "-m64" "/symbols.o" "<2 object files omitted>" "-Wl,--as-needed" "-Wl,-Bstatic" "<sysroot>/lib/rustlib/x86_64-unknown-linux-gnu/lib/{libstd-*,libpanic_unwind-*,libobject-*,libmemchr-*,libaddr2line-*,libgimli-*,librustc_demangle-*,libstd_detect-*,libhashbrown-*,librustc_std_workspace_alloc-*,libminiz_oxide-*,libadler2-*,libunwind-*,libcfg_if-*,liblibc-*,liballoc-*,librustc_std_workspace_core-*,libcore-*,libcompiler_builtins-*}.rlib" "-Wl,-Bdynamic" "-lgcc_s" "-lutil" "-lrt" "-lpthread" "-lm" "-ldl" "-lc" "-L" "/raw-dylibs" "-Wl,--eh-frame-hdr" "-Wl,-z,noexecstack" "-L" "/build-root/test/run-make/linker-warning/rmake_out" "-L" "<sysroot>/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-o" "main" "-Wl,--gc-sections" "-pie" "-Wl,-z,relro,-z,now" "-nodefaultlibs" "run_make_error" = note: some arguments are omitted. use `--verbose` to show all linker arguments = note: error: baz diff --git a/tests/run-make/pgo-embed-bc-lto/interesting.rs b/tests/run-make/pgo-embed-bc-lto/interesting.rs new file mode 100644 index 00000000000..13105c17e12 --- /dev/null +++ b/tests/run-make/pgo-embed-bc-lto/interesting.rs @@ -0,0 +1,16 @@ +#![crate_name = "interesting"] +#![crate_type = "rlib"] + +extern crate opaque; + +#[no_mangle] +#[inline(never)] +pub fn function_called_once() { + opaque::foo(); +} + +// CHECK-LABEL: @function_called_once +// CHECK-SAME: !prof [[function_called_once_id:![0-9]+]] { +// CHECK: "CG Profile" +// CHECK-NOT: "CG Profile" +// CHECK-DAG: [[function_called_once_id]] = !{!"function_entry_count", i64 1} diff --git a/tests/run-make/pgo-embed-bc-lto/main.rs b/tests/run-make/pgo-embed-bc-lto/main.rs new file mode 100644 index 00000000000..ce8747bef3c --- /dev/null +++ b/tests/run-make/pgo-embed-bc-lto/main.rs @@ -0,0 +1,5 @@ +extern crate interesting; + +fn main() { + interesting::function_called_once(); +} diff --git a/tests/run-make/pgo-embed-bc-lto/opaque.rs b/tests/run-make/pgo-embed-bc-lto/opaque.rs new file mode 100644 index 00000000000..b4467dc7796 --- /dev/null +++ b/tests/run-make/pgo-embed-bc-lto/opaque.rs @@ -0,0 +1,5 @@ +#![crate_name = "opaque"] +#![crate_type = "rlib"] + +#[inline(never)] +pub fn foo() {} diff --git a/tests/run-make/pgo-embed-bc-lto/rmake.rs b/tests/run-make/pgo-embed-bc-lto/rmake.rs new file mode 100644 index 00000000000..b7eba0c68e3 --- /dev/null +++ b/tests/run-make/pgo-embed-bc-lto/rmake.rs @@ -0,0 +1,67 @@ +// This test case verifies that we successfully complete an LTO build with PGO +// using the embedded bitcode. +// It also ensures that the generated IR correctly includes the call results. + +//@ needs-profiler-runtime +//@ ignore-cross-compile + +use std::path::Path; + +use run_make_support::{ + has_extension, has_prefix, llvm_filecheck, llvm_profdata, rfs, run, rustc, shallow_find_files, +}; + +fn run_test(cg_units: usize) { + let path_prof_data_dir = Path::new("prof_data_dir"); + if path_prof_data_dir.exists() { + rfs::remove_dir_all(path_prof_data_dir); + } + rfs::create_dir_all(&path_prof_data_dir); + let path_merged_profdata = path_prof_data_dir.join("merged.profdata"); + rustc().input("opaque.rs").codegen_units(1).run(); + rustc() + .input("interesting.rs") + .profile_generate(&path_prof_data_dir) + .opt() + .crate_type("lib,cdylib") + .codegen_units(cg_units) + .run(); + rustc() + .input("main.rs") + .arg("-Clto=thin") + .opt() + .codegen_units(cg_units) + .profile_generate(&path_prof_data_dir) + .opt() + .run(); + run("main"); + llvm_profdata().merge().output(&path_merged_profdata).input(path_prof_data_dir).run(); + rustc() + .input("interesting.rs") + .profile_use(&path_merged_profdata) + .opt() + .crate_type("lib,cdylib") + .codegen_units(cg_units) + .emit("link") + .run(); + rustc() + .input("main.rs") + .arg("-Clto=thin") + .opt() + .codegen_units(cg_units) + .profile_use(&path_merged_profdata) + .emit("llvm-ir,link") + .opt() + .run(); + let files = shallow_find_files(".", |path| { + has_prefix(path, "main.interesting.interesting") && has_extension(path, "ll") + }); + assert_eq!(files.len(), 1); + let llvm_ir = &files[0]; + llvm_filecheck().patterns("interesting.rs").stdin_buf(rfs::read(llvm_ir)).run(); +} + +fn main() { + run_test(1); + run_test(16); +} diff --git a/tests/run-make/raw-dylib-elf-verbatim-absolute/main.rs b/tests/run-make/raw-dylib-elf-verbatim-absolute/main.rs new file mode 100644 index 00000000000..75bd7747f4f --- /dev/null +++ b/tests/run-make/raw-dylib-elf-verbatim-absolute/main.rs @@ -0,0 +1,11 @@ +#![feature(raw_dylib_elf)] +#![allow(incomplete_features)] + +#[link(name = "/absolute-path/liblibrary.so.1", kind = "raw-dylib", modifiers = "+verbatim")] +unsafe extern "C" { + safe fn this_is_a_library_function() -> core::ffi::c_int; +} + +fn main() { + println!("{}", this_is_a_library_function()) +} diff --git a/tests/run-make/raw-dylib-elf-verbatim-absolute/output.txt b/tests/run-make/raw-dylib-elf-verbatim-absolute/output.txt new file mode 100644 index 00000000000..d81cc0710eb --- /dev/null +++ b/tests/run-make/raw-dylib-elf-verbatim-absolute/output.txt @@ -0,0 +1 @@ +42 diff --git a/tests/run-make/raw-dylib-elf-verbatim-absolute/rmake.rs b/tests/run-make/raw-dylib-elf-verbatim-absolute/rmake.rs new file mode 100644 index 00000000000..d2a9b0477e5 --- /dev/null +++ b/tests/run-make/raw-dylib-elf-verbatim-absolute/rmake.rs @@ -0,0 +1,20 @@ +//@ only-elf +//@ ignore-cross-compile: Runs a binary. +//@ needs-dynamic-linking +// FIXME(raw_dylib_elf): Debug the failures on other targets. +//@ only-gnu +//@ only-x86_64 + +//! Ensure ELF raw-dylib is able to link against a non-existent verbatim absolute path +//! by embedding the absolute path in the DT_SONAME and passing a different path for +//! the linker for the stub. + +use run_make_support::{build_native_dynamic_lib, cwd, diff, rfs, run, rustc}; + +fn main() { + // We compile the binary without having the library present. + // The verbatim library name is an absolute path. + rustc().crate_type("bin").input("main.rs").run(); + + // FIXME(raw_dylib_elf): Read the NEEDED of the library to ensure it's the absolute path. +} diff --git a/tests/run-make/raw-dylib-elf-verbatim/library.c b/tests/run-make/raw-dylib-elf-verbatim/library.c new file mode 100644 index 00000000000..2e3a95b7ede --- /dev/null +++ b/tests/run-make/raw-dylib-elf-verbatim/library.c @@ -0,0 +1,3 @@ +int this_is_a_library_function() { + return 42; +} diff --git a/tests/run-make/raw-dylib-elf-verbatim/main.rs b/tests/run-make/raw-dylib-elf-verbatim/main.rs new file mode 100644 index 00000000000..044b7400a84 --- /dev/null +++ b/tests/run-make/raw-dylib-elf-verbatim/main.rs @@ -0,0 +1,11 @@ +#![feature(raw_dylib_elf)] +#![allow(incomplete_features)] + +#[link(name = "liblibrary.so.1", kind = "raw-dylib", modifiers = "+verbatim")] +unsafe extern "C" { + safe fn this_is_a_library_function() -> core::ffi::c_int; +} + +fn main() { + println!("{}", this_is_a_library_function()) +} diff --git a/tests/run-make/raw-dylib-elf-verbatim/output.txt b/tests/run-make/raw-dylib-elf-verbatim/output.txt new file mode 100644 index 00000000000..d81cc0710eb --- /dev/null +++ b/tests/run-make/raw-dylib-elf-verbatim/output.txt @@ -0,0 +1 @@ +42 diff --git a/tests/run-make/raw-dylib-elf-verbatim/rmake.rs b/tests/run-make/raw-dylib-elf-verbatim/rmake.rs new file mode 100644 index 00000000000..319534b24c8 --- /dev/null +++ b/tests/run-make/raw-dylib-elf-verbatim/rmake.rs @@ -0,0 +1,31 @@ +//@ only-elf +//@ ignore-cross-compile: Runs a binary. +//@ needs-dynamic-linking +// FIXME(raw_dylib_elf): Debug the failures on other targets. +//@ only-gnu +//@ only-x86_64 + +//! Ensure ELF raw-dylib is able to link against the verbatim versioned library +//! without it being present, and then be executed against this library. + +use run_make_support::{build_native_dynamic_lib, cwd, diff, rfs, run, rustc}; + +fn main() { + // We compile the binary without having the library present. + // We also set the rpath to the current directory so we can pick up the library at runtime. + rustc() + .crate_type("bin") + .input("main.rs") + .arg(&format!("-Wl,-rpath={}", cwd().display())) + .run(); + + // Now, *after* building the binary, we build the library... + build_native_dynamic_lib("library"); + // ... rename it to have the versioned library name... + rfs::rename("liblibrary.so", "liblibrary.so.1"); + + // ... and run with this library, ensuring it was linked correctly at runtime. + let output = run("main").stdout_utf8(); + + diff().expected_file("output.txt").actual_text("actual", output).run(); +} diff --git a/tests/run-make/raw-dylib-elf/library.c b/tests/run-make/raw-dylib-elf/library.c new file mode 100644 index 00000000000..2e3a95b7ede --- /dev/null +++ b/tests/run-make/raw-dylib-elf/library.c @@ -0,0 +1,3 @@ +int this_is_a_library_function() { + return 42; +} diff --git a/tests/run-make/raw-dylib-elf/main.rs b/tests/run-make/raw-dylib-elf/main.rs new file mode 100644 index 00000000000..3be944d2951 --- /dev/null +++ b/tests/run-make/raw-dylib-elf/main.rs @@ -0,0 +1,11 @@ +#![feature(raw_dylib_elf)] +#![allow(incomplete_features)] + +#[link(name = "library", kind = "raw-dylib")] +unsafe extern "C" { + safe fn this_is_a_library_function() -> core::ffi::c_int; +} + +fn main() { + println!("{}", this_is_a_library_function()) +} diff --git a/tests/run-make/raw-dylib-elf/output.txt b/tests/run-make/raw-dylib-elf/output.txt new file mode 100644 index 00000000000..d81cc0710eb --- /dev/null +++ b/tests/run-make/raw-dylib-elf/output.txt @@ -0,0 +1 @@ +42 diff --git a/tests/run-make/raw-dylib-elf/rmake.rs b/tests/run-make/raw-dylib-elf/rmake.rs new file mode 100644 index 00000000000..59f901ac1ed --- /dev/null +++ b/tests/run-make/raw-dylib-elf/rmake.rs @@ -0,0 +1,29 @@ +//@ only-elf +//@ ignore-cross-compile: Runs a binary. +//@ needs-dynamic-linking +// FIXME(raw_dylib_elf): Debug the failures on other targets. +//@ only-gnu +//@ only-x86_64 + +//! Ensure ELF raw-dylib is able to link the binary without having the library present, +//! and then successfully run against the real library. + +use run_make_support::{build_native_dynamic_lib, cwd, diff, run, rustc}; + +fn main() { + // We compile the binary without having the library present. + // We also set the rpath to the current directory so we can pick up the library at runtime. + rustc() + .crate_type("bin") + .input("main.rs") + .arg(&format!("-Wl,-rpath={}", cwd().display())) + .run(); + + // Now, *after* building the binary, we build the library... + build_native_dynamic_lib("library"); + + // ... and run with this library, ensuring it was linked correctly at runtime. + let output = run("main").stdout_utf8(); + + diff().expected_file("output.txt").actual_text("actual", output).run(); +} diff --git a/tests/run-make/repr128-dwarf/main.rs b/tests/run-make/repr128-dwarf/main.rs index 57923a8386d..9842ab4a342 100644 --- a/tests/run-make/repr128-dwarf/main.rs +++ b/tests/run-make/repr128-dwarf/main.rs @@ -19,8 +19,33 @@ pub enum I128Enum { I128D = i128::MAX.to_le(), } +#[cfg(not(old_llvm))] +#[repr(u128)] +pub enum U128VariantEnum { + VariantU128A(u8) = 0_u128.to_le(), + VariantU128B = 1_u128.to_le(), + VariantU128C = (u64::MAX as u128 + 1).to_le(), + VariantU128D = u128::MAX.to_le(), +} + +#[cfg(not(old_llvm))] +#[repr(i128)] +pub enum I128VariantEnum { + VariantI128A(u8) = 0_i128.to_le(), + VariantI128B = (-1_i128).to_le(), + VariantI128C = i128::MIN.to_le(), + VariantI128D = i128::MAX.to_le(), +} + pub fn f(_: U128Enum, _: I128Enum) {} +#[cfg(not(old_llvm))] +pub fn g(_: U128VariantEnum, _: I128VariantEnum) {} + fn main() { f(U128Enum::U128A, I128Enum::I128A); + #[cfg(not(old_llvm))] + { + g(U128VariantEnum::VariantU128A(1), I128VariantEnum::VariantI128A(2)); + } } diff --git a/tests/run-make/repr128-dwarf/rmake.rs b/tests/run-make/repr128-dwarf/rmake.rs index 2fd54c186b9..15eb186717f 100644 --- a/tests/run-make/repr128-dwarf/rmake.rs +++ b/tests/run-make/repr128-dwarf/rmake.rs @@ -5,13 +5,32 @@ use std::collections::HashMap; use std::path::PathBuf; use std::rc::Rc; +use gimli::read::DebuggingInformationEntry; use gimli::{AttributeValue, EndianRcSlice, Reader, RunTimeEndian}; use object::{Object, ObjectSection}; use run_make_support::{gimli, object, rfs, rustc}; fn main() { + // Before LLVM 20, 128-bit enums with variants didn't emit debuginfo correctly. + // This check can be removed once Rust no longer supports LLVM 18 and 19. + let llvm_version = rustc() + .verbose() + .arg("--version") + .run() + .stdout_utf8() + .lines() + .filter_map(|line| line.strip_prefix("LLVM version: ")) + .map(|version| version.split(".").next().unwrap().parse::<u32>().unwrap()) + .next() + .unwrap(); + let is_old_llvm = llvm_version < 20; + let output = PathBuf::from("repr128"); - rustc().input("main.rs").output(&output).arg("-Cdebuginfo=2").run(); + let mut rustc = rustc(); + if is_old_llvm { + rustc.cfg("old_llvm"); + } + rustc.input("main.rs").output(&output).arg("-Cdebuginfo=2").run(); // Mach-O uses packed debug info let dsym_location = output .with_extension("dSYM") @@ -29,7 +48,8 @@ fn main() { }) .unwrap(); let mut iter = dwarf.units(); - let mut still_to_find = HashMap::from([ + + let mut enumerators_to_find = HashMap::from([ ("U128A", 0_u128), ("U128B", 1_u128), ("U128C", u64::MAX as u128 + 1), @@ -39,35 +59,88 @@ fn main() { ("I128C", i128::MIN as u128), ("I128D", i128::MAX as u128), ]); + let mut variants_to_find = HashMap::from([ + ("VariantU128A", 0_u128), + ("VariantU128B", 1_u128), + ("VariantU128C", u64::MAX as u128 + 1), + ("VariantU128D", u128::MAX), + ("VariantI128A", 0_i128 as u128), + ("VariantI128B", (-1_i128) as u128), + ("VariantI128C", i128::MIN as u128), + ("VariantI128D", i128::MAX as u128), + ]); + while let Some(header) = iter.next().unwrap() { let unit = dwarf.unit(header).unwrap(); let mut cursor = unit.entries(); + + let get_name = |entry: &DebuggingInformationEntry<'_, '_, _>| { + let name = dwarf + .attr_string( + &unit, + entry.attr(gimli::constants::DW_AT_name).unwrap().unwrap().value(), + ) + .unwrap(); + name.to_string().unwrap().to_string() + }; + while let Some((_, entry)) = cursor.next_dfs().unwrap() { - if entry.tag() == gimli::constants::DW_TAG_enumerator { - let name = dwarf - .attr_string( - &unit, - entry.attr(gimli::constants::DW_AT_name).unwrap().unwrap().value(), - ) - .unwrap(); - let name = name.to_string().unwrap(); - if let Some(expected) = still_to_find.remove(name.as_ref()) { - match entry.attr(gimli::constants::DW_AT_const_value).unwrap().unwrap().value() + match entry.tag() { + gimli::constants::DW_TAG_variant if !is_old_llvm => { + let value = match entry + .attr(gimli::constants::DW_AT_discr_value) + .unwrap() + .unwrap() + .value() { - AttributeValue::Block(value) => { - assert_eq!( - value.to_slice().unwrap(), - expected.to_le_bytes().as_slice(), - "{name}" - ); + AttributeValue::Block(value) => value.to_slice().unwrap().to_vec(), + value => panic!("unexpected DW_AT_discr_value of {value:?}"), + }; + // The `DW_TAG_member` that is a child of `DW_TAG_variant` will contain the + // variant's name. + let Some((1, child_entry)) = cursor.next_dfs().unwrap() else { + panic!("Missing child of DW_TAG_variant"); + }; + assert_eq!(child_entry.tag(), gimli::constants::DW_TAG_member); + let name = get_name(child_entry); + if let Some(expected) = variants_to_find.remove(name.as_str()) { + // This test uses LE byte order is used for consistent values across + // architectures. + assert_eq!(value.as_slice(), expected.to_le_bytes().as_slice(), "{name}"); + } + } + + gimli::constants::DW_TAG_enumerator => { + let name = get_name(entry); + if let Some(expected) = enumerators_to_find.remove(name.as_str()) { + match entry + .attr(gimli::constants::DW_AT_const_value) + .unwrap() + .unwrap() + .value() + { + AttributeValue::Block(value) => { + // This test uses LE byte order is used for consistent values across + // architectures. + assert_eq!( + value.to_slice().unwrap(), + expected.to_le_bytes().as_slice(), + "{name}" + ); + } + value => panic!("{name}: unexpected DW_AT_const_value of {value:?}"), } - value => panic!("{name}: unexpected DW_AT_const_value of {value:?}"), } } + + _ => {} } } } - if !still_to_find.is_empty() { - panic!("Didn't find debug entries for {still_to_find:?}"); + if !enumerators_to_find.is_empty() { + panic!("Didn't find debug enumerator entries for {enumerators_to_find:?}"); + } + if !is_old_llvm && !variants_to_find.is_empty() { + panic!("Didn't find debug variant entries for {variants_to_find:?}"); } } diff --git a/tests/run-make/reproducible-build/linker.rs b/tests/run-make/reproducible-build/linker.rs index ab3b4049cc3..2f57d9f9be9 100644 --- a/tests/run-make/reproducible-build/linker.rs +++ b/tests/run-make/reproducible-build/linker.rs @@ -17,6 +17,8 @@ fn main() { for arg in env::args().skip(1) { let path = Path::new(&arg); if !path.is_file() { + // This directory is produced during linking in a temporary directory (ELF only). + let arg = if arg.ends_with("/raw-dylibs") { "/raw-dylibs" } else { &*arg }; out.push_str(&arg); out.push_str("\n"); continue; diff --git a/tests/run-make/rustc-help/help-v.stdout b/tests/run-make/rustc-help/help-v.stdout index 382b1c96682..c8ea09ee2c8 100644 --- a/tests/run-make/rustc-help/help-v.stdout +++ b/tests/run-make/rustc-help/help-v.stdout @@ -29,7 +29,7 @@ Options: --emit [asm|llvm-bc|llvm-ir|obj|metadata|link|dep-info|mir] Comma separated list of types of output for the compiler to emit - --print [crate-name|file-names|sysroot|target-libdir|cfg|check-cfg|calling-conventions|target-list|target-cpus|target-features|relocation-models|code-models|tls-models|target-spec-json|all-target-specs-json|native-static-libs|stack-protector-strategies|link-args|deployment-target] + --print [all-target-specs-json|calling-conventions|cfg|check-cfg|code-models|crate-name|deployment-target|file-names|host-tuple|link-args|native-static-libs|relocation-models|split-debuginfo|stack-protector-strategies|sysroot|target-cpus|target-features|target-libdir|target-list|target-spec-json|tls-models] Compiler information to print on stdout -g Equivalent to -C debuginfo=2 -O Equivalent to -C opt-level=3 diff --git a/tests/run-make/rustc-help/help.stdout b/tests/run-make/rustc-help/help.stdout index 08bb7f85098..434e71e901e 100644 --- a/tests/run-make/rustc-help/help.stdout +++ b/tests/run-make/rustc-help/help.stdout @@ -29,7 +29,7 @@ Options: --emit [asm|llvm-bc|llvm-ir|obj|metadata|link|dep-info|mir] Comma separated list of types of output for the compiler to emit - --print [crate-name|file-names|sysroot|target-libdir|cfg|check-cfg|calling-conventions|target-list|target-cpus|target-features|relocation-models|code-models|tls-models|target-spec-json|all-target-specs-json|native-static-libs|stack-protector-strategies|link-args|deployment-target] + --print [all-target-specs-json|calling-conventions|cfg|check-cfg|code-models|crate-name|deployment-target|file-names|host-tuple|link-args|native-static-libs|relocation-models|split-debuginfo|stack-protector-strategies|sysroot|target-cpus|target-features|target-libdir|target-list|target-spec-json|tls-models] Compiler information to print on stdout -g Equivalent to -C debuginfo=2 -O Equivalent to -C opt-level=3 diff --git a/tests/run-make/rustdoc-default-output/output-default.stdout b/tests/run-make/rustdoc-default-output/output-default.stdout index c1b246e849c..01f470f6e16 100644 --- a/tests/run-make/rustdoc-default-output/output-default.stdout +++ b/tests/run-make/rustdoc-default-output/output-default.stdout @@ -153,7 +153,7 @@ Options: --generate-redirect-map Generate JSON file at the top level instead of generating HTML redirection files - --emit [unversioned-shared-resources,toolchain-shared-resources,invocation-specific] + --emit [unversioned-shared-resources,toolchain-shared-resources,invocation-specific,dep-info] Comma separated list of types of output for rustdoc to emit --no-run Compile doctests without running them diff --git a/tests/run-make/rustdoc-default-output/rmake.rs b/tests/run-make/rustdoc-default-output/rmake.rs index 06720445a35..5f9c501e528 100644 --- a/tests/run-make/rustdoc-default-output/rmake.rs +++ b/tests/run-make/rustdoc-default-output/rmake.rs @@ -3,10 +3,10 @@ // ensures the output of rustdoc's help menu is as expected. // See https://github.com/rust-lang/rust/issues/88756 -use run_make_support::{bare_rustdoc, diff}; +use run_make_support::{diff, rustdoc}; fn main() { - let out = bare_rustdoc().run().stdout_utf8(); + let out = rustdoc().run().stdout_utf8(); diff() .expected_file("output-default.stdout") .actual_text("actual", out) diff --git a/tests/run-make/rustdoc-dep-info/bar.rs b/tests/run-make/rustdoc-dep-info/bar.rs new file mode 100644 index 00000000000..76b8dcd05c8 --- /dev/null +++ b/tests/run-make/rustdoc-dep-info/bar.rs @@ -0,0 +1 @@ +include!("foo.rs"); diff --git a/tests/run-make/rustdoc-dep-info/doc.md b/tests/run-make/rustdoc-dep-info/doc.md new file mode 100644 index 00000000000..6a4238fc8b6 --- /dev/null +++ b/tests/run-make/rustdoc-dep-info/doc.md @@ -0,0 +1 @@ +blablabla diff --git a/tests/run-make/rustdoc-dep-info/foo.rs b/tests/run-make/rustdoc-dep-info/foo.rs new file mode 100644 index 00000000000..b76b4321d62 --- /dev/null +++ b/tests/run-make/rustdoc-dep-info/foo.rs @@ -0,0 +1 @@ +pub fn foo() {} diff --git a/tests/run-make/rustdoc-dep-info/lib.rs b/tests/run-make/rustdoc-dep-info/lib.rs new file mode 100644 index 00000000000..1f003f79b1f --- /dev/null +++ b/tests/run-make/rustdoc-dep-info/lib.rs @@ -0,0 +1,6 @@ +#![crate_name = "foo"] + +#[cfg_attr(doc, doc = include_str!("doc.md"))] +pub struct Bar; + +mod bar; diff --git a/tests/run-make/rustdoc-dep-info/rmake.rs b/tests/run-make/rustdoc-dep-info/rmake.rs new file mode 100644 index 00000000000..6902bfc21ca --- /dev/null +++ b/tests/run-make/rustdoc-dep-info/rmake.rs @@ -0,0 +1,21 @@ +// This is a simple smoke test for rustdoc's `--emit dep-info` feature. It prints out +// information about dependencies in a Makefile-compatible format, as a `.d` file. + +use run_make_support::assertion_helpers::assert_contains; +use run_make_support::{path, rfs, rustdoc}; + +fn main() { + // We're only emitting dep info, so we shouldn't be running static analysis to + // figure out that this program is erroneous. + rustdoc().input("lib.rs").arg("-Zunstable-options").emit("dep-info").run(); + + let content = rfs::read_to_string("foo.d"); + assert_contains(&content, "lib.rs:"); + assert_contains(&content, "foo.rs:"); + assert_contains(&content, "bar.rs:"); + assert_contains(&content, "doc.md:"); + + // Now we check that we can provide a file name to the `dep-info` argument. + rustdoc().input("lib.rs").arg("-Zunstable-options").emit("dep-info=bla.d").run(); + assert!(path("bla.d").exists()); +} diff --git a/tests/run-make/rustdoc-scrape-examples-macros/src/lib.rs b/tests/run-make/rustdoc-scrape-examples-macros/src/lib.rs index 26ab1390a49..3ec2cf66fa3 100644 --- a/tests/run-make/rustdoc-scrape-examples-macros/src/lib.rs +++ b/tests/run-make/rustdoc-scrape-examples-macros/src/lib.rs @@ -1,8 +1,8 @@ // Scraped example should only include line numbers for items b and c in ex.rs -// @!has foobar/fn.f.html '//*[@class="src-line-numbers"]' '14' -// @has foobar/fn.f.html '//*[@class="src-line-numbers"]' '15' -// @has foobar/fn.f.html '//*[@class="src-line-numbers"]' '21' -// @!has foobar/fn.f.html '//*[@class="src-line-numbers"]' '22' +//@ !has foobar/fn.f.html '//span[@data-nosnippet]' '14' +//@ has foobar/fn.f.html '//span[@data-nosnippet]' '15' +//@ has foobar/fn.f.html '//span[@data-nosnippet]' '21' +//@ !has foobar/fn.f.html '//span[@data-nosnippet]' '22' pub fn f() {} diff --git a/tests/run-make/rustdoc-scrape-examples-multiple/src/lib.rs b/tests/run-make/rustdoc-scrape-examples-multiple/src/lib.rs index bdfeda92d79..25600915f5f 100644 --- a/tests/run-make/rustdoc-scrape-examples-multiple/src/lib.rs +++ b/tests/run-make/rustdoc-scrape-examples-multiple/src/lib.rs @@ -1,6 +1,5 @@ -// @has foobar/fn.ok.html '//*[@class="docblock scraped-example-list"]//*[@class="prev"]' '' -// @has foobar/fn.ok.html '//*[@class="more-scraped-examples"]' '' -// @has src/ex/ex.rs.html -// @has foobar/fn.ok.html '//a[@href="../src/ex/ex.rs.html#2"]' '' +//@ has foobar/fn.ok.html '//*[@class="more-scraped-examples"]' '' +//@ has src/ex/ex.rs.html +//@ has foobar/fn.ok.html '//a[@href="../src/ex/ex.rs.html#2"]' '' pub fn ok() {} diff --git a/tests/run-make/rustdoc-scrape-examples-ordering/src/lib.rs b/tests/run-make/rustdoc-scrape-examples-ordering/src/lib.rs index c53c987a7cb..c957263c048 100644 --- a/tests/run-make/rustdoc-scrape-examples-ordering/src/lib.rs +++ b/tests/run-make/rustdoc-scrape-examples-ordering/src/lib.rs @@ -1,6 +1,6 @@ -// @has foobar/fn.ok.html '//*[@class="docblock scraped-example-list"]' 'ex2' -// @has foobar/fn.ok.html '//*[@class="more-scraped-examples"]' 'ex1' -// @has foobar/fn.ok.html '//*[@class="highlight focus"]' 'ok' -// @has foobar/fn.ok.html '//*[@class="highlight"]' 'ok' +//@ has foobar/fn.ok.html '//*[@class="docblock scraped-example-list"]' 'ex2' +//@ has foobar/fn.ok.html '//*[@class="more-scraped-examples"]' 'ex1' +//@ has foobar/fn.ok.html '//*[@class="highlight focus"]' 'ok' +//@ has foobar/fn.ok.html '//*[@class="highlight"]' 'ok' pub fn ok(_x: i32) {} diff --git a/tests/run-make/rustdoc-scrape-examples-remap/src/lib.rs b/tests/run-make/rustdoc-scrape-examples-remap/src/lib.rs index f525a4270dd..e1dc4f91506 100644 --- a/tests/run-make/rustdoc-scrape-examples-remap/src/lib.rs +++ b/tests/run-make/rustdoc-scrape-examples-remap/src/lib.rs @@ -1,5 +1,5 @@ -// @has foobar/b/fn.foo.html '//*[@class="scraped-example expanded"]' 'ex.rs' -// @has foobar/c/fn.foo.html '//*[@class="scraped-example expanded"]' 'ex.rs' +//@ has foobar/b/fn.foo.html '//*[@class="scraped-example expanded"]' 'ex.rs' +//@ has foobar/c/fn.foo.html '//*[@class="scraped-example expanded"]' 'ex.rs' #[path = "a.rs"] pub mod b; diff --git a/tests/run-make/rustdoc-scrape-examples-test/src/lib.rs b/tests/run-make/rustdoc-scrape-examples-test/src/lib.rs index 22be1ad4101..93d56b7e972 100644 --- a/tests/run-make/rustdoc-scrape-examples-test/src/lib.rs +++ b/tests/run-make/rustdoc-scrape-examples-test/src/lib.rs @@ -1,3 +1,3 @@ -// @has foobar/fn.ok.html '//*[@class="docblock scraped-example-list"]' '' +//@ has foobar/fn.ok.html '//*[@class="docblock scraped-example-list"]' '' pub fn ok() {} diff --git a/tests/run-make/rustdoc-scrape-examples-whitespace/src/lib.rs b/tests/run-make/rustdoc-scrape-examples-whitespace/src/lib.rs index 28c34716c2f..8fc3a5e41d2 100644 --- a/tests/run-make/rustdoc-scrape-examples-whitespace/src/lib.rs +++ b/tests/run-make/rustdoc-scrape-examples-whitespace/src/lib.rs @@ -1,3 +1,3 @@ -// @has foobar/fn.ok.html '//*[@class="docblock scraped-example-list"]//code' ' ' +//@ has foobar/fn.ok.html '//*[@class="docblock scraped-example-list"]//code' ' ' pub fn ok() {} diff --git a/tests/run-make/rustdoc-themes/foo.rs b/tests/run-make/rustdoc-themes/foo.rs index 8b1e75b0ae1..555429b07df 100644 --- a/tests/run-make/rustdoc-themes/foo.rs +++ b/tests/run-make/rustdoc-themes/foo.rs @@ -1,4 +1,4 @@ -// @has test.css -// @has foo/struct.Foo.html -// @has - '//*[@name="rustdoc-vars"]/@data-themes' 'test' +//@ has test.css +//@ has foo/struct.Foo.html +//@ has - '//*[@name="rustdoc-vars"]/@data-themes' 'test' pub struct Foo; diff --git a/tests/run-make/rustdoc-with-out-dir-option/src/lib.rs b/tests/run-make/rustdoc-with-out-dir-option/src/lib.rs index 044bb6acb19..98753560d3a 100644 --- a/tests/run-make/rustdoc-with-out-dir-option/src/lib.rs +++ b/tests/run-make/rustdoc-with-out-dir-option/src/lib.rs @@ -1,2 +1,2 @@ -// @has foobar/fn.ok.html +//@ has foobar/fn.ok.html pub fn ok() {} diff --git a/tests/run-make/rustdoc-with-output-option/src/lib.rs b/tests/run-make/rustdoc-with-output-option/src/lib.rs index 044bb6acb19..98753560d3a 100644 --- a/tests/run-make/rustdoc-with-output-option/src/lib.rs +++ b/tests/run-make/rustdoc-with-output-option/src/lib.rs @@ -1,2 +1,2 @@ -// @has foobar/fn.ok.html +//@ has foobar/fn.ok.html pub fn ok() {} diff --git a/tests/run-make/rustdoc-with-short-out-dir-option/src/lib.rs b/tests/run-make/rustdoc-with-short-out-dir-option/src/lib.rs index 044bb6acb19..98753560d3a 100644 --- a/tests/run-make/rustdoc-with-short-out-dir-option/src/lib.rs +++ b/tests/run-make/rustdoc-with-short-out-dir-option/src/lib.rs @@ -1,2 +1,2 @@ -// @has foobar/fn.ok.html +//@ has foobar/fn.ok.html pub fn ok() {} diff --git a/tests/run-make/staticlib-broken-bitcode/rmake.rs b/tests/run-make/staticlib-broken-bitcode/rmake.rs new file mode 100644 index 00000000000..17d17c1f0f5 --- /dev/null +++ b/tests/run-make/staticlib-broken-bitcode/rmake.rs @@ -0,0 +1,23 @@ +// Regression test for https://github.com/rust-lang/rust/issues/128955#issuecomment-2657811196 +// which checks that rustc can read an archive containing LLVM bitcode with a +// newer version from the one rustc links against. +use run_make_support::{llvm_ar, path, rfs, rustc, static_lib_name}; + +fn main() { + rfs::create_dir("archive"); + + let mut bitcode = b"BC\xC0\xDE".to_vec(); + bitcode.extend(std::iter::repeat(b'a').take(50)); + rfs::write("archive/invalid_bitcode.o", &bitcode); + + llvm_ar() + .arg("rcuS") // like obj_to_ar() except skips creating a symbol table + .output_input( + path("archive").join(static_lib_name("thin_archive")), + "archive/invalid_bitcode.o", + ) + .run(); + + // Build an rlib which includes the members of this thin archive + rustc().input("rust_lib.rs").library_search_path("archive").run(); +} diff --git a/tests/run-make/staticlib-broken-bitcode/rust_lib.rs b/tests/run-make/staticlib-broken-bitcode/rust_lib.rs new file mode 100644 index 00000000000..c76b0f25433 --- /dev/null +++ b/tests/run-make/staticlib-broken-bitcode/rust_lib.rs @@ -0,0 +1,6 @@ +#![crate_type = "rlib"] + +#[link(name = "thin_archive", kind = "static")] +extern "C" { + pub fn simple_fn(); +} diff --git a/tests/run-make/tools.mk b/tests/run-make/tools.mk deleted file mode 100644 index b1e872a202a..00000000000 --- a/tests/run-make/tools.mk +++ /dev/null @@ -1,209 +0,0 @@ -# These deliberately use `=` and not `:=` so that client makefiles can -# augment HOST_RPATH_DIR / TARGET_RPATH_DIR. -HOST_RPATH_ENV = \ - $(LD_LIB_PATH_ENVVAR)="$(TMPDIR):$(HOST_RPATH_DIR):$($(LD_LIB_PATH_ENVVAR))" -TARGET_RPATH_ENV = \ - $(LD_LIB_PATH_ENVVAR)="$(TMPDIR):$(TARGET_RPATH_DIR):$($(LD_LIB_PATH_ENVVAR))" - -RUSTC_ORIGINAL := $(RUSTC) -BARE_RUSTC := $(HOST_RPATH_ENV) '$(RUSTC)' -BARE_RUSTDOC := $(HOST_RPATH_ENV) '$(RUSTDOC)' -RUSTC := $(BARE_RUSTC) --out-dir $(TMPDIR) -L $(TMPDIR) $(RUSTFLAGS) -Ainternal_features -RUSTDOC := $(BARE_RUSTDOC) -L $(TARGET_RPATH_DIR) -ifdef RUSTC_LINKER -RUSTC := $(RUSTC) -Clinker='$(RUSTC_LINKER)' -RUSTDOC := $(RUSTDOC) -Clinker='$(RUSTC_LINKER)' -endif -#CC := $(CC) -L $(TMPDIR) -HTMLDOCCK := '$(PYTHON)' '$(S)/src/etc/htmldocck.py' -CGREP := "$(S)/src/etc/cat-and-grep.sh" - -# diff with common flags for multi-platform diffs against text output -DIFF := diff -u --strip-trailing-cr - -# With RUSTC_TEST_OP you can elegantly support blessing of run-make tests. Do -# like this in a Makefile recipe: -# -# "$(TMPDIR)"/your-test > "$(TMPDIR)"/your-test.run.stdout -# $(RUSTC_TEST_OP) "$(TMPDIR)"/your-test.run.stdout your-test.run.stdout -# -# When running the test normally with -# -# ./x test tests/run-make/your-test -# -# the actual output will be diffed against the expected output. When running in -# bless-mode with -# -# ./x test --bless tests/run-make/your-test -# -# the actual output will be blessed as the expected output. -ifdef RUSTC_BLESS_TEST - RUSTC_TEST_OP = cp -else - RUSTC_TEST_OP = $(DIFF) -endif - -# Some of the Rust CI platforms use `/bin/dash` to run `shell` script in -# Makefiles. Other platforms, including many developer platforms, default to -# `/bin/bash`. (In many cases, `make` is actually using `/bin/sh`, but `sh` -# is configured to execute one or the other shell binary). `dash` features -# support only a small subset of `bash` features, so `dash` can be thought of as -# the lowest common denominator, and tests should be validated against `dash` -# whenever possible. Most developer platforms include `/bin/dash`, but to ensure -# tests still work when `/bin/dash`, if not available, this `SHELL` override is -# conditional: -ifndef IS_WINDOWS # dash interprets backslashes in executable paths incorrectly -ifneq (,$(wildcard /bin/dash)) -SHELL := /bin/dash -endif -endif - -# This is the name of the binary we will generate and run; use this -# e.g. for `$(CC) -o $(RUN_BINFILE)`. -RUN_BINFILE = $(TMPDIR)/$(1) - -# Invoke the generated binary on the remote machine if compiletest was -# configured to use a remote test device, otherwise run it on the current host. -ifdef REMOTE_TEST_CLIENT -# FIXME: if a test requires additional files, this will need to be changed to -# also push them (by changing the 0 to the number of additional files, and -# providing the path of the additional files as the last arguments). -EXECUTE = $(REMOTE_TEST_CLIENT) run 0 $(RUN_BINFILE) -else -EXECUTE = $(RUN_BINFILE) -endif - -# RUN and FAIL are basic way we will invoke the generated binary. On -# non-windows platforms, they set the LD_LIBRARY_PATH environment -# variable before running the binary. - -RLIB_GLOB = lib$(1)*.rlib -BIN = $(1) - -UNAME = $(shell uname) - -ifeq ($(UNAME),Darwin) -RUN = $(TARGET_RPATH_ENV) $(EXECUTE) -FAIL = $(TARGET_RPATH_ENV) $(EXECUTE) && exit 1 || exit 0 -DYLIB_GLOB = lib$(1)*.dylib -DYLIB = $(TMPDIR)/lib$(1).dylib -STATICLIB = $(TMPDIR)/lib$(1).a -STATICLIB_GLOB = lib$(1)*.a -else -ifdef IS_WINDOWS -RUN = PATH="$(PATH):$(TARGET_RPATH_DIR)" $(EXECUTE) -FAIL = PATH="$(PATH):$(TARGET_RPATH_DIR)" $(EXECUTE) && exit 1 || exit 0 -DYLIB_GLOB = $(1)*.dll -DYLIB = $(TMPDIR)/$(1).dll -ifdef IS_MSVC -STATICLIB = $(TMPDIR)/$(1).lib -STATICLIB_GLOB = $(1)*.lib -else -IMPLIB = $(TMPDIR)/lib$(1).dll.a -STATICLIB = $(TMPDIR)/lib$(1).a -STATICLIB_GLOB = lib$(1)*.a -endif -BIN = $(1).exe -LLVM_FILECHECK := $(shell cygpath -u "$(LLVM_FILECHECK)") -else -RUN = $(TARGET_RPATH_ENV) $(EXECUTE) -FAIL = $(TARGET_RPATH_ENV) $(EXECUTE) && exit 1 || exit 0 -DYLIB_GLOB = lib$(1)*.so -DYLIB = $(TMPDIR)/lib$(1).so -STATICLIB = $(TMPDIR)/lib$(1).a -STATICLIB_GLOB = lib$(1)*.a -endif -endif - -ifdef IS_MSVC -COMPILE_OBJ = $(CC) -c -Fo:`cygpath -w $(1)` $(2) -COMPILE_OBJ_CXX = $(CXX) -EHs -c -Fo:`cygpath -w $(1)` $(2) -NATIVE_STATICLIB_FILE = $(1).lib -NATIVE_STATICLIB = $(TMPDIR)/$(call NATIVE_STATICLIB_FILE,$(1)) -OUT_EXE=-Fe:`cygpath -w $(TMPDIR)/$(call BIN,$(1))` \ - -Fo:`cygpath -w $(TMPDIR)/$(1).obj` -else -COMPILE_OBJ = $(CC) -v -c -o $(1) $(2) -COMPILE_OBJ_CXX = $(CXX) -c -o $(1) $(2) -NATIVE_STATICLIB_FILE = lib$(1).a -NATIVE_STATICLIB = $(call STATICLIB,$(1)) -OUT_EXE=-o $(TMPDIR)/$(1) -endif - - -# Extra flags needed to compile a working executable with the standard library -ifdef IS_WINDOWS -ifdef IS_MSVC - EXTRACFLAGS := ws2_32.lib userenv.lib advapi32.lib bcrypt.lib ntdll.lib synchronization.lib -else - EXTRACFLAGS := -lws2_32 -luserenv -lbcrypt -lntdll -lsynchronization - EXTRACXXFLAGS := -lstdc++ - # So this is a bit hacky: we can't use the DLL version of libstdc++ because - # it pulls in the DLL version of libgcc, which means that we end up with 2 - # instances of the DW2 unwinding implementation. This is a problem on - # i686-pc-windows-gnu because each module (DLL/EXE) needs to register its - # unwind information with the unwinding implementation, and libstdc++'s - # __cxa_throw won't see the unwinding info we registered with our statically - # linked libgcc. - # - # Now, simply statically linking libstdc++ would fix this problem, except - # that it is compiled with the expectation that pthreads is dynamically - # linked as a DLL and will fail to link with a statically linked libpthread. - # - # So we end up with the following hack: we link use static:-bundle to only - # link the parts of libstdc++ that we actually use, which doesn't include - # the dependency on the pthreads DLL. - EXTRARSCXXFLAGS := -l static:-bundle=stdc++ -endif -else -ifeq ($(UNAME),Darwin) - EXTRACFLAGS := -lresolv - EXTRACXXFLAGS := -lc++ - EXTRARSCXXFLAGS := -lc++ -else -ifeq ($(UNAME),FreeBSD) - EXTRACFLAGS := -lm -lpthread -lgcc_s -else -ifeq ($(UNAME),SunOS) - EXTRACFLAGS := -lm -lpthread -lposix4 -lsocket -lresolv -else -ifeq ($(UNAME),OpenBSD) - EXTRACFLAGS := -lm -lpthread -lc++abi - RUSTC := $(RUSTC) -C linker="$(word 1,$(CC:ccache=))" -else - EXTRACFLAGS := -lm -lrt -ldl -lpthread - EXTRACXXFLAGS := -lstdc++ - EXTRARSCXXFLAGS := -lstdc++ -endif -endif -endif -endif -endif - -REMOVE_DYLIBS = rm $(TMPDIR)/$(call DYLIB_GLOB,$(1)) -REMOVE_RLIBS = rm $(TMPDIR)/$(call RLIB_GLOB,$(1)) - -%.a: %.o - $(AR) crus $@ $< -ifdef IS_MSVC -%.lib: lib%.o - $(MSVC_LIB) -out:`cygpath -w $@` $< -else -%.lib: lib%.o - $(AR) crus $@ $< -endif -%.dylib: %.o - $(CC) -dynamiclib -Wl,-dylib -o $@ $< -%.so: %.o - $(CC) -o $@ $< -shared - -ifdef IS_MSVC -%.dll: lib%.o - $(CC) $< -link -dll -out:`cygpath -w $@` -else -%.dll: lib%.o - $(CC) -o $@ $< -shared -Wl,--out-implib=$@.a -endif - -$(TMPDIR)/lib%.o: %.c - $(call COMPILE_OBJ,$@,$<) diff --git a/tests/run-make/unstable-feature-usage-metrics/rmake.rs b/tests/run-make/unstable-feature-usage-metrics/rmake.rs index 1397548a6fc..2183e28e89a 100644 --- a/tests/run-make/unstable-feature-usage-metrics/rmake.rs +++ b/tests/run-make/unstable-feature-usage-metrics/rmake.rs @@ -58,12 +58,17 @@ fn test_metrics_dump() { ); let message = rfs::read_to_string(json_path); - let parsed: serde_json::Value = + let mut parsed: serde_json::Value = serde_json::from_str(&message).expect("metrics should be dumped as json"); + // remove timestamps + assert!(parsed["lib_features"][0]["timestamp"].is_number()); + assert!(parsed["lang_features"][0]["timestamp"].is_number()); + parsed["lib_features"][0]["timestamp"] = serde_json::json!(null); + parsed["lang_features"][0]["timestamp"] = serde_json::json!(null); let expected = serde_json::json!( { - "lib_features":[{"symbol":"ascii_char"}], - "lang_features":[{"symbol":"box_patterns","since":null}] + "lib_features":[{"symbol":"ascii_char", "timestamp":null}], + "lang_features":[{"symbol":"box_patterns","since":null, "timestamp":null}] } ); diff --git a/tests/run-make/version-verbose-commit-hash/rmake.rs b/tests/run-make/version-verbose-commit-hash/rmake.rs index 733c0e2cdb1..ae8dda38ab4 100644 --- a/tests/run-make/version-verbose-commit-hash/rmake.rs +++ b/tests/run-make/version-verbose-commit-hash/rmake.rs @@ -5,13 +5,13 @@ //@ needs-git-hash -use run_make_support::{bare_rustc, bare_rustdoc, regex}; +use run_make_support::{bare_rustc, regex, rustdoc}; fn main() { let out_rustc = bare_rustc().arg("--version").arg("--verbose").run().stdout_utf8().to_lowercase(); let out_rustdoc = - bare_rustdoc().arg("--version").arg("--verbose").run().stdout_utf8().to_lowercase(); + rustdoc().arg("--version").arg("--verbose").run().stdout_utf8().to_lowercase(); let re = regex::Regex::new(r#"commit-hash: [0-9a-f]{40}\ncommit-date: [0-9]{4}-[0-9]{2}-[0-9]{2}"#) .unwrap(); diff --git a/tests/rustdoc-gui/code-example-buttons.goml b/tests/rustdoc-gui/code-example-buttons.goml index c62683b45da..b96f6ddcc37 100644 --- a/tests/rustdoc-gui/code-example-buttons.goml +++ b/tests/rustdoc-gui/code-example-buttons.goml @@ -26,6 +26,8 @@ click: ".example-wrap .copy-button" move-cursor-to: ".search-input" assert-count: (".example-wrap:not(:hover) .button-holder.keep-visible", 0) assert-css: (".example-wrap .copy-button", { "visibility": "hidden" }) +// Since we clicked on the copy button, the clipboard content should have been updated. +assert-clipboard: 'println!("nothing fancy");\nprintln!("but with two lines!");' define-function: ( "check-buttons", diff --git a/tests/rustdoc-gui/copy-path.goml b/tests/rustdoc-gui/copy-path.goml index dc05b96f7ae..e8766688f8d 100644 --- a/tests/rustdoc-gui/copy-path.goml +++ b/tests/rustdoc-gui/copy-path.goml @@ -1,12 +1,17 @@ // Checks that the "copy path" button is not triggering JS error and its display -// isn't broken. -go-to: "file://" + |DOC_PATH| + "/test_docs/fn.foo.html" +// isn't broken and the copied path is as expected. +go-to: "file://" + |DOC_PATH| + "/test_docs/foreign_impl_order/trait.Foo.html" + +// We ensure that the clipboard is empty. +assert-clipboard: "" // First we store the size of the button before we click on it. store-size: ("#copy-path", {"width": width, "height": height}) click: "#copy-path" // We wait for the new text to appear. wait-for: "#copy-path.clicked" +// We check that the clipboard value is the expected one. +assert-clipboard: "test_docs::foreign_impl_order::Foo" // We check that the size didn't change. assert-size: ("#copy-path.clicked", {"width": |width|, "height": |height|}) // We wait for the button to turn back to its original state. diff --git a/tests/rustdoc-gui/docblock-code-block-line-number.goml b/tests/rustdoc-gui/docblock-code-block-line-number.goml index 032746a6bdf..97273ceb195 100644 --- a/tests/rustdoc-gui/docblock-code-block-line-number.goml +++ b/tests/rustdoc-gui/docblock-code-block-line-number.goml @@ -21,7 +21,7 @@ assert-css: ( set-local-storage: {"rustdoc-line-numbers": "true"} reload: // We wait for the line numbers to be added into the DOM by the JS... -wait-for: "pre.example-line-numbers" +wait-for: ".digits-1 pre" // Otherwise, we can't check text color show-text: true @@ -35,30 +35,21 @@ define-function: ( call-function: ("switch-theme", {"theme": |theme|}) // If the test didn't fail, it means that it was found! assert-css: ( - "pre.example-line-numbers", + ".digits-1 pre [data-nosnippet]", { "color": |color|, - "margin": "0px", - "padding-top": "14px", - "padding-bottom": "14px", - "padding-left": "8px", - "padding-right": "2px", + "margin-top": "0px", + "margin-bottom": "0px", + "margin-left": "0px", + "margin-right": "20px", + "padding-top": "0px", + "padding-bottom": "0px", + "padding-left": "4px", + "padding-right": "4px", "text-align": "right", - // There should not be a radius on the right of the line numbers. - "border-top-left-radius": "6px", - "border-bottom-left-radius": "6px", - "border-top-right-radius": "0px", - "border-bottom-right-radius": "0px", }, ALL, ) - // There should not be a radius on the left of the line numbers. - assert-css: ("pre.example-line-numbers + .rust", { - "border-top-left-radius": "0px", - "border-bottom-left-radius": "0px", - "border-top-right-radius": "6px", - "border-bottom-right-radius": "6px", - }) }, ) call-function: ("check-colors", { @@ -74,9 +65,6 @@ call-function: ("check-colors", { "color": "#c67e2d", }) -// The first code block has two lines so let's check its `<pre>` elements lists both of them. -assert-text: ("pre.example-line-numbers", "1\n2") - // Now, try changing the setting dynamically. We'll turn it off, using the settings menu, // and make sure it goes away. @@ -87,42 +75,17 @@ assert-css: ("#settings", {"display": "block"}) // Then, click the toggle button. click: "input#line-numbers" -wait-for-false: "pre.example-line-numbers" +wait-for: ".digits-1.hide-lines" assert-local-storage: {"rustdoc-line-numbers": "false" } -// Check that the rounded corners are back. -assert-css: ( - ".example-wrap .rust", - { - "border-top-left-radius": "6px", - "border-bottom-left-radius": "6px", - "border-top-right-radius": "6px", - "border-bottom-right-radius": "6px", - }, - ALL, -) - // Finally, turn it on again. click: "input#line-numbers" -wait-for: "pre.example-line-numbers" +wait-for: ".digits-1:not(.hide-lines)" assert-local-storage: {"rustdoc-line-numbers": "true" } -wait-for: "pre.example-line-numbers" // Same check with scraped examples line numbers. go-to: "file://" + |DOC_PATH| + "/scrape_examples/fn.test_many.html" -assert-css: ( - ".scraped-example .rust", - { - // There should not be a radius on the left of the code. - "border-top-left-radius": "0px", - "border-bottom-left-radius": "0px", - "border-top-right-radius": "6px", - "border-bottom-right-radius": "6px", - }, - ALL, -) - define-function: ( "check-padding", [path, padding_bottom], @@ -203,17 +166,18 @@ assert-local-storage: {"rustdoc-line-numbers": "true" } assert: ".example-wrap > pre.language-txt" assert: ".example-wrap > pre.rust" assert-count: (".example-wrap", 2) -assert-count: (".example-wrap > pre.example-line-numbers", 2) +assert-count: (".example-wrap.digits-1", 2) click: "#settings-menu" wait-for: "#settings" // Then, click the toggle button. click: "input#line-numbers" -wait-for-count: (".example-wrap > pre.example-line-numbers", 0) +wait-for-count: (".example-wrap.digits-1.hide-lines", 2) assert-local-storage-false: {"rustdoc-line-numbers": "true" } // Now turning off the setting. click: "input#line-numbers" -wait-for-count: (".example-wrap > pre.example-line-numbers", 2) +wait-for-count: (".example-wrap.digits-1", 2) +wait-for-count: (".example-wrap.digits-1.hide-lines", 0) assert-local-storage: {"rustdoc-line-numbers": "true" } diff --git a/tests/rustdoc-gui/source-code-wrapping.goml b/tests/rustdoc-gui/source-code-wrapping.goml new file mode 100644 index 00000000000..cb2fd3052cd --- /dev/null +++ b/tests/rustdoc-gui/source-code-wrapping.goml @@ -0,0 +1,47 @@ +// Checks that the interactions with the source code pages are working as expected. +go-to: "file://" + |DOC_PATH| + "/src/test_docs/lib.rs.html" +show-text: true +set-window-size: (1000, 1000) + +define-function: ( + "click-code-wrapping", + [expected], + block { + click: "#word-wrap-source-code" + wait-for-local-storage: {"rustdoc-word-wrap-source-code": |expected|} + }, +) + +store-size: (".rust code", {"width": width, "height": height}) +click: "#settings-menu" +wait-for: "#settings" +call-function: ("click-code-wrapping", {"expected": "true"}) +wait-for-size-false: (".rust code", {"width": |width|, "height": |height|}) +store-size: (".rust code", {"width": new_width, "height": new_height}) +// The width should now be smaller than the window's and the height +// should have increased. +assert: |width| > |new_width| && |height| < |new_height| + +// Switching back to the original setting. +call-function: ("click-code-wrapping", {"expected": "false"}) +assert-size: (".rust code", {"width": |width|, "height": |height|}) + +// Now let's check in docs code examples. +go-to: "file://" + |DOC_PATH| + "/test_docs/trait_bounds/index.html" +click: "#settings-menu" +wait-for: "#settings" + +store-size: (".example-wrap .rust code", {"width": rust_width, "height": rust_height}) +store-size: (".example-wrap .language-text code", {"width": txt_width, "height": txt_height}) +call-function: ("click-code-wrapping", {"expected": "true"}) +wait-for-size-false: (".example-wrap .rust code", {"width": |rust_width|, "height": |rust_height|}) + +store-size: (".example-wrap .rust code", {"width": new_rust_width, "height": new_rust_height}) +store-size: (".example-wrap .language-text code", {"width": new_txt_width, "height": new_txt_height}) + +assert: |rust_width| > |new_rust_width| && |rust_height| < |new_rust_height| +assert: |txt_width| > |new_txt_width| && |txt_height| < |new_txt_height| + +call-function: ("click-code-wrapping", {"expected": "false"}) +wait-for-size: (".example-wrap .rust code", {"width": |rust_width|, "height": |rust_height|}) +assert-size: (".example-wrap .language-text code", {"width": |txt_width|, "height": |txt_height|}) diff --git a/tests/rustdoc-gui/src/test_docs/lib.rs b/tests/rustdoc-gui/src/test_docs/lib.rs index f9c20ab22b8..31f6b7f09b7 100644 --- a/tests/rustdoc-gui/src/test_docs/lib.rs +++ b/tests/rustdoc-gui/src/test_docs/lib.rs @@ -615,6 +615,15 @@ pub mod private { } } +/// ``` +/// fn super_long_function_name_because_i_need_to_hit_the_limit_and_break_beyond_it() { +/// } +/// ``` +/// +/// ```text +/// fn super_long_function_name_because_i_need_to_hit_the_limit_and_break_beyond_it_v2() { +/// } +/// ``` pub mod trait_bounds { pub trait OneBound: Sized {} pub trait TwoBounds: Sized + Copy {} diff --git a/tests/rustdoc-json/attrs/export_name_2021.rs b/tests/rustdoc-json/attrs/export_name_2021.rs new file mode 100644 index 00000000000..badf124bdde --- /dev/null +++ b/tests/rustdoc-json/attrs/export_name_2021.rs @@ -0,0 +1,6 @@ +//@ edition: 2021 +#![no_std] + +//@ is "$.index[*][?(@.name=='example')].attrs" '["#[export_name = \"altered\"]"]' +#[export_name = "altered"] +pub extern "C" fn example() {} diff --git a/tests/rustdoc-json/attrs/export_name_2024.rs b/tests/rustdoc-json/attrs/export_name_2024.rs new file mode 100644 index 00000000000..c5bb9dcc8f6 --- /dev/null +++ b/tests/rustdoc-json/attrs/export_name_2024.rs @@ -0,0 +1,9 @@ +//@ edition: 2024 +#![no_std] + +// The representation of `#[unsafe(export_name = ..)]` in rustdoc in edition 2024 +// is still `#[export_name = ..]` without the `unsafe` attribute wrapper. + +//@ is "$.index[*][?(@.name=='example')].attrs" '["#[export_name = \"altered\"]"]' +#[unsafe(export_name = "altered")] +pub extern "C" fn example() {} diff --git a/tests/rustdoc-json/attrs/must_use.rs b/tests/rustdoc-json/attrs/must_use.rs new file mode 100644 index 00000000000..dca73abc76a --- /dev/null +++ b/tests/rustdoc-json/attrs/must_use.rs @@ -0,0 +1,9 @@ +#![no_std] + +//@ is "$.index[*][?(@.name=='example')].attrs" '["#[must_use]"]' +#[must_use] +pub fn example() -> impl Iterator<Item = i64> {} + +//@ is "$.index[*][?(@.name=='explicit_message')].attrs" '["#[must_use = \"does nothing if you do not use it\"]"]' +#[must_use = "does nothing if you do not use it"] +pub fn explicit_message() -> impl Iterator<Item = i64> {} diff --git a/tests/rustdoc-json/attrs/no_mangle_2021.rs b/tests/rustdoc-json/attrs/no_mangle_2021.rs new file mode 100644 index 00000000000..258542086ec --- /dev/null +++ b/tests/rustdoc-json/attrs/no_mangle_2021.rs @@ -0,0 +1,6 @@ +//@ edition: 2021 +#![no_std] + +//@ is "$.index[*][?(@.name=='example')].attrs" '["#[no_mangle]"]' +#[no_mangle] +pub extern "C" fn example() {} diff --git a/tests/rustdoc-json/attrs/no_mangle_2024.rs b/tests/rustdoc-json/attrs/no_mangle_2024.rs new file mode 100644 index 00000000000..4c01082d045 --- /dev/null +++ b/tests/rustdoc-json/attrs/no_mangle_2024.rs @@ -0,0 +1,9 @@ +//@ edition: 2024 +#![no_std] + +// The representation of `#[unsafe(no_mangle)]` in rustdoc in edition 2024 +// is still `#[no_mangle]` without the `unsafe` attribute wrapper. + +//@ is "$.index[*][?(@.name=='example')].attrs" '["#[no_mangle]"]' +#[unsafe(no_mangle)] +pub extern "C" fn example() {} diff --git a/tests/rustdoc-json/attrs/non_exhaustive.rs b/tests/rustdoc-json/attrs/non_exhaustive.rs new file mode 100644 index 00000000000..5d738fc0560 --- /dev/null +++ b/tests/rustdoc-json/attrs/non_exhaustive.rs @@ -0,0 +1,19 @@ +#![no_std] + +//@ is "$.index[*][?(@.name=='MyEnum')].attrs" '["#[non_exhaustive]"]' +#[non_exhaustive] +pub enum MyEnum { + First, +} + +pub enum NonExhaustiveVariant { + //@ is "$.index[*][?(@.name=='Variant')].attrs" '["#[non_exhaustive]"]' + #[non_exhaustive] + Variant(i64), +} + +//@ is "$.index[*][?(@.name=='MyStruct')].attrs" '["#[non_exhaustive]"]' +#[non_exhaustive] +pub struct MyStruct { + pub x: i64, +} diff --git a/tests/rustdoc-json/enums/discriminant/limits.rs b/tests/rustdoc-json/enums/discriminant/limits.rs index a023c9fbf6e..7508490d666 100644 --- a/tests/rustdoc-json/enums/discriminant/limits.rs +++ b/tests/rustdoc-json/enums/discriminant/limits.rs @@ -1,4 +1,3 @@ -// ignore-tidy-linelength #![feature(repr128)] #![allow(incomplete_features)] diff --git a/tests/rustdoc-json/enums/discriminant/num_underscore_and_suffix.rs b/tests/rustdoc-json/enums/discriminant/num_underscore_and_suffix.rs index f16a74d638b..6f66495bed2 100644 --- a/tests/rustdoc-json/enums/discriminant/num_underscore_and_suffix.rs +++ b/tests/rustdoc-json/enums/discriminant/num_underscore_and_suffix.rs @@ -1,5 +1,3 @@ -// ignore-tidy-linelength - #[repr(u32)] pub enum Foo { //@ is "$.index[*][?(@.name=='Basic')].inner.variant.discriminant.value" '"0"' diff --git a/tests/rustdoc-json/enums/discriminant/only_some_have_discriminant.rs b/tests/rustdoc-json/enums/discriminant/only_some_have_discriminant.rs index 522545d34d0..8e7985f07f4 100644 --- a/tests/rustdoc-json/enums/discriminant/only_some_have_discriminant.rs +++ b/tests/rustdoc-json/enums/discriminant/only_some_have_discriminant.rs @@ -1,5 +1,3 @@ -// ignore-tidy-linelength - pub enum Foo { //@ is "$.index[*][?(@.name=='Has')].inner.variant.discriminant" '{"expr":"0", "value":"0"}' Has = 0, diff --git a/tests/rustdoc-json/enums/discriminant/struct.rs b/tests/rustdoc-json/enums/discriminant/struct.rs index 0ac40cda733..82437f5ef03 100644 --- a/tests/rustdoc-json/enums/discriminant/struct.rs +++ b/tests/rustdoc-json/enums/discriminant/struct.rs @@ -1,7 +1,5 @@ -// ignore-tidy-linelength - #[repr(i32)] -//@ is "$.index[*][?(@.name=='Foo')].attrs" '["#[repr(i32)]"]' +//@ is "$.index[*][?(@.name=='Foo')].attrs" '["#[attr=\"Repr([ReprInt(SignedInt(I32))])\")]\n"]' pub enum Foo { //@ is "$.index[*][?(@.name=='Struct')].inner.variant.discriminant" null //@ count "$.index[*][?(@.name=='Struct')].inner.variant.kind.struct.fields[*]" 0 diff --git a/tests/rustdoc-json/enums/discriminant/tuple.rs b/tests/rustdoc-json/enums/discriminant/tuple.rs index fbff5aacd67..25bba07e8f7 100644 --- a/tests/rustdoc-json/enums/discriminant/tuple.rs +++ b/tests/rustdoc-json/enums/discriminant/tuple.rs @@ -1,7 +1,5 @@ -// ignore-tidy-linelength - #[repr(u32)] -//@ is "$.index[*][?(@.name=='Foo')].attrs" '["#[repr(u32)]"]' +//@ is "$.index[*][?(@.name=='Foo')].attrs" '["#[attr=\"Repr([ReprInt(UnsignedInt(U32))])\")]\n"]' pub enum Foo { //@ is "$.index[*][?(@.name=='Tuple')].inner.variant.discriminant" null //@ count "$.index[*][?(@.name=='Tuple')].inner.variant.kind.tuple[*]" 0 diff --git a/tests/rustdoc-json/enums/kind.rs b/tests/rustdoc-json/enums/kind.rs index 2e0fb3101a3..517a53828b7 100644 --- a/tests/rustdoc-json/enums/kind.rs +++ b/tests/rustdoc-json/enums/kind.rs @@ -1,5 +1,3 @@ -// ignore-tidy-linelength - pub enum Foo { //@ set Unit = "$.index[*][?(@.name=='Unit')].id" //@ is "$.index[*][?(@.name=='Unit')].inner.variant.kind" '"plain"' diff --git a/tests/rustdoc-json/fn_pointer/abi.rs b/tests/rustdoc-json/fn_pointer/abi.rs index 03fbb3b795d..13a967bd35e 100644 --- a/tests/rustdoc-json/fn_pointer/abi.rs +++ b/tests/rustdoc-json/fn_pointer/abi.rs @@ -1,5 +1,3 @@ -// ignore-tidy-linelength - #![feature(abi_vectorcall)] //@ is "$.index[*][?(@.name=='AbiRust')].inner.type_alias.type.function_pointer.header.abi" \"Rust\" diff --git a/tests/rustdoc-json/fn_pointer/generics.rs b/tests/rustdoc-json/fn_pointer/generics.rs index 7d64e490a22..c974b472297 100644 --- a/tests/rustdoc-json/fn_pointer/generics.rs +++ b/tests/rustdoc-json/fn_pointer/generics.rs @@ -1,5 +1,3 @@ -// ignore-tidy-linelength - //@ count "$.index[*][?(@.name=='WithHigherRankTraitBounds')].inner.type_alias.type.function_pointer.sig.inputs[*]" 1 //@ is "$.index[*][?(@.name=='WithHigherRankTraitBounds')].inner.type_alias.type.function_pointer.sig.inputs[0][0]" '"val"' //@ is "$.index[*][?(@.name=='WithHigherRankTraitBounds')].inner.type_alias.type.function_pointer.sig.inputs[0][1].borrowed_ref.lifetime" \"\'c\" diff --git a/tests/rustdoc-json/fn_pointer/qualifiers.rs b/tests/rustdoc-json/fn_pointer/qualifiers.rs index 6f03cf58522..398e31f72db 100644 --- a/tests/rustdoc-json/fn_pointer/qualifiers.rs +++ b/tests/rustdoc-json/fn_pointer/qualifiers.rs @@ -1,5 +1,3 @@ -// ignore-tidy-linelength - //@ is "$.index[*][?(@.name=='FnPointer')].inner.type_alias.type.function_pointer.header.is_unsafe" false //@ is "$.index[*][?(@.name=='FnPointer')].inner.type_alias.type.function_pointer.header.is_const" false //@ is "$.index[*][?(@.name=='FnPointer')].inner.type_alias.type.function_pointer.header.is_async" false diff --git a/tests/rustdoc-json/fns/abi.rs b/tests/rustdoc-json/fns/abi.rs index 2f6413cee6f..68957f79952 100644 --- a/tests/rustdoc-json/fns/abi.rs +++ b/tests/rustdoc-json/fns/abi.rs @@ -1,5 +1,3 @@ -// ignore-tidy-linelength - #![feature(abi_vectorcall)] //@ is "$.index[*][?(@.name=='abi_rust')].inner.function.header.abi" \"Rust\" diff --git a/tests/rustdoc-json/fns/async_return.rs b/tests/rustdoc-json/fns/async_return.rs index ff88fa99c61..ddfd4ccf90d 100644 --- a/tests/rustdoc-json/fns/async_return.rs +++ b/tests/rustdoc-json/fns/async_return.rs @@ -1,5 +1,4 @@ //@ edition:2021 -// ignore-tidy-linelength // Regression test for <https://github.com/rust-lang/rust/issues/101199> diff --git a/tests/rustdoc-json/fns/generic_args.rs b/tests/rustdoc-json/fns/generic_args.rs index b5412446ab4..6a7124976f8 100644 --- a/tests/rustdoc-json/fns/generic_args.rs +++ b/tests/rustdoc-json/fns/generic_args.rs @@ -1,5 +1,3 @@ -// ignore-tidy-linelength - //@ set foo = "$.index[*][?(@.name=='Foo')].id" pub trait Foo {} diff --git a/tests/rustdoc-json/fns/generic_returns.rs b/tests/rustdoc-json/fns/generic_returns.rs index 2f23801fc3f..90e17525c44 100644 --- a/tests/rustdoc-json/fns/generic_returns.rs +++ b/tests/rustdoc-json/fns/generic_returns.rs @@ -1,5 +1,3 @@ -// ignore-tidy-linelength - //@ count "$.index[*][?(@.name=='generic_returns')].inner.module.items[*]" 2 //@ set foo = "$.index[*][?(@.name=='Foo')].id" diff --git a/tests/rustdoc-json/fns/generics.rs b/tests/rustdoc-json/fns/generics.rs index f2064fd1e93..b953094b5de 100644 --- a/tests/rustdoc-json/fns/generics.rs +++ b/tests/rustdoc-json/fns/generics.rs @@ -1,5 +1,3 @@ -// ignore-tidy-linelength - //@ set wham_id = "$.index[*][?(@.name=='Wham')].id" pub trait Wham {} diff --git a/tests/rustdoc-json/generic-associated-types/gats.rs b/tests/rustdoc-json/generic-associated-types/gats.rs index fdf605e9287..d1172b35fda 100644 --- a/tests/rustdoc-json/generic-associated-types/gats.rs +++ b/tests/rustdoc-json/generic-associated-types/gats.rs @@ -1,5 +1,3 @@ -// ignore-tidy-linelength - pub trait Display {} pub trait LendingIterator { diff --git a/tests/rustdoc-json/impl-trait-in-assoc-type.rs b/tests/rustdoc-json/impl-trait-in-assoc-type.rs index 14ea2950769..fc12fc87e8d 100644 --- a/tests/rustdoc-json/impl-trait-in-assoc-type.rs +++ b/tests/rustdoc-json/impl-trait-in-assoc-type.rs @@ -1,4 +1,3 @@ -// ignore-tidy-linelength #![feature(impl_trait_in_assoc_type)] pub struct AlwaysTrue; diff --git a/tests/rustdoc-json/lifetime/longest.rs b/tests/rustdoc-json/lifetime/longest.rs index 8ac60be0fef..2d4e098d696 100644 --- a/tests/rustdoc-json/lifetime/longest.rs +++ b/tests/rustdoc-json/lifetime/longest.rs @@ -1,5 +1,3 @@ -// ignore-tidy-linelength - //@ is "$.index[*][?(@.name=='longest')].inner.function.generics.params[0].name" \"\'a\" //@ is "$.index[*][?(@.name=='longest')].inner.function.generics.params[0].kind" '{"lifetime": {"outlives": []}}' //@ is "$.index[*][?(@.name=='longest')].inner.function.generics.params[0].kind" '{"lifetime": {"outlives": []}}' diff --git a/tests/rustdoc-json/lifetime/outlives.rs b/tests/rustdoc-json/lifetime/outlives.rs index 99d14296f99..257e43985ac 100644 --- a/tests/rustdoc-json/lifetime/outlives.rs +++ b/tests/rustdoc-json/lifetime/outlives.rs @@ -1,5 +1,3 @@ -// ignore-tidy-linelength - //@ count "$.index[*][?(@.name=='foo')].inner.function.generics.params[*]" 3 //@ is "$.index[*][?(@.name=='foo')].inner.function.generics.where_predicates" [] //@ is "$.index[*][?(@.name=='foo')].inner.function.generics.params[0].name" \"\'a\" diff --git a/tests/rustdoc-json/lifetime/outlives_in_param.rs b/tests/rustdoc-json/lifetime/outlives_in_param.rs index 3eee6d9ea46..55ff5250541 100644 --- a/tests/rustdoc-json/lifetime/outlives_in_param.rs +++ b/tests/rustdoc-json/lifetime/outlives_in_param.rs @@ -1,5 +1,3 @@ -// ignore-tidy-linelength - //@ count '$.index[*][?(@.name=="outlives")].inner.function.generics.params[*]' 2 //@ is '$.index[*][?(@.name=="outlives")].inner.function.generics.params[0].name' \"\'a\" //@ is '$.index[*][?(@.name=="outlives")].inner.function.generics.params[0].kind.lifetime.outlives' [] diff --git a/tests/rustdoc-json/lifetime/outlives_in_where.rs b/tests/rustdoc-json/lifetime/outlives_in_where.rs index a8f88be01da..5158ff118a0 100644 --- a/tests/rustdoc-json/lifetime/outlives_in_where.rs +++ b/tests/rustdoc-json/lifetime/outlives_in_where.rs @@ -1,5 +1,3 @@ -// ignore-tidy-linelength - //@ is '$.index[*][?(@.name=="on_lifetimes")].inner.function.generics.where_predicates' '[{"lifetime_predicate": {"lifetime": "'\''all", "outlives": ["'\''a", "'\''b", "'\''c"]}}]' pub fn on_lifetimes<'a, 'b, 'c, 'all>() where diff --git a/tests/rustdoc-json/methods/abi.rs b/tests/rustdoc-json/methods/abi.rs index 6d33dfca373..dac02a6ce3c 100644 --- a/tests/rustdoc-json/methods/abi.rs +++ b/tests/rustdoc-json/methods/abi.rs @@ -1,5 +1,3 @@ -// ignore-tidy-linelength - #![feature(abi_vectorcall)] //@ has "$.index[*][?(@.name=='Foo')]" diff --git a/tests/rustdoc-json/non_lifetime_binders.rs b/tests/rustdoc-json/non_lifetime_binders.rs index 8443141fecd..7c518a8f5a7 100644 --- a/tests/rustdoc-json/non_lifetime_binders.rs +++ b/tests/rustdoc-json/non_lifetime_binders.rs @@ -1,5 +1,3 @@ -// ignore-tidy-linelength - #![feature(non_lifetime_binders)] #![allow(incomplete_features)] diff --git a/tests/rustdoc-json/path_name.rs b/tests/rustdoc-json/path_name.rs index 67843dfc8ff..a1b3ae294fa 100644 --- a/tests/rustdoc-json/path_name.rs +++ b/tests/rustdoc-json/path_name.rs @@ -3,7 +3,6 @@ // See https://github.com/rust-lang/rust/issues/135600 // and https://github.com/rust-lang/rust/pull/134880#issuecomment-2596386111 // -// ignore-tidy-linelength //@ aux-build: defines_and_reexports.rs extern crate defines_and_reexports; diff --git a/tests/rustdoc-json/reexport/doc_inline_external_crate.rs b/tests/rustdoc-json/reexport/doc_inline_external_crate.rs index 512c741798b..4debd395496 100644 --- a/tests/rustdoc-json/reexport/doc_inline_external_crate.rs +++ b/tests/rustdoc-json/reexport/doc_inline_external_crate.rs @@ -1,6 +1,5 @@ // Regression Test for https://github.com/rust-lang/rust/issues/110138 //@ aux-build: enum_with_discriminant.rs -// ignore-tidy-linelength #[doc(inline)] pub extern crate enum_with_discriminant; diff --git a/tests/rustdoc-json/reexport/export_extern_crate_as_self.rs b/tests/rustdoc-json/reexport/export_extern_crate_as_self.rs index 6e9b5044816..4efacd283ef 100644 --- a/tests/rustdoc-json/reexport/export_extern_crate_as_self.rs +++ b/tests/rustdoc-json/reexport/export_extern_crate_as_self.rs @@ -2,7 +2,5 @@ #![crate_name = "export_extern_crate_as_self"] -// ignore-tidy-linelength - //@ is "$.index[*][?(@.inner.module)].name" \"export_extern_crate_as_self\" pub extern crate self as export_extern_crate_as_self; // Must be the same name as the crate already has diff --git a/tests/rustdoc-json/reexport/private_twice_one_inline.rs b/tests/rustdoc-json/reexport/private_twice_one_inline.rs index 87b97e65c0a..fdf8cda103b 100644 --- a/tests/rustdoc-json/reexport/private_twice_one_inline.rs +++ b/tests/rustdoc-json/reexport/private_twice_one_inline.rs @@ -1,5 +1,4 @@ //@ aux-build:pub-struct.rs -// ignore-tidy-linelength // Test for the ICE in https://github.com/rust-lang/rust/issues/83057 // An external type re-exported with different attributes shouldn't cause an error diff --git a/tests/rustdoc-json/reexport/private_two_names.rs b/tests/rustdoc-json/reexport/private_two_names.rs index 1ed54f15fdc..049100d7f49 100644 --- a/tests/rustdoc-json/reexport/private_two_names.rs +++ b/tests/rustdoc-json/reexport/private_two_names.rs @@ -1,5 +1,3 @@ -// ignore-tidy-linelength - // Test for the ICE in https://github.com/rust-lang/rust/issues/83720 // A pub-in-private type re-exported under two different names shouldn't cause an error diff --git a/tests/rustdoc-json/reexport/same_type_reexported_more_than_once.rs b/tests/rustdoc-json/reexport/same_type_reexported_more_than_once.rs index 27e2827d08d..f313171afa5 100644 --- a/tests/rustdoc-json/reexport/same_type_reexported_more_than_once.rs +++ b/tests/rustdoc-json/reexport/same_type_reexported_more_than_once.rs @@ -1,5 +1,3 @@ -// ignore-tidy-linelength - // Regression test for <https://github.com/rust-lang/rust/issues/97432>. #![no_std] diff --git a/tests/rustdoc-json/return_private.rs b/tests/rustdoc-json/return_private.rs index bfcbed89040..214fda14aca 100644 --- a/tests/rustdoc-json/return_private.rs +++ b/tests/rustdoc-json/return_private.rs @@ -1,5 +1,4 @@ // Regression test for <https://github.com/rust-lang/rust/issues/96161>. -// ignore-tidy-linelength mod secret { //@ set struct_secret = "$.index[*][?(@.name == 'Secret' && @.inner.struct)].id" diff --git a/tests/rustdoc-json/statics/extern.rs b/tests/rustdoc-json/statics/extern.rs index d38fdf1cd1c..9e0265da8e2 100644 --- a/tests/rustdoc-json/statics/extern.rs +++ b/tests/rustdoc-json/statics/extern.rs @@ -1,4 +1,3 @@ -// ignore-tidy-linelength //@ edition: 2021 extern "C" { diff --git a/tests/rustdoc-json/structs/with_primitives.rs b/tests/rustdoc-json/structs/with_primitives.rs index 7202ab9af9c..fe99292456d 100644 --- a/tests/rustdoc-json/structs/with_primitives.rs +++ b/tests/rustdoc-json/structs/with_primitives.rs @@ -1,5 +1,3 @@ -// ignore-tidy-linelength - //@ is "$.index[*][?(@.name=='WithPrimitives')].visibility" \"public\" //@ has "$.index[*][?(@.name=='WithPrimitives')].inner.struct" //@ is "$.index[*][?(@.name=='WithPrimitives')].inner.struct.generics.params[0].name" \"\'a\" diff --git a/tests/rustdoc-json/trait_alias.rs b/tests/rustdoc-json/trait_alias.rs index 3ae5fad8acc..d9ef256b106 100644 --- a/tests/rustdoc-json/trait_alias.rs +++ b/tests/rustdoc-json/trait_alias.rs @@ -1,4 +1,3 @@ -// ignore-tidy-linelength #![feature(trait_alias)] //@ set StrLike = "$.index[*][?(@.name=='StrLike')].id" diff --git a/tests/rustdoc-json/traits/private_supertrait.rs b/tests/rustdoc-json/traits/private_supertrait.rs index d31b6ca4ad8..ce0642278e0 100644 --- a/tests/rustdoc-json/traits/private_supertrait.rs +++ b/tests/rustdoc-json/traits/private_supertrait.rs @@ -1,5 +1,3 @@ -// ignore-tidy-linelength - //@ !has "$.index[*][?(@.name == 'sealed')]" mod sealed { //@ set sealed_id = "$.index[*][?(@.name=='Sealed')].id" diff --git a/tests/rustdoc-json/traits/self.rs b/tests/rustdoc-json/traits/self.rs index 060bc37f2d5..efd9efd556f 100644 --- a/tests/rustdoc-json/traits/self.rs +++ b/tests/rustdoc-json/traits/self.rs @@ -1,5 +1,3 @@ -// ignore-tidy-linelength - pub struct Foo; // Check that Self is represented uniformly between inherent impls, trait impls, diff --git a/tests/rustdoc-json/traits/supertrait.rs b/tests/rustdoc-json/traits/supertrait.rs index e8fe82ab9cd..4b6199d4b26 100644 --- a/tests/rustdoc-json/traits/supertrait.rs +++ b/tests/rustdoc-json/traits/supertrait.rs @@ -1,5 +1,3 @@ -// ignore-tidy-linelength - //@ set loud_id = "$.index[*][?(@.name=='Loud')].id" pub trait Loud {} diff --git a/tests/rustdoc-json/traits/trait_alias.rs b/tests/rustdoc-json/traits/trait_alias.rs index 17c83ddc353..137b8947e23 100644 --- a/tests/rustdoc-json/traits/trait_alias.rs +++ b/tests/rustdoc-json/traits/trait_alias.rs @@ -1,5 +1,4 @@ // Regression test for <https://github.com/rust-lang/rust/issues/104923> -// ignore-tidy-linelength #![feature(trait_alias)] diff --git a/tests/rustdoc-json/type/dyn.rs b/tests/rustdoc-json/type/dyn.rs index f990a2cb53a..d8686d4e2fb 100644 --- a/tests/rustdoc-json/type/dyn.rs +++ b/tests/rustdoc-json/type/dyn.rs @@ -1,4 +1,3 @@ -// ignore-tidy-linelength use std::fmt::Debug; //@ count "$.index[*][?(@.name=='dyn')].inner.module.items[*]" 3 diff --git a/tests/rustdoc-json/type/fn_lifetime.rs b/tests/rustdoc-json/type/fn_lifetime.rs index 7fa12dad54e..aaa716bf11f 100644 --- a/tests/rustdoc-json/type/fn_lifetime.rs +++ b/tests/rustdoc-json/type/fn_lifetime.rs @@ -1,5 +1,3 @@ -// ignore-tidy-linelength - //@ has "$.index[*][?(@.name=='GenericFn')].inner.type_alias" //@ ismany "$.index[*][?(@.name=='GenericFn')].inner.type_alias.generics.params[*].name" \"\'a\" diff --git a/tests/rustdoc-json/type/generic_default.rs b/tests/rustdoc-json/type/generic_default.rs index 7eaa299af5c..2d2ce9cd103 100644 --- a/tests/rustdoc-json/type/generic_default.rs +++ b/tests/rustdoc-json/type/generic_default.rs @@ -1,5 +1,3 @@ -// ignore-tidy-linelength - //@ set result = "$.index[*][?(@.name=='Result')].id" pub enum Result<T, E> { Ok(T), diff --git a/tests/rustdoc-json/type/hrtb.rs b/tests/rustdoc-json/type/hrtb.rs index e71d9fc1e1e..08b35b90a2b 100644 --- a/tests/rustdoc-json/type/hrtb.rs +++ b/tests/rustdoc-json/type/hrtb.rs @@ -1,5 +1,3 @@ -// ignore-tidy-linelength - //@ is "$.index[*][?(@.name=='genfn')].inner.function.generics.where_predicates[0].bound_predicate.type" '{"generic": "F"}' //@ is "$.index[*][?(@.name=='genfn')].inner.function.generics.where_predicates[0].bound_predicate.generic_params" '[{"kind": {"lifetime": {"outlives": []}},"name": "'\''a"},{"kind": {"lifetime": {"outlives": []}},"name": "'\''b"}]' pub fn genfn<F>(f: F) diff --git a/tests/rustdoc-json/type/inherent_associated_type.rs b/tests/rustdoc-json/type/inherent_associated_type.rs index b8ce11fc6e1..e26f8f7c651 100644 --- a/tests/rustdoc-json/type/inherent_associated_type.rs +++ b/tests/rustdoc-json/type/inherent_associated_type.rs @@ -1,4 +1,3 @@ -// ignore-tidy-linelength #![feature(inherent_associated_types)] #![allow(incomplete_features)] diff --git a/tests/rustdoc-json/type/inherent_associated_type_bound.rs b/tests/rustdoc-json/type/inherent_associated_type_bound.rs index cb008291b72..22c9c9c1149 100644 --- a/tests/rustdoc-json/type/inherent_associated_type_bound.rs +++ b/tests/rustdoc-json/type/inherent_associated_type_bound.rs @@ -1,4 +1,3 @@ -// ignore-tidy-linelength #![feature(inherent_associated_types)] #![allow(incomplete_features)] diff --git a/tests/rustdoc-json/type/inherent_associated_type_projections.rs b/tests/rustdoc-json/type/inherent_associated_type_projections.rs index e73e86d5817..501694dce8b 100644 --- a/tests/rustdoc-json/type/inherent_associated_type_projections.rs +++ b/tests/rustdoc-json/type/inherent_associated_type_projections.rs @@ -1,4 +1,3 @@ -// ignore-tidy-linelength #![feature(inherent_associated_types)] #![allow(incomplete_features)] diff --git a/tests/rustdoc-ui/diagnostic-width.stderr b/tests/rustdoc-ui/diagnostic-width.stderr index d8c4934a576..94fc2343faf 100644 --- a/tests/rustdoc-ui/diagnostic-width.stderr +++ b/tests/rustdoc-ui/diagnostic-width.stderr @@ -8,8 +8,8 @@ LL | ... a http://link.com note: the lint level is defined here --> $DIR/diagnostic-width.rs:2:9 | -LL | ...ny(rustdoc::bare_url... - | ^^^^^^^^^^^^^^^^^^ +LL | ...ny(ru...are_urls)] + | ^^...^^^^^^^^ help: use an automatic link instead | LL | /// This is a long line that contains a <http://link.com> diff --git a/tests/rustdoc-ui/issues/issue-79494.rs b/tests/rustdoc-ui/issues/issue-79494.rs index 7a1890c4429..28ef82dac0f 100644 --- a/tests/rustdoc-ui/issues/issue-79494.rs +++ b/tests/rustdoc-ui/issues/issue-79494.rs @@ -2,4 +2,4 @@ #![feature(const_transmute)] -const ZST: &[u8] = unsafe { std::mem::transmute(1usize) }; //~ ERROR cannot transmute between types of different sizes, or dependently-sized types +pub const ZST: &[u8] = unsafe { std::mem::transmute(1usize) }; //~ ERROR cannot transmute between types of different sizes, or dependently-sized types diff --git a/tests/rustdoc-ui/issues/issue-79494.stderr b/tests/rustdoc-ui/issues/issue-79494.stderr index abcd69d3aae..20e568d8eab 100644 --- a/tests/rustdoc-ui/issues/issue-79494.stderr +++ b/tests/rustdoc-ui/issues/issue-79494.stderr @@ -1,8 +1,8 @@ error[E0512]: cannot transmute between types of different sizes, or dependently-sized types - --> $DIR/issue-79494.rs:5:29 + --> $DIR/issue-79494.rs:5:33 | -LL | const ZST: &[u8] = unsafe { std::mem::transmute(1usize) }; - | ^^^^^^^^^^^^^^^^^^^ +LL | pub const ZST: &[u8] = unsafe { std::mem::transmute(1usize) }; + | ^^^^^^^^^^^^^^^^^^^ | = note: source type: `usize` (64 bits) = note: target type: `&[u8]` (128 bits) diff --git a/tests/rustdoc-ui/target-feature-stability.rs b/tests/rustdoc-ui/target-feature-stability.rs new file mode 100644 index 00000000000..17fa3ccfe3e --- /dev/null +++ b/tests/rustdoc-ui/target-feature-stability.rs @@ -0,0 +1,28 @@ +//! This is a regression test for <https://github.com/rust-lang/rust/issues/137366>, ensuring +//! that we can use the `neon` target feature on ARM32 targets in rustdoc despite there +//! being a "forbidden" feature of the same name for aarch64, and rustdoc merging the +//! target features of all targets. +//@ check-pass +//@ revisions: arm aarch64 +//@[arm] compile-flags: --target armv7-unknown-linux-gnueabihf +//@[arm] needs-llvm-components: arm +//@[aarch64] compile-flags: --target aarch64-unknown-none-softfloat +//@[aarch64] needs-llvm-components: aarch64 + +#![crate_type = "lib"] +#![feature(no_core, lang_items)] +#![feature(arm_target_feature)] +#![no_core] + +#[lang = "sized"] +pub trait Sized {} + +// `fp-armv8` is "forbidden" on aarch64 as we tie it to `neon`. +#[target_feature(enable = "fp-armv8")] +pub fn fun1() {} + +// This would usually be rejected as it changes the ABI. +// But we disable that check in rustdoc since we are building "for all targets" and the +// check can't really handle that. +#[target_feature(enable = "soft-float")] +pub fn fun2() {} diff --git a/tests/rustdoc-ui/track-diagnostics.rs b/tests/rustdoc-ui/track-diagnostics.rs index 5c950a11082..27781f47e0d 100644 --- a/tests/rustdoc-ui/track-diagnostics.rs +++ b/tests/rustdoc-ui/track-diagnostics.rs @@ -7,4 +7,5 @@ struct A; struct B; -const S: A = B; + +pub const S: A = B; diff --git a/tests/rustdoc-ui/track-diagnostics.stderr b/tests/rustdoc-ui/track-diagnostics.stderr index 3d17570a7a2..fb0d7b86644 100644 --- a/tests/rustdoc-ui/track-diagnostics.stderr +++ b/tests/rustdoc-ui/track-diagnostics.stderr @@ -1,8 +1,8 @@ error[E0308]: mismatched types --> $DIR/track-diagnostics.rs:LL:CC | -LL | const S: A = B; - | ^ expected `A`, found `B` +LL | pub const S: A = B; + | ^ expected `A`, found `B` -Ztrack-diagnostics: created at compiler/rustc_trait_selection/src/error_reporting/infer/mod.rs:LL:CC error: aborting due to 1 previous error diff --git a/tests/rustdoc-ui/unused-extern-crate.rs b/tests/rustdoc-ui/unused-extern-crate.rs deleted file mode 100644 index 240dd1f00e2..00000000000 --- a/tests/rustdoc-ui/unused-extern-crate.rs +++ /dev/null @@ -1,3 +0,0 @@ -//@ check-pass -//@ aux-crate:panic_item=panic-item.rs -// @has unused_extern_crate/index.html diff --git a/tests/rustdoc-ui/auxiliary/panic-item.rs b/tests/rustdoc/auxiliary/panic-item.rs index ccf784f7284..ccf784f7284 100644 --- a/tests/rustdoc-ui/auxiliary/panic-item.rs +++ b/tests/rustdoc/auxiliary/panic-item.rs diff --git a/tests/rustdoc/const-intrinsic.rs b/tests/rustdoc/const-intrinsic.rs index 8444d4a3aa7..7dedb083b7d 100644 --- a/tests/rustdoc/const-intrinsic.rs +++ b/tests/rustdoc/const-intrinsic.rs @@ -9,19 +9,13 @@ #[stable(since="1.0.0", feature="rust1")] #[rustc_const_stable(feature = "const_transmute", since = "1.56.0")] #[rustc_intrinsic] -#[rustc_intrinsic_must_be_overridden] -pub const unsafe fn transmute<T, U>(_: T) -> U { - loop {} -} +pub const unsafe fn transmute<T, U>(_: T) -> U; //@ has 'foo/fn.unreachable.html' //@ has - '//pre[@class="rust item-decl"]' 'pub unsafe fn unreachable() -> !' #[stable(since="1.0.0", feature="rust1")] #[rustc_intrinsic] -#[rustc_intrinsic_must_be_overridden] -pub unsafe fn unreachable() -> ! { - loop {} -} +pub unsafe fn unreachable() -> !; extern "C" { //@ has 'foo/fn.needs_drop.html' diff --git a/tests/rustdoc/doc-hidden-reexports-109449.rs b/tests/rustdoc/doc-hidden-reexports-109449.rs index 8f195544120..78b9214300a 100644 --- a/tests/rustdoc/doc-hidden-reexports-109449.rs +++ b/tests/rustdoc/doc-hidden-reexports-109449.rs @@ -26,21 +26,21 @@ pub mod single_reexport { //@ has 'foo/single_reexport/index.html' // First we check that we have 4 type aliases. - //@ count - '//*[@id="main-content"]/*[@class="item-table reexports"]//code' 4 + //@ count - '//*[@id="main-content"]/*[@class="item-table reexports"]//code' 0 // Then we check that we have the correct link for each re-export. //@ !has - '//*[@href="struct.Foo.html"]' 'Foo' - //@ has - '//*[@id="reexport.Foo"]/code' 'pub use crate::private_module::Public as Foo;' + //@ !has - '//*[@id="reexport.Foo"]/code' 'pub use crate::private_module::Public as Foo;' pub use crate::private_module::Public as Foo; //@ !has - '//*[@href="type.Foo2.html"]' 'Foo2' - //@ has - '//*[@id="reexport.Foo2"]/code' 'pub use crate::private_module::Bar as Foo2;' + //@ !has - '//*[@id="reexport.Foo2"]/code' 'pub use crate::private_module::Bar as Foo2;' pub use crate::private_module::Bar as Foo2; //@ !has - '//*[@href="type.Yo.html"]' 'Yo' - //@ has - '//*[@id="reexport.Yo"]/code' 'pub use crate::Bar3 as Yo;' + //@ !has - '//*[@id="reexport.Yo"]/code' 'pub use crate::Bar3 as Yo;' pub use crate::Bar3 as Yo; //@ !has - '//*[@href="struct.Yo2.html"]' 'Yo2' - //@ has - '//*[@id="reexport.Yo2"]/code' 'pub use crate::FooFoo as Yo2;' + //@ !has - '//*[@id="reexport.Yo2"]/code' 'pub use crate::FooFoo as Yo2;' pub use crate::FooFoo as Yo2; // Checking that each file is also created as expected. @@ -70,19 +70,19 @@ pub mod single_reexport_no_inline { //@ has - '//*[@id="main-content"]/*[@class="section-header"]' 'Re-exports' // Now we check that we don't have links to the items, just `pub use`. - //@ has - '//*[@id="main-content"]//*' 'pub use crate::private_module::Public as XFoo;' + //@ !has - '//*[@id="main-content"]//*' 'pub use crate::private_module::Public as XFoo;' //@ !has - '//*[@id="main-content"]//a' 'XFoo' #[doc(no_inline)] pub use crate::private_module::Public as XFoo; - //@ has - '//*[@id="main-content"]//*' 'pub use crate::private_module::Bar as Foo2;' + //@ !has - '//*[@id="main-content"]//*' 'pub use crate::private_module::Bar as Foo2;' //@ !has - '//*[@id="main-content"]//a' 'Foo2' #[doc(no_inline)] pub use crate::private_module::Bar as Foo2; - //@ has - '//*[@id="main-content"]//*' 'pub use crate::Bar3 as Yo;' + //@ !has - '//*[@id="main-content"]//*' 'pub use crate::Bar3 as Yo;' //@ !has - '//*[@id="main-content"]//a' 'Yo' #[doc(no_inline)] pub use crate::Bar3 as Yo; - //@ has - '//*[@id="main-content"]//*' 'pub use crate::FooFoo as Yo2;' + //@ !has - '//*[@id="main-content"]//*' 'pub use crate::FooFoo as Yo2;' //@ !has - '//*[@id="main-content"]//a' 'Yo2' #[doc(no_inline)] pub use crate::FooFoo as Yo2; diff --git a/tests/rustdoc/doc-hidden-source.rs b/tests/rustdoc/doc-hidden-source.rs new file mode 100644 index 00000000000..b6bc622dd58 --- /dev/null +++ b/tests/rustdoc/doc-hidden-source.rs @@ -0,0 +1,16 @@ +// Test for <https://github.com/rust-lang/rust/issues/137342>. + +#![crate_name = "foo"] + +//@ has 'foo/index.html' +//@ !has - '//*[@id="main-content"]//*[@class="struct"]' 'Bar' +#[doc(hidden)] +pub struct Bar; + +//@ !has - '//*' 'pub use crate::Bar as A;' +pub use crate::Bar as A; +//@ !has - '//*' 'pub use crate::A as B;' +pub use crate::A as B; +//@ has - '//dt/a[@class="struct"]' 'C' +#[doc(inline)] +pub use crate::Bar as C; diff --git a/tests/rustdoc/impl-parts-crosscrate.rs b/tests/rustdoc/impl-parts-crosscrate.rs index 49752ab75d5..631c8bb3eb3 100644 --- a/tests/rustdoc/impl-parts-crosscrate.rs +++ b/tests/rustdoc/impl-parts-crosscrate.rs @@ -5,7 +5,7 @@ extern crate rustdoc_impl_parts_crosscrate; -pub struct Bar<T> { t: T } +pub struct Bar<T: Copy + Send> { t: T } // The output file is html embedded in javascript, so the html tags // aren't stripped by the processing script and we can't check for the diff --git a/tests/rustdoc/impl-parts.rs b/tests/rustdoc/impl-parts.rs index 820f51008a4..4f281bfd63c 100644 --- a/tests/rustdoc/impl-parts.rs +++ b/tests/rustdoc/impl-parts.rs @@ -3,7 +3,7 @@ pub auto trait AnAutoTrait {} -pub struct Foo<T> { field: T } +pub struct Foo<T: Clone + Sync> { field: T } //@ has impl_parts/struct.Foo.html '//*[@class="impl"]//h3[@class="code-header"]' \ // "impl<T> !AnAutoTrait for Foo<T>where T: Sync + Clone," diff --git a/tests/rustdoc/inline_cross/inline_hidden.rs b/tests/rustdoc/inline_cross/inline_hidden.rs index 49ca2db6a22..f6727de2cc6 100644 --- a/tests/rustdoc/inline_cross/inline_hidden.rs +++ b/tests/rustdoc/inline_cross/inline_hidden.rs @@ -6,7 +6,7 @@ extern crate rustdoc_hidden; //@ has inline_hidden/index.html // Ensures this item is not inlined. -//@ has - '//*[@id="reexport.Foo"]/code' 'pub use rustdoc_hidden::Foo;' +//@ !has - '//*[@id="reexport.Foo"]/code' 'pub use rustdoc_hidden::Foo;' #[doc(no_inline)] pub use rustdoc_hidden::Foo; @@ -16,7 +16,7 @@ pub use rustdoc_hidden::Foo; pub use rustdoc_hidden::Foo as Inlined; // Even with this import, we should not see `Foo`. -//@ count - '//dt' 4 +//@ count - '//dt' 3 //@ has - '//dt/a[@class="struct"]' 'Bar' //@ has - '//dt/a[@class="fn"]' 'foo' pub use rustdoc_hidden::*; diff --git a/tests/rustdoc/inline_local/staged-inline.rs b/tests/rustdoc/inline_local/staged-inline.rs index f2131ad5f94..d0dc3f9eea7 100644 --- a/tests/rustdoc/inline_local/staged-inline.rs +++ b/tests/rustdoc/inline_local/staged-inline.rs @@ -16,3 +16,31 @@ pub mod ffi { //@ has "foo/struct.CStr.html" "//span[@class='sub-heading']/span[@class='since']" "1.0.0" //@ !has - "//span[@class='sub-heading']/span[@class='since']" "1.99.0" pub use ffi::CStr; + +// https://github.com/rust-lang/rust/issues/137141 +#[stable(feature = "futures_api", since = "1.36.0")] +//@ has "foo/task/index.html" "//span[@class='sub-heading']/span[@class='since']" "1.36.0" +//@ !has - "//span[@class='sub-heading']/span[@class='since']" "1.0.0" +pub mod task { + + #[doc(inline)] + #[stable(feature = "futures_api", since = "1.36.0")] + //@ has "foo/task/index.html" "//span[@class='sub-heading']/span[@class='since']" "1.36.0" + //@ has "foo/task/ready/index.html" "//span[@class='sub-heading']/span[@class='since']" "1.64.0" + pub use core::task::*; +} + +#[stable(feature = "futures_api", since = "1.36.0")] +//@ has "foo/core/index.html" "//span[@class='sub-heading']/span[@class='since']" "1.36.0" +//@ !has - "//span[@class='sub-heading']/span[@class='since']" "1.0.0" +pub mod core { + #[stable(feature = "futures_api", since = "1.36.0")] + //@ has "foo/core/task/index.html" "//span[@class='sub-heading']/span[@class='since']" "1.36.0" + pub mod task { + + #[stable(feature = "ready_macro", since = "1.64.0")] + //@ has "foo/core/task/ready/index.html" "//span[@class='sub-heading']/span[@class='since']" "1.64.0" + pub mod ready { + } + } +} diff --git a/tests/rustdoc/reexport-attr-merge.rs b/tests/rustdoc/reexport-attr-merge.rs index e4a406c3845..aef302eb0b2 100644 --- a/tests/rustdoc/reexport-attr-merge.rs +++ b/tests/rustdoc/reexport-attr-merge.rs @@ -18,7 +18,7 @@ pub use Foo1 as Foo2; // First we ensure that only the reexport `Bar2` and the inlined struct `Bar` // are inlined. -//@ count - '//a[@class="struct"]' 2 +//@ count - '//a[@class="struct"]' 1 // Then we check that `cfg` is displayed for base item, but not for intermediate re-exports. //@ has - '//*[@class="stab portability"]' 'foo' //@ !has - '//*[@class="stab portability"]' 'bar' @@ -29,5 +29,5 @@ pub use Foo2 as Bar; // This one should appear but `Bar2` won't be linked because there is no // `#[doc(inline)]`. -//@ has - '//*[@id="reexport.Bar2"]' 'pub use Foo2 as Bar2;' +//@ !has - '//*[@id="reexport.Bar2"]' 'pub use Foo2 as Bar2;' pub use Foo2 as Bar2; diff --git a/tests/rustdoc/reexport-doc-hidden-inside-private.rs b/tests/rustdoc/reexport-doc-hidden-inside-private.rs index 8e194ef74fb..bae2aa78ec7 100644 --- a/tests/rustdoc/reexport-doc-hidden-inside-private.rs +++ b/tests/rustdoc/reexport-doc-hidden-inside-private.rs @@ -9,8 +9,8 @@ mod private_module { } //@ has 'foo/index.html' -//@ has - '//*[@id="reexport.Foo"]/code' 'pub use crate::private_module::Public as Foo;' +//@ !has - '//*[@id="reexport.Foo"]/code' 'pub use crate::private_module::Public as Foo;' pub use crate::private_module::Public as Foo; // Glob re-exports with no visible items should not be displayed. -//@ count - '//*[@class="item-table reexports"]/dt' 1 +//@ count - '//*[@class="item-table reexports"]/dt' 0 pub use crate::private_module::*; diff --git a/tests/rustdoc/reexport-doc-hidden.rs b/tests/rustdoc/reexport-doc-hidden.rs index b912362f298..1468e9ad957 100644 --- a/tests/rustdoc/reexport-doc-hidden.rs +++ b/tests/rustdoc/reexport-doc-hidden.rs @@ -8,7 +8,7 @@ pub type Type = u32; //@ has 'foo/index.html' -//@ has - '//*[@id="reexport.Type2"]/code' 'pub use crate::Type as Type2;' +//@ !has - '//*[@id="reexport.Type2"]/code' 'pub use crate::Type as Type2;' pub use crate::Type as Type2; //@ count - '//*[@id="reexport.Type3"]' 0 @@ -21,5 +21,5 @@ macro_rules! foo { () => {}; } -//@ has - '//*[@id="reexport.Macro"]/code' 'pub use crate::foo as Macro;' +//@ !has - '//*[@id="reexport.Macro"]/code' 'pub use crate::foo as Macro;' pub use crate::foo as Macro; diff --git a/tests/rustdoc/reexport-hidden-macro.rs b/tests/rustdoc/reexport-hidden-macro.rs index 9b83bca3906..7345149c645 100644 --- a/tests/rustdoc/reexport-hidden-macro.rs +++ b/tests/rustdoc/reexport-hidden-macro.rs @@ -5,7 +5,7 @@ //@ has 'foo/index.html' //@ has - '//*[@id="main-content"]//a[@href="macro.Macro2.html"]' 'Macro2' -//@ has - '//*[@id="reexport.Macro"]/code' 'pub use crate::foo as Macro;' +//@ !has - '//*[@id="reexport.Macro"]/code' 'pub use crate::foo as Macro;' //@ has 'foo/macro.Macro2.html' //@ has - '//*[@class="docblock"]' 'Displayed' diff --git a/tests/rustdoc/reexport-of-doc-hidden.rs b/tests/rustdoc/reexport-of-doc-hidden.rs index 21511bc2aea..e901d0ff8a2 100644 --- a/tests/rustdoc/reexport-of-doc-hidden.rs +++ b/tests/rustdoc/reexport-of-doc-hidden.rs @@ -12,13 +12,13 @@ macro_rules! foo { } //@ has 'foo/index.html' -//@ has - '//*[@id="reexport.Macro"]/code' 'pub use crate::foo as Macro;' +//@ !has - '//*[@id="reexport.Macro"]/code' 'pub use crate::foo as Macro;' pub use crate::foo as Macro; -//@ has - '//*[@id="reexport.Macro2"]/code' 'pub use crate::foo as Macro2;' +//@ !has - '//*[@id="reexport.Macro2"]/code' 'pub use crate::foo as Macro2;' pub use crate::foo as Macro2; -//@ has - '//*[@id="reexport.Boo"]/code' 'pub use crate::Bar as Boo;' +//@ !has - '//*[@id="reexport.Boo"]/code' 'pub use crate::Bar as Boo;' pub use crate::Bar as Boo; -//@ has - '//*[@id="reexport.Boo2"]/code' 'pub use crate::Bar as Boo2;' +//@ !has - '//*[@id="reexport.Boo2"]/code' 'pub use crate::Bar as Boo2;' pub use crate::Bar as Boo2; pub fn fofo() {} @@ -30,9 +30,9 @@ pub use crate::fofo as f2; pub mod sub { //@ has 'foo/sub/index.html' - //@ has - '//*[@id="reexport.Macro"]/code' 'pub use crate::foo as Macro;' + //@ !has - '//*[@id="reexport.Macro"]/code' 'pub use crate::foo as Macro;' pub use crate::foo as Macro; - //@ has - '//*[@id="reexport.Macro2"]/code' 'pub use crate::foo as Macro2;' + //@ !has - '//*[@id="reexport.Macro2"]/code' 'pub use crate::foo as Macro2;' pub use crate::foo as Macro2; //@ has - '//*[@id="reexport.f1"]/code' 'pub use crate::fofo as f1;' diff --git a/tests/rustdoc/safe-intrinsic.rs b/tests/rustdoc/safe-intrinsic.rs index 1edc1d9f79b..0d2ee89415d 100644 --- a/tests/rustdoc/safe-intrinsic.rs +++ b/tests/rustdoc/safe-intrinsic.rs @@ -11,14 +11,8 @@ trait Sized {} //@ has 'foo/fn.abort.html' //@ has - '//pre[@class="rust item-decl"]' 'pub fn abort() -> !' #[rustc_intrinsic] -#[rustc_intrinsic_must_be_overridden] -pub fn abort() -> ! { - loop {} -} +pub fn abort() -> !; //@ has 'foo/fn.unreachable.html' //@ has - '//pre[@class="rust item-decl"]' 'pub unsafe fn unreachable() -> !' #[rustc_intrinsic] -#[rustc_intrinsic_must_be_overridden] -pub unsafe fn unreachable() -> ! { - loop {} -} +pub unsafe fn unreachable() -> !; diff --git a/tests/rustdoc/unused-extern-crate.rs b/tests/rustdoc/unused-extern-crate.rs new file mode 100644 index 00000000000..cdc00fd313a --- /dev/null +++ b/tests/rustdoc/unused-extern-crate.rs @@ -0,0 +1,2 @@ +//@ aux-crate:panic_item=panic-item.rs +//@ has unused_extern_crate/index.html diff --git a/tests/ui-fulldeps/codegen-backend/hotplug.bindep.stdout b/tests/ui-fulldeps/codegen-backend/hotplug.bindep.stdout index 4d58fd503d0..5cf39ca3165 100644 --- a/tests/ui-fulldeps/codegen-backend/hotplug.bindep.stdout +++ b/tests/ui-fulldeps/codegen-backend/hotplug.bindep.stdout @@ -1,4 +1,4 @@ -$TEST_BUILD_DIR/codegen-backend/hotplug.bindep/libhotplug.rlib: $DIR/hotplug.rs $TEST_BUILD_DIR/codegen-backend/hotplug.bindep/auxiliary/libthe_backend.so +$TEST_BUILD_DIR/libhotplug.rlib: $DIR/hotplug.rs $TEST_BUILD_DIR/auxiliary/libthe_backend.so $DIR/hotplug.rs: -$TEST_BUILD_DIR/codegen-backend/hotplug.bindep/auxiliary/libthe_backend.so: +$TEST_BUILD_DIR/auxiliary/libthe_backend.so: diff --git a/tests/ui-fulldeps/codegen-backend/hotplug.dep.stdout b/tests/ui-fulldeps/codegen-backend/hotplug.dep.stdout index 48b7534d8fa..717439f14e1 100644 --- a/tests/ui-fulldeps/codegen-backend/hotplug.dep.stdout +++ b/tests/ui-fulldeps/codegen-backend/hotplug.dep.stdout @@ -1,3 +1,3 @@ -$TEST_BUILD_DIR/codegen-backend/hotplug.dep/libhotplug.rlib: $DIR/hotplug.rs +$TEST_BUILD_DIR/libhotplug.rlib: $DIR/hotplug.rs $DIR/hotplug.rs: diff --git a/tests/ui-fulldeps/stable-mir/check_attribute.rs b/tests/ui-fulldeps/stable-mir/check_attribute.rs index 11cb63f3f8a..de5ba15f6ea 100644 --- a/tests/ui-fulldeps/stable-mir/check_attribute.rs +++ b/tests/ui-fulldeps/stable-mir/check_attribute.rs @@ -27,63 +27,23 @@ fn test_stable_mir() -> ControlFlow<()> { // Find items in the local crate. let items = stable_mir::all_local_items(); - test_builtins(&items); - test_derive(&items); test_tool(&items); - test_all_attrs(&items); ControlFlow::Continue(()) } -// Test built-in attributes. -fn test_builtins(items: &CrateItems) { - let target_fn = *get_item(&items, "builtins_fn").unwrap(); - let allow_attrs = target_fn.attrs_by_path(&["allow".to_string()]); - assert_eq!(allow_attrs[0].as_str(), "#![allow(unused_variables)]"); - - let inline_attrs = target_fn.attrs_by_path(&["inline".to_string()]); - assert_eq!(inline_attrs[0].as_str(), "#[inline]"); - - let deprecated_attrs = target_fn.attrs_by_path(&["deprecated".to_string()]); - assert_eq!(deprecated_attrs[0].as_str(), "#[deprecated(since = \"5.2.0\")]"); -} - -// Test derive attribute. -fn test_derive(items: &CrateItems) { - let target_struct = *get_item(&items, "Foo").unwrap(); - let attrs = target_struct.attrs_by_path(&["derive".to_string()]); - // No `derive` attribute since it's expanded before MIR. - assert_eq!(attrs.len(), 0); - - // Check derived trait method's attributes. - let derived_fmt = *get_item(&items, "<Foo as std::fmt::Debug>::fmt").unwrap(); - // The Rust reference lies about this attribute. It doesn't show up in `clone` or `fmt` impl. - let _fmt_attrs = derived_fmt.attrs_by_path(&["automatically_derived".to_string()]); -} - // Test tool attributes. fn test_tool(items: &CrateItems) { let rustfmt_fn = *get_item(&items, "do_not_format").unwrap(); - let rustfmt_attrs = rustfmt_fn.attrs_by_path(&["rustfmt".to_string(), "skip".to_string()]); + let rustfmt_attrs = rustfmt_fn.tool_attrs(&["rustfmt".to_string(), "skip".to_string()]); assert_eq!(rustfmt_attrs[0].as_str(), "#[rustfmt::skip]"); let clippy_fn = *get_item(&items, "complex_fn").unwrap(); - let clippy_attrs = clippy_fn.attrs_by_path(&["clippy".to_string(), + let clippy_attrs = clippy_fn.tool_attrs(&["clippy".to_string(), "cyclomatic_complexity".to_string()]); assert_eq!(clippy_attrs[0].as_str(), "#[clippy::cyclomatic_complexity = \"100\"]"); } -fn test_all_attrs(items: &CrateItems) { - let target_fn = *get_item(&items, "many_attrs").unwrap(); - let all_attrs = target_fn.all_attrs(); - assert_eq!(all_attrs[0].as_str(), "#[inline]"); - assert_eq!(all_attrs[1].as_str(), "#[allow(unused_variables)]"); - assert_eq!(all_attrs[2].as_str(), "#[allow(dead_code)]"); - assert_eq!(all_attrs[3].as_str(), "#[allow(unused_imports)]"); - assert_eq!(all_attrs[4].as_str(), "#![allow(clippy::filter_map)]"); -} - - fn get_item<'a>( items: &'a CrateItems, name: &str, diff --git a/tests/ui-fulldeps/stable-mir/check_intrinsics.rs b/tests/ui-fulldeps/stable-mir/check_intrinsics.rs index 2f772b97886..07a2a62e066 100644 --- a/tests/ui-fulldeps/stable-mir/check_intrinsics.rs +++ b/tests/ui-fulldeps/stable-mir/check_intrinsics.rs @@ -51,13 +51,11 @@ fn test_intrinsics() -> ControlFlow<()> { /// This check is unfortunately tight to the implementation of intrinsics. /// -/// We want to ensure that StableMIR can handle intrinsics with and without fallback body. +/// We want to ensure that StableMIR can handle intrinsics with and without fallback body: +/// for intrinsics without a body, obviously we cannot expose anything. /// /// If by any chance this test breaks because you changed how an intrinsic is implemented, please /// update the test to invoke a different intrinsic. -/// -/// In StableMIR, we only expose intrinsic body if they are not marked with -/// `rustc_intrinsic_must_be_overridden`. fn check_instance(instance: &Instance) { assert_eq!(instance.kind, InstanceKind::Intrinsic); let name = instance.intrinsic_name().unwrap(); diff --git a/tests/ui-fulldeps/stable-mir/check_ty_fold.rs b/tests/ui-fulldeps/stable-mir/check_ty_fold.rs index 9fa4929d68e..9d71697178e 100644 --- a/tests/ui-fulldeps/stable-mir/check_ty_fold.rs +++ b/tests/ui-fulldeps/stable-mir/check_ty_fold.rs @@ -18,9 +18,11 @@ extern crate rustc_interface; extern crate stable_mir; use rustc_smir::rustc_internal; -use stable_mir::ty::{RigidTy, TyKind, Ty, }; -use stable_mir::mir::{Body, MirVisitor, FieldIdx, Place, ProjectionElem, visit::{Location, - PlaceContext}}; +use stable_mir::mir::{ + Body, FieldIdx, MirVisitor, Place, ProjectionElem, + visit::{Location, PlaceContext}, +}; +use stable_mir::ty::{RigidTy, Ty, TyKind}; use std::io::Write; use std::ops::ControlFlow; @@ -29,8 +31,8 @@ const CRATE_NAME: &str = "input"; /// This function uses the Stable MIR APIs to get information about the test crate. fn test_stable_mir() -> ControlFlow<()> { let main_fn = stable_mir::entry_fn(); - let body = main_fn.unwrap().body(); - let mut visitor = PlaceVisitor{ body: &body, tested: false}; + let body = main_fn.unwrap().expect_body(); + let mut visitor = PlaceVisitor { body: &body, tested: false }; visitor.visit_body(&body); assert!(visitor.tested); ControlFlow::Continue(()) diff --git a/tests/ui-fulldeps/stable-mir/crate-info.rs b/tests/ui-fulldeps/stable-mir/crate-info.rs index 7f0e9b50335..4d2d7e26276 100644 --- a/tests/ui-fulldeps/stable-mir/crate-info.rs +++ b/tests/ui-fulldeps/stable-mir/crate-info.rs @@ -45,7 +45,7 @@ fn test_stable_mir() -> ControlFlow<()> { assert!(stable_mir::find_crates("std").len() == 1); let bar = get_item(&items, (DefKind::Fn, "bar")).unwrap(); - let body = bar.body(); + let body = bar.expect_body(); assert_eq!(body.locals().len(), 2); assert_eq!(body.blocks.len(), 1); let block = &body.blocks[0]; @@ -60,7 +60,7 @@ fn test_stable_mir() -> ControlFlow<()> { } let foo_bar = get_item(&items, (DefKind::Fn, "foo_bar")).unwrap(); - let body = foo_bar.body(); + let body = foo_bar.expect_body(); assert_eq!(body.locals().len(), 5); assert_eq!(body.blocks.len(), 4); let block = &body.blocks[0]; @@ -70,7 +70,7 @@ fn test_stable_mir() -> ControlFlow<()> { } let types = get_item(&items, (DefKind::Fn, "types")).unwrap(); - let body = types.body(); + let body = types.expect_body(); assert_eq!(body.locals().len(), 6); assert_matches!( body.locals()[0].ty.kind(), @@ -100,7 +100,7 @@ fn test_stable_mir() -> ControlFlow<()> { ); let drop = get_item(&items, (DefKind::Fn, "drop")).unwrap(); - let body = drop.body(); + let body = drop.expect_body(); assert_eq!(body.blocks.len(), 2); let block = &body.blocks[0]; match &block.terminator.kind { @@ -109,7 +109,7 @@ fn test_stable_mir() -> ControlFlow<()> { } let assert = get_item(&items, (DefKind::Fn, "assert")).unwrap(); - let body = assert.body(); + let body = assert.expect_body(); assert_eq!(body.blocks.len(), 2); let block = &body.blocks[0]; match &block.terminator.kind { @@ -123,7 +123,8 @@ fn test_stable_mir() -> ControlFlow<()> { match &block.terminator.kind { stable_mir::mir::TerminatorKind::Call { func, .. } => { let TyKind::RigidTy(ty) = func.ty(&body.locals()).unwrap().kind() else { - unreachable!() }; + unreachable!() + }; let RigidTy::FnDef(def, args) = ty else { unreachable!() }; let next_func = Instance::resolve(def, &args).unwrap(); match next_func.body().unwrap().locals()[1].ty.kind() { @@ -138,10 +139,10 @@ fn test_stable_mir() -> ControlFlow<()> { let foo_const = get_item(&items, (DefKind::Const, "FOO")).unwrap(); // Ensure we don't panic trying to get the body of a constant. - foo_const.body(); + foo_const.expect_body(); let locals_fn = get_item(&items, (DefKind::Fn, "locals")).unwrap(); - let body = locals_fn.body(); + let body = locals_fn.expect_body(); assert_eq!(body.locals().len(), 4); assert_matches!( body.ret_local().ty.kind(), @@ -172,8 +173,10 @@ fn get_item<'a>( item: (DefKind, &str), ) -> Option<&'a stable_mir::CrateItem> { items.iter().find(|crate_item| { - matches!((item.0, crate_item.kind()), (DefKind::Fn, ItemKind::Fn) | (DefKind::Const, - ItemKind::Const)) && crate_item.name() == item.1 + matches!( + (item.0, crate_item.kind()), + (DefKind::Fn, ItemKind::Fn) | (DefKind::Const, ItemKind::Const) + ) && crate_item.name() == item.1 }) } diff --git a/tests/ui-fulldeps/stable-mir/projections.rs b/tests/ui-fulldeps/stable-mir/projections.rs index 3cc71247e67..6f82eba61fc 100644 --- a/tests/ui-fulldeps/stable-mir/projections.rs +++ b/tests/ui-fulldeps/stable-mir/projections.rs @@ -18,10 +18,10 @@ extern crate rustc_interface; extern crate stable_mir; use rustc_smir::rustc_internal; +use stable_mir::ItemKind; use stable_mir::crate_def::CrateDef; use stable_mir::mir::{ProjectionElem, Rvalue, StatementKind}; use stable_mir::ty::{RigidTy, TyKind, UintTy}; -use stable_mir::ItemKind; use std::assert_matches::assert_matches; use std::io::Write; use std::ops::ControlFlow; @@ -31,7 +31,7 @@ const CRATE_NAME: &str = "input"; /// Tests projections within Place objects fn test_place_projections() -> ControlFlow<()> { let items = stable_mir::all_local_items(); - let body = get_item(&items, (ItemKind::Fn, "projections")).unwrap().body(); + let body = get_item(&items, (ItemKind::Fn, "projections")).unwrap().expect_body(); assert_eq!(body.blocks.len(), 4); // The first statement assigns `&s.c` to a local. The projections include a deref for `s`, since // `s` is passed as a reference argument, and a field access for field `c`. @@ -53,7 +53,7 @@ fn test_place_projections() -> ControlFlow<()> { ); let ty = place.ty(body.locals()).unwrap(); assert_matches!(ty.kind().rigid(), Some(RigidTy::Ref(..))); - }, + } other => panic!( "Unable to match against expected rvalue projection. Expected the projection \ for `s.c`, which is a Deref and u8 Field. Got: {:?}", @@ -137,9 +137,7 @@ fn get_item<'a>( items: &'a stable_mir::CrateItems, item: (ItemKind, &str), ) -> Option<&'a stable_mir::CrateItem> { - items.iter().find(|crate_item| { - crate_item.kind() == item.0 && crate_item.name() == item.1 - }) + items.iter().find(|crate_item| crate_item.kind() == item.0 && crate_item.name() == item.1) } /// This test will generate and analyze a dummy crate using the stable mir. diff --git a/tests/ui-fulldeps/stable-mir/smir_internal.rs b/tests/ui-fulldeps/stable-mir/smir_internal.rs index 453e5372de4..f9972dc27e3 100644 --- a/tests/ui-fulldeps/stable-mir/smir_internal.rs +++ b/tests/ui-fulldeps/stable-mir/smir_internal.rs @@ -26,7 +26,7 @@ const CRATE_NAME: &str = "input"; fn test_translation(tcx: TyCtxt<'_>) -> ControlFlow<()> { let main_fn = stable_mir::entry_fn().unwrap(); - let body = main_fn.body(); + let body = main_fn.expect_body(); let orig_ty = body.locals()[0].ty; let rustc_ty = rustc_internal::internal(tcx, &orig_ty); assert!(rustc_ty.is_unit()); diff --git a/tests/ui-fulldeps/stable-mir/smir_serde.rs b/tests/ui-fulldeps/stable-mir/smir_serde.rs index 2c74276d550..9b3638a9f2f 100644 --- a/tests/ui-fulldeps/stable-mir/smir_serde.rs +++ b/tests/ui-fulldeps/stable-mir/smir_serde.rs @@ -14,33 +14,29 @@ extern crate rustc_smir; extern crate rustc_driver; extern crate rustc_interface; extern crate rustc_middle; -extern crate stable_mir; extern crate serde; extern crate serde_json; +extern crate stable_mir; use rustc_middle::ty::TyCtxt; use rustc_smir::rustc_internal; +use serde_json::to_string; use stable_mir::mir::Body; -use std::io::{Write, BufWriter}; +use std::io::{BufWriter, Write}; use std::ops::ControlFlow; -use serde_json::to_string; - const CRATE_NAME: &str = "input"; fn serialize_to_json(_tcx: TyCtxt<'_>) -> ControlFlow<()> { let path = "output.json"; - let mut writer = BufWriter::new(std::fs::File::create(path) - .expect("Failed to create path")); + let mut writer = BufWriter::new(std::fs::File::create(path).expect("Failed to create path")); let local_crate = stable_mir::local_crate(); - let items: Vec<Body> = stable_mir::all_local_items() - .iter() - .map(|item| { item.body() }) - .collect(); - let crate_data = ( local_crate.name, items ); - writer.write_all(to_string(&crate_data) - .expect("serde_json failed") - .as_bytes()).expect("JSON serialization failed"); + let items: Vec<Body> = + stable_mir::all_local_items().iter().map(|item| item.expect_body()).collect(); + let crate_data = (local_crate.name, items); + writer + .write_all(to_string(&crate_data).expect("serde_json failed").as_bytes()) + .expect("JSON serialization failed"); ControlFlow::Continue(()) } diff --git a/tests/ui-fulldeps/stable-mir/smir_visitor.rs b/tests/ui-fulldeps/stable-mir/smir_visitor.rs index 0a6415d490e..cffb41742b4 100644 --- a/tests/ui-fulldeps/stable-mir/smir_visitor.rs +++ b/tests/ui-fulldeps/stable-mir/smir_visitor.rs @@ -16,10 +16,10 @@ extern crate rustc_driver; extern crate rustc_interface; extern crate stable_mir; -use std::collections::HashSet; use rustc_smir::rustc_internal; -use stable_mir::*; use stable_mir::mir::MirVisitor; +use stable_mir::*; +use std::collections::HashSet; use std::io::Write; use std::ops::ControlFlow; @@ -27,7 +27,7 @@ const CRATE_NAME: &str = "input"; fn test_visitor() -> ControlFlow<()> { let main_fn = stable_mir::entry_fn(); - let main_body = main_fn.unwrap().body(); + let main_body = main_fn.unwrap().expect_body(); let main_visitor = TestVisitor::collect(&main_body); assert!(main_visitor.ret_val.is_some()); assert!(main_visitor.args.is_empty()); @@ -51,7 +51,7 @@ struct TestVisitor<'a> { pub tys: HashSet<ty::Ty>, pub ret_val: Option<mir::LocalDecl>, pub args: Vec<mir::LocalDecl>, - pub calls: Vec<mir::mono::Instance> + pub calls: Vec<mir::mono::Instance>, } impl<'a> TestVisitor<'a> { @@ -90,8 +90,8 @@ impl<'a> mir::MirVisitor for TestVisitor<'a> { fn visit_terminator(&mut self, term: &mir::Terminator, location: mir::visit::Location) { if let mir::TerminatorKind::Call { func, .. } = &term.kind { let ty::TyKind::RigidTy(ty) = func.ty(self.body.locals()).unwrap().kind() else { - unreachable! - () }; + unreachable!() + }; let ty::RigidTy::FnDef(def, args) = ty else { unreachable!() }; self.calls.push(mir::mono::Instance::resolve(def, &args).unwrap()); } diff --git a/tests/ui/abi/arm-unadjusted-intrinsic.rs b/tests/ui/abi/arm-unadjusted-intrinsic.rs index 533cd40b30a..dcf0d9f39f6 100644 --- a/tests/ui/abi/arm-unadjusted-intrinsic.rs +++ b/tests/ui/abi/arm-unadjusted-intrinsic.rs @@ -1,3 +1,4 @@ +//@ add-core-stubs //@ build-pass //@ revisions: arm //@[arm] compile-flags: --target arm-unknown-linux-gnueabi @@ -14,19 +15,8 @@ #![crate_type = "lib"] #![allow(non_camel_case_types)] -/// To work cross-target this test must be no_core. -/// This little prelude supplies what we need. -#[lang = "sized"] -pub trait Sized {} - -#[lang = "copy"] -pub trait Copy: Sized {} -impl Copy for i8 {} -impl<T: ?Sized> Copy for *const T {} -impl<T: ?Sized> Copy for *mut T {} - -// I hate no_core tests! -impl<T: Copy, const N: usize> Copy for [T; N] {} +extern crate minicore; +use minicore::*; // Regression test for https://github.com/rust-lang/rust/issues/118124. diff --git a/tests/ui/abi/c-zst.aarch64-darwin.stderr b/tests/ui/abi/c-zst.aarch64-darwin.stderr index 57cc48aa9cf..48fa2bf29bc 100644 --- a/tests/ui/abi/c-zst.aarch64-darwin.stderr +++ b/tests/ui/abi/c-zst.aarch64-darwin.stderr @@ -9,7 +9,7 @@ error: fn_abi_of(pass_zst) = FnAbi { abi: $SOME_ALIGN, pref: $SOME_ALIGN, }, - abi: Memory { + backend_repr: Memory { sized: true, }, fields: Arbitrary { @@ -38,7 +38,7 @@ error: fn_abi_of(pass_zst) = FnAbi { abi: $SOME_ALIGN, pref: $SOME_ALIGN, }, - abi: Memory { + backend_repr: Memory { sized: true, }, fields: Arbitrary { diff --git a/tests/ui/abi/c-zst.powerpc-linux.stderr b/tests/ui/abi/c-zst.powerpc-linux.stderr index 67380176730..bfdf94c9900 100644 --- a/tests/ui/abi/c-zst.powerpc-linux.stderr +++ b/tests/ui/abi/c-zst.powerpc-linux.stderr @@ -9,7 +9,7 @@ error: fn_abi_of(pass_zst) = FnAbi { abi: $SOME_ALIGN, pref: $SOME_ALIGN, }, - abi: Memory { + backend_repr: Memory { sized: true, }, fields: Arbitrary { @@ -49,7 +49,7 @@ error: fn_abi_of(pass_zst) = FnAbi { abi: $SOME_ALIGN, pref: $SOME_ALIGN, }, - abi: Memory { + backend_repr: Memory { sized: true, }, fields: Arbitrary { diff --git a/tests/ui/abi/c-zst.s390x-linux.stderr b/tests/ui/abi/c-zst.s390x-linux.stderr index 67380176730..bfdf94c9900 100644 --- a/tests/ui/abi/c-zst.s390x-linux.stderr +++ b/tests/ui/abi/c-zst.s390x-linux.stderr @@ -9,7 +9,7 @@ error: fn_abi_of(pass_zst) = FnAbi { abi: $SOME_ALIGN, pref: $SOME_ALIGN, }, - abi: Memory { + backend_repr: Memory { sized: true, }, fields: Arbitrary { @@ -49,7 +49,7 @@ error: fn_abi_of(pass_zst) = FnAbi { abi: $SOME_ALIGN, pref: $SOME_ALIGN, }, - abi: Memory { + backend_repr: Memory { sized: true, }, fields: Arbitrary { diff --git a/tests/ui/abi/c-zst.sparc64-linux.stderr b/tests/ui/abi/c-zst.sparc64-linux.stderr index 67380176730..bfdf94c9900 100644 --- a/tests/ui/abi/c-zst.sparc64-linux.stderr +++ b/tests/ui/abi/c-zst.sparc64-linux.stderr @@ -9,7 +9,7 @@ error: fn_abi_of(pass_zst) = FnAbi { abi: $SOME_ALIGN, pref: $SOME_ALIGN, }, - abi: Memory { + backend_repr: Memory { sized: true, }, fields: Arbitrary { @@ -49,7 +49,7 @@ error: fn_abi_of(pass_zst) = FnAbi { abi: $SOME_ALIGN, pref: $SOME_ALIGN, }, - abi: Memory { + backend_repr: Memory { sized: true, }, fields: Arbitrary { diff --git a/tests/ui/abi/c-zst.x86_64-linux.stderr b/tests/ui/abi/c-zst.x86_64-linux.stderr index 57cc48aa9cf..48fa2bf29bc 100644 --- a/tests/ui/abi/c-zst.x86_64-linux.stderr +++ b/tests/ui/abi/c-zst.x86_64-linux.stderr @@ -9,7 +9,7 @@ error: fn_abi_of(pass_zst) = FnAbi { abi: $SOME_ALIGN, pref: $SOME_ALIGN, }, - abi: Memory { + backend_repr: Memory { sized: true, }, fields: Arbitrary { @@ -38,7 +38,7 @@ error: fn_abi_of(pass_zst) = FnAbi { abi: $SOME_ALIGN, pref: $SOME_ALIGN, }, - abi: Memory { + backend_repr: Memory { sized: true, }, fields: Arbitrary { 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 67380176730..bfdf94c9900 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 @@ -9,7 +9,7 @@ error: fn_abi_of(pass_zst) = FnAbi { abi: $SOME_ALIGN, pref: $SOME_ALIGN, }, - abi: Memory { + backend_repr: Memory { sized: true, }, fields: Arbitrary { @@ -49,7 +49,7 @@ error: fn_abi_of(pass_zst) = FnAbi { abi: $SOME_ALIGN, pref: $SOME_ALIGN, }, - abi: Memory { + backend_repr: Memory { sized: true, }, fields: Arbitrary { diff --git a/tests/ui/abi/debug.stderr b/tests/ui/abi/debug.stderr index 5f73ff7d6bd..2239ba0e588 100644 --- a/tests/ui/abi/debug.stderr +++ b/tests/ui/abi/debug.stderr @@ -9,7 +9,7 @@ error: fn_abi_of(test) = FnAbi { abi: $SOME_ALIGN, pref: $SOME_ALIGN, }, - abi: Scalar( + backend_repr: Scalar( Initialized { value: Int( I8, @@ -48,7 +48,7 @@ error: fn_abi_of(test) = FnAbi { abi: $SOME_ALIGN, pref: $SOME_ALIGN, }, - abi: Scalar( + backend_repr: Scalar( Initialized { value: Int( I8, @@ -107,7 +107,7 @@ error: fn_abi_of(TestFnPtr) = FnAbi { abi: $SOME_ALIGN, pref: $SOME_ALIGN, }, - abi: Scalar( + backend_repr: Scalar( Initialized { value: Int( I8, @@ -155,7 +155,7 @@ error: fn_abi_of(TestFnPtr) = FnAbi { abi: $SOME_ALIGN, pref: $SOME_ALIGN, }, - abi: Scalar( + backend_repr: Scalar( Initialized { value: Int( I8, @@ -205,7 +205,7 @@ error: fn_abi_of(test_generic) = FnAbi { abi: $SOME_ALIGN, pref: $SOME_ALIGN, }, - abi: Scalar( + backend_repr: Scalar( Initialized { value: Pointer( AddressSpace( @@ -245,7 +245,7 @@ error: fn_abi_of(test_generic) = FnAbi { abi: $SOME_ALIGN, pref: $SOME_ALIGN, }, - abi: Memory { + backend_repr: Memory { sized: true, }, fields: Arbitrary { @@ -292,7 +292,7 @@ error: ABIs are not compatible abi: $SOME_ALIGN, pref: $SOME_ALIGN, }, - abi: Scalar( + backend_repr: Scalar( Initialized { value: Int( I8, @@ -331,7 +331,7 @@ error: ABIs are not compatible abi: $SOME_ALIGN, pref: $SOME_ALIGN, }, - abi: Memory { + backend_repr: Memory { sized: true, }, fields: Arbitrary { @@ -366,7 +366,7 @@ error: ABIs are not compatible abi: $SOME_ALIGN, pref: $SOME_ALIGN, }, - abi: Scalar( + backend_repr: Scalar( Initialized { value: Int( I32, @@ -405,7 +405,7 @@ error: ABIs are not compatible abi: $SOME_ALIGN, pref: $SOME_ALIGN, }, - abi: Memory { + backend_repr: Memory { sized: true, }, fields: Arbitrary { @@ -446,7 +446,7 @@ error: ABIs are not compatible abi: $SOME_ALIGN, pref: $SOME_ALIGN, }, - abi: Memory { + backend_repr: Memory { sized: true, }, fields: Array { @@ -486,7 +486,7 @@ error: ABIs are not compatible abi: $SOME_ALIGN, pref: $SOME_ALIGN, }, - abi: Memory { + backend_repr: Memory { sized: true, }, fields: Arbitrary { @@ -521,7 +521,7 @@ error: ABIs are not compatible abi: $SOME_ALIGN, pref: $SOME_ALIGN, }, - abi: Memory { + backend_repr: Memory { sized: true, }, fields: Array { @@ -561,7 +561,7 @@ error: ABIs are not compatible abi: $SOME_ALIGN, pref: $SOME_ALIGN, }, - abi: Memory { + backend_repr: Memory { sized: true, }, fields: Arbitrary { @@ -602,7 +602,7 @@ error: ABIs are not compatible abi: $SOME_ALIGN, pref: $SOME_ALIGN, }, - abi: Scalar( + backend_repr: Scalar( Initialized { value: Float( F32, @@ -640,7 +640,7 @@ error: ABIs are not compatible abi: $SOME_ALIGN, pref: $SOME_ALIGN, }, - abi: Memory { + backend_repr: Memory { sized: true, }, fields: Arbitrary { @@ -675,7 +675,7 @@ error: ABIs are not compatible abi: $SOME_ALIGN, pref: $SOME_ALIGN, }, - abi: Scalar( + backend_repr: Scalar( Initialized { value: Int( I32, @@ -714,7 +714,7 @@ error: ABIs are not compatible abi: $SOME_ALIGN, pref: $SOME_ALIGN, }, - abi: Memory { + backend_repr: Memory { sized: true, }, fields: Arbitrary { @@ -755,7 +755,7 @@ error: ABIs are not compatible abi: $SOME_ALIGN, pref: $SOME_ALIGN, }, - abi: Scalar( + backend_repr: Scalar( Initialized { value: Int( I32, @@ -794,7 +794,7 @@ error: ABIs are not compatible abi: $SOME_ALIGN, pref: $SOME_ALIGN, }, - abi: Memory { + backend_repr: Memory { sized: true, }, fields: Arbitrary { @@ -829,7 +829,7 @@ error: ABIs are not compatible abi: $SOME_ALIGN, pref: $SOME_ALIGN, }, - abi: Scalar( + backend_repr: Scalar( Initialized { value: Int( I32, @@ -868,7 +868,7 @@ error: ABIs are not compatible abi: $SOME_ALIGN, pref: $SOME_ALIGN, }, - abi: Memory { + backend_repr: Memory { sized: true, }, fields: Arbitrary { @@ -923,7 +923,7 @@ error: fn_abi_of(assoc_test) = FnAbi { abi: $SOME_ALIGN, pref: $SOME_ALIGN, }, - abi: Scalar( + backend_repr: Scalar( Initialized { value: Pointer( AddressSpace( @@ -975,7 +975,7 @@ error: fn_abi_of(assoc_test) = FnAbi { abi: $SOME_ALIGN, pref: $SOME_ALIGN, }, - abi: Memory { + backend_repr: Memory { sized: true, }, fields: Arbitrary { diff --git a/tests/ui/abi/riscv-discoverability-guidance.riscv32.stderr b/tests/ui/abi/riscv-discoverability-guidance.riscv32.stderr index e1f43347985..c71797b500d 100644 --- a/tests/ui/abi/riscv-discoverability-guidance.riscv32.stderr +++ b/tests/ui/abi/riscv-discoverability-guidance.riscv32.stderr @@ -1,24 +1,27 @@ error[E0703]: invalid ABI: found `riscv-interrupt` - --> $DIR/riscv-discoverability-guidance.rs:17:8 + --> $DIR/riscv-discoverability-guidance.rs:15:8 | LL | extern "riscv-interrupt" fn isr() {} - | ^^^^^^^^^^^^^^^^^ - | | - | invalid ABI - | help: did you mean: `"riscv-interrupt-m"` + | ^^^^^^^^^^^^^^^^^ invalid ABI | = note: invoke `rustc --print=calling-conventions` for a full list of supported calling conventions +help: there's a similarly named valid ABI `riscv-interrupt-m` + | +LL | extern "riscv-interrupt-m" fn isr() {} + | ++ error[E0703]: invalid ABI: found `riscv-interrupt-u` - --> $DIR/riscv-discoverability-guidance.rs:22:8 + --> $DIR/riscv-discoverability-guidance.rs:20:8 | LL | extern "riscv-interrupt-u" fn isr_U() {} - | ^^^^^^^^^^^^^^^^^^^ - | | - | invalid ABI - | help: did you mean: `"riscv-interrupt-m"` + | ^^^^^^^^^^^^^^^^^^^ invalid ABI | = note: invoke `rustc --print=calling-conventions` for a full list of supported calling conventions +help: there's a similarly named valid ABI `riscv-interrupt-m` + | +LL - extern "riscv-interrupt-u" fn isr_U() {} +LL + extern "riscv-interrupt-m" fn isr_U() {} + | error: aborting due to 2 previous errors diff --git a/tests/ui/abi/riscv-discoverability-guidance.riscv64.stderr b/tests/ui/abi/riscv-discoverability-guidance.riscv64.stderr index e1f43347985..c71797b500d 100644 --- a/tests/ui/abi/riscv-discoverability-guidance.riscv64.stderr +++ b/tests/ui/abi/riscv-discoverability-guidance.riscv64.stderr @@ -1,24 +1,27 @@ error[E0703]: invalid ABI: found `riscv-interrupt` - --> $DIR/riscv-discoverability-guidance.rs:17:8 + --> $DIR/riscv-discoverability-guidance.rs:15:8 | LL | extern "riscv-interrupt" fn isr() {} - | ^^^^^^^^^^^^^^^^^ - | | - | invalid ABI - | help: did you mean: `"riscv-interrupt-m"` + | ^^^^^^^^^^^^^^^^^ invalid ABI | = note: invoke `rustc --print=calling-conventions` for a full list of supported calling conventions +help: there's a similarly named valid ABI `riscv-interrupt-m` + | +LL | extern "riscv-interrupt-m" fn isr() {} + | ++ error[E0703]: invalid ABI: found `riscv-interrupt-u` - --> $DIR/riscv-discoverability-guidance.rs:22:8 + --> $DIR/riscv-discoverability-guidance.rs:20:8 | LL | extern "riscv-interrupt-u" fn isr_U() {} - | ^^^^^^^^^^^^^^^^^^^ - | | - | invalid ABI - | help: did you mean: `"riscv-interrupt-m"` + | ^^^^^^^^^^^^^^^^^^^ invalid ABI | = note: invoke `rustc --print=calling-conventions` for a full list of supported calling conventions +help: there's a similarly named valid ABI `riscv-interrupt-m` + | +LL - extern "riscv-interrupt-u" fn isr_U() {} +LL + extern "riscv-interrupt-m" fn isr_U() {} + | error: aborting due to 2 previous errors diff --git a/tests/ui/abi/riscv-discoverability-guidance.rs b/tests/ui/abi/riscv-discoverability-guidance.rs index dec5059b0a7..41cce35aefa 100644 --- a/tests/ui/abi/riscv-discoverability-guidance.rs +++ b/tests/ui/abi/riscv-discoverability-guidance.rs @@ -1,4 +1,5 @@ // ignore-tidy-linelength +//@ add-core-stubs //@ revisions: riscv32 riscv64 // //@ [riscv32] needs-llvm-components: riscv @@ -6,13 +7,10 @@ //@ [riscv64] needs-llvm-components: riscv //@ [riscv64] compile-flags: --target=riscv64gc-unknown-none-elf -C target-feature=-unaligned-scalar-mem --crate-type=rlib #![no_core] -#![feature( - no_core, - lang_items, - abi_riscv_interrupt -)] -#[lang = "sized"] -trait Sized {} +#![feature(no_core, lang_items, abi_riscv_interrupt)] + +extern crate minicore; +use minicore::*; extern "riscv-interrupt" fn isr() {} //~^ ERROR invalid ABI diff --git a/tests/ui/abi/rust-cold-works-with-rustic-args.rs b/tests/ui/abi/rust-cold-works-with-rustic-args.rs new file mode 100644 index 00000000000..57027364699 --- /dev/null +++ b/tests/ui/abi/rust-cold-works-with-rustic-args.rs @@ -0,0 +1,6 @@ +//@build-pass +//@compile-flags: -Clink-dead-code=true --crate-type lib +// We used to not handle all "rustic" ABIs in a (relatively) uniform way, +// so we failed to fix up arguments for actually passing through the ABI... +#![feature(rust_cold_cc)] +pub extern "rust-cold" fn foo(_: [usize; 3]) {} diff --git a/tests/ui/abi/sparcv8plus-llvm19.rs b/tests/ui/abi/sparcv8plus-llvm19.rs index a884e5ca06f..3d6d8568b6e 100644 --- a/tests/ui/abi/sparcv8plus-llvm19.rs +++ b/tests/ui/abi/sparcv8plus-llvm19.rs @@ -1,3 +1,4 @@ +//@ add-core-stubs //@ revisions: sparc sparcv8plus sparc_cpu_v9 sparc_feature_v8plus sparc_cpu_v9_feature_v8plus //@[sparc] compile-flags: --target sparc-unknown-none-elf //@[sparc] needs-llvm-components: sparc @@ -15,10 +16,8 @@ #![feature(no_core, rustc_attrs, lang_items)] #![no_core] -#[lang = "sized"] -trait Sized {} -#[lang = "copy"] -trait Copy {} +extern crate minicore; +use minicore::*; #[rustc_builtin_macro] macro_rules! compile_error { diff --git a/tests/ui/abi/sparcv8plus-llvm19.sparc.stderr b/tests/ui/abi/sparcv8plus-llvm19.sparc.stderr index 7eedf26135f..d3462ae87d3 100644 --- a/tests/ui/abi/sparcv8plus-llvm19.sparc.stderr +++ b/tests/ui/abi/sparcv8plus-llvm19.sparc.stderr @@ -1,5 +1,5 @@ error: -v8plus,-v9 - --> $DIR/sparcv8plus-llvm19.rs:29:1 + --> $DIR/sparcv8plus-llvm19.rs:28:1 | LL | compile_error!("-v8plus,-v9"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/abi/sparcv8plus-llvm19.sparc_cpu_v9.stderr b/tests/ui/abi/sparcv8plus-llvm19.sparc_cpu_v9.stderr index ac61df35678..9891aec94b8 100644 --- a/tests/ui/abi/sparcv8plus-llvm19.sparc_cpu_v9.stderr +++ b/tests/ui/abi/sparcv8plus-llvm19.sparc_cpu_v9.stderr @@ -1,5 +1,5 @@ error: +v8plus,+v9 - --> $DIR/sparcv8plus-llvm19.rs:34:1 + --> $DIR/sparcv8plus-llvm19.rs:33:1 | LL | compile_error!("+v8plus,+v9"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/abi/sparcv8plus-llvm19.sparc_cpu_v9_feature_v8plus.stderr b/tests/ui/abi/sparcv8plus-llvm19.sparc_cpu_v9_feature_v8plus.stderr index ac61df35678..9891aec94b8 100644 --- a/tests/ui/abi/sparcv8plus-llvm19.sparc_cpu_v9_feature_v8plus.stderr +++ b/tests/ui/abi/sparcv8plus-llvm19.sparc_cpu_v9_feature_v8plus.stderr @@ -1,5 +1,5 @@ error: +v8plus,+v9 - --> $DIR/sparcv8plus-llvm19.rs:34:1 + --> $DIR/sparcv8plus-llvm19.rs:33:1 | LL | compile_error!("+v8plus,+v9"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/abi/sparcv8plus-llvm19.sparc_feature_v8plus.stderr b/tests/ui/abi/sparcv8plus-llvm19.sparc_feature_v8plus.stderr index 1bf7a3ad76a..dbcdb8ed121 100644 --- a/tests/ui/abi/sparcv8plus-llvm19.sparc_feature_v8plus.stderr +++ b/tests/ui/abi/sparcv8plus-llvm19.sparc_feature_v8plus.stderr @@ -1,5 +1,5 @@ error: +v8plus,-v9 (FIXME) - --> $DIR/sparcv8plus-llvm19.rs:39:1 + --> $DIR/sparcv8plus-llvm19.rs:38:1 | LL | compile_error!("+v8plus,-v9 (FIXME)"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/abi/sparcv8plus-llvm19.sparcv8plus.stderr b/tests/ui/abi/sparcv8plus-llvm19.sparcv8plus.stderr index ac61df35678..9891aec94b8 100644 --- a/tests/ui/abi/sparcv8plus-llvm19.sparcv8plus.stderr +++ b/tests/ui/abi/sparcv8plus-llvm19.sparcv8plus.stderr @@ -1,5 +1,5 @@ error: +v8plus,+v9 - --> $DIR/sparcv8plus-llvm19.rs:34:1 + --> $DIR/sparcv8plus-llvm19.rs:33:1 | LL | compile_error!("+v8plus,+v9"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/abi/sparcv8plus.rs b/tests/ui/abi/sparcv8plus.rs index a78ae0cd328..6c17f721838 100644 --- a/tests/ui/abi/sparcv8plus.rs +++ b/tests/ui/abi/sparcv8plus.rs @@ -1,3 +1,4 @@ +//@ add-core-stubs //@ revisions: sparc sparcv8plus sparc_cpu_v9 sparc_feature_v8plus sparc_cpu_v9_feature_v8plus //@[sparc] compile-flags: --target sparc-unknown-none-elf //@[sparc] needs-llvm-components: sparc @@ -15,10 +16,8 @@ #![feature(no_core, rustc_attrs, lang_items)] #![no_core] -#[lang = "sized"] -trait Sized {} -#[lang = "copy"] -trait Copy {} +extern crate minicore; +use minicore::*; #[rustc_builtin_macro] macro_rules! compile_error { diff --git a/tests/ui/abi/sparcv8plus.sparc.stderr b/tests/ui/abi/sparcv8plus.sparc.stderr index 6d14ff53ab9..e2aa89a9273 100644 --- a/tests/ui/abi/sparcv8plus.sparc.stderr +++ b/tests/ui/abi/sparcv8plus.sparc.stderr @@ -1,5 +1,5 @@ error: -v8plus,-v9 - --> $DIR/sparcv8plus.rs:29:1 + --> $DIR/sparcv8plus.rs:28:1 | LL | compile_error!("-v8plus,-v9"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/abi/sparcv8plus.sparc_cpu_v9.stderr b/tests/ui/abi/sparcv8plus.sparc_cpu_v9.stderr index 00fd7ef4ea8..2c5699f2dec 100644 --- a/tests/ui/abi/sparcv8plus.sparc_cpu_v9.stderr +++ b/tests/ui/abi/sparcv8plus.sparc_cpu_v9.stderr @@ -1,5 +1,5 @@ error: -v8plus,+v9 - --> $DIR/sparcv8plus.rs:42:1 + --> $DIR/sparcv8plus.rs:41:1 | LL | compile_error!("-v8plus,+v9"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/abi/sparcv8plus.sparc_cpu_v9_feature_v8plus.stderr b/tests/ui/abi/sparcv8plus.sparc_cpu_v9_feature_v8plus.stderr index a3c74e67f8f..4b96e4421f9 100644 --- a/tests/ui/abi/sparcv8plus.sparc_cpu_v9_feature_v8plus.stderr +++ b/tests/ui/abi/sparcv8plus.sparc_cpu_v9_feature_v8plus.stderr @@ -1,5 +1,5 @@ error: +v8plus,+v9 - --> $DIR/sparcv8plus.rs:33:1 + --> $DIR/sparcv8plus.rs:32:1 | LL | compile_error!("+v8plus,+v9"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/abi/sparcv8plus.sparc_feature_v8plus.stderr b/tests/ui/abi/sparcv8plus.sparc_feature_v8plus.stderr index 84f560d158c..dfdec88961b 100644 --- a/tests/ui/abi/sparcv8plus.sparc_feature_v8plus.stderr +++ b/tests/ui/abi/sparcv8plus.sparc_feature_v8plus.stderr @@ -1,5 +1,5 @@ error: +v8plus,-v9 (FIXME) - --> $DIR/sparcv8plus.rs:38:1 + --> $DIR/sparcv8plus.rs:37:1 | LL | compile_error!("+v8plus,-v9 (FIXME)"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/abi/sparcv8plus.sparcv8plus.stderr b/tests/ui/abi/sparcv8plus.sparcv8plus.stderr index a3c74e67f8f..4b96e4421f9 100644 --- a/tests/ui/abi/sparcv8plus.sparcv8plus.stderr +++ b/tests/ui/abi/sparcv8plus.sparcv8plus.stderr @@ -1,5 +1,5 @@ error: +v8plus,+v9 - --> $DIR/sparcv8plus.rs:33:1 + --> $DIR/sparcv8plus.rs:32:1 | LL | compile_error!("+v8plus,+v9"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/abi/sysv64-zst.stderr b/tests/ui/abi/sysv64-zst.stderr index ec85030c106..59d7b004417 100644 --- a/tests/ui/abi/sysv64-zst.stderr +++ b/tests/ui/abi/sysv64-zst.stderr @@ -9,7 +9,7 @@ error: fn_abi_of(pass_zst) = FnAbi { abi: $SOME_ALIGN, pref: $SOME_ALIGN, }, - abi: Memory { + backend_repr: Memory { sized: true, }, fields: Arbitrary { @@ -38,7 +38,7 @@ error: fn_abi_of(pass_zst) = FnAbi { abi: $SOME_ALIGN, pref: $SOME_ALIGN, }, - abi: Memory { + backend_repr: Memory { sized: true, }, fields: Arbitrary { diff --git a/tests/ui/abi/unsized-args-in-c-abi-issues-94223-115845.rs b/tests/ui/abi/unsized-args-in-c-abi-issues-94223-115845.rs index 376630b8d33..7d21307e1b2 100644 --- a/tests/ui/abi/unsized-args-in-c-abi-issues-94223-115845.rs +++ b/tests/ui/abi/unsized-args-in-c-abi-issues-94223-115845.rs @@ -1,9 +1,10 @@ //@ check-pass #![allow(improper_ctypes_definitions)] -#![feature(unsized_tuple_coercion)] #![feature(unsized_fn_params)] #![crate_type = "lib"] +struct Fat<T: ?Sized>(T); + // Check that computing the fn abi for `bad`, with a external ABI fn ptr that is not FFI-safe, does // not ICE. @@ -19,12 +20,12 @@ pub extern "C" fn declare_bad(_x: str) {} pub extern "system" fn declare_more_bad(f: dyn FnOnce()) { } -fn make_bad() -> extern "C" fn(([u8],)) { +fn make_bad() -> extern "C" fn(Fat<[u8]>) { todo!() } pub fn call_bad() { let f = make_bad(); - let slice: Box<([u8],)> = Box::new(([1; 8],)); + let slice: Box<Fat<[u8]>> = Box::new(Fat([1; 8])); f(*slice); } diff --git a/tests/ui/abi/unsupported.aarch64.stderr b/tests/ui/abi/unsupported.aarch64.stderr index 2eb6ab08232..c11cc4e2d52 100644 --- a/tests/ui/abi/unsupported.aarch64.stderr +++ b/tests/ui/abi/unsupported.aarch64.stderr @@ -1,5 +1,5 @@ warning: the calling convention "ptx-kernel" is not supported on this target - --> $DIR/unsupported.rs:36:15 + --> $DIR/unsupported.rs:35:15 | LL | fn ptx_ptr(f: extern "ptx-kernel" fn()) { | ^^^^^^^^^^^^^^^^^^^^^^^^ @@ -9,13 +9,13 @@ LL | fn ptx_ptr(f: extern "ptx-kernel" fn()) { = note: `#[warn(unsupported_fn_ptr_calling_conventions)]` on by default error[E0570]: `"ptx-kernel"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:41:1 + --> $DIR/unsupported.rs:40:1 | LL | extern "ptx-kernel" {} | ^^^^^^^^^^^^^^^^^^^^^^ warning: the calling convention "aapcs" is not supported on this target - --> $DIR/unsupported.rs:52:17 + --> $DIR/unsupported.rs:51:17 | LL | fn aapcs_ptr(f: extern "aapcs" fn()) { | ^^^^^^^^^^^^^^^^^^^ @@ -24,13 +24,13 @@ LL | fn aapcs_ptr(f: extern "aapcs" fn()) { = note: for more information, see issue #130260 <https://github.com/rust-lang/rust/issues/130260> error[E0570]: `"aapcs"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:65:1 + --> $DIR/unsupported.rs:64:1 | LL | extern "aapcs" {} | ^^^^^^^^^^^^^^^^^ warning: the calling convention "msp430-interrupt" is not supported on this target - --> $DIR/unsupported.rs:74:18 + --> $DIR/unsupported.rs:73:18 | LL | fn msp430_ptr(f: extern "msp430-interrupt" fn()) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -39,13 +39,13 @@ LL | fn msp430_ptr(f: extern "msp430-interrupt" fn()) { = note: for more information, see issue #130260 <https://github.com/rust-lang/rust/issues/130260> error[E0570]: `"msp430-interrupt"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:79:1 + --> $DIR/unsupported.rs:78:1 | LL | extern "msp430-interrupt" {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: the calling convention "avr-interrupt" is not supported on this target - --> $DIR/unsupported.rs:84:15 + --> $DIR/unsupported.rs:83:15 | LL | fn avr_ptr(f: extern "avr-interrupt" fn()) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -54,13 +54,13 @@ LL | fn avr_ptr(f: extern "avr-interrupt" fn()) { = note: for more information, see issue #130260 <https://github.com/rust-lang/rust/issues/130260> error[E0570]: `"avr-interrupt"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:89:1 + --> $DIR/unsupported.rs:88:1 | LL | extern "avr-interrupt" {} | ^^^^^^^^^^^^^^^^^^^^^^^^^ warning: the calling convention "riscv-interrupt-m" is not supported on this target - --> $DIR/unsupported.rs:97:17 + --> $DIR/unsupported.rs:96:17 | LL | fn riscv_ptr(f: extern "riscv-interrupt-m" fn()) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -69,13 +69,13 @@ LL | fn riscv_ptr(f: extern "riscv-interrupt-m" fn()) { = note: for more information, see issue #130260 <https://github.com/rust-lang/rust/issues/130260> error[E0570]: `"riscv-interrupt-m"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:108:1 + --> $DIR/unsupported.rs:107:1 | LL | extern "riscv-interrupt-m" {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: the calling convention "x86-interrupt" is not supported on this target - --> $DIR/unsupported.rs:119:15 + --> $DIR/unsupported.rs:118:15 | LL | fn x86_ptr(f: extern "x86-interrupt" fn()) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -84,13 +84,13 @@ LL | fn x86_ptr(f: extern "x86-interrupt" fn()) { = note: for more information, see issue #130260 <https://github.com/rust-lang/rust/issues/130260> error[E0570]: `"x86-interrupt"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:130:1 + --> $DIR/unsupported.rs:129:1 | LL | extern "x86-interrupt" {} | ^^^^^^^^^^^^^^^^^^^^^^^^^ warning: the calling convention "thiscall" is not supported on this target - --> $DIR/unsupported.rs:142:20 + --> $DIR/unsupported.rs:141:20 | LL | fn thiscall_ptr(f: extern "thiscall" fn()) { | ^^^^^^^^^^^^^^^^^^^^^^ @@ -99,13 +99,13 @@ LL | fn thiscall_ptr(f: extern "thiscall" fn()) { = note: for more information, see issue #130260 <https://github.com/rust-lang/rust/issues/130260> error[E0570]: `"thiscall"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:155:1 + --> $DIR/unsupported.rs:154:1 | LL | extern "thiscall" {} | ^^^^^^^^^^^^^^^^^^^^ warning: the calling convention "stdcall" is not supported on this target - --> $DIR/unsupported.rs:168:19 + --> $DIR/unsupported.rs:167:19 | LL | fn stdcall_ptr(f: extern "stdcall" fn()) { | ^^^^^^^^^^^^^^^^^^^^^ @@ -114,13 +114,13 @@ LL | fn stdcall_ptr(f: extern "stdcall" fn()) { = note: for more information, see issue #130260 <https://github.com/rust-lang/rust/issues/130260> error[E0570]: `"stdcall"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:181:1 + --> $DIR/unsupported.rs:180:1 | LL | extern "stdcall" {} | ^^^^^^^^^^^^^^^^^^^ warning: the calling convention "C-cmse-nonsecure-call" is not supported on this target - --> $DIR/unsupported.rs:188:21 + --> $DIR/unsupported.rs:187:21 | LL | fn cmse_call_ptr(f: extern "C-cmse-nonsecure-call" fn()) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -129,7 +129,7 @@ LL | fn cmse_call_ptr(f: extern "C-cmse-nonsecure-call" fn()) { = note: for more information, see issue #130260 <https://github.com/rust-lang/rust/issues/130260> warning: the calling convention "C-cmse-nonsecure-entry" is not supported on this target - --> $DIR/unsupported.rs:196:22 + --> $DIR/unsupported.rs:195:22 | LL | fn cmse_entry_ptr(f: extern "C-cmse-nonsecure-entry" fn()) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -138,67 +138,67 @@ LL | fn cmse_entry_ptr(f: extern "C-cmse-nonsecure-entry" fn()) { = note: for more information, see issue #130260 <https://github.com/rust-lang/rust/issues/130260> error[E0570]: `"C-cmse-nonsecure-entry"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:201:1 + --> $DIR/unsupported.rs:200:1 | LL | extern "C-cmse-nonsecure-entry" {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0570]: `"ptx-kernel"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:34:1 + --> $DIR/unsupported.rs:33:1 | LL | extern "ptx-kernel" fn ptx() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0570]: `"gpu-kernel"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:43:1 + --> $DIR/unsupported.rs:42:1 | LL | extern "gpu-kernel" fn gpu() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0570]: `"aapcs"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:46:1 + --> $DIR/unsupported.rs:45:1 | LL | extern "aapcs" fn aapcs() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0570]: `"msp430-interrupt"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:72:1 + --> $DIR/unsupported.rs:71:1 | LL | extern "msp430-interrupt" fn msp430() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0570]: `"avr-interrupt"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:82:1 + --> $DIR/unsupported.rs:81:1 | LL | extern "avr-interrupt" fn avr() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0570]: `"riscv-interrupt-m"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:92:1 + --> $DIR/unsupported.rs:91:1 | LL | extern "riscv-interrupt-m" fn riscv() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0570]: `"x86-interrupt"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:114:1 + --> $DIR/unsupported.rs:113:1 | LL | extern "x86-interrupt" fn x86() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0570]: `"thiscall"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:136:1 + --> $DIR/unsupported.rs:135:1 | LL | extern "thiscall" fn thiscall() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0570]: `"stdcall"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:162:1 + --> $DIR/unsupported.rs:161:1 | LL | extern "stdcall" fn stdcall() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0570]: `"C-cmse-nonsecure-entry"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:194:1 + --> $DIR/unsupported.rs:193:1 | LL | extern "C-cmse-nonsecure-entry" fn cmse_entry() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -206,3 +206,113 @@ LL | extern "C-cmse-nonsecure-entry" fn cmse_entry() {} error: aborting due to 19 previous errors; 10 warnings emitted For more information about this error, try `rustc --explain E0570`. +Future incompatibility report: Future breakage diagnostic: +warning: the calling convention "ptx-kernel" is not supported on this target + --> $DIR/unsupported.rs:35:15 + | +LL | fn ptx_ptr(f: extern "ptx-kernel" fn()) { + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #130260 <https://github.com/rust-lang/rust/issues/130260> + = note: `#[warn(unsupported_fn_ptr_calling_conventions)]` on by default + +Future breakage diagnostic: +warning: the calling convention "aapcs" is not supported on this target + --> $DIR/unsupported.rs:51:17 + | +LL | fn aapcs_ptr(f: extern "aapcs" fn()) { + | ^^^^^^^^^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #130260 <https://github.com/rust-lang/rust/issues/130260> + = note: `#[warn(unsupported_fn_ptr_calling_conventions)]` on by default + +Future breakage diagnostic: +warning: the calling convention "msp430-interrupt" is not supported on this target + --> $DIR/unsupported.rs:73:18 + | +LL | fn msp430_ptr(f: extern "msp430-interrupt" fn()) { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #130260 <https://github.com/rust-lang/rust/issues/130260> + = note: `#[warn(unsupported_fn_ptr_calling_conventions)]` on by default + +Future breakage diagnostic: +warning: the calling convention "avr-interrupt" is not supported on this target + --> $DIR/unsupported.rs:83:15 + | +LL | fn avr_ptr(f: extern "avr-interrupt" fn()) { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #130260 <https://github.com/rust-lang/rust/issues/130260> + = note: `#[warn(unsupported_fn_ptr_calling_conventions)]` on by default + +Future breakage diagnostic: +warning: the calling convention "riscv-interrupt-m" is not supported on this target + --> $DIR/unsupported.rs:96:17 + | +LL | fn riscv_ptr(f: extern "riscv-interrupt-m" fn()) { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #130260 <https://github.com/rust-lang/rust/issues/130260> + = note: `#[warn(unsupported_fn_ptr_calling_conventions)]` on by default + +Future breakage diagnostic: +warning: the calling convention "x86-interrupt" is not supported on this target + --> $DIR/unsupported.rs:118:15 + | +LL | fn x86_ptr(f: extern "x86-interrupt" fn()) { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #130260 <https://github.com/rust-lang/rust/issues/130260> + = note: `#[warn(unsupported_fn_ptr_calling_conventions)]` on by default + +Future breakage diagnostic: +warning: the calling convention "thiscall" is not supported on this target + --> $DIR/unsupported.rs:141:20 + | +LL | fn thiscall_ptr(f: extern "thiscall" fn()) { + | ^^^^^^^^^^^^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #130260 <https://github.com/rust-lang/rust/issues/130260> + = note: `#[warn(unsupported_fn_ptr_calling_conventions)]` on by default + +Future breakage diagnostic: +warning: the calling convention "stdcall" is not supported on this target + --> $DIR/unsupported.rs:167:19 + | +LL | fn stdcall_ptr(f: extern "stdcall" fn()) { + | ^^^^^^^^^^^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #130260 <https://github.com/rust-lang/rust/issues/130260> + = note: `#[warn(unsupported_fn_ptr_calling_conventions)]` on by default + +Future breakage diagnostic: +warning: the calling convention "C-cmse-nonsecure-call" is not supported on this target + --> $DIR/unsupported.rs:187:21 + | +LL | fn cmse_call_ptr(f: extern "C-cmse-nonsecure-call" fn()) { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #130260 <https://github.com/rust-lang/rust/issues/130260> + = note: `#[warn(unsupported_fn_ptr_calling_conventions)]` on by default + +Future breakage diagnostic: +warning: the calling convention "C-cmse-nonsecure-entry" is not supported on this target + --> $DIR/unsupported.rs:195:22 + | +LL | fn cmse_entry_ptr(f: extern "C-cmse-nonsecure-entry" fn()) { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #130260 <https://github.com/rust-lang/rust/issues/130260> + = note: `#[warn(unsupported_fn_ptr_calling_conventions)]` on by default + diff --git a/tests/ui/abi/unsupported.arm.stderr b/tests/ui/abi/unsupported.arm.stderr index ee878379cc6..b2f24381336 100644 --- a/tests/ui/abi/unsupported.arm.stderr +++ b/tests/ui/abi/unsupported.arm.stderr @@ -1,5 +1,5 @@ warning: the calling convention "ptx-kernel" is not supported on this target - --> $DIR/unsupported.rs:36:15 + --> $DIR/unsupported.rs:35:15 | LL | fn ptx_ptr(f: extern "ptx-kernel" fn()) { | ^^^^^^^^^^^^^^^^^^^^^^^^ @@ -9,13 +9,13 @@ LL | fn ptx_ptr(f: extern "ptx-kernel" fn()) { = note: `#[warn(unsupported_fn_ptr_calling_conventions)]` on by default error[E0570]: `"ptx-kernel"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:41:1 + --> $DIR/unsupported.rs:40:1 | LL | extern "ptx-kernel" {} | ^^^^^^^^^^^^^^^^^^^^^^ warning: the calling convention "msp430-interrupt" is not supported on this target - --> $DIR/unsupported.rs:74:18 + --> $DIR/unsupported.rs:73:18 | LL | fn msp430_ptr(f: extern "msp430-interrupt" fn()) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -24,13 +24,13 @@ LL | fn msp430_ptr(f: extern "msp430-interrupt" fn()) { = note: for more information, see issue #130260 <https://github.com/rust-lang/rust/issues/130260> error[E0570]: `"msp430-interrupt"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:79:1 + --> $DIR/unsupported.rs:78:1 | LL | extern "msp430-interrupt" {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: the calling convention "avr-interrupt" is not supported on this target - --> $DIR/unsupported.rs:84:15 + --> $DIR/unsupported.rs:83:15 | LL | fn avr_ptr(f: extern "avr-interrupt" fn()) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -39,13 +39,13 @@ LL | fn avr_ptr(f: extern "avr-interrupt" fn()) { = note: for more information, see issue #130260 <https://github.com/rust-lang/rust/issues/130260> error[E0570]: `"avr-interrupt"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:89:1 + --> $DIR/unsupported.rs:88:1 | LL | extern "avr-interrupt" {} | ^^^^^^^^^^^^^^^^^^^^^^^^^ warning: the calling convention "riscv-interrupt-m" is not supported on this target - --> $DIR/unsupported.rs:97:17 + --> $DIR/unsupported.rs:96:17 | LL | fn riscv_ptr(f: extern "riscv-interrupt-m" fn()) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -54,13 +54,13 @@ LL | fn riscv_ptr(f: extern "riscv-interrupt-m" fn()) { = note: for more information, see issue #130260 <https://github.com/rust-lang/rust/issues/130260> error[E0570]: `"riscv-interrupt-m"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:108:1 + --> $DIR/unsupported.rs:107:1 | LL | extern "riscv-interrupt-m" {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: the calling convention "x86-interrupt" is not supported on this target - --> $DIR/unsupported.rs:119:15 + --> $DIR/unsupported.rs:118:15 | LL | fn x86_ptr(f: extern "x86-interrupt" fn()) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -69,13 +69,13 @@ LL | fn x86_ptr(f: extern "x86-interrupt" fn()) { = note: for more information, see issue #130260 <https://github.com/rust-lang/rust/issues/130260> error[E0570]: `"x86-interrupt"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:130:1 + --> $DIR/unsupported.rs:129:1 | LL | extern "x86-interrupt" {} | ^^^^^^^^^^^^^^^^^^^^^^^^^ warning: the calling convention "thiscall" is not supported on this target - --> $DIR/unsupported.rs:142:20 + --> $DIR/unsupported.rs:141:20 | LL | fn thiscall_ptr(f: extern "thiscall" fn()) { | ^^^^^^^^^^^^^^^^^^^^^^ @@ -84,13 +84,13 @@ LL | fn thiscall_ptr(f: extern "thiscall" fn()) { = note: for more information, see issue #130260 <https://github.com/rust-lang/rust/issues/130260> error[E0570]: `"thiscall"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:155:1 + --> $DIR/unsupported.rs:154:1 | LL | extern "thiscall" {} | ^^^^^^^^^^^^^^^^^^^^ warning: the calling convention "stdcall" is not supported on this target - --> $DIR/unsupported.rs:168:19 + --> $DIR/unsupported.rs:167:19 | LL | fn stdcall_ptr(f: extern "stdcall" fn()) { | ^^^^^^^^^^^^^^^^^^^^^ @@ -99,13 +99,13 @@ LL | fn stdcall_ptr(f: extern "stdcall" fn()) { = note: for more information, see issue #130260 <https://github.com/rust-lang/rust/issues/130260> error[E0570]: `"stdcall"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:181:1 + --> $DIR/unsupported.rs:180:1 | LL | extern "stdcall" {} | ^^^^^^^^^^^^^^^^^^^ warning: the calling convention "C-cmse-nonsecure-call" is not supported on this target - --> $DIR/unsupported.rs:188:21 + --> $DIR/unsupported.rs:187:21 | LL | fn cmse_call_ptr(f: extern "C-cmse-nonsecure-call" fn()) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -114,7 +114,7 @@ LL | fn cmse_call_ptr(f: extern "C-cmse-nonsecure-call" fn()) { = note: for more information, see issue #130260 <https://github.com/rust-lang/rust/issues/130260> warning: the calling convention "C-cmse-nonsecure-entry" is not supported on this target - --> $DIR/unsupported.rs:196:22 + --> $DIR/unsupported.rs:195:22 | LL | fn cmse_entry_ptr(f: extern "C-cmse-nonsecure-entry" fn()) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -123,61 +123,61 @@ LL | fn cmse_entry_ptr(f: extern "C-cmse-nonsecure-entry" fn()) { = note: for more information, see issue #130260 <https://github.com/rust-lang/rust/issues/130260> error[E0570]: `"C-cmse-nonsecure-entry"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:201:1 + --> $DIR/unsupported.rs:200:1 | LL | extern "C-cmse-nonsecure-entry" {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0570]: `"ptx-kernel"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:34:1 + --> $DIR/unsupported.rs:33:1 | LL | extern "ptx-kernel" fn ptx() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0570]: `"gpu-kernel"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:43:1 + --> $DIR/unsupported.rs:42:1 | LL | extern "gpu-kernel" fn gpu() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0570]: `"msp430-interrupt"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:72:1 + --> $DIR/unsupported.rs:71:1 | LL | extern "msp430-interrupt" fn msp430() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0570]: `"avr-interrupt"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:82:1 + --> $DIR/unsupported.rs:81:1 | LL | extern "avr-interrupt" fn avr() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0570]: `"riscv-interrupt-m"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:92:1 + --> $DIR/unsupported.rs:91:1 | LL | extern "riscv-interrupt-m" fn riscv() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0570]: `"x86-interrupt"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:114:1 + --> $DIR/unsupported.rs:113:1 | LL | extern "x86-interrupt" fn x86() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0570]: `"thiscall"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:136:1 + --> $DIR/unsupported.rs:135:1 | LL | extern "thiscall" fn thiscall() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0570]: `"stdcall"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:162:1 + --> $DIR/unsupported.rs:161:1 | LL | extern "stdcall" fn stdcall() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0570]: `"C-cmse-nonsecure-entry"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:194:1 + --> $DIR/unsupported.rs:193:1 | LL | extern "C-cmse-nonsecure-entry" fn cmse_entry() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -185,3 +185,102 @@ LL | extern "C-cmse-nonsecure-entry" fn cmse_entry() {} error: aborting due to 17 previous errors; 9 warnings emitted For more information about this error, try `rustc --explain E0570`. +Future incompatibility report: Future breakage diagnostic: +warning: the calling convention "ptx-kernel" is not supported on this target + --> $DIR/unsupported.rs:35:15 + | +LL | fn ptx_ptr(f: extern "ptx-kernel" fn()) { + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #130260 <https://github.com/rust-lang/rust/issues/130260> + = note: `#[warn(unsupported_fn_ptr_calling_conventions)]` on by default + +Future breakage diagnostic: +warning: the calling convention "msp430-interrupt" is not supported on this target + --> $DIR/unsupported.rs:73:18 + | +LL | fn msp430_ptr(f: extern "msp430-interrupt" fn()) { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #130260 <https://github.com/rust-lang/rust/issues/130260> + = note: `#[warn(unsupported_fn_ptr_calling_conventions)]` on by default + +Future breakage diagnostic: +warning: the calling convention "avr-interrupt" is not supported on this target + --> $DIR/unsupported.rs:83:15 + | +LL | fn avr_ptr(f: extern "avr-interrupt" fn()) { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #130260 <https://github.com/rust-lang/rust/issues/130260> + = note: `#[warn(unsupported_fn_ptr_calling_conventions)]` on by default + +Future breakage diagnostic: +warning: the calling convention "riscv-interrupt-m" is not supported on this target + --> $DIR/unsupported.rs:96:17 + | +LL | fn riscv_ptr(f: extern "riscv-interrupt-m" fn()) { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #130260 <https://github.com/rust-lang/rust/issues/130260> + = note: `#[warn(unsupported_fn_ptr_calling_conventions)]` on by default + +Future breakage diagnostic: +warning: the calling convention "x86-interrupt" is not supported on this target + --> $DIR/unsupported.rs:118:15 + | +LL | fn x86_ptr(f: extern "x86-interrupt" fn()) { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #130260 <https://github.com/rust-lang/rust/issues/130260> + = note: `#[warn(unsupported_fn_ptr_calling_conventions)]` on by default + +Future breakage diagnostic: +warning: the calling convention "thiscall" is not supported on this target + --> $DIR/unsupported.rs:141:20 + | +LL | fn thiscall_ptr(f: extern "thiscall" fn()) { + | ^^^^^^^^^^^^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #130260 <https://github.com/rust-lang/rust/issues/130260> + = note: `#[warn(unsupported_fn_ptr_calling_conventions)]` on by default + +Future breakage diagnostic: +warning: the calling convention "stdcall" is not supported on this target + --> $DIR/unsupported.rs:167:19 + | +LL | fn stdcall_ptr(f: extern "stdcall" fn()) { + | ^^^^^^^^^^^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #130260 <https://github.com/rust-lang/rust/issues/130260> + = note: `#[warn(unsupported_fn_ptr_calling_conventions)]` on by default + +Future breakage diagnostic: +warning: the calling convention "C-cmse-nonsecure-call" is not supported on this target + --> $DIR/unsupported.rs:187:21 + | +LL | fn cmse_call_ptr(f: extern "C-cmse-nonsecure-call" fn()) { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #130260 <https://github.com/rust-lang/rust/issues/130260> + = note: `#[warn(unsupported_fn_ptr_calling_conventions)]` on by default + +Future breakage diagnostic: +warning: the calling convention "C-cmse-nonsecure-entry" is not supported on this target + --> $DIR/unsupported.rs:195:22 + | +LL | fn cmse_entry_ptr(f: extern "C-cmse-nonsecure-entry" fn()) { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #130260 <https://github.com/rust-lang/rust/issues/130260> + = note: `#[warn(unsupported_fn_ptr_calling_conventions)]` on by default + diff --git a/tests/ui/abi/unsupported.i686.stderr b/tests/ui/abi/unsupported.i686.stderr index 02b2cdd356f..94bd9b8af90 100644 --- a/tests/ui/abi/unsupported.i686.stderr +++ b/tests/ui/abi/unsupported.i686.stderr @@ -1,5 +1,5 @@ warning: the calling convention "ptx-kernel" is not supported on this target - --> $DIR/unsupported.rs:36:15 + --> $DIR/unsupported.rs:35:15 | LL | fn ptx_ptr(f: extern "ptx-kernel" fn()) { | ^^^^^^^^^^^^^^^^^^^^^^^^ @@ -9,13 +9,13 @@ LL | fn ptx_ptr(f: extern "ptx-kernel" fn()) { = note: `#[warn(unsupported_fn_ptr_calling_conventions)]` on by default error[E0570]: `"ptx-kernel"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:41:1 + --> $DIR/unsupported.rs:40:1 | LL | extern "ptx-kernel" {} | ^^^^^^^^^^^^^^^^^^^^^^ warning: the calling convention "aapcs" is not supported on this target - --> $DIR/unsupported.rs:52:17 + --> $DIR/unsupported.rs:51:17 | LL | fn aapcs_ptr(f: extern "aapcs" fn()) { | ^^^^^^^^^^^^^^^^^^^ @@ -24,13 +24,13 @@ LL | fn aapcs_ptr(f: extern "aapcs" fn()) { = note: for more information, see issue #130260 <https://github.com/rust-lang/rust/issues/130260> error[E0570]: `"aapcs"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:65:1 + --> $DIR/unsupported.rs:64:1 | LL | extern "aapcs" {} | ^^^^^^^^^^^^^^^^^ warning: the calling convention "msp430-interrupt" is not supported on this target - --> $DIR/unsupported.rs:74:18 + --> $DIR/unsupported.rs:73:18 | LL | fn msp430_ptr(f: extern "msp430-interrupt" fn()) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -39,13 +39,13 @@ LL | fn msp430_ptr(f: extern "msp430-interrupt" fn()) { = note: for more information, see issue #130260 <https://github.com/rust-lang/rust/issues/130260> error[E0570]: `"msp430-interrupt"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:79:1 + --> $DIR/unsupported.rs:78:1 | LL | extern "msp430-interrupt" {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: the calling convention "avr-interrupt" is not supported on this target - --> $DIR/unsupported.rs:84:15 + --> $DIR/unsupported.rs:83:15 | LL | fn avr_ptr(f: extern "avr-interrupt" fn()) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -54,13 +54,13 @@ LL | fn avr_ptr(f: extern "avr-interrupt" fn()) { = note: for more information, see issue #130260 <https://github.com/rust-lang/rust/issues/130260> error[E0570]: `"avr-interrupt"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:89:1 + --> $DIR/unsupported.rs:88:1 | LL | extern "avr-interrupt" {} | ^^^^^^^^^^^^^^^^^^^^^^^^^ warning: the calling convention "riscv-interrupt-m" is not supported on this target - --> $DIR/unsupported.rs:97:17 + --> $DIR/unsupported.rs:96:17 | LL | fn riscv_ptr(f: extern "riscv-interrupt-m" fn()) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -69,13 +69,13 @@ LL | fn riscv_ptr(f: extern "riscv-interrupt-m" fn()) { = note: for more information, see issue #130260 <https://github.com/rust-lang/rust/issues/130260> error[E0570]: `"riscv-interrupt-m"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:108:1 + --> $DIR/unsupported.rs:107:1 | LL | extern "riscv-interrupt-m" {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: the calling convention "C-cmse-nonsecure-call" is not supported on this target - --> $DIR/unsupported.rs:188:21 + --> $DIR/unsupported.rs:187:21 | LL | fn cmse_call_ptr(f: extern "C-cmse-nonsecure-call" fn()) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -84,7 +84,7 @@ LL | fn cmse_call_ptr(f: extern "C-cmse-nonsecure-call" fn()) { = note: for more information, see issue #130260 <https://github.com/rust-lang/rust/issues/130260> warning: the calling convention "C-cmse-nonsecure-entry" is not supported on this target - --> $DIR/unsupported.rs:196:22 + --> $DIR/unsupported.rs:195:22 | LL | fn cmse_entry_ptr(f: extern "C-cmse-nonsecure-entry" fn()) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -93,49 +93,49 @@ LL | fn cmse_entry_ptr(f: extern "C-cmse-nonsecure-entry" fn()) { = note: for more information, see issue #130260 <https://github.com/rust-lang/rust/issues/130260> error[E0570]: `"C-cmse-nonsecure-entry"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:201:1 + --> $DIR/unsupported.rs:200:1 | LL | extern "C-cmse-nonsecure-entry" {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0570]: `"ptx-kernel"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:34:1 + --> $DIR/unsupported.rs:33:1 | LL | extern "ptx-kernel" fn ptx() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0570]: `"gpu-kernel"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:43:1 + --> $DIR/unsupported.rs:42:1 | LL | extern "gpu-kernel" fn gpu() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0570]: `"aapcs"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:46:1 + --> $DIR/unsupported.rs:45:1 | LL | extern "aapcs" fn aapcs() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0570]: `"msp430-interrupt"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:72:1 + --> $DIR/unsupported.rs:71:1 | LL | extern "msp430-interrupt" fn msp430() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0570]: `"avr-interrupt"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:82:1 + --> $DIR/unsupported.rs:81:1 | LL | extern "avr-interrupt" fn avr() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0570]: `"riscv-interrupt-m"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:92:1 + --> $DIR/unsupported.rs:91:1 | LL | extern "riscv-interrupt-m" fn riscv() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0570]: `"C-cmse-nonsecure-entry"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:194:1 + --> $DIR/unsupported.rs:193:1 | LL | extern "C-cmse-nonsecure-entry" fn cmse_entry() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -143,3 +143,80 @@ LL | extern "C-cmse-nonsecure-entry" fn cmse_entry() {} error: aborting due to 13 previous errors; 7 warnings emitted For more information about this error, try `rustc --explain E0570`. +Future incompatibility report: Future breakage diagnostic: +warning: the calling convention "ptx-kernel" is not supported on this target + --> $DIR/unsupported.rs:35:15 + | +LL | fn ptx_ptr(f: extern "ptx-kernel" fn()) { + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #130260 <https://github.com/rust-lang/rust/issues/130260> + = note: `#[warn(unsupported_fn_ptr_calling_conventions)]` on by default + +Future breakage diagnostic: +warning: the calling convention "aapcs" is not supported on this target + --> $DIR/unsupported.rs:51:17 + | +LL | fn aapcs_ptr(f: extern "aapcs" fn()) { + | ^^^^^^^^^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #130260 <https://github.com/rust-lang/rust/issues/130260> + = note: `#[warn(unsupported_fn_ptr_calling_conventions)]` on by default + +Future breakage diagnostic: +warning: the calling convention "msp430-interrupt" is not supported on this target + --> $DIR/unsupported.rs:73:18 + | +LL | fn msp430_ptr(f: extern "msp430-interrupt" fn()) { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #130260 <https://github.com/rust-lang/rust/issues/130260> + = note: `#[warn(unsupported_fn_ptr_calling_conventions)]` on by default + +Future breakage diagnostic: +warning: the calling convention "avr-interrupt" is not supported on this target + --> $DIR/unsupported.rs:83:15 + | +LL | fn avr_ptr(f: extern "avr-interrupt" fn()) { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #130260 <https://github.com/rust-lang/rust/issues/130260> + = note: `#[warn(unsupported_fn_ptr_calling_conventions)]` on by default + +Future breakage diagnostic: +warning: the calling convention "riscv-interrupt-m" is not supported on this target + --> $DIR/unsupported.rs:96:17 + | +LL | fn riscv_ptr(f: extern "riscv-interrupt-m" fn()) { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #130260 <https://github.com/rust-lang/rust/issues/130260> + = note: `#[warn(unsupported_fn_ptr_calling_conventions)]` on by default + +Future breakage diagnostic: +warning: the calling convention "C-cmse-nonsecure-call" is not supported on this target + --> $DIR/unsupported.rs:187:21 + | +LL | fn cmse_call_ptr(f: extern "C-cmse-nonsecure-call" fn()) { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #130260 <https://github.com/rust-lang/rust/issues/130260> + = note: `#[warn(unsupported_fn_ptr_calling_conventions)]` on by default + +Future breakage diagnostic: +warning: the calling convention "C-cmse-nonsecure-entry" is not supported on this target + --> $DIR/unsupported.rs:195:22 + | +LL | fn cmse_entry_ptr(f: extern "C-cmse-nonsecure-entry" fn()) { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #130260 <https://github.com/rust-lang/rust/issues/130260> + = note: `#[warn(unsupported_fn_ptr_calling_conventions)]` on by default + diff --git a/tests/ui/abi/unsupported.riscv32.stderr b/tests/ui/abi/unsupported.riscv32.stderr index abf403da8bd..c6ff47283c6 100644 --- a/tests/ui/abi/unsupported.riscv32.stderr +++ b/tests/ui/abi/unsupported.riscv32.stderr @@ -1,5 +1,5 @@ warning: the calling convention "ptx-kernel" is not supported on this target - --> $DIR/unsupported.rs:36:15 + --> $DIR/unsupported.rs:35:15 | LL | fn ptx_ptr(f: extern "ptx-kernel" fn()) { | ^^^^^^^^^^^^^^^^^^^^^^^^ @@ -9,13 +9,13 @@ LL | fn ptx_ptr(f: extern "ptx-kernel" fn()) { = note: `#[warn(unsupported_fn_ptr_calling_conventions)]` on by default error[E0570]: `"ptx-kernel"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:41:1 + --> $DIR/unsupported.rs:40:1 | LL | extern "ptx-kernel" {} | ^^^^^^^^^^^^^^^^^^^^^^ warning: the calling convention "aapcs" is not supported on this target - --> $DIR/unsupported.rs:52:17 + --> $DIR/unsupported.rs:51:17 | LL | fn aapcs_ptr(f: extern "aapcs" fn()) { | ^^^^^^^^^^^^^^^^^^^ @@ -24,13 +24,13 @@ LL | fn aapcs_ptr(f: extern "aapcs" fn()) { = note: for more information, see issue #130260 <https://github.com/rust-lang/rust/issues/130260> error[E0570]: `"aapcs"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:65:1 + --> $DIR/unsupported.rs:64:1 | LL | extern "aapcs" {} | ^^^^^^^^^^^^^^^^^ warning: the calling convention "msp430-interrupt" is not supported on this target - --> $DIR/unsupported.rs:74:18 + --> $DIR/unsupported.rs:73:18 | LL | fn msp430_ptr(f: extern "msp430-interrupt" fn()) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -39,13 +39,13 @@ LL | fn msp430_ptr(f: extern "msp430-interrupt" fn()) { = note: for more information, see issue #130260 <https://github.com/rust-lang/rust/issues/130260> error[E0570]: `"msp430-interrupt"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:79:1 + --> $DIR/unsupported.rs:78:1 | LL | extern "msp430-interrupt" {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: the calling convention "avr-interrupt" is not supported on this target - --> $DIR/unsupported.rs:84:15 + --> $DIR/unsupported.rs:83:15 | LL | fn avr_ptr(f: extern "avr-interrupt" fn()) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -54,13 +54,13 @@ LL | fn avr_ptr(f: extern "avr-interrupt" fn()) { = note: for more information, see issue #130260 <https://github.com/rust-lang/rust/issues/130260> error[E0570]: `"avr-interrupt"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:89:1 + --> $DIR/unsupported.rs:88:1 | LL | extern "avr-interrupt" {} | ^^^^^^^^^^^^^^^^^^^^^^^^^ warning: the calling convention "x86-interrupt" is not supported on this target - --> $DIR/unsupported.rs:119:15 + --> $DIR/unsupported.rs:118:15 | LL | fn x86_ptr(f: extern "x86-interrupt" fn()) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -69,13 +69,13 @@ LL | fn x86_ptr(f: extern "x86-interrupt" fn()) { = note: for more information, see issue #130260 <https://github.com/rust-lang/rust/issues/130260> error[E0570]: `"x86-interrupt"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:130:1 + --> $DIR/unsupported.rs:129:1 | LL | extern "x86-interrupt" {} | ^^^^^^^^^^^^^^^^^^^^^^^^^ warning: the calling convention "thiscall" is not supported on this target - --> $DIR/unsupported.rs:142:20 + --> $DIR/unsupported.rs:141:20 | LL | fn thiscall_ptr(f: extern "thiscall" fn()) { | ^^^^^^^^^^^^^^^^^^^^^^ @@ -84,13 +84,13 @@ LL | fn thiscall_ptr(f: extern "thiscall" fn()) { = note: for more information, see issue #130260 <https://github.com/rust-lang/rust/issues/130260> error[E0570]: `"thiscall"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:155:1 + --> $DIR/unsupported.rs:154:1 | LL | extern "thiscall" {} | ^^^^^^^^^^^^^^^^^^^^ warning: the calling convention "stdcall" is not supported on this target - --> $DIR/unsupported.rs:168:19 + --> $DIR/unsupported.rs:167:19 | LL | fn stdcall_ptr(f: extern "stdcall" fn()) { | ^^^^^^^^^^^^^^^^^^^^^ @@ -99,13 +99,13 @@ LL | fn stdcall_ptr(f: extern "stdcall" fn()) { = note: for more information, see issue #130260 <https://github.com/rust-lang/rust/issues/130260> error[E0570]: `"stdcall"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:181:1 + --> $DIR/unsupported.rs:180:1 | LL | extern "stdcall" {} | ^^^^^^^^^^^^^^^^^^^ warning: the calling convention "C-cmse-nonsecure-call" is not supported on this target - --> $DIR/unsupported.rs:188:21 + --> $DIR/unsupported.rs:187:21 | LL | fn cmse_call_ptr(f: extern "C-cmse-nonsecure-call" fn()) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -114,7 +114,7 @@ LL | fn cmse_call_ptr(f: extern "C-cmse-nonsecure-call" fn()) { = note: for more information, see issue #130260 <https://github.com/rust-lang/rust/issues/130260> warning: the calling convention "C-cmse-nonsecure-entry" is not supported on this target - --> $DIR/unsupported.rs:196:22 + --> $DIR/unsupported.rs:195:22 | LL | fn cmse_entry_ptr(f: extern "C-cmse-nonsecure-entry" fn()) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -123,61 +123,61 @@ LL | fn cmse_entry_ptr(f: extern "C-cmse-nonsecure-entry" fn()) { = note: for more information, see issue #130260 <https://github.com/rust-lang/rust/issues/130260> error[E0570]: `"C-cmse-nonsecure-entry"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:201:1 + --> $DIR/unsupported.rs:200:1 | LL | extern "C-cmse-nonsecure-entry" {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0570]: `"ptx-kernel"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:34:1 + --> $DIR/unsupported.rs:33:1 | LL | extern "ptx-kernel" fn ptx() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0570]: `"gpu-kernel"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:43:1 + --> $DIR/unsupported.rs:42:1 | LL | extern "gpu-kernel" fn gpu() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0570]: `"aapcs"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:46:1 + --> $DIR/unsupported.rs:45:1 | LL | extern "aapcs" fn aapcs() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0570]: `"msp430-interrupt"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:72:1 + --> $DIR/unsupported.rs:71:1 | LL | extern "msp430-interrupt" fn msp430() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0570]: `"avr-interrupt"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:82:1 + --> $DIR/unsupported.rs:81:1 | LL | extern "avr-interrupt" fn avr() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0570]: `"x86-interrupt"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:114:1 + --> $DIR/unsupported.rs:113:1 | LL | extern "x86-interrupt" fn x86() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0570]: `"thiscall"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:136:1 + --> $DIR/unsupported.rs:135:1 | LL | extern "thiscall" fn thiscall() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0570]: `"stdcall"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:162:1 + --> $DIR/unsupported.rs:161:1 | LL | extern "stdcall" fn stdcall() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0570]: `"C-cmse-nonsecure-entry"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:194:1 + --> $DIR/unsupported.rs:193:1 | LL | extern "C-cmse-nonsecure-entry" fn cmse_entry() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -185,3 +185,102 @@ LL | extern "C-cmse-nonsecure-entry" fn cmse_entry() {} error: aborting due to 17 previous errors; 9 warnings emitted For more information about this error, try `rustc --explain E0570`. +Future incompatibility report: Future breakage diagnostic: +warning: the calling convention "ptx-kernel" is not supported on this target + --> $DIR/unsupported.rs:35:15 + | +LL | fn ptx_ptr(f: extern "ptx-kernel" fn()) { + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #130260 <https://github.com/rust-lang/rust/issues/130260> + = note: `#[warn(unsupported_fn_ptr_calling_conventions)]` on by default + +Future breakage diagnostic: +warning: the calling convention "aapcs" is not supported on this target + --> $DIR/unsupported.rs:51:17 + | +LL | fn aapcs_ptr(f: extern "aapcs" fn()) { + | ^^^^^^^^^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #130260 <https://github.com/rust-lang/rust/issues/130260> + = note: `#[warn(unsupported_fn_ptr_calling_conventions)]` on by default + +Future breakage diagnostic: +warning: the calling convention "msp430-interrupt" is not supported on this target + --> $DIR/unsupported.rs:73:18 + | +LL | fn msp430_ptr(f: extern "msp430-interrupt" fn()) { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #130260 <https://github.com/rust-lang/rust/issues/130260> + = note: `#[warn(unsupported_fn_ptr_calling_conventions)]` on by default + +Future breakage diagnostic: +warning: the calling convention "avr-interrupt" is not supported on this target + --> $DIR/unsupported.rs:83:15 + | +LL | fn avr_ptr(f: extern "avr-interrupt" fn()) { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #130260 <https://github.com/rust-lang/rust/issues/130260> + = note: `#[warn(unsupported_fn_ptr_calling_conventions)]` on by default + +Future breakage diagnostic: +warning: the calling convention "x86-interrupt" is not supported on this target + --> $DIR/unsupported.rs:118:15 + | +LL | fn x86_ptr(f: extern "x86-interrupt" fn()) { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #130260 <https://github.com/rust-lang/rust/issues/130260> + = note: `#[warn(unsupported_fn_ptr_calling_conventions)]` on by default + +Future breakage diagnostic: +warning: the calling convention "thiscall" is not supported on this target + --> $DIR/unsupported.rs:141:20 + | +LL | fn thiscall_ptr(f: extern "thiscall" fn()) { + | ^^^^^^^^^^^^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #130260 <https://github.com/rust-lang/rust/issues/130260> + = note: `#[warn(unsupported_fn_ptr_calling_conventions)]` on by default + +Future breakage diagnostic: +warning: the calling convention "stdcall" is not supported on this target + --> $DIR/unsupported.rs:167:19 + | +LL | fn stdcall_ptr(f: extern "stdcall" fn()) { + | ^^^^^^^^^^^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #130260 <https://github.com/rust-lang/rust/issues/130260> + = note: `#[warn(unsupported_fn_ptr_calling_conventions)]` on by default + +Future breakage diagnostic: +warning: the calling convention "C-cmse-nonsecure-call" is not supported on this target + --> $DIR/unsupported.rs:187:21 + | +LL | fn cmse_call_ptr(f: extern "C-cmse-nonsecure-call" fn()) { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #130260 <https://github.com/rust-lang/rust/issues/130260> + = note: `#[warn(unsupported_fn_ptr_calling_conventions)]` on by default + +Future breakage diagnostic: +warning: the calling convention "C-cmse-nonsecure-entry" is not supported on this target + --> $DIR/unsupported.rs:195:22 + | +LL | fn cmse_entry_ptr(f: extern "C-cmse-nonsecure-entry" fn()) { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #130260 <https://github.com/rust-lang/rust/issues/130260> + = note: `#[warn(unsupported_fn_ptr_calling_conventions)]` on by default + diff --git a/tests/ui/abi/unsupported.riscv64.stderr b/tests/ui/abi/unsupported.riscv64.stderr index abf403da8bd..c6ff47283c6 100644 --- a/tests/ui/abi/unsupported.riscv64.stderr +++ b/tests/ui/abi/unsupported.riscv64.stderr @@ -1,5 +1,5 @@ warning: the calling convention "ptx-kernel" is not supported on this target - --> $DIR/unsupported.rs:36:15 + --> $DIR/unsupported.rs:35:15 | LL | fn ptx_ptr(f: extern "ptx-kernel" fn()) { | ^^^^^^^^^^^^^^^^^^^^^^^^ @@ -9,13 +9,13 @@ LL | fn ptx_ptr(f: extern "ptx-kernel" fn()) { = note: `#[warn(unsupported_fn_ptr_calling_conventions)]` on by default error[E0570]: `"ptx-kernel"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:41:1 + --> $DIR/unsupported.rs:40:1 | LL | extern "ptx-kernel" {} | ^^^^^^^^^^^^^^^^^^^^^^ warning: the calling convention "aapcs" is not supported on this target - --> $DIR/unsupported.rs:52:17 + --> $DIR/unsupported.rs:51:17 | LL | fn aapcs_ptr(f: extern "aapcs" fn()) { | ^^^^^^^^^^^^^^^^^^^ @@ -24,13 +24,13 @@ LL | fn aapcs_ptr(f: extern "aapcs" fn()) { = note: for more information, see issue #130260 <https://github.com/rust-lang/rust/issues/130260> error[E0570]: `"aapcs"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:65:1 + --> $DIR/unsupported.rs:64:1 | LL | extern "aapcs" {} | ^^^^^^^^^^^^^^^^^ warning: the calling convention "msp430-interrupt" is not supported on this target - --> $DIR/unsupported.rs:74:18 + --> $DIR/unsupported.rs:73:18 | LL | fn msp430_ptr(f: extern "msp430-interrupt" fn()) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -39,13 +39,13 @@ LL | fn msp430_ptr(f: extern "msp430-interrupt" fn()) { = note: for more information, see issue #130260 <https://github.com/rust-lang/rust/issues/130260> error[E0570]: `"msp430-interrupt"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:79:1 + --> $DIR/unsupported.rs:78:1 | LL | extern "msp430-interrupt" {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: the calling convention "avr-interrupt" is not supported on this target - --> $DIR/unsupported.rs:84:15 + --> $DIR/unsupported.rs:83:15 | LL | fn avr_ptr(f: extern "avr-interrupt" fn()) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -54,13 +54,13 @@ LL | fn avr_ptr(f: extern "avr-interrupt" fn()) { = note: for more information, see issue #130260 <https://github.com/rust-lang/rust/issues/130260> error[E0570]: `"avr-interrupt"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:89:1 + --> $DIR/unsupported.rs:88:1 | LL | extern "avr-interrupt" {} | ^^^^^^^^^^^^^^^^^^^^^^^^^ warning: the calling convention "x86-interrupt" is not supported on this target - --> $DIR/unsupported.rs:119:15 + --> $DIR/unsupported.rs:118:15 | LL | fn x86_ptr(f: extern "x86-interrupt" fn()) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -69,13 +69,13 @@ LL | fn x86_ptr(f: extern "x86-interrupt" fn()) { = note: for more information, see issue #130260 <https://github.com/rust-lang/rust/issues/130260> error[E0570]: `"x86-interrupt"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:130:1 + --> $DIR/unsupported.rs:129:1 | LL | extern "x86-interrupt" {} | ^^^^^^^^^^^^^^^^^^^^^^^^^ warning: the calling convention "thiscall" is not supported on this target - --> $DIR/unsupported.rs:142:20 + --> $DIR/unsupported.rs:141:20 | LL | fn thiscall_ptr(f: extern "thiscall" fn()) { | ^^^^^^^^^^^^^^^^^^^^^^ @@ -84,13 +84,13 @@ LL | fn thiscall_ptr(f: extern "thiscall" fn()) { = note: for more information, see issue #130260 <https://github.com/rust-lang/rust/issues/130260> error[E0570]: `"thiscall"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:155:1 + --> $DIR/unsupported.rs:154:1 | LL | extern "thiscall" {} | ^^^^^^^^^^^^^^^^^^^^ warning: the calling convention "stdcall" is not supported on this target - --> $DIR/unsupported.rs:168:19 + --> $DIR/unsupported.rs:167:19 | LL | fn stdcall_ptr(f: extern "stdcall" fn()) { | ^^^^^^^^^^^^^^^^^^^^^ @@ -99,13 +99,13 @@ LL | fn stdcall_ptr(f: extern "stdcall" fn()) { = note: for more information, see issue #130260 <https://github.com/rust-lang/rust/issues/130260> error[E0570]: `"stdcall"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:181:1 + --> $DIR/unsupported.rs:180:1 | LL | extern "stdcall" {} | ^^^^^^^^^^^^^^^^^^^ warning: the calling convention "C-cmse-nonsecure-call" is not supported on this target - --> $DIR/unsupported.rs:188:21 + --> $DIR/unsupported.rs:187:21 | LL | fn cmse_call_ptr(f: extern "C-cmse-nonsecure-call" fn()) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -114,7 +114,7 @@ LL | fn cmse_call_ptr(f: extern "C-cmse-nonsecure-call" fn()) { = note: for more information, see issue #130260 <https://github.com/rust-lang/rust/issues/130260> warning: the calling convention "C-cmse-nonsecure-entry" is not supported on this target - --> $DIR/unsupported.rs:196:22 + --> $DIR/unsupported.rs:195:22 | LL | fn cmse_entry_ptr(f: extern "C-cmse-nonsecure-entry" fn()) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -123,61 +123,61 @@ LL | fn cmse_entry_ptr(f: extern "C-cmse-nonsecure-entry" fn()) { = note: for more information, see issue #130260 <https://github.com/rust-lang/rust/issues/130260> error[E0570]: `"C-cmse-nonsecure-entry"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:201:1 + --> $DIR/unsupported.rs:200:1 | LL | extern "C-cmse-nonsecure-entry" {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0570]: `"ptx-kernel"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:34:1 + --> $DIR/unsupported.rs:33:1 | LL | extern "ptx-kernel" fn ptx() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0570]: `"gpu-kernel"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:43:1 + --> $DIR/unsupported.rs:42:1 | LL | extern "gpu-kernel" fn gpu() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0570]: `"aapcs"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:46:1 + --> $DIR/unsupported.rs:45:1 | LL | extern "aapcs" fn aapcs() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0570]: `"msp430-interrupt"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:72:1 + --> $DIR/unsupported.rs:71:1 | LL | extern "msp430-interrupt" fn msp430() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0570]: `"avr-interrupt"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:82:1 + --> $DIR/unsupported.rs:81:1 | LL | extern "avr-interrupt" fn avr() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0570]: `"x86-interrupt"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:114:1 + --> $DIR/unsupported.rs:113:1 | LL | extern "x86-interrupt" fn x86() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0570]: `"thiscall"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:136:1 + --> $DIR/unsupported.rs:135:1 | LL | extern "thiscall" fn thiscall() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0570]: `"stdcall"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:162:1 + --> $DIR/unsupported.rs:161:1 | LL | extern "stdcall" fn stdcall() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0570]: `"C-cmse-nonsecure-entry"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:194:1 + --> $DIR/unsupported.rs:193:1 | LL | extern "C-cmse-nonsecure-entry" fn cmse_entry() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -185,3 +185,102 @@ LL | extern "C-cmse-nonsecure-entry" fn cmse_entry() {} error: aborting due to 17 previous errors; 9 warnings emitted For more information about this error, try `rustc --explain E0570`. +Future incompatibility report: Future breakage diagnostic: +warning: the calling convention "ptx-kernel" is not supported on this target + --> $DIR/unsupported.rs:35:15 + | +LL | fn ptx_ptr(f: extern "ptx-kernel" fn()) { + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #130260 <https://github.com/rust-lang/rust/issues/130260> + = note: `#[warn(unsupported_fn_ptr_calling_conventions)]` on by default + +Future breakage diagnostic: +warning: the calling convention "aapcs" is not supported on this target + --> $DIR/unsupported.rs:51:17 + | +LL | fn aapcs_ptr(f: extern "aapcs" fn()) { + | ^^^^^^^^^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #130260 <https://github.com/rust-lang/rust/issues/130260> + = note: `#[warn(unsupported_fn_ptr_calling_conventions)]` on by default + +Future breakage diagnostic: +warning: the calling convention "msp430-interrupt" is not supported on this target + --> $DIR/unsupported.rs:73:18 + | +LL | fn msp430_ptr(f: extern "msp430-interrupt" fn()) { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #130260 <https://github.com/rust-lang/rust/issues/130260> + = note: `#[warn(unsupported_fn_ptr_calling_conventions)]` on by default + +Future breakage diagnostic: +warning: the calling convention "avr-interrupt" is not supported on this target + --> $DIR/unsupported.rs:83:15 + | +LL | fn avr_ptr(f: extern "avr-interrupt" fn()) { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #130260 <https://github.com/rust-lang/rust/issues/130260> + = note: `#[warn(unsupported_fn_ptr_calling_conventions)]` on by default + +Future breakage diagnostic: +warning: the calling convention "x86-interrupt" is not supported on this target + --> $DIR/unsupported.rs:118:15 + | +LL | fn x86_ptr(f: extern "x86-interrupt" fn()) { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #130260 <https://github.com/rust-lang/rust/issues/130260> + = note: `#[warn(unsupported_fn_ptr_calling_conventions)]` on by default + +Future breakage diagnostic: +warning: the calling convention "thiscall" is not supported on this target + --> $DIR/unsupported.rs:141:20 + | +LL | fn thiscall_ptr(f: extern "thiscall" fn()) { + | ^^^^^^^^^^^^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #130260 <https://github.com/rust-lang/rust/issues/130260> + = note: `#[warn(unsupported_fn_ptr_calling_conventions)]` on by default + +Future breakage diagnostic: +warning: the calling convention "stdcall" is not supported on this target + --> $DIR/unsupported.rs:167:19 + | +LL | fn stdcall_ptr(f: extern "stdcall" fn()) { + | ^^^^^^^^^^^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #130260 <https://github.com/rust-lang/rust/issues/130260> + = note: `#[warn(unsupported_fn_ptr_calling_conventions)]` on by default + +Future breakage diagnostic: +warning: the calling convention "C-cmse-nonsecure-call" is not supported on this target + --> $DIR/unsupported.rs:187:21 + | +LL | fn cmse_call_ptr(f: extern "C-cmse-nonsecure-call" fn()) { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #130260 <https://github.com/rust-lang/rust/issues/130260> + = note: `#[warn(unsupported_fn_ptr_calling_conventions)]` on by default + +Future breakage diagnostic: +warning: the calling convention "C-cmse-nonsecure-entry" is not supported on this target + --> $DIR/unsupported.rs:195:22 + | +LL | fn cmse_entry_ptr(f: extern "C-cmse-nonsecure-entry" fn()) { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #130260 <https://github.com/rust-lang/rust/issues/130260> + = note: `#[warn(unsupported_fn_ptr_calling_conventions)]` on by default + diff --git a/tests/ui/abi/unsupported.rs b/tests/ui/abi/unsupported.rs index 7d4142f0dee..84646502f6f 100644 --- a/tests/ui/abi/unsupported.rs +++ b/tests/ui/abi/unsupported.rs @@ -1,3 +1,4 @@ +//@ add-core-stubs //@ revisions: x64 i686 aarch64 arm riscv32 riscv64 // //@ [x64] needs-llvm-components: x86 @@ -25,11 +26,9 @@ abi_c_cmse_nonsecure_call, cmse_nonsecure_entry )] -#[lang = "sized"] -trait Sized {} -#[lang = "copy"] -trait Copy {} +extern crate minicore; +use minicore::*; extern "ptx-kernel" fn ptx() {} //~^ ERROR is not a supported ABI diff --git a/tests/ui/abi/unsupported.x64.stderr b/tests/ui/abi/unsupported.x64.stderr index 824a33c948a..0a9f9a69123 100644 --- a/tests/ui/abi/unsupported.x64.stderr +++ b/tests/ui/abi/unsupported.x64.stderr @@ -1,5 +1,5 @@ warning: the calling convention "ptx-kernel" is not supported on this target - --> $DIR/unsupported.rs:36:15 + --> $DIR/unsupported.rs:35:15 | LL | fn ptx_ptr(f: extern "ptx-kernel" fn()) { | ^^^^^^^^^^^^^^^^^^^^^^^^ @@ -9,13 +9,13 @@ LL | fn ptx_ptr(f: extern "ptx-kernel" fn()) { = note: `#[warn(unsupported_fn_ptr_calling_conventions)]` on by default error[E0570]: `"ptx-kernel"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:41:1 + --> $DIR/unsupported.rs:40:1 | LL | extern "ptx-kernel" {} | ^^^^^^^^^^^^^^^^^^^^^^ warning: the calling convention "aapcs" is not supported on this target - --> $DIR/unsupported.rs:52:17 + --> $DIR/unsupported.rs:51:17 | LL | fn aapcs_ptr(f: extern "aapcs" fn()) { | ^^^^^^^^^^^^^^^^^^^ @@ -24,13 +24,13 @@ LL | fn aapcs_ptr(f: extern "aapcs" fn()) { = note: for more information, see issue #130260 <https://github.com/rust-lang/rust/issues/130260> error[E0570]: `"aapcs"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:65:1 + --> $DIR/unsupported.rs:64:1 | LL | extern "aapcs" {} | ^^^^^^^^^^^^^^^^^ warning: the calling convention "msp430-interrupt" is not supported on this target - --> $DIR/unsupported.rs:74:18 + --> $DIR/unsupported.rs:73:18 | LL | fn msp430_ptr(f: extern "msp430-interrupt" fn()) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -39,13 +39,13 @@ LL | fn msp430_ptr(f: extern "msp430-interrupt" fn()) { = note: for more information, see issue #130260 <https://github.com/rust-lang/rust/issues/130260> error[E0570]: `"msp430-interrupt"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:79:1 + --> $DIR/unsupported.rs:78:1 | LL | extern "msp430-interrupt" {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: the calling convention "avr-interrupt" is not supported on this target - --> $DIR/unsupported.rs:84:15 + --> $DIR/unsupported.rs:83:15 | LL | fn avr_ptr(f: extern "avr-interrupt" fn()) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -54,13 +54,13 @@ LL | fn avr_ptr(f: extern "avr-interrupt" fn()) { = note: for more information, see issue #130260 <https://github.com/rust-lang/rust/issues/130260> error[E0570]: `"avr-interrupt"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:89:1 + --> $DIR/unsupported.rs:88:1 | LL | extern "avr-interrupt" {} | ^^^^^^^^^^^^^^^^^^^^^^^^^ warning: the calling convention "riscv-interrupt-m" is not supported on this target - --> $DIR/unsupported.rs:97:17 + --> $DIR/unsupported.rs:96:17 | LL | fn riscv_ptr(f: extern "riscv-interrupt-m" fn()) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -69,13 +69,13 @@ LL | fn riscv_ptr(f: extern "riscv-interrupt-m" fn()) { = note: for more information, see issue #130260 <https://github.com/rust-lang/rust/issues/130260> error[E0570]: `"riscv-interrupt-m"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:108:1 + --> $DIR/unsupported.rs:107:1 | LL | extern "riscv-interrupt-m" {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: the calling convention "thiscall" is not supported on this target - --> $DIR/unsupported.rs:142:20 + --> $DIR/unsupported.rs:141:20 | LL | fn thiscall_ptr(f: extern "thiscall" fn()) { | ^^^^^^^^^^^^^^^^^^^^^^ @@ -84,13 +84,13 @@ LL | fn thiscall_ptr(f: extern "thiscall" fn()) { = note: for more information, see issue #130260 <https://github.com/rust-lang/rust/issues/130260> error[E0570]: `"thiscall"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:155:1 + --> $DIR/unsupported.rs:154:1 | LL | extern "thiscall" {} | ^^^^^^^^^^^^^^^^^^^^ warning: the calling convention "stdcall" is not supported on this target - --> $DIR/unsupported.rs:168:19 + --> $DIR/unsupported.rs:167:19 | LL | fn stdcall_ptr(f: extern "stdcall" fn()) { | ^^^^^^^^^^^^^^^^^^^^^ @@ -99,13 +99,13 @@ LL | fn stdcall_ptr(f: extern "stdcall" fn()) { = note: for more information, see issue #130260 <https://github.com/rust-lang/rust/issues/130260> error[E0570]: `"stdcall"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:181:1 + --> $DIR/unsupported.rs:180:1 | LL | extern "stdcall" {} | ^^^^^^^^^^^^^^^^^^^ warning: the calling convention "C-cmse-nonsecure-call" is not supported on this target - --> $DIR/unsupported.rs:188:21 + --> $DIR/unsupported.rs:187:21 | LL | fn cmse_call_ptr(f: extern "C-cmse-nonsecure-call" fn()) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -114,7 +114,7 @@ LL | fn cmse_call_ptr(f: extern "C-cmse-nonsecure-call" fn()) { = note: for more information, see issue #130260 <https://github.com/rust-lang/rust/issues/130260> warning: the calling convention "C-cmse-nonsecure-entry" is not supported on this target - --> $DIR/unsupported.rs:196:22 + --> $DIR/unsupported.rs:195:22 | LL | fn cmse_entry_ptr(f: extern "C-cmse-nonsecure-entry" fn()) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -123,61 +123,61 @@ LL | fn cmse_entry_ptr(f: extern "C-cmse-nonsecure-entry" fn()) { = note: for more information, see issue #130260 <https://github.com/rust-lang/rust/issues/130260> error[E0570]: `"C-cmse-nonsecure-entry"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:201:1 + --> $DIR/unsupported.rs:200:1 | LL | extern "C-cmse-nonsecure-entry" {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0570]: `"ptx-kernel"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:34:1 + --> $DIR/unsupported.rs:33:1 | LL | extern "ptx-kernel" fn ptx() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0570]: `"gpu-kernel"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:43:1 + --> $DIR/unsupported.rs:42:1 | LL | extern "gpu-kernel" fn gpu() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0570]: `"aapcs"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:46:1 + --> $DIR/unsupported.rs:45:1 | LL | extern "aapcs" fn aapcs() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0570]: `"msp430-interrupt"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:72:1 + --> $DIR/unsupported.rs:71:1 | LL | extern "msp430-interrupt" fn msp430() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0570]: `"avr-interrupt"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:82:1 + --> $DIR/unsupported.rs:81:1 | LL | extern "avr-interrupt" fn avr() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0570]: `"riscv-interrupt-m"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:92:1 + --> $DIR/unsupported.rs:91:1 | LL | extern "riscv-interrupt-m" fn riscv() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0570]: `"thiscall"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:136:1 + --> $DIR/unsupported.rs:135:1 | LL | extern "thiscall" fn thiscall() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0570]: `"stdcall"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:162:1 + --> $DIR/unsupported.rs:161:1 | LL | extern "stdcall" fn stdcall() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0570]: `"C-cmse-nonsecure-entry"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:194:1 + --> $DIR/unsupported.rs:193:1 | LL | extern "C-cmse-nonsecure-entry" fn cmse_entry() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -185,3 +185,102 @@ LL | extern "C-cmse-nonsecure-entry" fn cmse_entry() {} error: aborting due to 17 previous errors; 9 warnings emitted For more information about this error, try `rustc --explain E0570`. +Future incompatibility report: Future breakage diagnostic: +warning: the calling convention "ptx-kernel" is not supported on this target + --> $DIR/unsupported.rs:35:15 + | +LL | fn ptx_ptr(f: extern "ptx-kernel" fn()) { + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #130260 <https://github.com/rust-lang/rust/issues/130260> + = note: `#[warn(unsupported_fn_ptr_calling_conventions)]` on by default + +Future breakage diagnostic: +warning: the calling convention "aapcs" is not supported on this target + --> $DIR/unsupported.rs:51:17 + | +LL | fn aapcs_ptr(f: extern "aapcs" fn()) { + | ^^^^^^^^^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #130260 <https://github.com/rust-lang/rust/issues/130260> + = note: `#[warn(unsupported_fn_ptr_calling_conventions)]` on by default + +Future breakage diagnostic: +warning: the calling convention "msp430-interrupt" is not supported on this target + --> $DIR/unsupported.rs:73:18 + | +LL | fn msp430_ptr(f: extern "msp430-interrupt" fn()) { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #130260 <https://github.com/rust-lang/rust/issues/130260> + = note: `#[warn(unsupported_fn_ptr_calling_conventions)]` on by default + +Future breakage diagnostic: +warning: the calling convention "avr-interrupt" is not supported on this target + --> $DIR/unsupported.rs:83:15 + | +LL | fn avr_ptr(f: extern "avr-interrupt" fn()) { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #130260 <https://github.com/rust-lang/rust/issues/130260> + = note: `#[warn(unsupported_fn_ptr_calling_conventions)]` on by default + +Future breakage diagnostic: +warning: the calling convention "riscv-interrupt-m" is not supported on this target + --> $DIR/unsupported.rs:96:17 + | +LL | fn riscv_ptr(f: extern "riscv-interrupt-m" fn()) { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #130260 <https://github.com/rust-lang/rust/issues/130260> + = note: `#[warn(unsupported_fn_ptr_calling_conventions)]` on by default + +Future breakage diagnostic: +warning: the calling convention "thiscall" is not supported on this target + --> $DIR/unsupported.rs:141:20 + | +LL | fn thiscall_ptr(f: extern "thiscall" fn()) { + | ^^^^^^^^^^^^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #130260 <https://github.com/rust-lang/rust/issues/130260> + = note: `#[warn(unsupported_fn_ptr_calling_conventions)]` on by default + +Future breakage diagnostic: +warning: the calling convention "stdcall" is not supported on this target + --> $DIR/unsupported.rs:167:19 + | +LL | fn stdcall_ptr(f: extern "stdcall" fn()) { + | ^^^^^^^^^^^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #130260 <https://github.com/rust-lang/rust/issues/130260> + = note: `#[warn(unsupported_fn_ptr_calling_conventions)]` on by default + +Future breakage diagnostic: +warning: the calling convention "C-cmse-nonsecure-call" is not supported on this target + --> $DIR/unsupported.rs:187:21 + | +LL | fn cmse_call_ptr(f: extern "C-cmse-nonsecure-call" fn()) { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #130260 <https://github.com/rust-lang/rust/issues/130260> + = note: `#[warn(unsupported_fn_ptr_calling_conventions)]` on by default + +Future breakage diagnostic: +warning: the calling convention "C-cmse-nonsecure-entry" is not supported on this target + --> $DIR/unsupported.rs:195:22 + | +LL | fn cmse_entry_ptr(f: extern "C-cmse-nonsecure-entry" fn()) { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #130260 <https://github.com/rust-lang/rust/issues/130260> + = note: `#[warn(unsupported_fn_ptr_calling_conventions)]` on by default + diff --git a/tests/ui/asm/conditionally-sized-ptr-fail.rs b/tests/ui/asm/conditionally-sized-ptr-fail.rs new file mode 100644 index 00000000000..b0a93495ffa --- /dev/null +++ b/tests/ui/asm/conditionally-sized-ptr-fail.rs @@ -0,0 +1,19 @@ +//@ needs-asm-support + +use std::arch::asm; + +fn _f<T: ?Sized>(p: *mut T) { + unsafe { + asm!("/* {} */", in(reg) p); + //~^ ERROR cannot use value of unsized pointer type `*mut T` for inline assembly + } +} + +fn _g(p: *mut [u8]) { + unsafe { + asm!("/* {} */", in(reg) p); + //~^ ERROR cannot use value of unsized pointer type `*mut [u8]` for inline assembly + } +} + +fn main() {} diff --git a/tests/ui/asm/conditionally-sized-ptr-fail.stderr b/tests/ui/asm/conditionally-sized-ptr-fail.stderr new file mode 100644 index 00000000000..b88f59f569c --- /dev/null +++ b/tests/ui/asm/conditionally-sized-ptr-fail.stderr @@ -0,0 +1,18 @@ +error: cannot use value of unsized pointer type `*mut T` for inline assembly + --> $DIR/conditionally-sized-ptr-fail.rs:7:34 + | +LL | asm!("/* {} */", in(reg) p); + | ^ + | + = note: only sized pointers can be used in inline assembly + +error: cannot use value of unsized pointer type `*mut [u8]` for inline assembly + --> $DIR/conditionally-sized-ptr-fail.rs:14:34 + | +LL | asm!("/* {} */", in(reg) p); + | ^ + | + = note: only sized pointers can be used in inline assembly + +error: aborting due to 2 previous errors + diff --git a/tests/ui/asm/conditionally-sized-ptr.rs b/tests/ui/asm/conditionally-sized-ptr.rs new file mode 100644 index 00000000000..8ff18fd1da1 --- /dev/null +++ b/tests/ui/asm/conditionally-sized-ptr.rs @@ -0,0 +1,12 @@ +//@ check-pass +//@ needs-asm-support + +use std::arch::asm; + +fn _f<T>(p: *mut T) { + unsafe { + asm!("/* {} */", in(reg) p); + } +} + +fn main() {} diff --git a/tests/ui/asm/const-resolve-error.rs b/tests/ui/asm/const-resolve-error.rs new file mode 100644 index 00000000000..19c8af0d542 --- /dev/null +++ b/tests/ui/asm/const-resolve-error.rs @@ -0,0 +1,10 @@ +//@ edition:2021 +//@ needs-asm-support + +use std::arch::asm; + +async unsafe fn foo<'a>() { + asm!("/* {0} */", const N); //~ ERROR E0425 +} + +fn main() {} diff --git a/tests/ui/asm/const-resolve-error.stderr b/tests/ui/asm/const-resolve-error.stderr new file mode 100644 index 00000000000..f02a7f0a6b1 --- /dev/null +++ b/tests/ui/asm/const-resolve-error.stderr @@ -0,0 +1,14 @@ +error[E0425]: cannot find value `N` in this scope + --> $DIR/const-resolve-error.rs:7:29 + | +LL | asm!("/* {0} */", const N); + | ^ not found in this scope + | +help: you might be missing a const parameter + | +LL | async unsafe fn foo<'a, const N: /* Type */>() { + | +++++++++++++++++++++ + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0425`. diff --git a/tests/ui/asm/fail-const-eval-issue-121099.rs b/tests/ui/asm/fail-const-eval-issue-121099.rs index 36d00b1e5d2..c91bbfd1b73 100644 --- a/tests/ui/asm/fail-const-eval-issue-121099.rs +++ b/tests/ui/asm/fail-const-eval-issue-121099.rs @@ -5,6 +5,6 @@ use std::arch::global_asm; fn main() {} -global_asm!("/* {} */", const 1 << 500); //~ ERROR evaluation of constant value failed [E0080] +global_asm!("/* {} */", const 1 << 500); //~ ERROR E0080 -global_asm!("/* {} */", const 1 / 0); //~ ERROR evaluation of constant value failed [E0080] +global_asm!("/* {} */", const 1 / 0); //~ ERROR E0080 diff --git a/tests/ui/asm/fail-const-eval-issue-121099.stderr b/tests/ui/asm/fail-const-eval-issue-121099.stderr index 5d86c3a5f7b..eb662dadffb 100644 --- a/tests/ui/asm/fail-const-eval-issue-121099.stderr +++ b/tests/ui/asm/fail-const-eval-issue-121099.stderr @@ -1,10 +1,10 @@ -error[E0080]: evaluation of constant value failed +error[E0080]: evaluation of `{global_asm#0}::{constant#0}` failed --> $DIR/fail-const-eval-issue-121099.rs:8:31 | LL | global_asm!("/* {} */", const 1 << 500); | ^^^^^^^^ attempt to shift left by `500_i32`, which would overflow -error[E0080]: evaluation of constant value failed +error[E0080]: evaluation of `{global_asm#1}::{constant#0}` failed --> $DIR/fail-const-eval-issue-121099.rs:10:31 | LL | global_asm!("/* {} */", const 1 / 0); diff --git a/tests/ui/asm/global-asm-isnt-really-a-mir-body.rs b/tests/ui/asm/global-asm-isnt-really-a-mir-body.rs new file mode 100644 index 00000000000..b7636d116ec --- /dev/null +++ b/tests/ui/asm/global-asm-isnt-really-a-mir-body.rs @@ -0,0 +1,26 @@ +//@ revisions: emit_mir instrument cfi + +// Make sure we don't try to emit MIR for it. +//@[emit_mir] compile-flags: --emit=mir + +// Make sure we don't try to instrument it. +//@[instrument] compile-flags: -Cinstrument-coverage -Zno-profiler-runtime +//@[instrument] only-linux + +// Make sure we don't try to CFI encode it. +//@[cfi] compile-flags: -Zsanitizer=cfi -Ccodegen-units=1 -Clto -Ctarget-feature=-crt-static -Clink-dead-code=true +//@[cfi] needs-sanitizer-cfi +//@[cfi] no-prefer-dynamic +// FIXME(#122848) Remove only-linux once OSX CFI binaries work +//@[cfi] only-linux + +//@ build-pass +//@ needs-asm-support + +use std::arch::global_asm; + +fn foo() {} + +global_asm!("/* {} */", sym foo); + +fn main() {} diff --git a/tests/ui/asm/global-asm-with-error.rs b/tests/ui/asm/global-asm-with-error.rs new file mode 100644 index 00000000000..c2253e3cb87 --- /dev/null +++ b/tests/ui/asm/global-asm-with-error.rs @@ -0,0 +1,11 @@ +// Ensure that we don't ICE when constructing the fake MIR body for a global +// asm when the body has errors. See #137470. + +//@ needs-asm-support + +use std::arch::global_asm; + +global_asm!("/* {} */", sym a); +//~^ ERROR cannot find value `a` in this scope + +fn main() {} diff --git a/tests/ui/asm/global-asm-with-error.stderr b/tests/ui/asm/global-asm-with-error.stderr new file mode 100644 index 00000000000..3b76bfd1948 --- /dev/null +++ b/tests/ui/asm/global-asm-with-error.stderr @@ -0,0 +1,9 @@ +error[E0425]: cannot find value `a` in this scope + --> $DIR/global-asm-with-error.rs:8:29 + | +LL | global_asm!("/* {} */", sym a); + | ^ not found in this scope + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0425`. diff --git a/tests/ui/asm/invalid-const-operand.stderr b/tests/ui/asm/invalid-const-operand.stderr index 13bb10e84a5..1cedabeef28 100644 --- a/tests/ui/asm/invalid-const-operand.stderr +++ b/tests/ui/asm/invalid-const-operand.stderr @@ -80,7 +80,7 @@ error: invalid type for `const` operand LL | asm!("{}", const &0); | ^^^^^^-- | | - | is a `&i32` + | is a `&{integer}` | = help: `const` operands must be of an integer type diff --git a/tests/ui/associated-inherent-types/issue-109299-1.stderr b/tests/ui/associated-inherent-types/issue-109299-1.stderr index 07a00b6b9a9..77a78da852f 100644 --- a/tests/ui/associated-inherent-types/issue-109299-1.stderr +++ b/tests/ui/associated-inherent-types/issue-109299-1.stderr @@ -2,7 +2,7 @@ error[E0220]: associated type `Cursor` not found for `Lexer<T>` in the current s --> $DIR/issue-109299-1.rs:10:40 | LL | struct Lexer<T>(T); - | --------------- associated item `Cursor` not found for this struct + | --------------- associated type `Cursor` not found for this struct ... LL | type X = impl for<T> Fn() -> Lexer<T>::Cursor; | ^^^^^^ associated item not found in `Lexer<T>` @@ -14,7 +14,7 @@ error[E0220]: associated type `Cursor` not found for `Lexer<T>` in the current s --> $DIR/issue-109299-1.rs:10:40 | LL | struct Lexer<T>(T); - | --------------- associated item `Cursor` not found for this struct + | --------------- associated type `Cursor` not found for this struct ... LL | type X = impl for<T> Fn() -> Lexer<T>::Cursor; | ^^^^^^ associated item not found in `Lexer<T>` diff --git a/tests/ui/associated-inherent-types/issue-109789.rs b/tests/ui/associated-inherent-types/issue-109789.rs index 46dd4590141..e3c490b2dc8 100644 --- a/tests/ui/associated-inherent-types/issue-109789.rs +++ b/tests/ui/associated-inherent-types/issue-109789.rs @@ -20,5 +20,6 @@ fn bar(_: Foo<for<'a> fn(&'a ())>::Assoc) {} //~| ERROR mismatched types //~| ERROR higher-ranked subtype error //~| ERROR higher-ranked subtype error +//~| ERROR higher-ranked subtype error fn main() {} diff --git a/tests/ui/associated-inherent-types/issue-109789.stderr b/tests/ui/associated-inherent-types/issue-109789.stderr index c6ea6c5541d..db860a64826 100644 --- a/tests/ui/associated-inherent-types/issue-109789.stderr +++ b/tests/ui/associated-inherent-types/issue-109789.stderr @@ -31,6 +31,14 @@ LL | fn bar(_: Foo<for<'a> fn(&'a ())>::Assoc) {} | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` -error: aborting due to 4 previous errors +error: higher-ranked subtype error + --> $DIR/issue-109789.rs:18:1 + | +LL | fn bar(_: Foo<for<'a> fn(&'a ())>::Assoc) {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + +error: aborting due to 5 previous errors For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/associated-inherent-types/issue-111404-1.rs b/tests/ui/associated-inherent-types/issue-111404-1.rs index 3255bf20ebd..cad6d48b1c5 100644 --- a/tests/ui/associated-inherent-types/issue-111404-1.rs +++ b/tests/ui/associated-inherent-types/issue-111404-1.rs @@ -12,5 +12,6 @@ fn bar(_: fn(Foo<for<'b> fn(Foo<fn(&'b ())>::Assoc)>::Assoc)) {} //~| ERROR mismatched types [E0308] //~| ERROR higher-ranked subtype error //~| ERROR higher-ranked subtype error +//~| ERROR higher-ranked subtype error fn main() {} diff --git a/tests/ui/associated-inherent-types/issue-111404-1.stderr b/tests/ui/associated-inherent-types/issue-111404-1.stderr index 5074c877a8e..ce49126c316 100644 --- a/tests/ui/associated-inherent-types/issue-111404-1.stderr +++ b/tests/ui/associated-inherent-types/issue-111404-1.stderr @@ -31,6 +31,14 @@ LL | fn bar(_: fn(Foo<for<'b> fn(Foo<fn(&'b ())>::Assoc)>::Assoc)) {} | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` -error: aborting due to 4 previous errors +error: higher-ranked subtype error + --> $DIR/issue-111404-1.rs:10:1 + | +LL | fn bar(_: fn(Foo<for<'b> fn(Foo<fn(&'b ())>::Assoc)>::Assoc)) {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + +error: aborting due to 5 previous errors For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/associated-inherent-types/not-found-self-type-differs-shadowing-trait-item.shadowed.stderr b/tests/ui/associated-inherent-types/not-found-self-type-differs-shadowing-trait-item.shadowed.stderr index 9bd5a842fdc..a247d6d5b45 100644 --- a/tests/ui/associated-inherent-types/not-found-self-type-differs-shadowing-trait-item.shadowed.stderr +++ b/tests/ui/associated-inherent-types/not-found-self-type-differs-shadowing-trait-item.shadowed.stderr @@ -2,7 +2,7 @@ error[E0220]: associated type `Pr` not found for `S<bool>` in the current scope --> $DIR/not-found-self-type-differs-shadowing-trait-item.rs:28:23 | LL | struct S<T>(T); - | ----------- associated item `Pr` not found for this struct + | ----------- associated type `Pr` not found for this struct ... LL | let _: S::<bool>::Pr = (); | ^^ associated item not found in `S<bool>` diff --git a/tests/ui/associated-inherent-types/not-found-self-type-differs.stderr b/tests/ui/associated-inherent-types/not-found-self-type-differs.stderr index 1871407c64f..6194c6ff4d7 100644 --- a/tests/ui/associated-inherent-types/not-found-self-type-differs.stderr +++ b/tests/ui/associated-inherent-types/not-found-self-type-differs.stderr @@ -2,7 +2,7 @@ error[E0220]: associated type `Proj` not found for `Family<Option<()>>` in the c --> $DIR/not-found-self-type-differs.rs:15:32 | LL | struct Family<T>(T); - | ---------------- associated item `Proj` not found for this struct + | ---------------- associated type `Proj` not found for this struct ... LL | let _: Family<Option<()>>::Proj; | ^^^^ associated item not found in `Family<Option<()>>` @@ -15,7 +15,7 @@ error[E0220]: associated type `Proj` not found for `Family<PathBuf>` in the curr --> $DIR/not-found-self-type-differs.rs:16:40 | LL | struct Family<T>(T); - | ---------------- associated item `Proj` not found for this struct + | ---------------- associated type `Proj` not found for this struct ... LL | let _: Family<std::path::PathBuf>::Proj = (); | ^^^^ associated item not found in `Family<PathBuf>` diff --git a/tests/ui/associated-inherent-types/not-found-unsatisfied-bounds-0.stderr b/tests/ui/associated-inherent-types/not-found-unsatisfied-bounds-0.stderr index 73657906761..dd51192e06f 100644 --- a/tests/ui/associated-inherent-types/not-found-unsatisfied-bounds-0.stderr +++ b/tests/ui/associated-inherent-types/not-found-unsatisfied-bounds-0.stderr @@ -2,7 +2,7 @@ error: the associated type `Yield` exists for `Container<[u8]>`, but its trait b --> $DIR/not-found-unsatisfied-bounds-0.rs:19:29 | LL | struct Container<T: ?Sized>(T); - | --------------------------- associated item `Yield` not found for this struct + | --------------------------- associated type `Yield` not found for this struct ... LL | let _: Container<[u8]>::Yield = 1; | ^^^^^ associated type cannot be referenced on `Container<[u8]>` due to unsatisfied trait bounds @@ -14,7 +14,7 @@ error: the associated type `Combination` exists for `Duple<String, Rc<str>>`, bu --> $DIR/not-found-unsatisfied-bounds-0.rs:20:45 | LL | struct Duple<T, U>(T, U); - | ------------------ associated item `Combination` not found for this struct + | ------------------ associated type `Combination` not found for this struct ... LL | let _: Duple<String, std::rc::Rc<str>>::Combination; | ^^^^^^^^^^^ associated type cannot be referenced on `Duple<String, Rc<str>>` due to unsatisfied trait bounds diff --git a/tests/ui/associated-inherent-types/not-found-unsatisfied-bounds-1.stderr b/tests/ui/associated-inherent-types/not-found-unsatisfied-bounds-1.stderr index 0d5f781dc63..c27e1f49faa 100644 --- a/tests/ui/associated-inherent-types/not-found-unsatisfied-bounds-1.stderr +++ b/tests/ui/associated-inherent-types/not-found-unsatisfied-bounds-1.stderr @@ -5,7 +5,7 @@ LL | let _: Container<T>::Proj = String::new(); | ^^^^ associated type cannot be referenced on `Container<T>` due to unsatisfied trait bounds ... LL | struct Container<T>(T); - | ------------------- associated item `Proj` not found for this struct + | ------------------- associated type `Proj` not found for this struct | = note: the following trait bounds were not satisfied: `T: Clone` diff --git a/tests/ui/associated-inherent-types/not-found-unsatisfied-bounds-in-multiple-impls.stderr b/tests/ui/associated-inherent-types/not-found-unsatisfied-bounds-in-multiple-impls.stderr index 1613af6b8b1..db6c71a626f 100644 --- a/tests/ui/associated-inherent-types/not-found-unsatisfied-bounds-in-multiple-impls.stderr +++ b/tests/ui/associated-inherent-types/not-found-unsatisfied-bounds-in-multiple-impls.stderr @@ -2,7 +2,7 @@ error: the associated type `X` exists for `S<Featureless, Featureless>`, but its --> $DIR/not-found-unsatisfied-bounds-in-multiple-impls.rs:19:43 | LL | struct S<A, B>(A, B); - | -------------- associated item `X` not found for this struct + | -------------- associated type `X` not found for this struct LL | struct Featureless; | ------------------ doesn't satisfy `Featureless: One` or `Featureless: Two` ... diff --git a/tests/ui/associated-item/missing-associated_item_or_field_def_ids.rs b/tests/ui/associated-item/missing-associated_item_or_field_def_ids.rs new file mode 100644 index 00000000000..b90bb9ea4dd --- /dev/null +++ b/tests/ui/associated-item/missing-associated_item_or_field_def_ids.rs @@ -0,0 +1,8 @@ +// Regression test for <https://github.com/rust-lang/rust/issues/137554>. + +fn main() -> dyn Iterator + ?Iterator::advance_by(usize) { + //~^ ERROR `?Trait` is not permitted in trait object types + //~| ERROR expected trait, found associated function `Iterator::advance_by` + //~| ERROR the value of the associated type `Item` in `Iterator` must be specified + todo!() +} diff --git a/tests/ui/associated-item/missing-associated_item_or_field_def_ids.stderr b/tests/ui/associated-item/missing-associated_item_or_field_def_ids.stderr new file mode 100644 index 00000000000..7f0fbc800ed --- /dev/null +++ b/tests/ui/associated-item/missing-associated_item_or_field_def_ids.stderr @@ -0,0 +1,25 @@ +error[E0658]: `?Trait` is not permitted in trait object types + --> $DIR/missing-associated_item_or_field_def_ids.rs:3:29 + | +LL | fn main() -> dyn Iterator + ?Iterator::advance_by(usize) { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: add `#![feature(more_maybe_bounds)]` 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[E0404]: expected trait, found associated function `Iterator::advance_by` + --> $DIR/missing-associated_item_or_field_def_ids.rs:3:30 + | +LL | fn main() -> dyn Iterator + ?Iterator::advance_by(usize) { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ not a trait + +error[E0191]: the value of the associated type `Item` in `Iterator` must be specified + --> $DIR/missing-associated_item_or_field_def_ids.rs:3:18 + | +LL | fn main() -> dyn Iterator + ?Iterator::advance_by(usize) { + | ^^^^^^^^ help: specify the associated type: `Iterator<Item = Type>` + +error: aborting due to 3 previous errors + +Some errors have detailed explanations: E0191, E0404, E0658. +For more information about an error, try `rustc --explain E0191`. diff --git a/tests/ui/associated-type-bounds/return-type-notation/bad-inputs-and-output.fixed b/tests/ui/associated-type-bounds/return-type-notation/bad-inputs-and-output.fixed new file mode 100644 index 00000000000..7af986267aa --- /dev/null +++ b/tests/ui/associated-type-bounds/return-type-notation/bad-inputs-and-output.fixed @@ -0,0 +1,40 @@ +//@ edition: 2021 +//@ run-rustfix +#![feature(return_type_notation)] +#![allow(dead_code)] + +trait Trait { + async fn method() {} +} + +fn foo<T: Trait<method(..): Send>>() {} +//~^ ERROR argument types not allowed with return type notation + +fn bar<T: Trait<method(..): Send>>() {} +//~^ ERROR return type not allowed with return type notation + +fn baz<T: Trait<method(..): Send>>() {} +//~^ ERROR return type notation arguments must be elided with `..` + +fn foo_path<T: Trait>() where T::method(..): Send {} +//~^ ERROR argument types not allowed with return type notation + +fn bar_path<T: Trait>() where T::method(..): Send {} +//~^ ERROR return type not allowed with return type notation + +fn bay_path<T: Trait>() where T::method(..): Send {} +//~^ ERROR return type not allowed with return type notation + +fn baz_path<T: Trait>() where T::method(..): Send {} +//~^ ERROR return type notation arguments must be elided with `..` + +fn foo_qualified<T: Trait>() where T::method(..): Send {} +//~^ ERROR expected associated type + +fn bar_qualified<T: Trait>() where T::method(..): Send {} +//~^ ERROR expected associated type + +fn baz_qualified<T: Trait>() where T::method(..): Send {} +//~^ ERROR expected associated type + +fn main() {} diff --git a/tests/ui/associated-type-bounds/return-type-notation/bad-inputs-and-output.rs b/tests/ui/associated-type-bounds/return-type-notation/bad-inputs-and-output.rs index f00aaec1a8c..983836e6433 100644 --- a/tests/ui/associated-type-bounds/return-type-notation/bad-inputs-and-output.rs +++ b/tests/ui/associated-type-bounds/return-type-notation/bad-inputs-and-output.rs @@ -1,6 +1,7 @@ //@ edition: 2021 - +//@ run-rustfix #![feature(return_type_notation)] +#![allow(dead_code)] trait Trait { async fn method() {} @@ -21,6 +22,9 @@ fn foo_path<T: Trait>() where T::method(i32): Send {} fn bar_path<T: Trait>() where T::method() -> (): Send {} //~^ ERROR return type not allowed with return type notation +fn bay_path<T: Trait>() where T::method(..) -> (): Send {} +//~^ ERROR return type not allowed with return type notation + fn baz_path<T: Trait>() where T::method(): Send {} //~^ ERROR return type notation arguments must be elided with `..` diff --git a/tests/ui/associated-type-bounds/return-type-notation/bad-inputs-and-output.stderr b/tests/ui/associated-type-bounds/return-type-notation/bad-inputs-and-output.stderr index c6b9f3eff90..e1245a04c7f 100644 --- a/tests/ui/associated-type-bounds/return-type-notation/bad-inputs-and-output.stderr +++ b/tests/ui/associated-type-bounds/return-type-notation/bad-inputs-and-output.stderr @@ -1,57 +1,121 @@ +error: return type not allowed with return type notation + --> $DIR/bad-inputs-and-output.rs:25:45 + | +LL | fn bay_path<T: Trait>() where T::method(..) -> (): Send {} + | ^^^^^ + | +help: remove the return type + | +LL - fn bay_path<T: Trait>() where T::method(..) -> (): Send {} +LL + fn bay_path<T: Trait>() where T::method(..): Send {} + | + error[E0575]: expected associated type, found associated function `Trait::method` - --> $DIR/bad-inputs-and-output.rs:27:36 + --> $DIR/bad-inputs-and-output.rs:31:36 | LL | fn foo_qualified<T: Trait>() where <T as Trait>::method(i32): Send {} | ^^^^^^^^^^^^^^^^^^^^^^^^^ not a associated type + | +help: you might have meant to use the return type notation syntax + | +LL - fn foo_qualified<T: Trait>() where <T as Trait>::method(i32): Send {} +LL + fn foo_qualified<T: Trait>() where T::method(..): Send {} + | error[E0575]: expected associated type, found associated function `Trait::method` - --> $DIR/bad-inputs-and-output.rs:30:36 + --> $DIR/bad-inputs-and-output.rs:34:36 | LL | fn bar_qualified<T: Trait>() where <T as Trait>::method() -> (): Send {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not a associated type + | +help: you might have meant to use the return type notation syntax + | +LL - fn bar_qualified<T: Trait>() where <T as Trait>::method() -> (): Send {} +LL + fn bar_qualified<T: Trait>() where T::method(..): Send {} + | error[E0575]: expected associated type, found associated function `Trait::method` - --> $DIR/bad-inputs-and-output.rs:33:36 + --> $DIR/bad-inputs-and-output.rs:37:36 | LL | fn baz_qualified<T: Trait>() where <T as Trait>::method(): Send {} | ^^^^^^^^^^^^^^^^^^^^^^ not a associated type + | +help: you might have meant to use the return type notation syntax + | +LL - fn baz_qualified<T: Trait>() where <T as Trait>::method(): Send {} +LL + fn baz_qualified<T: Trait>() where T::method(..): Send {} + | error: argument types not allowed with return type notation - --> $DIR/bad-inputs-and-output.rs:9:23 + --> $DIR/bad-inputs-and-output.rs:10:23 | LL | fn foo<T: Trait<method(i32): Send>>() {} - | ^^^^^ help: remove the input types: `()` + | ^^^^^ + | +help: remove the input types + | +LL - fn foo<T: Trait<method(i32): Send>>() {} +LL + fn foo<T: Trait<method(..): Send>>() {} + | error: return type not allowed with return type notation - --> $DIR/bad-inputs-and-output.rs:12:25 + --> $DIR/bad-inputs-and-output.rs:13:25 | LL | fn bar<T: Trait<method() -> (): Send>>() {} - | ^^^^^^ help: remove the return type + | ^^^^^^ + | +help: use the right argument notation and remove the return type + | +LL - fn bar<T: Trait<method() -> (): Send>>() {} +LL + fn bar<T: Trait<method(..): Send>>() {} + | error: return type notation arguments must be elided with `..` - --> $DIR/bad-inputs-and-output.rs:15:23 + --> $DIR/bad-inputs-and-output.rs:16:23 | LL | fn baz<T: Trait<method(): Send>>() {} - | ^^ help: add `..`: `(..)` + | ^^ + | +help: use the correct syntax by adding `..` to the arguments + | +LL | fn baz<T: Trait<method(..): Send>>() {} + | ++ error: argument types not allowed with return type notation - --> $DIR/bad-inputs-and-output.rs:18:40 + --> $DIR/bad-inputs-and-output.rs:19:40 | LL | fn foo_path<T: Trait>() where T::method(i32): Send {} - | ^^^^^ help: remove the input types: `()` + | ^^^^^ + | +help: remove the input types + | +LL - fn foo_path<T: Trait>() where T::method(i32): Send {} +LL + fn foo_path<T: Trait>() where T::method(..): Send {} + | error: return type not allowed with return type notation - --> $DIR/bad-inputs-and-output.rs:21:42 + --> $DIR/bad-inputs-and-output.rs:22:42 | LL | fn bar_path<T: Trait>() where T::method() -> (): Send {} - | ^^^^^^ help: remove the return type + | ^^^^^^ + | +help: use the right argument notation and remove the return type + | +LL - fn bar_path<T: Trait>() where T::method() -> (): Send {} +LL + fn bar_path<T: Trait>() where T::method(..): Send {} + | error: return type notation arguments must be elided with `..` - --> $DIR/bad-inputs-and-output.rs:24:40 + --> $DIR/bad-inputs-and-output.rs:28:40 | LL | fn baz_path<T: Trait>() where T::method(): Send {} - | ^^ help: add `..`: `(..)` + | ^^ + | +help: use the correct syntax by adding `..` to the arguments + | +LL | fn baz_path<T: Trait>() where T::method(..): Send {} + | ++ -error: aborting due to 9 previous errors +error: aborting due to 10 previous errors For more information about this error, try `rustc --explain E0575`. diff --git a/tests/ui/associated-types/associated-types-ICE-when-projecting-out-of-err.rs b/tests/ui/associated-types/associated-types-ICE-when-projecting-out-of-err.rs index 707bcac78bf..22786043693 100644 --- a/tests/ui/associated-types/associated-types-ICE-when-projecting-out-of-err.rs +++ b/tests/ui/associated-types/associated-types-ICE-when-projecting-out-of-err.rs @@ -1,3 +1,4 @@ +//@ add-core-stubs // Test that we do not ICE when the self type is `ty::err`, but rather // just propagate the error. @@ -6,17 +7,8 @@ #![feature(no_core)] #![no_core] -#[lang="sized"] -pub trait Sized { - // Empty. -} - -#[lang = "add"] -trait Add<RHS=Self> { - type Output; - - fn add(self, _: RHS) -> Self::Output; -} +extern crate minicore; +use minicore::*; fn ice<A>(a: A) { let r = loop {}; diff --git a/tests/ui/associated-types/associated-types-ICE-when-projecting-out-of-err.stderr b/tests/ui/associated-types/associated-types-ICE-when-projecting-out-of-err.stderr index ebe56c8cd68..0bbb601a6d2 100644 --- a/tests/ui/associated-types/associated-types-ICE-when-projecting-out-of-err.stderr +++ b/tests/ui/associated-types/associated-types-ICE-when-projecting-out-of-err.stderr @@ -1,14 +1,8 @@ error[E0277]: the trait bound `(): Add<A>` is not satisfied - --> $DIR/associated-types-ICE-when-projecting-out-of-err.rs:23:11 + --> $DIR/associated-types-ICE-when-projecting-out-of-err.rs:15:11 | LL | r = r + a; | ^ the trait `Add<A>` is not implemented for `()` - | -help: this trait has no implementations, consider adding one - --> $DIR/associated-types-ICE-when-projecting-out-of-err.rs:15:1 - | -LL | trait Add<RHS=Self> { - | ^^^^^^^^^^^^^^^^^^^ error: aborting due to 1 previous error diff --git a/tests/ui/associated-types/avoid-getting-associated-items-of-undefined-trait.rs b/tests/ui/associated-types/avoid-getting-associated-items-of-undefined-trait.rs new file mode 100644 index 00000000000..f6b749a5100 --- /dev/null +++ b/tests/ui/associated-types/avoid-getting-associated-items-of-undefined-trait.rs @@ -0,0 +1,12 @@ +// Fix for <https://github.com/rust-lang/rust/issues/137508>. + +trait Tr { + type Item; +} + +fn main() { + let _: dyn Tr + ?Foo<Assoc = ()>; + //~^ ERROR: `?Trait` is not permitted in trait object types + //~| ERROR: cannot find trait `Foo` in this scope + //~| ERROR: the value of the associated type `Item` in `Tr` must be specified +} diff --git a/tests/ui/associated-types/avoid-getting-associated-items-of-undefined-trait.stderr b/tests/ui/associated-types/avoid-getting-associated-items-of-undefined-trait.stderr new file mode 100644 index 00000000000..f31a1de76a7 --- /dev/null +++ b/tests/ui/associated-types/avoid-getting-associated-items-of-undefined-trait.stderr @@ -0,0 +1,28 @@ +error[E0658]: `?Trait` is not permitted in trait object types + --> $DIR/avoid-getting-associated-items-of-undefined-trait.rs:8:21 + | +LL | let _: dyn Tr + ?Foo<Assoc = ()>; + | ^^^^^^^^^^^^^^^^ + | + = help: add `#![feature(more_maybe_bounds)]` 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[E0405]: cannot find trait `Foo` in this scope + --> $DIR/avoid-getting-associated-items-of-undefined-trait.rs:8:22 + | +LL | let _: dyn Tr + ?Foo<Assoc = ()>; + | ^^^ not found in this scope + +error[E0191]: the value of the associated type `Item` in `Tr` must be specified + --> $DIR/avoid-getting-associated-items-of-undefined-trait.rs:8:16 + | +LL | type Item; + | --------- `Item` defined here +... +LL | let _: dyn Tr + ?Foo<Assoc = ()>; + | ^^ help: specify the associated type: `Tr<Item = Type>` + +error: aborting due to 3 previous errors + +Some errors have detailed explanations: E0191, E0405, E0658. +For more information about an error, try `rustc --explain E0191`. diff --git a/tests/ui/associated-types/ident-from-macro-expansion.rs b/tests/ui/associated-types/ident-from-macro-expansion.rs new file mode 100644 index 00000000000..6aabe457140 --- /dev/null +++ b/tests/ui/associated-types/ident-from-macro-expansion.rs @@ -0,0 +1,23 @@ +trait Trait {} +impl Trait for () {} + +macro_rules! fully_qualified { + ($id:ident) => { + <() as Trait>::$id + } +} + +macro_rules! type_dependent { + ($t:ident, $id:ident) => { + T::$id + } +} + +fn t<T: Trait>() { + let x: fully_qualified!(Assoc); + //~^ ERROR cannot find associated type `Assoc` in trait `Trait` + let x: type_dependent!(T, Assoc); + //~^ ERROR associated type `Assoc` not found for `T` +} + +fn main() {} diff --git a/tests/ui/associated-types/ident-from-macro-expansion.stderr b/tests/ui/associated-types/ident-from-macro-expansion.stderr new file mode 100644 index 00000000000..dabf13c2c17 --- /dev/null +++ b/tests/ui/associated-types/ident-from-macro-expansion.stderr @@ -0,0 +1,22 @@ +error[E0576]: cannot find associated type `Assoc` in trait `Trait` + --> $DIR/ident-from-macro-expansion.rs:17:29 + | +LL | <() as Trait>::$id + | --- due to this macro variable +... +LL | let x: fully_qualified!(Assoc); + | ^^^^^ not found in `Trait` + +error[E0220]: associated type `Assoc` not found for `T` + --> $DIR/ident-from-macro-expansion.rs:19:31 + | +LL | T::$id + | --- due to this macro variable +... +LL | let x: type_dependent!(T, Assoc); + | ^^^^^ associated type `Assoc` not found + +error: aborting due to 2 previous errors + +Some errors have detailed explanations: E0220, E0576. +For more information about an error, try `rustc --explain E0220`. diff --git a/tests/ui/async-await/async-closures/kind-due-to-rpit.rs b/tests/ui/async-await/async-closures/kind-due-to-rpit.rs new file mode 100644 index 00000000000..ad19d93b93a --- /dev/null +++ b/tests/ui/async-await/async-closures/kind-due-to-rpit.rs @@ -0,0 +1,14 @@ +//@ edition: 2024 + +// Make sure the error message is understandable when an `AsyncFn` goal is not satisfied +// (due to closure kind), and that goal originates from an RPIT. + +fn repro(foo: impl Into<bool>) -> impl AsyncFn() { + let inner_fn = async move || { + //~^ ERROR expected a closure that implements the `AsyncFn` trait + let _ = foo.into(); + }; + inner_fn +} + +fn main() {} diff --git a/tests/ui/async-await/async-closures/kind-due-to-rpit.stderr b/tests/ui/async-await/async-closures/kind-due-to-rpit.stderr new file mode 100644 index 00000000000..982cc50e14f --- /dev/null +++ b/tests/ui/async-await/async-closures/kind-due-to-rpit.stderr @@ -0,0 +1,17 @@ +error[E0525]: expected a closure that implements the `AsyncFn` trait, but this closure only implements `AsyncFnOnce` + --> $DIR/kind-due-to-rpit.rs:7:20 + | +LL | fn repro(foo: impl Into<bool>) -> impl AsyncFn() { + | -------------- the requirement to implement `AsyncFn` derives from here +LL | let inner_fn = async move || { + | ^^^^^^^^^^^^^ this closure implements `AsyncFnOnce`, not `AsyncFn` +LL | +LL | let _ = foo.into(); + | --- closure is `AsyncFnOnce` because it moves the variable `foo` out of its environment +LL | }; +LL | inner_fn + | -------- return type was inferred to be `{async closure@$DIR/kind-due-to-rpit.rs:7:20: 7:33}` here + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0525`. diff --git a/tests/ui/async-await/async-fn/suggest-constrain.rs b/tests/ui/async-await/async-fn/suggest-constrain.rs new file mode 100644 index 00000000000..319dcc0084a --- /dev/null +++ b/tests/ui/async-await/async-fn/suggest-constrain.rs @@ -0,0 +1,11 @@ +// Ensure that we don't suggest constraining `CallRefFuture` here, +// since that isn't stable. + +fn spawn<F: AsyncFn() + Send>(f: F) { + check_send(f()); + //~^ ERROR cannot be sent between threads safely +} + +fn check_send<T: Send>(_: T) {} + +fn main() {} diff --git a/tests/ui/async-await/async-fn/suggest-constrain.stderr b/tests/ui/async-await/async-fn/suggest-constrain.stderr new file mode 100644 index 00000000000..94270aad63e --- /dev/null +++ b/tests/ui/async-await/async-fn/suggest-constrain.stderr @@ -0,0 +1,18 @@ +error[E0277]: `<F as AsyncFnMut<()>>::CallRefFuture<'_>` cannot be sent between threads safely + --> $DIR/suggest-constrain.rs:5:16 + | +LL | check_send(f()); + | ---------- ^^^ `<F as AsyncFnMut<()>>::CallRefFuture<'_>` cannot be sent between threads safely + | | + | required by a bound introduced by this call + | + = help: the trait `Send` is not implemented for `<F as AsyncFnMut<()>>::CallRefFuture<'_>` +note: required by a bound in `check_send` + --> $DIR/suggest-constrain.rs:9:18 + | +LL | fn check_send<T: Send>(_: T) {} + | ^^^^ required by this bound in `check_send` + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/async-await/issues/issue-63388-2.rs b/tests/ui/async-await/issues/issue-63388-2.rs index 8bb5cfa4a59..d9dc602bd1c 100644 --- a/tests/ui/async-await/issues/issue-63388-2.rs +++ b/tests/ui/async-await/issues/issue-63388-2.rs @@ -12,7 +12,6 @@ impl Xyz { ) -> &dyn Foo //~ ERROR missing lifetime specifier { foo - //~^ ERROR explicit lifetime required in the type of `foo` [E0621] } } diff --git a/tests/ui/async-await/issues/issue-63388-2.stderr b/tests/ui/async-await/issues/issue-63388-2.stderr index 7e3c0a1227d..45843bc72cd 100644 --- a/tests/ui/async-await/issues/issue-63388-2.stderr +++ b/tests/ui/async-await/issues/issue-63388-2.stderr @@ -12,16 +12,6 @@ help: consider using the `'a` lifetime LL | ) -> &'a dyn Foo | ++ -error[E0621]: explicit lifetime required in the type of `foo` - --> $DIR/issue-63388-2.rs:14:9 - | -LL | foo: &dyn Foo, bar: &'a dyn Foo - | -------- help: add explicit lifetime `'a` to the type of `foo`: `&'a (dyn Foo + 'a)` -... -LL | foo - | ^^^ lifetime `'a` required - -error: aborting due to 2 previous errors +error: aborting due to 1 previous error -Some errors have detailed explanations: E0106, E0621. -For more information about an error, try `rustc --explain E0106`. +For more information about this error, try `rustc --explain E0106`. diff --git a/tests/ui/async-await/pin-ergonomics/sugar-self.rs b/tests/ui/async-await/pin-ergonomics/sugar-self.rs new file mode 100644 index 00000000000..3d71b54b1ae --- /dev/null +++ b/tests/ui/async-await/pin-ergonomics/sugar-self.rs @@ -0,0 +1,46 @@ +//@ check-pass + +#![feature(pin_ergonomics)] +#![allow(dead_code, incomplete_features)] + +// Makes sure we can handle `&pin mut self` and `&pin const self` as sugar for +// `self: Pin<&mut Self>` and `self: Pin<&Self>`. + +use std::pin::Pin; + +struct Foo; + +impl Foo { + fn baz(&pin mut self) {} + + fn baz_const(&pin const self) {} + + fn baz_lt<'a>(&'a pin mut self) {} + + fn baz_const_lt(&'_ pin const self) {} +} + +fn foo(_: &pin mut Foo) {} + +fn foo_const(_: &pin const Foo) {} + +fn bar(x: &pin mut Foo) { + // For the calls below to work we need to automatically reborrow, + // as if the user had written `foo(x.as_mut())`. + foo(x); + foo(x); + + Foo::baz(x); + Foo::baz(x); + + // make sure we can reborrow &mut as &. + foo_const(x); + Foo::baz_const(x); + + let x: &pin const _ = Pin::new(&Foo); + + foo_const(x); // make sure reborrowing from & to & works. + foo_const(x); +} + +fn main() {} diff --git a/tests/ui/attributes/arg-error-issue-121425.stderr b/tests/ui/attributes/arg-error-issue-121425.stderr index 1beb99b1703..6e71f15fdc8 100644 --- a/tests/ui/attributes/arg-error-issue-121425.stderr +++ b/tests/ui/attributes/arg-error-issue-121425.stderr @@ -1,3 +1,9 @@ +error[E0693]: incorrect `repr(align)` attribute format: `align` takes exactly one argument in parentheses + --> $DIR/arg-error-issue-121425.rs:16:8 + | +LL | #[repr(align())] + | ^^^^^^^ + error[E0693]: incorrect `repr(align)` attribute format: `align` expects a literal integer as argument --> $DIR/arg-error-issue-121425.rs:4:14 | @@ -16,12 +22,6 @@ error[E0589]: invalid `repr(align)` attribute: not an unsuffixed integer LL | #[repr(align("str"))] | ^^^^^ -error[E0693]: incorrect `repr(align)` attribute format: `align` takes exactly one argument in parentheses - --> $DIR/arg-error-issue-121425.rs:16:8 - | -LL | #[repr(align())] - | ^^^^^^^ - error[E0552]: incorrect `repr(packed)` attribute format: `packed` expects a literal integer as argument --> $DIR/arg-error-issue-121425.rs:21:15 | diff --git a/tests/ui/attributes/auxiliary/used_pre_main_constructor.rs b/tests/ui/attributes/auxiliary/used_pre_main_constructor.rs new file mode 100644 index 00000000000..d94572ef5d6 --- /dev/null +++ b/tests/ui/attributes/auxiliary/used_pre_main_constructor.rs @@ -0,0 +1,33 @@ +//! Add a constructor that runs pre-main, similar to what the `ctor` crate does. +//! +//! #[ctor] +//! fn constructor() { +//! println!("constructor"); +//! } + +//@ no-prefer-dynamic explicitly test with crates that are built as an archive +#![crate_type = "rlib"] + +#[cfg_attr( + any( + target_os = "android", + target_os = "dragonfly", + target_os = "freebsd", + target_os = "haiku", + target_os = "illumos", + target_os = "linux", + target_os = "netbsd", + target_os = "nto", + target_os = "openbsd", + ), + link_section = ".init_array" +)] +#[cfg_attr(target_vendor = "apple", link_section = "__DATA,__mod_init_func,mod_init_funcs")] +#[cfg_attr(target_os = "windows", link_section = ".CRT$XCU")] +#[used] +static CONSTRUCTOR: extern "C" fn() = constructor; + +#[cfg_attr(any(target_os = "linux", target_os = "android"), link_section = ".text.startup")] +extern "C" fn constructor() { + println!("constructor"); +} diff --git a/tests/ui/attributes/crate-type-macro-empty.rs b/tests/ui/attributes/crate-type-macro-empty.rs new file mode 100644 index 00000000000..5ff7fc002fd --- /dev/null +++ b/tests/ui/attributes/crate-type-macro-empty.rs @@ -0,0 +1,7 @@ +// Tests for the issue in #137589 +#[crate_type = foo!()] +//~^ ERROR cannot find macro `foo` in this scope + +macro_rules! foo {} //~ ERROR unexpected end of macro invocation + +fn main() {} diff --git a/tests/ui/attributes/crate-type-macro-empty.stderr b/tests/ui/attributes/crate-type-macro-empty.stderr new file mode 100644 index 00000000000..e48d3d95470 --- /dev/null +++ b/tests/ui/attributes/crate-type-macro-empty.stderr @@ -0,0 +1,20 @@ +error: unexpected end of macro invocation + --> $DIR/crate-type-macro-empty.rs:5:1 + | +LL | macro_rules! foo {} + | ^^^^^^^^^^^^^^^^^^^ missing tokens in macro arguments + +error: cannot find macro `foo` in this scope + --> $DIR/crate-type-macro-empty.rs:2:16 + | +LL | #[crate_type = foo!()] + | ^^^ consider moving the definition of `foo` before this call + | +note: a macro with the same name exists, but it appears later + --> $DIR/crate-type-macro-empty.rs:5:14 + | +LL | macro_rules! foo {} + | ^^^ + +error: aborting due to 2 previous errors + diff --git a/tests/ui/attributes/crate-type-macro-not-crate.rs b/tests/ui/attributes/crate-type-macro-not-crate.rs new file mode 100644 index 00000000000..e5eb22d6f6e --- /dev/null +++ b/tests/ui/attributes/crate-type-macro-not-crate.rs @@ -0,0 +1,9 @@ +// Tests for the issue in #137589 + + +macro_rules! foo { + ($x:expr) => {"rlib"} +} + +#[crate_type = foo!()] //~ ERROR unexpected end of macro invocation +fn main() {} diff --git a/tests/ui/attributes/crate-type-macro-not-crate.stderr b/tests/ui/attributes/crate-type-macro-not-crate.stderr new file mode 100644 index 00000000000..ce188b3eef5 --- /dev/null +++ b/tests/ui/attributes/crate-type-macro-not-crate.stderr @@ -0,0 +1,17 @@ +error: unexpected end of macro invocation + --> $DIR/crate-type-macro-not-crate.rs:8:16 + | +LL | macro_rules! foo { + | ---------------- when calling this macro +... +LL | #[crate_type = foo!()] + | ^^^^^^ missing tokens in macro arguments + | +note: while trying to match meta-variable `$x:expr` + --> $DIR/crate-type-macro-not-crate.rs:5:6 + | +LL | ($x:expr) => {"rlib"} + | ^^^^^^^ + +error: aborting due to 1 previous error + diff --git a/tests/ui/attributes/crate-type-macro-not-found.rs b/tests/ui/attributes/crate-type-macro-not-found.rs new file mode 100644 index 00000000000..824468c0e85 --- /dev/null +++ b/tests/ui/attributes/crate-type-macro-not-found.rs @@ -0,0 +1,8 @@ +// Tests for the issue in #137589 +#[crate_type = foo!()] //~ ERROR cannot find macro `foo` in this scope + +macro_rules! foo { + ($x:expr) => {"rlib"} +} + +fn main() {} diff --git a/tests/ui/attributes/crate-type-macro-not-found.stderr b/tests/ui/attributes/crate-type-macro-not-found.stderr new file mode 100644 index 00000000000..a4967e4f12e --- /dev/null +++ b/tests/ui/attributes/crate-type-macro-not-found.stderr @@ -0,0 +1,14 @@ +error: cannot find macro `foo` in this scope + --> $DIR/crate-type-macro-not-found.rs:2:16 + | +LL | #[crate_type = foo!()] + | ^^^ consider moving the definition of `foo` before this call + | +note: a macro with the same name exists, but it appears later + --> $DIR/crate-type-macro-not-found.rs:4:14 + | +LL | macro_rules! foo { + | ^^^ + +error: aborting due to 1 previous error + diff --git a/tests/ui/attributes/decl_macro_ty_in_attr_macro.rs b/tests/ui/attributes/decl_macro_ty_in_attr_macro.rs new file mode 100644 index 00000000000..e633c08be3a --- /dev/null +++ b/tests/ui/attributes/decl_macro_ty_in_attr_macro.rs @@ -0,0 +1,20 @@ +// tests for #137662: using a ty or (or most other) fragment inside an attr macro wouldn't work +// because of a missing code path. With $repr: tt it did work. +//@ check-pass + +macro_rules! foo { + { + $repr:ty + } => { + #[repr($repr)] + pub enum Foo { + Bar = 0i32, + } + } +} + +foo! { + i32 +} + +fn main() {} diff --git a/tests/ui/attributes/issue-100631.stderr b/tests/ui/attributes/issue-100631.stderr index 6e8e4f3b418..b2bd0a96325 100644 --- a/tests/ui/attributes/issue-100631.stderr +++ b/tests/ui/attributes/issue-100631.stderr @@ -1,8 +1,8 @@ error[E0084]: unsupported representation for zero-variant enum - --> $DIR/issue-100631.rs:4:1 + --> $DIR/issue-100631.rs:4:8 | LL | #[repr(C)] - | ^^^^^^^^^^ + | ^ LL | #[repr(C)] LL | enum Foo {} | -------- zero-variant enum diff --git a/tests/ui/attributes/malformed-fn-align.rs b/tests/ui/attributes/malformed-fn-align.rs new file mode 100644 index 00000000000..4aaad01b723 --- /dev/null +++ b/tests/ui/attributes/malformed-fn-align.rs @@ -0,0 +1,7 @@ +#![feature(fn_align)] +#![crate_type = "lib"] + +trait MyTrait { + #[repr(align)] //~ ERROR invalid `repr(align)` attribute: `align` needs an argument + fn myfun(); +} diff --git a/tests/ui/attributes/malformed-fn-align.stderr b/tests/ui/attributes/malformed-fn-align.stderr new file mode 100644 index 00000000000..57913c48ef7 --- /dev/null +++ b/tests/ui/attributes/malformed-fn-align.stderr @@ -0,0 +1,9 @@ +error[E0589]: invalid `repr(align)` attribute: `align` needs an argument + --> $DIR/malformed-fn-align.rs:5:12 + | +LL | #[repr(align)] + | ^^^^^ help: supply an argument here: `align(...)` + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0589`. diff --git a/tests/ui/attributes/mixed_export_name_and_no_mangle.fixed b/tests/ui/attributes/mixed_export_name_and_no_mangle.fixed index 7224d4289e3..d8b5235c52f 100644 --- a/tests/ui/attributes/mixed_export_name_and_no_mangle.fixed +++ b/tests/ui/attributes/mixed_export_name_and_no_mangle.fixed @@ -3,7 +3,7 @@ //@ check-pass #![warn(unused_attributes)] -//~^ WARN `#[no_mangle]` attribute may not be used in combination with `#[export_name]` [unused_attributes] +//~^ WARN `#[unsafe(no_mangle)]` attribute may not be used in combination with `#[export_name]` [unused_attributes] #[export_name = "foo"] pub fn bar() {} diff --git a/tests/ui/attributes/mixed_export_name_and_no_mangle.rs b/tests/ui/attributes/mixed_export_name_and_no_mangle.rs index 149a7904e1e..83a673a7d13 100644 --- a/tests/ui/attributes/mixed_export_name_and_no_mangle.rs +++ b/tests/ui/attributes/mixed_export_name_and_no_mangle.rs @@ -4,7 +4,7 @@ #![warn(unused_attributes)] #[no_mangle] -//~^ WARN `#[no_mangle]` attribute may not be used in combination with `#[export_name]` [unused_attributes] +//~^ WARN `#[unsafe(no_mangle)]` attribute may not be used in combination with `#[export_name]` [unused_attributes] #[export_name = "foo"] pub fn bar() {} diff --git a/tests/ui/attributes/mixed_export_name_and_no_mangle.stderr b/tests/ui/attributes/mixed_export_name_and_no_mangle.stderr index ba63127ba2d..c760d27db25 100644 --- a/tests/ui/attributes/mixed_export_name_and_no_mangle.stderr +++ b/tests/ui/attributes/mixed_export_name_and_no_mangle.stderr @@ -1,8 +1,8 @@ -warning: `#[no_mangle]` attribute may not be used in combination with `#[export_name]` +warning: `#[unsafe(no_mangle)]` attribute may not be used in combination with `#[export_name]` --> $DIR/mixed_export_name_and_no_mangle.rs:6:1 | LL | #[no_mangle] - | ^^^^^^^^^^^^ `#[no_mangle]` is ignored + | ^^^^^^^^^^^^ `#[unsafe(no_mangle)]` is ignored | note: `#[export_name]` takes precedence --> $DIR/mixed_export_name_and_no_mangle.rs:8:1 @@ -14,7 +14,7 @@ note: the lint level is defined here | LL | #![warn(unused_attributes)] | ^^^^^^^^^^^^^^^^^ -help: remove the `#[no_mangle]` attribute +help: remove the `#[unsafe(no_mangle)]` attribute | LL - #[no_mangle] | diff --git a/tests/ui/attributes/nonterminal-expansion.rs b/tests/ui/attributes/nonterminal-expansion.rs index 1b2e92a3170..83c8f00999a 100644 --- a/tests/ui/attributes/nonterminal-expansion.rs +++ b/tests/ui/attributes/nonterminal-expansion.rs @@ -5,7 +5,8 @@ macro_rules! pass_nonterminal { ($n:expr) => { #[repr(align($n))] - //~^ ERROR expected unsuffixed literal, found `n!()` + //~^ ERROR expected unsuffixed literal, found expression `n!()` + //~^^ ERROR incorrect `repr(align)` attribute format: `align` expects a literal integer as argument [E0693] struct S; }; } @@ -15,6 +16,5 @@ macro_rules! n { } pass_nonterminal!(n!()); -//~^ ERROR incorrect `repr(align)` attribute format: `align` expects a literal integer as argument [E0693] fn main() {} diff --git a/tests/ui/attributes/nonterminal-expansion.stderr b/tests/ui/attributes/nonterminal-expansion.stderr index b640575d17d..8a85731bd5a 100644 --- a/tests/ui/attributes/nonterminal-expansion.stderr +++ b/tests/ui/attributes/nonterminal-expansion.stderr @@ -1,4 +1,4 @@ -error: expected unsuffixed literal, found `n!()` +error: expected unsuffixed literal, found expression `n!()` --> $DIR/nonterminal-expansion.rs:7:22 | LL | #[repr(align($n))] @@ -10,10 +10,15 @@ LL | pass_nonterminal!(n!()); = note: this error originates in the macro `pass_nonterminal` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0693]: incorrect `repr(align)` attribute format: `align` expects a literal integer as argument - --> $DIR/nonterminal-expansion.rs:17:19 + --> $DIR/nonterminal-expansion.rs:7:22 | +LL | #[repr(align($n))] + | ^^ +... LL | pass_nonterminal!(n!()); - | ^ + | ----------------------- in this macro invocation + | + = note: this error originates in the macro `pass_nonterminal` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 2 previous errors diff --git a/tests/ui/attributes/repr-align-in-trait-issue-132391.rs b/tests/ui/attributes/repr-align-in-trait-issue-132391.rs new file mode 100644 index 00000000000..b3b79e93e9b --- /dev/null +++ b/tests/ui/attributes/repr-align-in-trait-issue-132391.rs @@ -0,0 +1,6 @@ +trait MyTrait { + #[repr(align)] //~ ERROR invalid `repr(align)` attribute: `align` needs an argument + fn myfun(); +} + +pub fn main() {} diff --git a/tests/ui/attributes/repr-align-in-trait-issue-132391.stderr b/tests/ui/attributes/repr-align-in-trait-issue-132391.stderr new file mode 100644 index 00000000000..4208b018f52 --- /dev/null +++ b/tests/ui/attributes/repr-align-in-trait-issue-132391.stderr @@ -0,0 +1,9 @@ +error[E0589]: invalid `repr(align)` attribute: `align` needs an argument + --> $DIR/repr-align-in-trait-issue-132391.rs:2:12 + | +LL | #[repr(align)] + | ^^^^^ help: supply an argument here: `align(...)` + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0589`. diff --git a/tests/ui/attributes/rustc_confusables.stderr b/tests/ui/attributes/rustc_confusables.stderr index dc71d974daf..55c9219a08a 100644 --- a/tests/ui/attributes/rustc_confusables.stderr +++ b/tests/ui/attributes/rustc_confusables.stderr @@ -4,12 +4,6 @@ error: malformed `rustc_confusables` attribute input LL | #[rustc_confusables] | ^^^^^^^^^^^^^^^^^^^^ help: must be of the form: `#[rustc_confusables("name1", "name2", ...)]` -error: attribute should be applied to an inherent method - --> $DIR/rustc_confusables.rs:45:1 - | -LL | #[rustc_confusables("blah")] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - error: expected at least one confusable name --> $DIR/rustc_confusables.rs:30:5 | @@ -27,6 +21,12 @@ help: consider surrounding this with quotes LL | #[rustc_confusables("invalid_meta_item")] | + + +error: attribute should be applied to an inherent method + --> $DIR/rustc_confusables.rs:45:1 + | +LL | #[rustc_confusables("blah")] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + error[E0599]: no method named `inser` found for struct `rustc_confusables_across_crate::BTreeSet` in the current scope --> $DIR/rustc_confusables.rs:12:7 | diff --git a/tests/ui/attributes/used_with_archive.rs b/tests/ui/attributes/used_with_archive.rs new file mode 100644 index 00000000000..ff29456b87d --- /dev/null +++ b/tests/ui/attributes/used_with_archive.rs @@ -0,0 +1,16 @@ +//! Ensure that `#[used]` in archives are correctly registered. +//! +//! Regression test for https://github.com/rust-lang/rust/issues/133491. + +//@ run-pass +//@ check-run-results +//@ aux-build: used_pre_main_constructor.rs + +//@ ignore-wasm ctor doesn't work on WASM + +// Make sure `rustc` links the archive, but intentionally do not import/use any items. +extern crate used_pre_main_constructor as _; + +fn main() { + println!("main"); +} diff --git a/tests/ui/attributes/used_with_archive.run.stdout b/tests/ui/attributes/used_with_archive.run.stdout new file mode 100644 index 00000000000..212372b3e57 --- /dev/null +++ b/tests/ui/attributes/used_with_archive.run.stdout @@ -0,0 +1,2 @@ +constructor +main diff --git a/tests/ui/auto-traits/ungated-impl.rs b/tests/ui/auto-traits/ungated-impl.rs new file mode 100644 index 00000000000..d46b4b01af9 --- /dev/null +++ b/tests/ui/auto-traits/ungated-impl.rs @@ -0,0 +1,7 @@ +auto trait MyTrait {} +//~^ ERROR auto traits are experimental and possibly buggy + +impl<T> !MyTrait for *mut T {} +//~^ ERROR negative trait bounds are not fully implemented + +fn main() {} diff --git a/tests/ui/auto-traits/ungated-impl.stderr b/tests/ui/auto-traits/ungated-impl.stderr new file mode 100644 index 00000000000..9d10d46a902 --- /dev/null +++ b/tests/ui/auto-traits/ungated-impl.stderr @@ -0,0 +1,23 @@ +error[E0658]: auto traits are experimental and possibly buggy + --> $DIR/ungated-impl.rs:1:1 + | +LL | auto trait MyTrait {} + | ^^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #13231 <https://github.com/rust-lang/rust/issues/13231> for more information + = help: add `#![feature(auto_traits)]` 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[E0658]: negative trait bounds are not fully implemented; use marker types for now + --> $DIR/ungated-impl.rs:4:9 + | +LL | impl<T> !MyTrait for *mut T {} + | ^^^^^^^^ + | + = note: see issue #68318 <https://github.com/rust-lang/rust/issues/68318> for more information + = help: add `#![feature(negative_impls)]` 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/borrowck/issue-81899.rs b/tests/ui/borrowck/issue-81899.rs index 1f1af5c7e05..380c03751f5 100644 --- a/tests/ui/borrowck/issue-81899.rs +++ b/tests/ui/borrowck/issue-81899.rs @@ -1,15 +1,14 @@ // Regression test for #81899. // The `panic!()` below is important to trigger the fixed ICE. -const _CONST: &[u8] = &f(&[], |_| {}); +const _CONST: &[u8] = &f(&[], |_| {}); //~ ERROR evaluation of constant value failed //~^ constant const fn f<F>(_: &[u8], _: F) -> &[u8] where F: FnMut(&u8), { - panic!() //~ ERROR evaluation of constant value failed - //~^ panic + panic!() //~ inside `f } fn main() {} diff --git a/tests/ui/borrowck/issue-81899.stderr b/tests/ui/borrowck/issue-81899.stderr index 1da573ea97c..2e6e7511ec9 100644 --- a/tests/ui/borrowck/issue-81899.stderr +++ b/tests/ui/borrowck/issue-81899.stderr @@ -1,19 +1,14 @@ error[E0080]: evaluation of constant value failed - --> $DIR/issue-81899.rs:11:5 + --> $DIR/issue-81899.rs:4:24 | -LL | panic!() - | ^^^^^^^^ the evaluated program panicked at 'explicit panic', $DIR/issue-81899.rs:11:5 +LL | const _CONST: &[u8] = &f(&[], |_| {}); + | ^^^^^^^^^^^^^^ evaluation panicked: explicit panic | note: inside `f::<{closure@$DIR/issue-81899.rs:4:31: 4:34}>` --> $DIR/issue-81899.rs:11:5 | LL | panic!() - | ^^^^^^^^ -note: inside `_CONST` - --> $DIR/issue-81899.rs:4:24 - | -LL | const _CONST: &[u8] = &f(&[], |_| {}); - | ^^^^^^^^^^^^^^ + | ^^^^^^^^ the failure occurred here = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info) note: erroneous constant encountered diff --git a/tests/ui/borrowck/issue-88434-minimal-example.rs b/tests/ui/borrowck/issue-88434-minimal-example.rs index b75abcb731e..ebaa9a92273 100644 --- a/tests/ui/borrowck/issue-88434-minimal-example.rs +++ b/tests/ui/borrowck/issue-88434-minimal-example.rs @@ -1,14 +1,13 @@ // Regression test related to issue 88434 -const _CONST: &() = &f(&|_| {}); +const _CONST: &() = &f(&|_| {}); //~ ERROR evaluation of constant value failed //~^ constant const fn f<F>(_: &F) where F: FnMut(&u8), { - panic!() //~ ERROR evaluation of constant value failed - //~^ panic + panic!() //~ inside `f } fn main() { } diff --git a/tests/ui/borrowck/issue-88434-minimal-example.stderr b/tests/ui/borrowck/issue-88434-minimal-example.stderr index b32331ce448..c8ac13a3473 100644 --- a/tests/ui/borrowck/issue-88434-minimal-example.stderr +++ b/tests/ui/borrowck/issue-88434-minimal-example.stderr @@ -1,19 +1,14 @@ error[E0080]: evaluation of constant value failed - --> $DIR/issue-88434-minimal-example.rs:10:5 + --> $DIR/issue-88434-minimal-example.rs:3:22 | -LL | panic!() - | ^^^^^^^^ the evaluated program panicked at 'explicit panic', $DIR/issue-88434-minimal-example.rs:10:5 +LL | const _CONST: &() = &f(&|_| {}); + | ^^^^^^^^^^ evaluation panicked: explicit panic | note: inside `f::<{closure@$DIR/issue-88434-minimal-example.rs:3:25: 3:28}>` --> $DIR/issue-88434-minimal-example.rs:10:5 | LL | panic!() - | ^^^^^^^^ -note: inside `_CONST` - --> $DIR/issue-88434-minimal-example.rs:3:22 - | -LL | const _CONST: &() = &f(&|_| {}); - | ^^^^^^^^^^ + | ^^^^^^^^ the failure occurred here = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info) note: erroneous constant encountered diff --git a/tests/ui/borrowck/issue-88434-removal-index-should-be-less.rs b/tests/ui/borrowck/issue-88434-removal-index-should-be-less.rs index f9134e669dc..8d042630424 100644 --- a/tests/ui/borrowck/issue-88434-removal-index-should-be-less.rs +++ b/tests/ui/borrowck/issue-88434-removal-index-should-be-less.rs @@ -1,14 +1,13 @@ // Regression test for issue 88434 -const _CONST: &[u8] = &f(&[], |_| {}); +const _CONST: &[u8] = &f(&[], |_| {}); //~ ERROR evaluation of constant value failed //~^ constant const fn f<F>(_: &[u8], _: F) -> &[u8] where F: FnMut(&u8), { - panic!() //~ ERROR evaluation of constant value failed - //~^ panic + panic!() //~ inside `f } fn main() { } diff --git a/tests/ui/borrowck/issue-88434-removal-index-should-be-less.stderr b/tests/ui/borrowck/issue-88434-removal-index-should-be-less.stderr index e3c881dd465..0041759609c 100644 --- a/tests/ui/borrowck/issue-88434-removal-index-should-be-less.stderr +++ b/tests/ui/borrowck/issue-88434-removal-index-should-be-less.stderr @@ -1,19 +1,14 @@ error[E0080]: evaluation of constant value failed - --> $DIR/issue-88434-removal-index-should-be-less.rs:10:5 + --> $DIR/issue-88434-removal-index-should-be-less.rs:3:24 | -LL | panic!() - | ^^^^^^^^ the evaluated program panicked at 'explicit panic', $DIR/issue-88434-removal-index-should-be-less.rs:10:5 +LL | const _CONST: &[u8] = &f(&[], |_| {}); + | ^^^^^^^^^^^^^^ evaluation panicked: explicit panic | note: inside `f::<{closure@$DIR/issue-88434-removal-index-should-be-less.rs:3:31: 3:34}>` --> $DIR/issue-88434-removal-index-should-be-less.rs:10:5 | LL | panic!() - | ^^^^^^^^ -note: inside `_CONST` - --> $DIR/issue-88434-removal-index-should-be-less.rs:3:24 - | -LL | const _CONST: &[u8] = &f(&[], |_| {}); - | ^^^^^^^^^^^^^^ + | ^^^^^^^^ the failure occurred here = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info) note: erroneous constant encountered diff --git a/tests/ui/borrowck/issue-92157.rs b/tests/ui/borrowck/issue-92157.rs index a2b685cdf6e..72f216e301d 100644 --- a/tests/ui/borrowck/issue-92157.rs +++ b/tests/ui/borrowck/issue-92157.rs @@ -1,3 +1,4 @@ +//@ add-core-stubs #![feature(no_core)] #![feature(lang_items)] @@ -13,28 +14,7 @@ fn start<T>(_main: fn() -> T, _argc: isize, _argv: *const *const u8) -> isize { 40+2 } -#[lang = "sized"] -pub trait Sized {} -#[lang = "copy"] -pub trait Copy {} - -#[lang = "drop_in_place"] -#[allow(unconditional_recursion)] -pub unsafe fn drop_in_place<T: ?Sized>(to_drop: *mut T) { - drop_in_place(to_drop) -} - -#[lang = "add"] -trait Add<RHS> { - type Output; - fn add(self, other: RHS) -> Self::Output; -} - -impl Add<isize> for isize { - type Output = isize; - fn add(self, other: isize) -> isize { - self + other - } -} +extern crate minicore; +use minicore::*; fn main() {} diff --git a/tests/ui/borrowck/issue-92157.stderr b/tests/ui/borrowck/issue-92157.stderr index 0ffedccd690..248d700ab4b 100644 --- a/tests/ui/borrowck/issue-92157.stderr +++ b/tests/ui/borrowck/issue-92157.stderr @@ -1,5 +1,5 @@ error[E0308]: lang item `start` function has wrong type - --> $DIR/issue-92157.rs:11:1 + --> $DIR/issue-92157.rs:12:1 | LL | fn start<T>(_main: fn() -> T, _argc: isize, _argv: *const *const u8) -> isize { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ incorrect number of function parameters diff --git a/tests/ui/c-variadic/variadic-ffi-1.rs b/tests/ui/c-variadic/variadic-ffi-1.rs index e41ab269211..9dcd55d13e3 100644 --- a/tests/ui/c-variadic/variadic-ffi-1.rs +++ b/tests/ui/c-variadic/variadic-ffi-1.rs @@ -1,9 +1,11 @@ +//@ add-core-stubs //@ needs-llvm-components: x86 //@ compile-flags: --target=i686-pc-windows-msvc --crate-type=rlib #![no_core] #![feature(no_core, lang_items)] -#[lang="sized"] -trait Sized { } + +extern crate minicore; +use minicore::*; extern "stdcall" { fn printf(_: *const u8, ...); diff --git a/tests/ui/c-variadic/variadic-ffi-1.stderr b/tests/ui/c-variadic/variadic-ffi-1.stderr index 39dfb2548a3..f99abed0a62 100644 --- a/tests/ui/c-variadic/variadic-ffi-1.stderr +++ b/tests/ui/c-variadic/variadic-ffi-1.stderr @@ -1,17 +1,17 @@ error[E0045]: C-variadic function must have a compatible calling convention, like `C`, `cdecl`, `system`, `aapcs`, `win64`, `sysv64` or `efiapi` - --> $DIR/variadic-ffi-1.rs:9:5 + --> $DIR/variadic-ffi-1.rs:11:5 | LL | fn printf(_: *const u8, ...); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ C-variadic function must have a compatible calling convention error[E0060]: this function takes at least 2 arguments but 0 arguments were supplied - --> $DIR/variadic-ffi-1.rs:22:9 + --> $DIR/variadic-ffi-1.rs:24:9 | LL | foo(); | ^^^-- two arguments of type `isize` and `u8` are missing | note: function defined here - --> $DIR/variadic-ffi-1.rs:15:8 + --> $DIR/variadic-ffi-1.rs:17:8 | LL | fn foo(f: isize, x: u8, ...); | ^^^ - - @@ -21,13 +21,13 @@ LL | foo(/* isize */, /* u8 */); | +++++++++++++++++++++ error[E0060]: this function takes at least 2 arguments but 1 argument was supplied - --> $DIR/variadic-ffi-1.rs:23:9 + --> $DIR/variadic-ffi-1.rs:25:9 | LL | foo(1); | ^^^--- argument #2 of type `u8` is missing | note: function defined here - --> $DIR/variadic-ffi-1.rs:15:8 + --> $DIR/variadic-ffi-1.rs:17:8 | LL | fn foo(f: isize, x: u8, ...); | ^^^ - @@ -37,7 +37,7 @@ LL | foo(1, /* u8 */); | ++++++++++ error[E0308]: mismatched types - --> $DIR/variadic-ffi-1.rs:25:56 + --> $DIR/variadic-ffi-1.rs:27:56 | LL | let x: unsafe extern "C" fn(f: isize, x: u8) = foo; | ------------------------------------- ^^^ expected non-variadic fn, found variadic function @@ -48,7 +48,7 @@ LL | let x: unsafe extern "C" fn(f: isize, x: u8) = foo; found fn item `unsafe extern "C" fn(_, _, ...) {foo}` error[E0308]: mismatched types - --> $DIR/variadic-ffi-1.rs:26:54 + --> $DIR/variadic-ffi-1.rs:28:54 | LL | let y: extern "C" fn(f: isize, x: u8, ...) = bar; | ----------------------------------- ^^^ expected variadic fn, found non-variadic function @@ -59,7 +59,7 @@ LL | let y: extern "C" fn(f: isize, x: u8, ...) = bar; found fn item `extern "C" fn(_, _) {bar}` error[E0617]: can't pass `f32` to variadic function - --> $DIR/variadic-ffi-1.rs:28:19 + --> $DIR/variadic-ffi-1.rs:30:19 | LL | foo(1, 2, 3f32); | ^^^^ @@ -70,7 +70,7 @@ LL | foo(1, 2, 3f32 as c_double); | +++++++++++ error[E0617]: can't pass `bool` to variadic function - --> $DIR/variadic-ffi-1.rs:29:19 + --> $DIR/variadic-ffi-1.rs:31:19 | LL | foo(1, 2, true); | ^^^^ @@ -81,7 +81,7 @@ LL | foo(1, 2, true as c_int); | ++++++++ error[E0617]: can't pass `i8` to variadic function - --> $DIR/variadic-ffi-1.rs:30:19 + --> $DIR/variadic-ffi-1.rs:32:19 | LL | foo(1, 2, 1i8); | ^^^ @@ -92,7 +92,7 @@ LL | foo(1, 2, 1i8 as c_int); | ++++++++ error[E0617]: can't pass `u8` to variadic function - --> $DIR/variadic-ffi-1.rs:31:19 + --> $DIR/variadic-ffi-1.rs:33:19 | LL | foo(1, 2, 1u8); | ^^^ @@ -103,7 +103,7 @@ LL | foo(1, 2, 1u8 as c_uint); | +++++++++ error[E0617]: can't pass `i16` to variadic function - --> $DIR/variadic-ffi-1.rs:32:19 + --> $DIR/variadic-ffi-1.rs:34:19 | LL | foo(1, 2, 1i16); | ^^^^ @@ -114,7 +114,7 @@ LL | foo(1, 2, 1i16 as c_int); | ++++++++ error[E0617]: can't pass `u16` to variadic function - --> $DIR/variadic-ffi-1.rs:33:19 + --> $DIR/variadic-ffi-1.rs:35:19 | LL | foo(1, 2, 1u16); | ^^^^ diff --git a/tests/ui/c-variadic/variadic-ffi-2.rs b/tests/ui/c-variadic/variadic-ffi-2.rs index 99f83f22d17..da7bb76fc14 100644 --- a/tests/ui/c-variadic/variadic-ffi-2.rs +++ b/tests/ui/c-variadic/variadic-ffi-2.rs @@ -1,8 +1,6 @@ -//@ ignore-arm stdcall isn't supported #![feature(extended_varargs_abi_support)] -#[allow(unsupported_fn_ptr_calling_conventions)] -fn baz(f: extern "stdcall" fn(usize, ...)) { +fn baz(f: extern "Rust" fn(usize, ...)) { //~^ ERROR: C-variadic function must have a compatible calling convention, // like C, cdecl, system, aapcs, win64, sysv64 or efiapi f(22, 44); diff --git a/tests/ui/c-variadic/variadic-ffi-2.stderr b/tests/ui/c-variadic/variadic-ffi-2.stderr index e52de93a926..9f8dcefdb03 100644 --- a/tests/ui/c-variadic/variadic-ffi-2.stderr +++ b/tests/ui/c-variadic/variadic-ffi-2.stderr @@ -1,8 +1,8 @@ error[E0045]: C-variadic function must have a compatible calling convention, like `C`, `cdecl`, `system`, `aapcs`, `win64`, `sysv64` or `efiapi` - --> $DIR/variadic-ffi-2.rs:5:11 + --> $DIR/variadic-ffi-2.rs:3:11 | -LL | fn baz(f: extern "stdcall" fn(usize, ...)) { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ C-variadic function must have a compatible calling convention +LL | fn baz(f: extern "Rust" fn(usize, ...)) { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ C-variadic function must have a compatible calling convention error: aborting due to 1 previous error diff --git a/tests/ui/cast/cast-rfc0401-vtable-kinds.rs b/tests/ui/cast/cast-rfc0401-vtable-kinds.rs index 5704a33cc87..78f6dca1818 100644 --- a/tests/ui/cast/cast-rfc0401-vtable-kinds.rs +++ b/tests/ui/cast/cast-rfc0401-vtable-kinds.rs @@ -2,8 +2,6 @@ // Check that you can cast between different pointers to trait objects // whose vtable have the same kind (both lengths, or both trait pointers). -#![feature(unsized_tuple_coercion)] - trait Bar { //~ WARN trait `Bar` is never used fn bar(&self) { println!("Bar!"); } } @@ -19,10 +17,6 @@ fn foo_to_bar<T:?Sized>(u: *const FooS<T>) -> *const BarS<T> { u as *const BarS<T> } -fn tuple_i32_to_u32<T:?Sized>(u: *const (i32, T)) -> *const (u32, T) { - u as *const (u32, T) -} - fn main() { let s = FooS([0,1,2]); @@ -31,14 +25,4 @@ fn main() { let bar_ref : *const BarS<[u32]> = foo_to_bar(u); let z : &BarS<[u32]> = unsafe{&*bar_ref}; assert_eq!(&z.0, &[0,1,2]); - - // this assumes that tuple reprs for (i32, _) and (u32, _) are - // the same. - let s = (0i32, [0, 1, 2]); - let u: &(i32, [u8]) = &s; - let u: *const (i32, [u8]) = u; - let u_u32 : *const (u32, [u8]) = tuple_i32_to_u32(u); - unsafe { - assert_eq!(&(*u_u32).1, &[0, 1, 2]); - } } diff --git a/tests/ui/cast/cast-rfc0401-vtable-kinds.stderr b/tests/ui/cast/cast-rfc0401-vtable-kinds.stderr index 4f57e2e7df7..01277fd632e 100644 --- a/tests/ui/cast/cast-rfc0401-vtable-kinds.stderr +++ b/tests/ui/cast/cast-rfc0401-vtable-kinds.stderr @@ -1,5 +1,5 @@ warning: trait `Bar` is never used - --> $DIR/cast-rfc0401-vtable-kinds.rs:7:7 + --> $DIR/cast-rfc0401-vtable-kinds.rs:5:7 | LL | trait Bar { | ^^^ diff --git a/tests/ui/cast/ptr-to-trait-obj-add-auto.rs b/tests/ui/cast/ptr-to-trait-obj-add-auto.rs index 46e72ea0877..3a1e667d03a 100644 --- a/tests/ui/cast/ptr-to-trait-obj-add-auto.rs +++ b/tests/ui/cast/ptr-to-trait-obj-add-auto.rs @@ -1,18 +1,20 @@ -//@ check-pass - trait Trait<'a> {} fn add_auto<'a>(x: *mut dyn Trait<'a>) -> *mut (dyn Trait<'a> + Send) { x as _ - //~^ warning: adding an auto trait `Send` to a trait object in a pointer cast may cause UB later on - //~| warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + //~^ ERROR cannot add auto trait `Send` to dyn bound via pointer cast + //~| NOTE unsupported cast + //~| NOTE this could allow UB elsewhere + //~| HELP use `transmute` if you're sure this is sound } // (to test diagnostic list formatting) fn add_multiple_auto<'a>(x: *mut dyn Trait<'a>) -> *mut (dyn Trait<'a> + Send + Sync + Unpin) { x as _ - //~^ warning: adding auto traits `Send`, `Sync`, and `Unpin` to a trait object in a pointer cast may cause UB later on - //~| warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + //~^ ERROR cannot add auto traits `Send`, `Sync`, and `Unpin` to dyn bound via pointer cast + //~| NOTE unsupported cast + //~| NOTE this could allow UB elsewhere + //~| HELP use `transmute` if you're sure this is sound } fn main() {} diff --git a/tests/ui/cast/ptr-to-trait-obj-add-auto.stderr b/tests/ui/cast/ptr-to-trait-obj-add-auto.stderr index e5ef8bf76b4..b64ca9b32bf 100644 --- a/tests/ui/cast/ptr-to-trait-obj-add-auto.stderr +++ b/tests/ui/cast/ptr-to-trait-obj-add-auto.stderr @@ -1,43 +1,21 @@ -warning: adding an auto trait `Send` to a trait object in a pointer cast may cause UB later on - --> $DIR/ptr-to-trait-obj-add-auto.rs:6:5 +error[E0804]: cannot add auto trait `Send` to dyn bound via pointer cast + --> $DIR/ptr-to-trait-obj-add-auto.rs:4:5 | LL | x as _ - | ^^^^^^ + | ^^^^^^ unsupported cast | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #127323 <https://github.com/rust-lang/rust/issues/127323> - = note: `#[warn(ptr_cast_add_auto_to_object)]` on by default + = note: this could allow UB elsewhere + = help: use `transmute` if you're sure this is sound -warning: adding auto traits `Send`, `Sync`, and `Unpin` to a trait object in a pointer cast may cause UB later on +error[E0804]: cannot add auto traits `Send`, `Sync`, and `Unpin` to dyn bound via pointer cast --> $DIR/ptr-to-trait-obj-add-auto.rs:13:5 | LL | x as _ - | ^^^^^^ + | ^^^^^^ unsupported cast | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #127323 <https://github.com/rust-lang/rust/issues/127323> + = note: this could allow UB elsewhere + = help: use `transmute` if you're sure this is sound -warning: 2 warnings emitted - -Future incompatibility report: Future breakage diagnostic: -warning: adding an auto trait `Send` to a trait object in a pointer cast may cause UB later on - --> $DIR/ptr-to-trait-obj-add-auto.rs:6:5 - | -LL | x as _ - | ^^^^^^ - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #127323 <https://github.com/rust-lang/rust/issues/127323> - = note: `#[warn(ptr_cast_add_auto_to_object)]` on by default - -Future breakage diagnostic: -warning: adding auto traits `Send`, `Sync`, and `Unpin` to a trait object in a pointer cast may cause UB later on - --> $DIR/ptr-to-trait-obj-add-auto.rs:13:5 - | -LL | x as _ - | ^^^^^^ - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #127323 <https://github.com/rust-lang/rust/issues/127323> - = note: `#[warn(ptr_cast_add_auto_to_object)]` on by default +error: aborting due to 2 previous errors +For more information about this error, try `rustc --explain E0804`. diff --git a/tests/ui/check-cfg/my-awesome-platform.json b/tests/ui/check-cfg/my-awesome-platform.json index 5e9ab8f1a2d..03b08b727bd 100644 --- a/tests/ui/check-cfg/my-awesome-platform.json +++ b/tests/ui/check-cfg/my-awesome-platform.json @@ -1,6 +1,6 @@ { "llvm-target": "x86_64-unknown-none-gnu", - "data-layout": "e-m:e-i64:64-f80:128-n8:16:32:64-S128", + "data-layout": "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128", "arch": "x86_64", "target-endian": "little", "target-pointer-width": "64", diff --git a/tests/ui/check-cfg/target_feature.stderr b/tests/ui/check-cfg/target_feature.stderr index 51808c5c7bc..5b82d3f539f 100644 --- a/tests/ui/check-cfg/target_feature.stderr +++ b/tests/ui/check-cfg/target_feature.stderr @@ -151,6 +151,7 @@ LL | cfg!(target_feature = "_UNEXPECTED_VALUE"); `mp` `mp1e2` `msa` +`msync` `mte` `multivalue` `mutable-globals` @@ -290,9 +291,14 @@ LL | cfg!(target_feature = "_UNEXPECTED_VALUE"); `xsavec` `xsaveopt` `xsaves` +`za128rs` +`za64rs` `zaamo` `zabha` +`zacas` `zalrsc` +`zama16b` +`zawrs` `zba` `zbb` `zbc` diff --git a/tests/ui/check-cfg/values-target-json.rs b/tests/ui/check-cfg/values-target-json.rs index b52decdf6c0..d473f39c3d6 100644 --- a/tests/ui/check-cfg/values-target-json.rs +++ b/tests/ui/check-cfg/values-target-json.rs @@ -1,5 +1,6 @@ // This test checks that we don't lint values defined by a custom target (target json) // +//@ add-core-stubs //@ check-pass //@ no-auto-check-cfg //@ needs-llvm-components: x86 @@ -8,8 +9,8 @@ #![feature(lang_items, no_core, auto_traits)] #![no_core] -#[lang = "sized"] -trait Sized {} +extern crate minicore; +use minicore::*; #[cfg(target_os = "linux")] fn target_os_linux() {} diff --git a/tests/ui/cmse-nonsecure/cmse-nonsecure-call/callback-as-argument.rs b/tests/ui/cmse-nonsecure/cmse-nonsecure-call/callback-as-argument.rs index 37c8319d98d..b25a81b858b 100644 --- a/tests/ui/cmse-nonsecure/cmse-nonsecure-call/callback-as-argument.rs +++ b/tests/ui/cmse-nonsecure/cmse-nonsecure-call/callback-as-argument.rs @@ -1,13 +1,12 @@ +//@ add-core-stubs //@ build-pass //@ compile-flags: --target thumbv8m.main-none-eabi --crate-type lib //@ needs-llvm-components: arm #![feature(abi_c_cmse_nonsecure_call, cmse_nonsecure_entry, no_core, lang_items, intrinsics)] #![no_core] -#[lang = "sized"] -pub trait Sized {} -#[lang = "copy"] -pub trait Copy {} -impl Copy for u32 {} + +extern crate minicore; +use minicore::*; #[no_mangle] pub extern "C-cmse-nonsecure-entry" fn test( diff --git a/tests/ui/cmse-nonsecure/cmse-nonsecure-call/gate_test.stderr b/tests/ui/cmse-nonsecure/cmse-nonsecure-call/gate_test.stderr index 63260b5c78f..beb0ab70cc7 100644 --- a/tests/ui/cmse-nonsecure/cmse-nonsecure-call/gate_test.stderr +++ b/tests/ui/cmse-nonsecure/cmse-nonsecure-call/gate_test.stderr @@ -11,3 +11,13 @@ LL | core::mem::transmute::<usize, extern "C-cmse-nonsecure-call" fn(i32 error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0658`. +Future incompatibility report: Future breakage diagnostic: +warning: the calling convention "C-cmse-nonsecure-call" is not supported on this target + --> $DIR/gate_test.rs:5:39 + | +LL | core::mem::transmute::<usize, extern "C-cmse-nonsecure-call" fn(i32, i32, i32, i32) -> i32>( + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #130260 <https://github.com/rust-lang/rust/issues/130260> + diff --git a/tests/ui/cmse-nonsecure/cmse-nonsecure-call/generics.rs b/tests/ui/cmse-nonsecure/cmse-nonsecure-call/generics.rs index 31782b05105..18041b08061 100644 --- a/tests/ui/cmse-nonsecure/cmse-nonsecure-call/generics.rs +++ b/tests/ui/cmse-nonsecure/cmse-nonsecure-call/generics.rs @@ -1,12 +1,11 @@ +//@ add-core-stubs //@ compile-flags: --target thumbv8m.main-none-eabi --crate-type lib //@ needs-llvm-components: arm #![feature(abi_c_cmse_nonsecure_call, no_core, lang_items)] #![no_core] -#[lang = "sized"] -pub trait Sized {} -#[lang = "copy"] -pub trait Copy {} -impl Copy for u32 {} + +extern crate minicore; +use minicore::*; #[repr(C)] struct Wrapper<T>(T); diff --git a/tests/ui/cmse-nonsecure/cmse-nonsecure-call/generics.stderr b/tests/ui/cmse-nonsecure/cmse-nonsecure-call/generics.stderr index 0560f0eec1c..ab7c9cee4f0 100644 --- a/tests/ui/cmse-nonsecure/cmse-nonsecure-call/generics.stderr +++ b/tests/ui/cmse-nonsecure/cmse-nonsecure-call/generics.stderr @@ -1,11 +1,11 @@ error: function pointer types may not have generic parameters - --> $DIR/generics.rs:15:42 + --> $DIR/generics.rs:14:42 | LL | f1: extern "C-cmse-nonsecure-call" fn<U: Copy>(U, u32, u32, u32) -> u64, | ^^^^^^^^^ error[E0412]: cannot find type `U` in this scope - --> $DIR/generics.rs:15:52 + --> $DIR/generics.rs:14:52 | LL | struct Test<T: Copy> { | - similarly named type parameter `T` defined here @@ -23,7 +23,7 @@ LL | struct Test<T: Copy, U> { | +++ error[E0562]: `impl Trait` is not allowed in `fn` pointer parameters - --> $DIR/generics.rs:18:43 + --> $DIR/generics.rs:17:43 | LL | f2: extern "C-cmse-nonsecure-call" fn(impl Copy, u32, u32, u32) -> u64, | ^^^^^^^^^ @@ -31,19 +31,19 @@ LL | f2: extern "C-cmse-nonsecure-call" fn(impl Copy, u32, u32, u32) -> u64, = note: `impl Trait` is only allowed in arguments and return types of functions and methods error[E0798]: function pointers with the `"C-cmse-nonsecure-call"` ABI cannot contain generics in their type - --> $DIR/generics.rs:20:9 + --> $DIR/generics.rs:19:9 | LL | f3: extern "C-cmse-nonsecure-call" fn(T, u32, u32, u32) -> u64, | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0798]: function pointers with the `"C-cmse-nonsecure-call"` ABI cannot contain generics in their type - --> $DIR/generics.rs:21:9 + --> $DIR/generics.rs:20:9 | LL | f4: extern "C-cmse-nonsecure-call" fn(Wrapper<T>, u32, u32, u32) -> u64, | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0798]: return value of `"C-cmse-nonsecure-call"` function too large to pass via registers - --> $DIR/generics.rs:27:73 + --> $DIR/generics.rs:26:73 | LL | type WithTraitObject = extern "C-cmse-nonsecure-call" fn(&dyn Trait) -> &dyn Trait; | ^^^^^^^^^^ this type doesn't fit in the available registers @@ -52,7 +52,7 @@ LL | type WithTraitObject = extern "C-cmse-nonsecure-call" fn(&dyn Trait) -> &dy = note: the result must either be a (transparently wrapped) i64, u64 or f64, or be at most 4 bytes in size error[E0798]: return value of `"C-cmse-nonsecure-call"` function too large to pass via registers - --> $DIR/generics.rs:31:62 + --> $DIR/generics.rs:30:62 | LL | extern "C-cmse-nonsecure-call" fn(&'static dyn Trait) -> &'static dyn Trait; | ^^^^^^^^^^^^^^^^^^ this type doesn't fit in the available registers @@ -61,7 +61,7 @@ LL | extern "C-cmse-nonsecure-call" fn(&'static dyn Trait) -> &'static dyn T = note: the result must either be a (transparently wrapped) i64, u64 or f64, or be at most 4 bytes in size error[E0798]: return value of `"C-cmse-nonsecure-call"` function too large to pass via registers - --> $DIR/generics.rs:38:62 + --> $DIR/generics.rs:37:62 | LL | extern "C-cmse-nonsecure-call" fn(WrapperTransparent) -> WrapperTransparent; | ^^^^^^^^^^^^^^^^^^ this type doesn't fit in the available registers @@ -70,7 +70,7 @@ LL | extern "C-cmse-nonsecure-call" fn(WrapperTransparent) -> WrapperTranspa = note: the result must either be a (transparently wrapped) i64, u64 or f64, or be at most 4 bytes in size error[E0045]: C-variadic function must have a compatible calling convention, like `C`, `cdecl`, `system`, `aapcs`, `win64`, `sysv64` or `efiapi` - --> $DIR/generics.rs:41:20 + --> $DIR/generics.rs:40:20 | LL | type WithVarArgs = extern "C-cmse-nonsecure-call" fn(u32, ...); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ C-variadic function must have a compatible calling convention diff --git a/tests/ui/cmse-nonsecure/cmse-nonsecure-call/params-via-stack.rs b/tests/ui/cmse-nonsecure/cmse-nonsecure-call/params-via-stack.rs index 083a563bd7b..8328f9b6dd5 100644 --- a/tests/ui/cmse-nonsecure/cmse-nonsecure-call/params-via-stack.rs +++ b/tests/ui/cmse-nonsecure/cmse-nonsecure-call/params-via-stack.rs @@ -1,12 +1,11 @@ +//@ add-core-stubs //@ compile-flags: --target thumbv8m.main-none-eabi --crate-type lib //@ needs-llvm-components: arm #![feature(abi_c_cmse_nonsecure_call, no_core, lang_items)] #![no_core] -#[lang = "sized"] -pub trait Sized {} -#[lang = "copy"] -pub trait Copy {} -impl Copy for u32 {} + +extern crate minicore; +use minicore::*; #[repr(C, align(16))] #[allow(unused)] diff --git a/tests/ui/cmse-nonsecure/cmse-nonsecure-call/params-via-stack.stderr b/tests/ui/cmse-nonsecure/cmse-nonsecure-call/params-via-stack.stderr index a5f5e1c3151..10a5e856107 100644 --- a/tests/ui/cmse-nonsecure/cmse-nonsecure-call/params-via-stack.stderr +++ b/tests/ui/cmse-nonsecure/cmse-nonsecure-call/params-via-stack.stderr @@ -1,5 +1,5 @@ error[E0798]: arguments for `"C-cmse-nonsecure-call"` function too large to pass via registers - --> $DIR/params-via-stack.rs:17:63 + --> $DIR/params-via-stack.rs:16:63 | LL | f1: extern "C-cmse-nonsecure-call" fn(u32, u32, u32, u32, x: u32, y: u32), | ^^^^^^^^^^^^^^ these arguments don't fit in the available registers @@ -7,7 +7,7 @@ LL | f1: extern "C-cmse-nonsecure-call" fn(u32, u32, u32, u32, x: u32, y: u3 = note: functions with the `"C-cmse-nonsecure-call"` ABI must pass all their arguments via the 4 32-bit available argument registers error[E0798]: arguments for `"C-cmse-nonsecure-call"` function too large to pass via registers - --> $DIR/params-via-stack.rs:18:63 + --> $DIR/params-via-stack.rs:17:63 | LL | f2: extern "C-cmse-nonsecure-call" fn(u32, u32, u32, u16, u16), | ^^^ this argument doesn't fit in the available registers @@ -15,7 +15,7 @@ LL | f2: extern "C-cmse-nonsecure-call" fn(u32, u32, u32, u16, u16), = note: functions with the `"C-cmse-nonsecure-call"` ABI must pass all their arguments via the 4 32-bit available argument registers error[E0798]: arguments for `"C-cmse-nonsecure-call"` function too large to pass via registers - --> $DIR/params-via-stack.rs:19:53 + --> $DIR/params-via-stack.rs:18:53 | LL | f3: extern "C-cmse-nonsecure-call" fn(u32, u64, u32), | ^^^ this argument doesn't fit in the available registers @@ -23,7 +23,7 @@ LL | f3: extern "C-cmse-nonsecure-call" fn(u32, u64, u32), = note: functions with the `"C-cmse-nonsecure-call"` ABI must pass all their arguments via the 4 32-bit available argument registers error[E0798]: arguments for `"C-cmse-nonsecure-call"` function too large to pass via registers - --> $DIR/params-via-stack.rs:20:58 + --> $DIR/params-via-stack.rs:19:58 | LL | f4: extern "C-cmse-nonsecure-call" fn(AlignRelevant, u32), | ^^^ this argument doesn't fit in the available registers @@ -31,7 +31,7 @@ LL | f4: extern "C-cmse-nonsecure-call" fn(AlignRelevant, u32), = note: functions with the `"C-cmse-nonsecure-call"` ABI must pass all their arguments via the 4 32-bit available argument registers error[E0798]: arguments for `"C-cmse-nonsecure-call"` function too large to pass via registers - --> $DIR/params-via-stack.rs:21:43 + --> $DIR/params-via-stack.rs:20:43 | LL | f5: extern "C-cmse-nonsecure-call" fn([u32; 5]), | ^^^^^^^^ this argument doesn't fit in the available registers diff --git a/tests/ui/cmse-nonsecure/cmse-nonsecure-call/return-via-stack.rs b/tests/ui/cmse-nonsecure/cmse-nonsecure-call/return-via-stack.rs index b052aabb499..890ec4b00f6 100644 --- a/tests/ui/cmse-nonsecure/cmse-nonsecure-call/return-via-stack.rs +++ b/tests/ui/cmse-nonsecure/cmse-nonsecure-call/return-via-stack.rs @@ -1,3 +1,4 @@ +//@ add-core-stubs //@ compile-flags: --target thumbv8m.main-none-eabi --crate-type lib //@ needs-llvm-components: arm //@ add-core-stubs diff --git a/tests/ui/cmse-nonsecure/cmse-nonsecure-call/return-via-stack.stderr b/tests/ui/cmse-nonsecure/cmse-nonsecure-call/return-via-stack.stderr index 89f7f159d6e..d2077352900 100644 --- a/tests/ui/cmse-nonsecure/cmse-nonsecure-call/return-via-stack.stderr +++ b/tests/ui/cmse-nonsecure/cmse-nonsecure-call/return-via-stack.stderr @@ -1,5 +1,5 @@ error[E0798]: return value of `"C-cmse-nonsecure-call"` function too large to pass via registers - --> $DIR/return-via-stack.rs:35:50 + --> $DIR/return-via-stack.rs:36:50 | LL | u128: extern "C-cmse-nonsecure-call" fn() -> u128, | ^^^^ this type doesn't fit in the available registers @@ -8,7 +8,7 @@ LL | u128: extern "C-cmse-nonsecure-call" fn() -> u128, = note: the result must either be a (transparently wrapped) i64, u64 or f64, or be at most 4 bytes in size error[E0798]: return value of `"C-cmse-nonsecure-call"` function too large to pass via registers - --> $DIR/return-via-stack.rs:36:50 + --> $DIR/return-via-stack.rs:37:50 | LL | i128: extern "C-cmse-nonsecure-call" fn() -> i128, | ^^^^ this type doesn't fit in the available registers @@ -17,7 +17,7 @@ LL | i128: extern "C-cmse-nonsecure-call" fn() -> i128, = note: the result must either be a (transparently wrapped) i64, u64 or f64, or be at most 4 bytes in size error[E0798]: return value of `"C-cmse-nonsecure-call"` function too large to pass via registers - --> $DIR/return-via-stack.rs:25:48 + --> $DIR/return-via-stack.rs:26:48 | LL | f1: extern "C-cmse-nonsecure-call" fn() -> ReprCU64, | ^^^^^^^^ this type doesn't fit in the available registers @@ -26,7 +26,7 @@ LL | f1: extern "C-cmse-nonsecure-call" fn() -> ReprCU64, = note: the result must either be a (transparently wrapped) i64, u64 or f64, or be at most 4 bytes in size error[E0798]: return value of `"C-cmse-nonsecure-call"` function too large to pass via registers - --> $DIR/return-via-stack.rs:26:48 + --> $DIR/return-via-stack.rs:27:48 | LL | f2: extern "C-cmse-nonsecure-call" fn() -> ReprCBytes, | ^^^^^^^^^^ this type doesn't fit in the available registers @@ -35,7 +35,7 @@ LL | f2: extern "C-cmse-nonsecure-call" fn() -> ReprCBytes, = note: the result must either be a (transparently wrapped) i64, u64 or f64, or be at most 4 bytes in size error[E0798]: return value of `"C-cmse-nonsecure-call"` function too large to pass via registers - --> $DIR/return-via-stack.rs:27:48 + --> $DIR/return-via-stack.rs:28:48 | LL | f3: extern "C-cmse-nonsecure-call" fn() -> U64Compound, | ^^^^^^^^^^^ this type doesn't fit in the available registers @@ -44,7 +44,7 @@ LL | f3: extern "C-cmse-nonsecure-call" fn() -> U64Compound, = note: the result must either be a (transparently wrapped) i64, u64 or f64, or be at most 4 bytes in size error[E0798]: return value of `"C-cmse-nonsecure-call"` function too large to pass via registers - --> $DIR/return-via-stack.rs:28:48 + --> $DIR/return-via-stack.rs:29:48 | LL | f4: extern "C-cmse-nonsecure-call" fn() -> ReprCAlign16, | ^^^^^^^^^^^^ this type doesn't fit in the available registers @@ -53,7 +53,7 @@ LL | f4: extern "C-cmse-nonsecure-call" fn() -> ReprCAlign16, = note: the result must either be a (transparently wrapped) i64, u64 or f64, or be at most 4 bytes in size error[E0798]: return value of `"C-cmse-nonsecure-call"` function too large to pass via registers - --> $DIR/return-via-stack.rs:29:48 + --> $DIR/return-via-stack.rs:30:48 | LL | f5: extern "C-cmse-nonsecure-call" fn() -> [u8; 5], | ^^^^^^^ this type doesn't fit in the available registers @@ -62,7 +62,7 @@ LL | f5: extern "C-cmse-nonsecure-call" fn() -> [u8; 5], = note: the result must either be a (transparently wrapped) i64, u64 or f64, or be at most 4 bytes in size error[E0798]: return value of `"C-cmse-nonsecure-call"` function too large to pass via registers - --> $DIR/return-via-stack.rs:51:48 + --> $DIR/return-via-stack.rs:52:48 | LL | f1: extern "C-cmse-nonsecure-call" fn() -> ReprRustUnionU64, | ^^^^^^^^^^^^^^^^ this type doesn't fit in the available registers @@ -71,7 +71,7 @@ LL | f1: extern "C-cmse-nonsecure-call" fn() -> ReprRustUnionU64, = note: the result must either be a (transparently wrapped) i64, u64 or f64, or be at most 4 bytes in size error[E0798]: return value of `"C-cmse-nonsecure-call"` function too large to pass via registers - --> $DIR/return-via-stack.rs:52:48 + --> $DIR/return-via-stack.rs:53:48 | LL | f2: extern "C-cmse-nonsecure-call" fn() -> ReprCUnionU64, | ^^^^^^^^^^^^^ this type doesn't fit in the available registers diff --git a/tests/ui/cmse-nonsecure/cmse-nonsecure-call/via-registers.rs b/tests/ui/cmse-nonsecure/cmse-nonsecure-call/via-registers.rs index 9fda55c2a48..7dfe6cf9672 100644 --- a/tests/ui/cmse-nonsecure/cmse-nonsecure-call/via-registers.rs +++ b/tests/ui/cmse-nonsecure/cmse-nonsecure-call/via-registers.rs @@ -1,13 +1,12 @@ +//@ add-core-stubs //@ build-pass //@ compile-flags: --target thumbv8m.main-none-eabi --crate-type lib //@ needs-llvm-components: arm #![feature(abi_c_cmse_nonsecure_call, no_core, lang_items, intrinsics)] #![no_core] -#[lang = "sized"] -pub trait Sized {} -#[lang = "copy"] -pub trait Copy {} -impl Copy for u32 {} + +extern crate minicore; +use minicore::*; #[repr(transparent)] pub struct ReprTransparentStruct<T> { diff --git a/tests/ui/cmse-nonsecure/cmse-nonsecure-call/wrong-abi-location-1.rs b/tests/ui/cmse-nonsecure/cmse-nonsecure-call/wrong-abi-location-1.rs index 3265cf4146d..5a2d2db19c5 100644 --- a/tests/ui/cmse-nonsecure/cmse-nonsecure-call/wrong-abi-location-1.rs +++ b/tests/ui/cmse-nonsecure/cmse-nonsecure-call/wrong-abi-location-1.rs @@ -1,8 +1,10 @@ +//@ add-core-stubs //@ compile-flags: --target thumbv8m.main-none-eabi --crate-type lib //@ needs-llvm-components: arm #![feature(abi_c_cmse_nonsecure_call, lang_items, no_core)] #![no_core] -#[lang="sized"] -trait Sized { } + +extern crate minicore; +use minicore::*; pub extern "C-cmse-nonsecure-call" fn test() {} //~ ERROR [E0781] diff --git a/tests/ui/cmse-nonsecure/cmse-nonsecure-call/wrong-abi-location-1.stderr b/tests/ui/cmse-nonsecure/cmse-nonsecure-call/wrong-abi-location-1.stderr index 8d1b10eaeb5..f49fab043a4 100644 --- a/tests/ui/cmse-nonsecure/cmse-nonsecure-call/wrong-abi-location-1.stderr +++ b/tests/ui/cmse-nonsecure/cmse-nonsecure-call/wrong-abi-location-1.stderr @@ -1,5 +1,5 @@ error[E0781]: the `"C-cmse-nonsecure-call"` ABI is only allowed on function pointers - --> $DIR/wrong-abi-location-1.rs:8:1 + --> $DIR/wrong-abi-location-1.rs:10:1 | LL | pub extern "C-cmse-nonsecure-call" fn test() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/cmse-nonsecure/cmse-nonsecure-call/wrong-abi-location-2.rs b/tests/ui/cmse-nonsecure/cmse-nonsecure-call/wrong-abi-location-2.rs index b47471c6ad7..e93b153949a 100644 --- a/tests/ui/cmse-nonsecure/cmse-nonsecure-call/wrong-abi-location-2.rs +++ b/tests/ui/cmse-nonsecure/cmse-nonsecure-call/wrong-abi-location-2.rs @@ -1,9 +1,11 @@ +//@ add-core-stubs //@ compile-flags: --target thumbv8m.main-none-eabi --crate-type lib //@ needs-llvm-components: arm #![feature(abi_c_cmse_nonsecure_call, lang_items, no_core)] #![no_core] -#[lang="sized"] -trait Sized { } + +extern crate minicore; +use minicore::*; extern "C-cmse-nonsecure-call" { //~ ERROR [E0781] fn test(); diff --git a/tests/ui/cmse-nonsecure/cmse-nonsecure-call/wrong-abi-location-2.stderr b/tests/ui/cmse-nonsecure/cmse-nonsecure-call/wrong-abi-location-2.stderr index 917098e21d8..bae8d20d81c 100644 --- a/tests/ui/cmse-nonsecure/cmse-nonsecure-call/wrong-abi-location-2.stderr +++ b/tests/ui/cmse-nonsecure/cmse-nonsecure-call/wrong-abi-location-2.stderr @@ -1,5 +1,5 @@ error[E0781]: the `"C-cmse-nonsecure-call"` ABI is only allowed on function pointers - --> $DIR/wrong-abi-location-2.rs:8:1 + --> $DIR/wrong-abi-location-2.rs:10:1 | LL | / extern "C-cmse-nonsecure-call" { LL | | fn test(); diff --git a/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/generics.rs b/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/generics.rs index a264bba6f3c..19b6179dde7 100644 --- a/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/generics.rs +++ b/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/generics.rs @@ -1,12 +1,11 @@ +//@ add-core-stubs //@ compile-flags: --target thumbv8m.main-none-eabi --crate-type lib //@ needs-llvm-components: arm #![feature(cmse_nonsecure_entry, c_variadic, no_core, lang_items)] #![no_core] -#[lang = "sized"] -pub trait Sized {} -#[lang = "copy"] -pub trait Copy {} -impl Copy for u32 {} + +extern crate minicore; +use minicore::*; #[repr(C)] struct Wrapper<T>(T); diff --git a/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/generics.stderr b/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/generics.stderr index 9e67f881f75..c314671dc29 100644 --- a/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/generics.stderr +++ b/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/generics.stderr @@ -1,11 +1,11 @@ error: only foreign, `unsafe extern "C"`, or `unsafe extern "C-unwind"` functions may have a C-variadic arg - --> $DIR/generics.rs:74:55 + --> $DIR/generics.rs:73:55 | LL | extern "C-cmse-nonsecure-entry" fn c_variadic(_: u32, _: ...) { | ^^^^^^ error[E0798]: functions with the `"C-cmse-nonsecure-entry"` ABI cannot contain generics in their type - --> $DIR/generics.rs:31:1 + --> $DIR/generics.rs:30:1 | LL | / extern "C-cmse-nonsecure-entry" fn introduced_generic<U: Copy>( LL | | @@ -17,19 +17,19 @@ LL | | ) -> u64 { | |________^ error[E0798]: functions with the `"C-cmse-nonsecure-entry"` ABI cannot contain generics in their type - --> $DIR/generics.rs:41:1 + --> $DIR/generics.rs:40:1 | LL | extern "C-cmse-nonsecure-entry" fn impl_trait(_: impl Copy, _: u32, _: u32, _: u32) -> u64 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0798]: functions with the `"C-cmse-nonsecure-entry"` ABI cannot contain generics in their type - --> $DIR/generics.rs:15:5 + --> $DIR/generics.rs:14:5 | LL | extern "C-cmse-nonsecure-entry" fn ambient_generic(_: T, _: u32, _: u32, _: u32) -> u64 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0798]: functions with the `"C-cmse-nonsecure-entry"` ABI cannot contain generics in their type - --> $DIR/generics.rs:20:5 + --> $DIR/generics.rs:19:5 | LL | / extern "C-cmse-nonsecure-entry" fn ambient_generic_nested( LL | | @@ -41,7 +41,7 @@ LL | | ) -> u64 { | |____________^ error[E0798]: return value of `"C-cmse-nonsecure-entry"` function too large to pass via registers - --> $DIR/generics.rs:52:67 + --> $DIR/generics.rs:51:67 | LL | extern "C-cmse-nonsecure-entry" fn trait_object(x: &dyn Trait) -> &dyn Trait { | ^^^^^^^^^^ this type doesn't fit in the available registers @@ -50,7 +50,7 @@ LL | extern "C-cmse-nonsecure-entry" fn trait_object(x: &dyn Trait) -> &dyn Trai = note: the result must either be a (transparently wrapped) i64, u64 or f64, or be at most 4 bytes in size error[E0798]: return value of `"C-cmse-nonsecure-entry"` function too large to pass via registers - --> $DIR/generics.rs:59:6 + --> $DIR/generics.rs:58:6 | LL | ) -> &'static dyn Trait { | ^^^^^^^^^^^^^^^^^^ this type doesn't fit in the available registers @@ -59,7 +59,7 @@ LL | ) -> &'static dyn Trait { = note: the result must either be a (transparently wrapped) i64, u64 or f64, or be at most 4 bytes in size error[E0798]: return value of `"C-cmse-nonsecure-entry"` function too large to pass via registers - --> $DIR/generics.rs:69:6 + --> $DIR/generics.rs:68:6 | LL | ) -> WrapperTransparent { | ^^^^^^^^^^^^^^^^^^ this type doesn't fit in the available registers @@ -68,7 +68,7 @@ LL | ) -> WrapperTransparent { = note: the result must either be a (transparently wrapped) i64, u64 or f64, or be at most 4 bytes in size error: requires `va_list` lang_item - --> $DIR/generics.rs:74:55 + --> $DIR/generics.rs:73:55 | LL | extern "C-cmse-nonsecure-entry" fn c_variadic(_: u32, _: ...) { | ^^^^^^ diff --git a/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/params-via-stack.rs b/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/params-via-stack.rs index 572d792d5a5..4c53f9422da 100644 --- a/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/params-via-stack.rs +++ b/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/params-via-stack.rs @@ -1,12 +1,11 @@ +//@ add-core-stubs //@ compile-flags: --target thumbv8m.main-none-eabi --crate-type lib //@ needs-llvm-components: arm #![feature(cmse_nonsecure_entry, no_core, lang_items)] #![no_core] -#[lang = "sized"] -trait Sized {} -#[lang = "copy"] -trait Copy {} -impl Copy for u32 {} + +extern crate minicore; +use minicore::*; #[repr(C, align(16))] #[allow(unused)] diff --git a/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/params-via-stack.stderr b/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/params-via-stack.stderr index b77e64c6bfb..24e9ddf32fe 100644 --- a/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/params-via-stack.stderr +++ b/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/params-via-stack.stderr @@ -1,5 +1,5 @@ error[E0798]: arguments for `"C-cmse-nonsecure-entry"` function too large to pass via registers - --> $DIR/params-via-stack.rs:16:78 + --> $DIR/params-via-stack.rs:15:78 | LL | pub extern "C-cmse-nonsecure-entry" fn f1(_: u32, _: u32, _: u32, _: u32, _: u32, _: u32) {} | ^^^^^^^^^^^ these arguments don't fit in the available registers @@ -7,7 +7,7 @@ LL | pub extern "C-cmse-nonsecure-entry" fn f1(_: u32, _: u32, _: u32, _: u32, _ = note: functions with the `"C-cmse-nonsecure-entry"` ABI must pass all their arguments via the 4 32-bit available argument registers error[E0798]: arguments for `"C-cmse-nonsecure-entry"` function too large to pass via registers - --> $DIR/params-via-stack.rs:18:78 + --> $DIR/params-via-stack.rs:17:78 | LL | pub extern "C-cmse-nonsecure-entry" fn f2(_: u32, _: u32, _: u32, _: u16, _: u16) {} | ^^^ this argument doesn't fit in the available registers @@ -15,7 +15,7 @@ LL | pub extern "C-cmse-nonsecure-entry" fn f2(_: u32, _: u32, _: u32, _: u16, _ = note: functions with the `"C-cmse-nonsecure-entry"` ABI must pass all their arguments via the 4 32-bit available argument registers error[E0798]: arguments for `"C-cmse-nonsecure-entry"` function too large to pass via registers - --> $DIR/params-via-stack.rs:20:62 + --> $DIR/params-via-stack.rs:19:62 | LL | pub extern "C-cmse-nonsecure-entry" fn f3(_: u32, _: u64, _: u32) {} | ^^^ this argument doesn't fit in the available registers @@ -23,7 +23,7 @@ LL | pub extern "C-cmse-nonsecure-entry" fn f3(_: u32, _: u64, _: u32) {} = note: functions with the `"C-cmse-nonsecure-entry"` ABI must pass all their arguments via the 4 32-bit available argument registers error[E0798]: arguments for `"C-cmse-nonsecure-entry"` function too large to pass via registers - --> $DIR/params-via-stack.rs:22:64 + --> $DIR/params-via-stack.rs:21:64 | LL | pub extern "C-cmse-nonsecure-entry" fn f4(_: AlignRelevant, _: u32) {} | ^^^ this argument doesn't fit in the available registers @@ -31,7 +31,7 @@ LL | pub extern "C-cmse-nonsecure-entry" fn f4(_: AlignRelevant, _: u32) {} = note: functions with the `"C-cmse-nonsecure-entry"` ABI must pass all their arguments via the 4 32-bit available argument registers error[E0798]: arguments for `"C-cmse-nonsecure-entry"` function too large to pass via registers - --> $DIR/params-via-stack.rs:26:46 + --> $DIR/params-via-stack.rs:25:46 | LL | pub extern "C-cmse-nonsecure-entry" fn f5(_: [u32; 5]) {} | ^^^^^^^^ this argument doesn't fit in the available registers diff --git a/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/return-via-stack.rs b/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/return-via-stack.rs index 23d55526e57..735eab10fa1 100644 --- a/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/return-via-stack.rs +++ b/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/return-via-stack.rs @@ -1,3 +1,4 @@ +//@ add-core-stubs //@ compile-flags: --target thumbv8m.main-none-eabi --crate-type lib //@ needs-llvm-components: arm //@ add-core-stubs diff --git a/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/return-via-stack.stderr b/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/return-via-stack.stderr index d37d9b5e8ff..9c885d95318 100644 --- a/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/return-via-stack.stderr +++ b/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/return-via-stack.stderr @@ -1,5 +1,5 @@ error[E0798]: return value of `"C-cmse-nonsecure-entry"` function too large to pass via registers - --> $DIR/return-via-stack.rs:24:48 + --> $DIR/return-via-stack.rs:25:48 | LL | pub extern "C-cmse-nonsecure-entry" fn f1() -> ReprCU64 { | ^^^^^^^^ this type doesn't fit in the available registers @@ -8,7 +8,7 @@ LL | pub extern "C-cmse-nonsecure-entry" fn f1() -> ReprCU64 { = note: the result must either be a (transparently wrapped) i64, u64 or f64, or be at most 4 bytes in size error[E0798]: return value of `"C-cmse-nonsecure-entry"` function too large to pass via registers - --> $DIR/return-via-stack.rs:29:48 + --> $DIR/return-via-stack.rs:30:48 | LL | pub extern "C-cmse-nonsecure-entry" fn f2() -> ReprCBytes { | ^^^^^^^^^^ this type doesn't fit in the available registers @@ -17,7 +17,7 @@ LL | pub extern "C-cmse-nonsecure-entry" fn f2() -> ReprCBytes { = note: the result must either be a (transparently wrapped) i64, u64 or f64, or be at most 4 bytes in size error[E0798]: return value of `"C-cmse-nonsecure-entry"` function too large to pass via registers - --> $DIR/return-via-stack.rs:34:48 + --> $DIR/return-via-stack.rs:35:48 | LL | pub extern "C-cmse-nonsecure-entry" fn f3() -> U64Compound { | ^^^^^^^^^^^ this type doesn't fit in the available registers @@ -26,7 +26,7 @@ LL | pub extern "C-cmse-nonsecure-entry" fn f3() -> U64Compound { = note: the result must either be a (transparently wrapped) i64, u64 or f64, or be at most 4 bytes in size error[E0798]: return value of `"C-cmse-nonsecure-entry"` function too large to pass via registers - --> $DIR/return-via-stack.rs:39:48 + --> $DIR/return-via-stack.rs:40:48 | LL | pub extern "C-cmse-nonsecure-entry" fn f4() -> ReprCAlign16 { | ^^^^^^^^^^^^ this type doesn't fit in the available registers @@ -35,7 +35,7 @@ LL | pub extern "C-cmse-nonsecure-entry" fn f4() -> ReprCAlign16 { = note: the result must either be a (transparently wrapped) i64, u64 or f64, or be at most 4 bytes in size error[E0798]: return value of `"C-cmse-nonsecure-entry"` function too large to pass via registers - --> $DIR/return-via-stack.rs:46:48 + --> $DIR/return-via-stack.rs:47:48 | LL | pub extern "C-cmse-nonsecure-entry" fn f5() -> [u8; 5] { | ^^^^^^^ this type doesn't fit in the available registers @@ -44,7 +44,7 @@ LL | pub extern "C-cmse-nonsecure-entry" fn f5() -> [u8; 5] { = note: the result must either be a (transparently wrapped) i64, u64 or f64, or be at most 4 bytes in size error[E0798]: return value of `"C-cmse-nonsecure-entry"` function too large to pass via registers - --> $DIR/return-via-stack.rs:52:50 + --> $DIR/return-via-stack.rs:53:50 | LL | pub extern "C-cmse-nonsecure-entry" fn u128() -> u128 { | ^^^^ this type doesn't fit in the available registers @@ -53,7 +53,7 @@ LL | pub extern "C-cmse-nonsecure-entry" fn u128() -> u128 { = note: the result must either be a (transparently wrapped) i64, u64 or f64, or be at most 4 bytes in size error[E0798]: return value of `"C-cmse-nonsecure-entry"` function too large to pass via registers - --> $DIR/return-via-stack.rs:58:50 + --> $DIR/return-via-stack.rs:59:50 | LL | pub extern "C-cmse-nonsecure-entry" fn i128() -> i128 { | ^^^^ this type doesn't fit in the available registers @@ -62,7 +62,7 @@ LL | pub extern "C-cmse-nonsecure-entry" fn i128() -> i128 { = note: the result must either be a (transparently wrapped) i64, u64 or f64, or be at most 4 bytes in size error[E0798]: return value of `"C-cmse-nonsecure-entry"` function too large to pass via registers - --> $DIR/return-via-stack.rs:75:56 + --> $DIR/return-via-stack.rs:76:56 | LL | pub extern "C-cmse-nonsecure-entry" fn union_rust() -> ReprRustUnionU64 { | ^^^^^^^^^^^^^^^^ this type doesn't fit in the available registers @@ -71,7 +71,7 @@ LL | pub extern "C-cmse-nonsecure-entry" fn union_rust() -> ReprRustUnionU64 { = note: the result must either be a (transparently wrapped) i64, u64 or f64, or be at most 4 bytes in size error[E0798]: return value of `"C-cmse-nonsecure-entry"` function too large to pass via registers - --> $DIR/return-via-stack.rs:80:53 + --> $DIR/return-via-stack.rs:81:53 | LL | pub extern "C-cmse-nonsecure-entry" fn union_c() -> ReprCUnionU64 { | ^^^^^^^^^^^^^ this type doesn't fit in the available registers diff --git a/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/trustzone-only.aarch64.stderr b/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/trustzone-only.aarch64.stderr index 26409279fbe..6a90dc8d635 100644 --- a/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/trustzone-only.aarch64.stderr +++ b/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/trustzone-only.aarch64.stderr @@ -1,5 +1,5 @@ error[E0570]: `"C-cmse-nonsecure-entry"` is not a supported ABI for the current target - --> $DIR/trustzone-only.rs:20:1 + --> $DIR/trustzone-only.rs:17:1 | LL | pub extern "C-cmse-nonsecure-entry" fn entry_function(input: u32) -> u32 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/trustzone-only.rs b/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/trustzone-only.rs index a4ea7a1757d..6d84dab2166 100644 --- a/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/trustzone-only.rs +++ b/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/trustzone-only.rs @@ -1,3 +1,4 @@ +//@ add-core-stubs //@ revisions: x86 aarch64 thumb7 // //@[x86] compile-flags: --target x86_64-unknown-linux-gnu @@ -9,12 +10,8 @@ #![feature(no_core, lang_items, rustc_attrs, cmse_nonsecure_entry)] #![no_core] -#[lang = "sized"] -trait Sized {} -#[lang = "copy"] -trait Copy {} - -impl Copy for u32 {} +extern crate minicore; +use minicore::*; #[no_mangle] pub extern "C-cmse-nonsecure-entry" fn entry_function(input: u32) -> u32 { diff --git a/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/trustzone-only.thumb7.stderr b/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/trustzone-only.thumb7.stderr index 26409279fbe..6a90dc8d635 100644 --- a/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/trustzone-only.thumb7.stderr +++ b/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/trustzone-only.thumb7.stderr @@ -1,5 +1,5 @@ error[E0570]: `"C-cmse-nonsecure-entry"` is not a supported ABI for the current target - --> $DIR/trustzone-only.rs:20:1 + --> $DIR/trustzone-only.rs:17:1 | LL | pub extern "C-cmse-nonsecure-entry" fn entry_function(input: u32) -> u32 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/trustzone-only.x86.stderr b/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/trustzone-only.x86.stderr index 26409279fbe..6a90dc8d635 100644 --- a/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/trustzone-only.x86.stderr +++ b/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/trustzone-only.x86.stderr @@ -1,5 +1,5 @@ error[E0570]: `"C-cmse-nonsecure-entry"` is not a supported ABI for the current target - --> $DIR/trustzone-only.rs:20:1 + --> $DIR/trustzone-only.rs:17:1 | LL | pub extern "C-cmse-nonsecure-entry" fn entry_function(input: u32) -> u32 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/via-registers.rs b/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/via-registers.rs index 8978b35d356..912fc8b85eb 100644 --- a/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/via-registers.rs +++ b/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/via-registers.rs @@ -1,15 +1,13 @@ +//@ add-core-stubs //@ build-pass //@ compile-flags: --target thumbv8m.main-none-eabi --crate-type lib //@ needs-llvm-components: arm #![feature(cmse_nonsecure_entry, no_core, lang_items)] #![no_core] #![crate_type = "lib"] -#[lang = "sized"] -pub trait Sized {} -#[lang = "copy"] -trait Copy {} -impl Copy for u32 {} -impl Copy for u8 {} + +extern crate minicore; +use minicore::*; #[repr(transparent)] pub struct ReprTransparentStruct<T> { diff --git a/tests/ui/codemap_tests/tab_2.stderr b/tests/ui/codemap_tests/tab_2.stderr index b22c7b42665..4f9a937155d 100644 --- a/tests/ui/codemap_tests/tab_2.stderr +++ b/tests/ui/codemap_tests/tab_2.stderr @@ -4,7 +4,7 @@ error[E0765]: unterminated double quote string LL | """; | ___________________^ LL | | } - | |_^ + | |__^ error: aborting due to 1 previous error diff --git a/tests/ui/coercion/issue-26905.stderr b/tests/ui/coercion/issue-26905.stderr index 86f6a14cd10..17387ae992b 100644 --- a/tests/ui/coercion/issue-26905.stderr +++ b/tests/ui/coercion/issue-26905.stderr @@ -1,11 +1,16 @@ -error[E0375]: implementing the trait `CoerceUnsized` requires multiple coercions +error[E0375]: implementing `CoerceUnsized` does not allow multiple fields to be coerced --> $DIR/issue-26905.rs:16:40 | LL | impl<T: ?Sized + Unsize<U>, U: ?Sized> CoerceUnsized<MyRc<U>> for MyRc<T>{ } - | ^^^^^^^^^^^^^^^^^^^^^^ requires multiple coercions + | ^^^^^^^^^^^^^^^^^^^^^^ | - = note: `CoerceUnsized` may only be implemented for a coercion between structures with one field being coerced - = note: currently, 2 fields need coercions: `_ptr` (`*const T` to `*const U`), `_boo` (`NotPhantomData<T>` to `NotPhantomData<U>`) +note: the trait `CoerceUnsized` may only be implemented when a single field is being coerced + --> $DIR/issue-26905.rs:12:5 + | +LL | _ptr: *const T, + | ^^^^^^^^^^^^^^ +LL | _boo: NotPhantomData<T>, + | ^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 1 previous error diff --git a/tests/ui/coherence/coherence-conflicting-negative-trait-impl.rs b/tests/ui/coherence/coherence-conflicting-negative-trait-impl.rs index 24b87892753..15ca0577e4a 100644 --- a/tests/ui/coherence/coherence-conflicting-negative-trait-impl.rs +++ b/tests/ui/coherence/coherence-conflicting-negative-trait-impl.rs @@ -8,10 +8,14 @@ struct TestType<T>(::std::marker::PhantomData<T>); unsafe impl<T: MyTrait + 'static> Send for TestType<T> {} -impl<T: MyTrait> !Send for TestType<T> {} //~ ERROR found both positive and negative implementation +impl<T: MyTrait> !Send for TestType<T> {} +//~^ ERROR found both positive and negative implementation +//~| ERROR `!Send` impl requires `T: MyTrait` but the struct it is implemented for does not -unsafe impl<T: 'static> Send for TestType<T> {} //~ ERROR conflicting implementations +unsafe impl<T: 'static> Send for TestType<T> {} +//~^ ERROR conflicting implementations impl !Send for TestType<i32> {} +//~^ ERROR `!Send` impls cannot be specialized fn main() {} diff --git a/tests/ui/coherence/coherence-conflicting-negative-trait-impl.stderr b/tests/ui/coherence/coherence-conflicting-negative-trait-impl.stderr index 2463f38a922..c6aed150201 100644 --- a/tests/ui/coherence/coherence-conflicting-negative-trait-impl.stderr +++ b/tests/ui/coherence/coherence-conflicting-negative-trait-impl.stderr @@ -8,7 +8,7 @@ LL | impl<T: MyTrait> !Send for TestType<T> {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ negative implementation here error[E0119]: conflicting implementations of trait `Send` for type `TestType<_>` - --> $DIR/coherence-conflicting-negative-trait-impl.rs:13:1 + --> $DIR/coherence-conflicting-negative-trait-impl.rs:15:1 | LL | unsafe impl<T: MyTrait + 'static> Send for TestType<T> {} | ------------------------------------------------------ first implementation here @@ -16,7 +16,32 @@ LL | unsafe impl<T: MyTrait + 'static> Send for TestType<T> {} LL | unsafe impl<T: 'static> Send for TestType<T> {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `TestType<_>` -error: aborting due to 2 previous errors +error[E0367]: `!Send` impl requires `T: MyTrait` but the struct it is implemented for does not + --> $DIR/coherence-conflicting-negative-trait-impl.rs:11:9 + | +LL | impl<T: MyTrait> !Send for TestType<T> {} + | ^^^^^^^ + | +note: the implementor must specify the same requirement + --> $DIR/coherence-conflicting-negative-trait-impl.rs:7:1 + | +LL | struct TestType<T>(::std::marker::PhantomData<T>); + | ^^^^^^^^^^^^^^^^^^ + +error[E0366]: `!Send` impls cannot be specialized + --> $DIR/coherence-conflicting-negative-trait-impl.rs:18:1 + | +LL | impl !Send for TestType<i32> {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: `i32` is not a generic parameter +note: use the same sequence of generic lifetime, type and const parameters as the struct definition + --> $DIR/coherence-conflicting-negative-trait-impl.rs:7:1 + | +LL | struct TestType<T>(::std::marker::PhantomData<T>); + | ^^^^^^^^^^^^^^^^^^ + +error: aborting due to 4 previous errors -Some errors have detailed explanations: E0119, E0751. +Some errors have detailed explanations: E0119, E0366, E0367, E0751. For more information about an error, try `rustc --explain E0119`. diff --git a/tests/ui/coherence/coherence-impl-trait-for-marker-trait-negative.stderr b/tests/ui/coherence/coherence-impl-trait-for-marker-trait-negative.stderr index 77d1bdee5ac..bc81dd6f286 100644 --- a/tests/ui/coherence/coherence-impl-trait-for-marker-trait-negative.stderr +++ b/tests/ui/coherence/coherence-impl-trait-for-marker-trait-negative.stderr @@ -1,9 +1,3 @@ -error[E0371]: the object type `(dyn Object + Marker2 + 'static)` automatically implements the trait `Marker1` - --> $DIR/coherence-impl-trait-for-marker-trait-negative.rs:15:1 - | -LL | impl !Marker1 for dyn Object + Marker2 {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `(dyn Object + Marker2 + 'static)` automatically implements trait `Marker1` - error[E0321]: traits with a default impl, like `Marker1`, cannot be implemented for trait object `(dyn Object + Marker2 + 'static)` --> $DIR/coherence-impl-trait-for-marker-trait-negative.rs:15:1 | @@ -12,11 +6,11 @@ LL | impl !Marker1 for dyn Object + Marker2 {} | = note: a trait object implements `Marker1` if and only if `Marker1` is one of the trait object's trait bounds -error[E0371]: the object type `(dyn Object + Marker2 + 'static)` automatically implements the trait `Marker2` - --> $DIR/coherence-impl-trait-for-marker-trait-negative.rs:18:1 +error[E0371]: the object type `(dyn Object + Marker2 + 'static)` automatically implements the trait `Marker1` + --> $DIR/coherence-impl-trait-for-marker-trait-negative.rs:15:1 | -LL | impl !Marker2 for dyn Object + Marker2 {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `(dyn Object + Marker2 + 'static)` automatically implements trait `Marker2` +LL | impl !Marker1 for dyn Object + Marker2 {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `(dyn Object + Marker2 + 'static)` automatically implements trait `Marker1` error[E0321]: traits with a default impl, like `Marker2`, cannot be implemented for trait object `(dyn Object + Marker2 + 'static)` --> $DIR/coherence-impl-trait-for-marker-trait-negative.rs:18:1 @@ -26,6 +20,12 @@ LL | impl !Marker2 for dyn Object + Marker2 {} | = note: a trait object implements `Marker2` if and only if `Marker2` is one of the trait object's trait bounds +error[E0371]: the object type `(dyn Object + Marker2 + 'static)` automatically implements the trait `Marker2` + --> $DIR/coherence-impl-trait-for-marker-trait-negative.rs:18:1 + | +LL | impl !Marker2 for dyn Object + Marker2 {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `(dyn Object + Marker2 + 'static)` automatically implements trait `Marker2` + error[E0321]: traits with a default impl, like `Marker2`, cannot be implemented for trait object `(dyn Object + 'static)` --> $DIR/coherence-impl-trait-for-marker-trait-negative.rs:26:1 | diff --git a/tests/ui/coherence/coherence-orphan.rs b/tests/ui/coherence/coherence-orphan.rs index aee6647a788..665fa15c56e 100644 --- a/tests/ui/coherence/coherence-orphan.rs +++ b/tests/ui/coherence/coherence-orphan.rs @@ -8,12 +8,13 @@ use lib::TheTrait; struct TheType; impl TheTrait<usize> for isize {} -//~^ ERROR E0117 +//~^ ERROR only traits defined in the current crate can be implemented for primitive types impl TheTrait<TheType> for isize {} impl TheTrait<isize> for TheType {} -impl !Send for Vec<isize> {} //~ ERROR E0117 +impl !Send for Vec<isize> {} +//~^ ERROR only traits defined in the current crate can be implemented for types defined outside of the crate fn main() {} diff --git a/tests/ui/coherence/coherence-overlap-negative-impls.rs b/tests/ui/coherence/coherence-overlap-negative-impls.rs deleted file mode 100644 index ffcd56817e5..00000000000 --- a/tests/ui/coherence/coherence-overlap-negative-impls.rs +++ /dev/null @@ -1,44 +0,0 @@ -//@ check-pass -//@ known-bug: #74629 - -// Should fail. The `0` and `1` impls overlap, violating coherence. Eg, with -// `T = Test, F = ()`, all bounds are true, making both impls applicable. -// `Test: Fold<Nil>`, `Test: Fold<()>` are true because of `2`. -// `Is<Test>: NotNil` is true because of `auto trait` and lack of negative impl. - -#![feature(negative_impls)] -#![feature(auto_traits)] - -struct Nil; -struct Cons<H>(H); -struct Test; - -trait Fold<F> {} - -impl<T, F> Fold<F> for Cons<T> -// 0 -where - T: Fold<Nil>, -{ -} - -impl<T, F> Fold<F> for Cons<T> -// 1 -where - T: Fold<F>, - private::Is<T>: private::NotNil, -{ -} - -impl<F> Fold<F> for Test {} // 2 - -mod private { - use crate::Nil; - - pub struct Is<T>(T); - pub auto trait NotNil {} - - impl !NotNil for Is<Nil> {} -} - -fn main() {} diff --git a/tests/ui/coherence/coherence-unsafe-trait-object-impl.rs b/tests/ui/coherence/coherence-unsafe-trait-object-impl.rs deleted file mode 100644 index 16baf0958a6..00000000000 --- a/tests/ui/coherence/coherence-unsafe-trait-object-impl.rs +++ /dev/null @@ -1,18 +0,0 @@ -// Check that unsafe trait object do not implement themselves -// automatically - -#![feature(dyn_compatible_for_dispatch)] - -trait Trait: Sized { - fn call(&self); -} - -fn takes_t<S: Trait>(s: S) { - s.call(); -} - -fn takes_t_obj(t: &dyn Trait) { - takes_t(t); //~ ERROR E0277 -} - -fn main() {} diff --git a/tests/ui/coherence/coherence-unsafe-trait-object-impl.stderr b/tests/ui/coherence/coherence-unsafe-trait-object-impl.stderr deleted file mode 100644 index 4f898ec127b..00000000000 --- a/tests/ui/coherence/coherence-unsafe-trait-object-impl.stderr +++ /dev/null @@ -1,22 +0,0 @@ -error[E0277]: the trait bound `&dyn Trait: Trait` is not satisfied - --> $DIR/coherence-unsafe-trait-object-impl.rs:15:13 - | -LL | takes_t(t); - | ------- ^ the trait `Trait` is not implemented for `&dyn Trait` - | | - | required by a bound introduced by this call - | -help: this trait has no implementations, consider adding one - --> $DIR/coherence-unsafe-trait-object-impl.rs:6:1 - | -LL | trait Trait: Sized { - | ^^^^^^^^^^^^^^^^^^ -note: required by a bound in `takes_t` - --> $DIR/coherence-unsafe-trait-object-impl.rs:10:15 - | -LL | fn takes_t<S: Trait>(s: S) { - | ^^^^^ required by this bound in `takes_t` - -error: aborting due to 1 previous error - -For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/coherence/const-errs-dont-conflict-103369.rs b/tests/ui/coherence/const-errs-dont-conflict-103369.rs index c7d46a8000d..14937e0f02e 100644 --- a/tests/ui/coherence/const-errs-dont-conflict-103369.rs +++ b/tests/ui/coherence/const-errs-dont-conflict-103369.rs @@ -2,13 +2,12 @@ pub trait ConstGenericTrait<const N: u32> {} -impl ConstGenericTrait<{my_fn(1)}> for () {} +impl ConstGenericTrait<{my_fn(1)}> for () {} //~ ERROR E0080 -impl ConstGenericTrait<{my_fn(2)}> for () {} +impl ConstGenericTrait<{my_fn(2)}> for () {} //~ ERROR E0080 const fn my_fn(v: u32) -> u32 { - panic!("Some error occurred"); //~ ERROR E0080 - //~| ERROR E0080 + panic!("Some error occurred"); } fn main() {} diff --git a/tests/ui/coherence/const-errs-dont-conflict-103369.stderr b/tests/ui/coherence/const-errs-dont-conflict-103369.stderr index 22066d6b6bd..4acaaf22ae8 100644 --- a/tests/ui/coherence/const-errs-dont-conflict-103369.stderr +++ b/tests/ui/coherence/const-errs-dont-conflict-103369.stderr @@ -1,37 +1,27 @@ error[E0080]: evaluation of constant value failed - --> $DIR/const-errs-dont-conflict-103369.rs:10:5 + --> $DIR/const-errs-dont-conflict-103369.rs:5:25 | -LL | panic!("Some error occurred"); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the evaluated program panicked at 'Some error occurred', $DIR/const-errs-dont-conflict-103369.rs:10:5 +LL | impl ConstGenericTrait<{my_fn(1)}> for () {} + | ^^^^^^^^ evaluation panicked: Some error occurred | note: inside `my_fn` --> $DIR/const-errs-dont-conflict-103369.rs:10:5 | LL | panic!("Some error occurred"); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -note: inside `<() as ConstGenericTrait<{my_fn(1)}>>::{constant#0}` - --> $DIR/const-errs-dont-conflict-103369.rs:5:25 - | -LL | impl ConstGenericTrait<{my_fn(1)}> for () {} - | ^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the failure occurred here = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0080]: evaluation of constant value failed - --> $DIR/const-errs-dont-conflict-103369.rs:10:5 + --> $DIR/const-errs-dont-conflict-103369.rs:7:25 | -LL | panic!("Some error occurred"); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the evaluated program panicked at 'Some error occurred', $DIR/const-errs-dont-conflict-103369.rs:10:5 +LL | impl ConstGenericTrait<{my_fn(2)}> for () {} + | ^^^^^^^^ evaluation panicked: Some error occurred | note: inside `my_fn` --> $DIR/const-errs-dont-conflict-103369.rs:10:5 | LL | panic!("Some error occurred"); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -note: inside `<() as ConstGenericTrait<{my_fn(2)}>>::{constant#0}` - --> $DIR/const-errs-dont-conflict-103369.rs:7:25 - | -LL | impl ConstGenericTrait<{my_fn(2)}> for () {} - | ^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the failure occurred here = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 2 previous errors diff --git a/tests/ui/conditional-compilation/cfg-attr-syntax-validation.rs b/tests/ui/conditional-compilation/cfg-attr-syntax-validation.rs index d8852812492..9a041557c7c 100644 --- a/tests/ui/conditional-compilation/cfg-attr-syntax-validation.rs +++ b/tests/ui/conditional-compilation/cfg-attr-syntax-validation.rs @@ -28,8 +28,8 @@ struct S9; macro_rules! generate_s10 { ($expr: expr) => { #[cfg(feature = $expr)] - //~^ ERROR expected unsuffixed literal, found `concat!("nonexistent")` - //~| ERROR expected unsuffixed literal, found `concat!("nonexistent")` + //~^ ERROR expected unsuffixed literal, found expression `concat!("nonexistent")` + //~| ERROR expected unsuffixed literal, found expression `concat!("nonexistent")` struct S10; } } diff --git a/tests/ui/conditional-compilation/cfg-attr-syntax-validation.stderr b/tests/ui/conditional-compilation/cfg-attr-syntax-validation.stderr index 3dd0823389c..21a3712d939 100644 --- a/tests/ui/conditional-compilation/cfg-attr-syntax-validation.stderr +++ b/tests/ui/conditional-compilation/cfg-attr-syntax-validation.stderr @@ -54,7 +54,7 @@ LL | #[cfg(a = b"hi")] | | | help: consider removing the prefix -error: expected unsuffixed literal, found `concat!("nonexistent")` +error: expected unsuffixed literal, found expression `concat!("nonexistent")` --> $DIR/cfg-attr-syntax-validation.rs:30:25 | LL | #[cfg(feature = $expr)] @@ -65,7 +65,7 @@ LL | generate_s10!(concat!("nonexistent")); | = note: this error originates in the macro `generate_s10` (in Nightly builds, run with -Z macro-backtrace for more info) -error: expected unsuffixed literal, found `concat!("nonexistent")` +error: expected unsuffixed literal, found expression `concat!("nonexistent")` --> $DIR/cfg-attr-syntax-validation.rs:30:25 | LL | #[cfg(feature = $expr)] diff --git a/tests/ui/const-generics/const-param-type-depends-on-const-param.full.stderr b/tests/ui/const-generics/const-param-type-depends-on-const-param.full.stderr index 539d840f0a8..f639e276f46 100644 --- a/tests/ui/const-generics/const-param-type-depends-on-const-param.full.stderr +++ b/tests/ui/const-generics/const-param-type-depends-on-const-param.full.stderr @@ -3,16 +3,12 @@ error[E0770]: the type of const parameters must not depend on other generic para | LL | pub struct Dependent<const N: usize, const X: [u8; N]>([(); N]); | ^ the type must not depend on the parameter `N` - | - = note: const parameters may not be used in the type of const parameters error[E0770]: the type of const parameters must not depend on other generic parameters --> $DIR/const-param-type-depends-on-const-param.rs:15:40 | LL | pub struct SelfDependent<const N: [u8; N]>; | ^ the type must not depend on the parameter `N` - | - = note: const parameters may not be used in the type of const parameters error: aborting due to 2 previous errors diff --git a/tests/ui/const-generics/const-param-type-depends-on-const-param.min.stderr b/tests/ui/const-generics/const-param-type-depends-on-const-param.min.stderr index 18b89963267..44fcf9a13b1 100644 --- a/tests/ui/const-generics/const-param-type-depends-on-const-param.min.stderr +++ b/tests/ui/const-generics/const-param-type-depends-on-const-param.min.stderr @@ -3,16 +3,12 @@ error[E0770]: the type of const parameters must not depend on other generic para | LL | pub struct Dependent<const N: usize, const X: [u8; N]>([(); N]); | ^ the type must not depend on the parameter `N` - | - = note: const parameters may not be used in the type of const parameters error[E0770]: the type of const parameters must not depend on other generic parameters --> $DIR/const-param-type-depends-on-const-param.rs:15:40 | LL | pub struct SelfDependent<const N: [u8; N]>; | ^ the type must not depend on the parameter `N` - | - = note: const parameters may not be used in the type of const parameters error: `[u8; N]` is forbidden as the type of a const generic parameter --> $DIR/const-param-type-depends-on-const-param.rs:11:47 diff --git a/tests/ui/const-generics/const-param-type-depends-on-type-param-ungated.stderr b/tests/ui/const-generics/const-param-type-depends-on-type-param-ungated.stderr index 55bced29aff..3075597895b 100644 --- a/tests/ui/const-generics/const-param-type-depends-on-type-param-ungated.stderr +++ b/tests/ui/const-generics/const-param-type-depends-on-type-param-ungated.stderr @@ -3,8 +3,6 @@ error[E0770]: the type of const parameters must not depend on other generic para | LL | struct B<T, const N: T>(PhantomData<[T; N]>); | ^ the type must not depend on the parameter `T` - | - = note: type parameters may not be used in the type of const parameters error: aborting due to 1 previous error diff --git a/tests/ui/const-generics/const-param-type-depends-on-type-param.full.stderr b/tests/ui/const-generics/const-param-type-depends-on-type-param.full.stderr index 49cf4281323..e8257ace692 100644 --- a/tests/ui/const-generics/const-param-type-depends-on-type-param.full.stderr +++ b/tests/ui/const-generics/const-param-type-depends-on-type-param.full.stderr @@ -3,8 +3,6 @@ error[E0770]: the type of const parameters must not depend on other generic para | LL | pub struct Dependent<T, const X: T>([(); X]); | ^ the type must not depend on the parameter `T` - | - = note: type parameters may not be used in the type of const parameters error[E0392]: type parameter `T` is never used --> $DIR/const-param-type-depends-on-type-param.rs:11:22 diff --git a/tests/ui/const-generics/const-param-type-depends-on-type-param.min.stderr b/tests/ui/const-generics/const-param-type-depends-on-type-param.min.stderr index 49cf4281323..e8257ace692 100644 --- a/tests/ui/const-generics/const-param-type-depends-on-type-param.min.stderr +++ b/tests/ui/const-generics/const-param-type-depends-on-type-param.min.stderr @@ -3,8 +3,6 @@ error[E0770]: the type of const parameters must not depend on other generic para | LL | pub struct Dependent<T, const X: T>([(); X]); | ^ the type must not depend on the parameter `T` - | - = note: type parameters may not be used in the type of const parameters error[E0392]: type parameter `T` is never used --> $DIR/const-param-type-depends-on-type-param.rs:11:22 diff --git a/tests/ui/const-generics/generic_const_exprs/unevaluated-const-ice-119731.stderr b/tests/ui/const-generics/generic_const_exprs/unevaluated-const-ice-119731.stderr index 30a45ce377e..b73611c79b2 100644 --- a/tests/ui/const-generics/generic_const_exprs/unevaluated-const-ice-119731.stderr +++ b/tests/ui/const-generics/generic_const_exprs/unevaluated-const-ice-119731.stderr @@ -54,12 +54,6 @@ warning: type `v17` should have an upper camel case name LL | pub struct v17<const v10: usize, const v7: v11> { | ^^^ help: convert the identifier to upper camel case (notice the capitalization): `V17` -error[E0425]: cannot find function `v6` in this scope - --> $DIR/unevaluated-const-ice-119731.rs:13:35 - | -LL | const v0: [[usize; v4]; v4] = v6(v8); - | ^^ not found in this scope - error: `[[usize; v4]; v4]` is forbidden as the type of a const generic parameter --> $DIR/unevaluated-const-ice-119731.rs:16:48 | @@ -72,6 +66,12 @@ help: add `#![feature(adt_const_params)]` to the crate attributes to enable more LL + #![feature(adt_const_params)] | +error[E0425]: cannot find function `v6` in this scope + --> $DIR/unevaluated-const-ice-119731.rs:13:35 + | +LL | const v0: [[usize; v4]; v4] = v6(v8); + | ^^ not found in this scope + error: maximum number of nodes exceeded in constant v20::v17::<v10, v2>::{constant#0} --> $DIR/unevaluated-const-ice-119731.rs:28:37 | diff --git a/tests/ui/const-generics/generic_const_parameter_types/bad_inference.rs b/tests/ui/const-generics/generic_const_parameter_types/bad_inference.rs new file mode 100644 index 00000000000..de2e687e870 --- /dev/null +++ b/tests/ui/const-generics/generic_const_parameter_types/bad_inference.rs @@ -0,0 +1,23 @@ +#![feature( + adt_const_params, + unsized_const_params, + generic_const_parameter_types, + generic_arg_infer +)] +#![allow(incomplete_features)] + +use std::marker::ConstParamTy_; + +fn foo<T: ConstParamTy_, const N: usize, const M: [T; N]>() -> [T; N] { + loop {} +} + +fn main() { + // Requires inferring `T`/`N` from `12_u8` and `2` respectively. + let a = foo::<_, _, { [12_u8; 2] }>(); + //~^ ERROR: anonymous constants with inferred types are not yet supported + + // Requires inferring `T`/`N`/`12_?i`/`_` from `[u8; 2]` + let b: [u8; 2] = foo::<_, _, { [12; _] }>(); + //~^ ERROR: anonymous constants with inferred types are not yet supported +} diff --git a/tests/ui/const-generics/generic_const_parameter_types/bad_inference.stderr b/tests/ui/const-generics/generic_const_parameter_types/bad_inference.stderr new file mode 100644 index 00000000000..1ac67fe622b --- /dev/null +++ b/tests/ui/const-generics/generic_const_parameter_types/bad_inference.stderr @@ -0,0 +1,14 @@ +error: anonymous constants with inferred types are not yet supported + --> $DIR/bad_inference.rs:17:25 + | +LL | let a = foo::<_, _, { [12_u8; 2] }>(); + | ^^^^^^^^^^^^^^ + +error: anonymous constants with inferred types are not yet supported + --> $DIR/bad_inference.rs:21:34 + | +LL | let b: [u8; 2] = foo::<_, _, { [12; _] }>(); + | ^^^^^^^^^^^ + +error: aborting due to 2 previous errors + diff --git a/tests/ui/const-generics/generic_const_parameter_types/evaluate_const_parameter_in_mir.rs b/tests/ui/const-generics/generic_const_parameter_types/evaluate_const_parameter_in_mir.rs new file mode 100644 index 00000000000..910deb6632d --- /dev/null +++ b/tests/ui/const-generics/generic_const_parameter_types/evaluate_const_parameter_in_mir.rs @@ -0,0 +1,19 @@ +//@ check-pass + +#![feature( + adt_const_params, + unsized_const_params, + generic_const_parameter_types, + generic_arg_infer +)] +#![allow(incomplete_features)] + +use std::marker::ConstParamTy_; + +fn foo<T: ConstParamTy_, const N: usize, const M: [T; N]>() -> [T; N] { + M +} + +fn main() { + let a: [u8; 2] = foo::<u8, 2, { [12; _] }>(); +} diff --git a/tests/ui/const-generics/generic_const_parameter_types/forward_declared_type.rs b/tests/ui/const-generics/generic_const_parameter_types/forward_declared_type.rs new file mode 100644 index 00000000000..91c1c80e07c --- /dev/null +++ b/tests/ui/const-generics/generic_const_parameter_types/forward_declared_type.rs @@ -0,0 +1,11 @@ +#![feature(adt_const_params, generic_const_parameter_types)] +#![expect(incomplete_features)] + +use std::marker::PhantomData; + +struct UsesConst<const N: [u8; M], const M: usize>; +//~^ ERROR: the type of const parameters must not depend on other generic parameters +struct UsesType<const N: [T; 2], T>(PhantomData<T>); +//~^ ERROR: the type of const parameters must not depend on other generic parameters + +fn main() {} diff --git a/tests/ui/const-generics/generic_const_parameter_types/forward_declared_type.stderr b/tests/ui/const-generics/generic_const_parameter_types/forward_declared_type.stderr new file mode 100644 index 00000000000..b0dbdff8413 --- /dev/null +++ b/tests/ui/const-generics/generic_const_parameter_types/forward_declared_type.stderr @@ -0,0 +1,15 @@ +error[E0770]: the type of const parameters must not depend on other generic parameters + --> $DIR/forward_declared_type.rs:6:32 + | +LL | struct UsesConst<const N: [u8; M], const M: usize>; + | ^ the type must not depend on the parameter `M` + +error[E0770]: the type of const parameters must not depend on other generic parameters + --> $DIR/forward_declared_type.rs:8:27 + | +LL | struct UsesType<const N: [T; 2], T>(PhantomData<T>); + | ^ the type must not depend on the parameter `T` + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0770`. diff --git a/tests/ui/const-generics/generic_const_parameter_types/inferred_from_arg.rs b/tests/ui/const-generics/generic_const_parameter_types/inferred_from_arg.rs new file mode 100644 index 00000000000..d655fc174ee --- /dev/null +++ b/tests/ui/const-generics/generic_const_parameter_types/inferred_from_arg.rs @@ -0,0 +1,13 @@ +//@ check-pass + +#![feature(adt_const_params, generic_arg_infer, generic_const_parameter_types)] +#![expect(incomplete_features)] + +struct Bar<const N: usize, const M: [u8; N]>; + +fn foo<const N: usize, const M: [u8; N]>(_: Bar<N, M>) {} + +fn main() { + foo(Bar::<2, { [1; 2] }>); + foo::<_, _>(Bar::<2, { [1; 2] }>); +} diff --git a/tests/ui/const-generics/generic_const_parameter_types/lifetime_dependent_const_param.rs b/tests/ui/const-generics/generic_const_parameter_types/lifetime_dependent_const_param.rs new file mode 100644 index 00000000000..6b81ca743aa --- /dev/null +++ b/tests/ui/const-generics/generic_const_parameter_types/lifetime_dependent_const_param.rs @@ -0,0 +1,20 @@ +#![feature(generic_const_parameter_types, adt_const_params, unsized_const_params)] +#![expect(incomplete_features)] + +fn foo<'a, const N: &'a u32>() {} + +fn bar() { + foo::<'static, { &1_u32 }>(); + //~^ ERROR: anonymous constants with lifetimes in their type are not yet supported + foo::<'_, { &1_u32 }>(); + //~^ ERROR: anonymous constants with lifetimes in their type are not yet supported +} + +fn borrowck<'a, const N: &'static u32, const M: &'a u32>() { + foo::<'a, M>(); + foo::<'static, M>(); + //~^ ERROR: lifetime may not live long enough + foo::<'static, N>(); +} + +fn main() {} diff --git a/tests/ui/const-generics/generic_const_parameter_types/lifetime_dependent_const_param.stderr b/tests/ui/const-generics/generic_const_parameter_types/lifetime_dependent_const_param.stderr new file mode 100644 index 00000000000..be5f27bcbc0 --- /dev/null +++ b/tests/ui/const-generics/generic_const_parameter_types/lifetime_dependent_const_param.stderr @@ -0,0 +1,23 @@ +error: anonymous constants with lifetimes in their type are not yet supported + --> $DIR/lifetime_dependent_const_param.rs:7:20 + | +LL | foo::<'static, { &1_u32 }>(); + | ^^^^^^^^^^ + +error: anonymous constants with lifetimes in their type are not yet supported + --> $DIR/lifetime_dependent_const_param.rs:9:15 + | +LL | foo::<'_, { &1_u32 }>(); + | ^^^^^^^^^^ + +error: lifetime may not live long enough + --> $DIR/lifetime_dependent_const_param.rs:15:5 + | +LL | fn borrowck<'a, const N: &'static u32, const M: &'a u32>() { + | -- lifetime `'a` defined here +LL | foo::<'a, M>(); +LL | foo::<'static, M>(); + | ^^^^^^^^^^^^^^^^^ requires that `'a` must outlive `'static` + +error: aborting due to 3 previous errors + diff --git a/tests/ui/const-generics/generic_const_parameter_types/mismatched_args_with_value.rs b/tests/ui/const-generics/generic_const_parameter_types/mismatched_args_with_value.rs new file mode 100644 index 00000000000..df8a057b335 --- /dev/null +++ b/tests/ui/const-generics/generic_const_parameter_types/mismatched_args_with_value.rs @@ -0,0 +1,15 @@ +#![feature(adt_const_params, unsized_const_params, generic_const_parameter_types)] +#![allow(incomplete_features)] + +use std::marker::ConstParamTy_; + +fn foo<const N: usize, const M: [u8; N]>() {} +fn bar<T: ConstParamTy_, const M: [T; 2]>() {} + +fn main() { + foo::<3, { [1; 2] }>(); + //~^ ERROR: mismatched type + + bar::<u8, { [2_u16; 2] }>(); + //~^ ERROR: mismatched type +} diff --git a/tests/ui/const-generics/generic_const_parameter_types/mismatched_args_with_value.stderr b/tests/ui/const-generics/generic_const_parameter_types/mismatched_args_with_value.stderr new file mode 100644 index 00000000000..2411d31b980 --- /dev/null +++ b/tests/ui/const-generics/generic_const_parameter_types/mismatched_args_with_value.stderr @@ -0,0 +1,21 @@ +error[E0308]: mismatched types + --> $DIR/mismatched_args_with_value.rs:10:16 + | +LL | foo::<3, { [1; 2] }>(); + | ^^^^^^ expected an array with a size of 3, found one with a size of 2 + +error[E0308]: mismatched types + --> $DIR/mismatched_args_with_value.rs:13:18 + | +LL | bar::<u8, { [2_u16; 2] }>(); + | ^^^^^ expected `u8`, found `u16` + | +help: change the type of the numeric literal from `u16` to `u8` + | +LL - bar::<u8, { [2_u16; 2] }>(); +LL + bar::<u8, { [2_u8; 2] }>(); + | + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/const-generics/generic_const_parameter_types/no_const_param_ty_bound.rs b/tests/ui/const-generics/generic_const_parameter_types/no_const_param_ty_bound.rs new file mode 100644 index 00000000000..1a5ab46cda1 --- /dev/null +++ b/tests/ui/const-generics/generic_const_parameter_types/no_const_param_ty_bound.rs @@ -0,0 +1,9 @@ +#![feature(adt_const_params, unsized_const_params, generic_const_parameter_types)] +#![expect(incomplete_features)] + +use std::marker::{ConstParamTy_, PhantomData}; + +struct UsesType<T, const N: usize, const M: [T; N]>(PhantomData<T>); +//~^ ERROR: `[T; N]` can't be used as a const parameter type + +fn main() {} diff --git a/tests/ui/const-generics/generic_const_parameter_types/no_const_param_ty_bound.stderr b/tests/ui/const-generics/generic_const_parameter_types/no_const_param_ty_bound.stderr new file mode 100644 index 00000000000..4ea323f4a5c --- /dev/null +++ b/tests/ui/const-generics/generic_const_parameter_types/no_const_param_ty_bound.stderr @@ -0,0 +1,11 @@ +error[E0741]: `[T; N]` can't be used as a const parameter type + --> $DIR/no_const_param_ty_bound.rs:6:45 + | +LL | struct UsesType<T, const N: usize, const M: [T; N]>(PhantomData<T>); + | ^^^^^^ + | + = note: `T` must implement `UnsizedConstParamTy`, but it does not + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0741`. diff --git a/tests/ui/const-generics/generic_const_parameter_types/unrelated_inferred_arg.rs b/tests/ui/const-generics/generic_const_parameter_types/unrelated_inferred_arg.rs new file mode 100644 index 00000000000..b389e12884e --- /dev/null +++ b/tests/ui/const-generics/generic_const_parameter_types/unrelated_inferred_arg.rs @@ -0,0 +1,21 @@ +//@ check-pass + +#![feature( + adt_const_params, + unsized_const_params, + generic_const_parameter_types, + generic_arg_infer +)] +#![allow(incomplete_features)] + +use std::marker::ConstParamTy_; + +fn foo<U, T: ConstParamTy_, const N: usize, const M: [T; N]>(_: U) -> [T; N] { + loop {} +} + +fn main() { + // Check that `_` doesnt cause a "Type of const argument is uninferred" error + // as it is not actually used by the type of `M`. + let a = foo::<_, u8, 2, { [12; _] }>(true); +} diff --git a/tests/ui/const-generics/issues/cg-in-dyn-issue-128176.rs b/tests/ui/const-generics/issues/cg-in-dyn-issue-128176.rs index 5a67d34d6e5..dac5429f678 100644 --- a/tests/ui/const-generics/issues/cg-in-dyn-issue-128176.rs +++ b/tests/ui/const-generics/issues/cg-in-dyn-issue-128176.rs @@ -1,10 +1,7 @@ -//@ check-pass - // Regression test for #128176. Previously we would call `type_of` on the `1` anon const // before the anon const had been lowered and had the `type_of` fed with a result. #![feature(generic_const_exprs)] -#![feature(dyn_compatible_for_dispatch)] #![allow(incomplete_features)] trait X { @@ -13,6 +10,7 @@ trait X { const _: () = { fn f2<'a>(arg: Box<dyn X<Y<1> = &'a ()>>) {} + //~^ ERROR the trait `X` is not dyn compatible }; fn main() {} diff --git a/tests/ui/const-generics/issues/cg-in-dyn-issue-128176.stderr b/tests/ui/const-generics/issues/cg-in-dyn-issue-128176.stderr new file mode 100644 index 00000000000..7d563e3b605 --- /dev/null +++ b/tests/ui/const-generics/issues/cg-in-dyn-issue-128176.stderr @@ -0,0 +1,19 @@ +error[E0038]: the trait `X` is not dyn compatible + --> $DIR/cg-in-dyn-issue-128176.rs:12:24 + | +LL | fn f2<'a>(arg: Box<dyn X<Y<1> = &'a ()>>) {} + | ^^^^^^^^^^^^^^^^^^^^ `X` is not dyn compatible + | +note: for a trait to be dyn compatible it needs to allow building a vtable + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> + --> $DIR/cg-in-dyn-issue-128176.rs:8:10 + | +LL | trait X { + | - this trait is not dyn compatible... +LL | type Y<const N: i16>; + | ^ ...because it contains the generic associated type `Y` + = help: consider moving `Y` to another trait + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0038`. diff --git a/tests/ui/const-generics/issues/issue-100313.rs b/tests/ui/const-generics/issues/issue-100313.rs index 553165f90b8..7ce2a3b908c 100644 --- a/tests/ui/const-generics/issues/issue-100313.rs +++ b/tests/ui/const-generics/issues/issue-100313.rs @@ -6,15 +6,14 @@ struct T<const B: &'static bool>; impl<const B: &'static bool> T<B> { const fn set_false(&self) { unsafe { - *(B as *const bool as *mut bool) = false; - //~^ ERROR evaluation of constant value failed [E0080] + *(B as *const bool as *mut bool) = false; //~ inside `T } } } const _: () = { let x = T::<{ &true }>; - x.set_false(); + x.set_false(); //~ ERROR evaluation of constant value failed [E0080] }; fn main() {} diff --git a/tests/ui/const-generics/issues/issue-100313.stderr b/tests/ui/const-generics/issues/issue-100313.stderr index 6e419078e5e..03a658a83af 100644 --- a/tests/ui/const-generics/issues/issue-100313.stderr +++ b/tests/ui/const-generics/issues/issue-100313.stderr @@ -1,19 +1,14 @@ error[E0080]: evaluation of constant value failed - --> $DIR/issue-100313.rs:9:13 + --> $DIR/issue-100313.rs:16:5 | -LL | *(B as *const bool as *mut bool) = false; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ writing to ALLOC0 which is read-only +LL | x.set_false(); + | ^^^^^^^^^^^^^ writing to ALLOC0 which is read-only | note: inside `T::<&true>::set_false` --> $DIR/issue-100313.rs:9:13 | LL | *(B as *const bool as *mut bool) = false; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -note: inside `_` - --> $DIR/issue-100313.rs:17:5 - | -LL | x.set_false(); - | ^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the failure occurred here error: aborting due to 1 previous error diff --git a/tests/ui/const-generics/issues/issue-56445-1.full.stderr b/tests/ui/const-generics/issues/issue-56445-1.full.stderr index 86eb57355bd..392a125de67 100644 --- a/tests/ui/const-generics/issues/issue-56445-1.full.stderr +++ b/tests/ui/const-generics/issues/issue-56445-1.full.stderr @@ -3,8 +3,6 @@ error[E0770]: the type of const parameters must not depend on other generic para | LL | struct Bug<'a, const S: &'a str>(PhantomData<&'a ()>); | ^^ the type must not depend on the parameter `'a` - | - = note: lifetime parameters may not be used in the type of const parameters error: aborting due to 1 previous error diff --git a/tests/ui/const-generics/issues/issue-56445-1.min.stderr b/tests/ui/const-generics/issues/issue-56445-1.min.stderr index 86eb57355bd..392a125de67 100644 --- a/tests/ui/const-generics/issues/issue-56445-1.min.stderr +++ b/tests/ui/const-generics/issues/issue-56445-1.min.stderr @@ -3,8 +3,6 @@ error[E0770]: the type of const parameters must not depend on other generic para | LL | struct Bug<'a, const S: &'a str>(PhantomData<&'a ()>); | ^^ the type must not depend on the parameter `'a` - | - = note: lifetime parameters may not be used in the type of const parameters error: aborting due to 1 previous error diff --git a/tests/ui/const-generics/issues/issue-62878.full.stderr b/tests/ui/const-generics/issues/issue-62878.full.stderr index 615bfeb65a5..5e6b3ad9f4c 100644 --- a/tests/ui/const-generics/issues/issue-62878.full.stderr +++ b/tests/ui/const-generics/issues/issue-62878.full.stderr @@ -3,8 +3,6 @@ error[E0770]: the type of const parameters must not depend on other generic para | LL | fn foo<const N: usize, const A: [u8; N]>() {} | ^ the type must not depend on the parameter `N` - | - = note: const parameters may not be used in the type of const parameters error: aborting due to 1 previous error diff --git a/tests/ui/const-generics/issues/issue-62878.min.stderr b/tests/ui/const-generics/issues/issue-62878.min.stderr index 1bb111b188d..d3d4fa43871 100644 --- a/tests/ui/const-generics/issues/issue-62878.min.stderr +++ b/tests/ui/const-generics/issues/issue-62878.min.stderr @@ -3,8 +3,6 @@ error[E0770]: the type of const parameters must not depend on other generic para | LL | fn foo<const N: usize, const A: [u8; N]>() {} | ^ the type must not depend on the parameter `N` - | - = note: const parameters may not be used in the type of const parameters error: `[u8; N]` is forbidden as the type of a const generic parameter --> $DIR/issue-62878.rs:5:33 diff --git a/tests/ui/const-generics/issues/issue-71169.full.stderr b/tests/ui/const-generics/issues/issue-71169.full.stderr index 9553be6fc07..f600ecdab74 100644 --- a/tests/ui/const-generics/issues/issue-71169.full.stderr +++ b/tests/ui/const-generics/issues/issue-71169.full.stderr @@ -3,8 +3,6 @@ error[E0770]: the type of const parameters must not depend on other generic para | LL | fn foo<const LEN: usize, const DATA: [u8; LEN]>() {} | ^^^ the type must not depend on the parameter `LEN` - | - = note: const parameters may not be used in the type of const parameters error: aborting due to 1 previous error diff --git a/tests/ui/const-generics/issues/issue-71169.min.stderr b/tests/ui/const-generics/issues/issue-71169.min.stderr index 2ecbc337951..c04a710eee9 100644 --- a/tests/ui/const-generics/issues/issue-71169.min.stderr +++ b/tests/ui/const-generics/issues/issue-71169.min.stderr @@ -3,8 +3,6 @@ error[E0770]: the type of const parameters must not depend on other generic para | LL | fn foo<const LEN: usize, const DATA: [u8; LEN]>() {} | ^^^ the type must not depend on the parameter `LEN` - | - = note: const parameters may not be used in the type of const parameters error: `[u8; LEN]` is forbidden as the type of a const generic parameter --> $DIR/issue-71169.rs:5:38 diff --git a/tests/ui/const-generics/issues/issue-71381.full.stderr b/tests/ui/const-generics/issues/issue-71381.full.stderr index b6460e0017f..01bbe55415d 100644 --- a/tests/ui/const-generics/issues/issue-71381.full.stderr +++ b/tests/ui/const-generics/issues/issue-71381.full.stderr @@ -3,16 +3,12 @@ error[E0770]: the type of const parameters must not depend on other generic para | LL | pub fn call_me<Args: Sized, const IDX: usize, const FN: unsafe extern "C" fn(Args)>(&self) { | ^^^^ the type must not depend on the parameter `Args` - | - = note: type parameters may not be used in the type of const parameters error[E0770]: the type of const parameters must not depend on other generic parameters --> $DIR/issue-71381.rs:23:40 | LL | const FN: unsafe extern "C" fn(Args), | ^^^^ the type must not depend on the parameter `Args` - | - = note: type parameters may not be used in the type of const parameters error: aborting due to 2 previous errors diff --git a/tests/ui/const-generics/issues/issue-71381.min.stderr b/tests/ui/const-generics/issues/issue-71381.min.stderr index 38d2cbe6368..2b0a671bc3f 100644 --- a/tests/ui/const-generics/issues/issue-71381.min.stderr +++ b/tests/ui/const-generics/issues/issue-71381.min.stderr @@ -3,16 +3,12 @@ error[E0770]: the type of const parameters must not depend on other generic para | LL | pub fn call_me<Args: Sized, const IDX: usize, const FN: unsafe extern "C" fn(Args)>(&self) { | ^^^^ the type must not depend on the parameter `Args` - | - = note: type parameters may not be used in the type of const parameters error[E0770]: the type of const parameters must not depend on other generic parameters --> $DIR/issue-71381.rs:23:40 | LL | const FN: unsafe extern "C" fn(Args), | ^^^^ the type must not depend on the parameter `Args` - | - = note: type parameters may not be used in the type of const parameters error: using function pointers as const generic parameters is forbidden --> $DIR/issue-71381.rs:14:61 diff --git a/tests/ui/const-generics/issues/issue-71611.full.stderr b/tests/ui/const-generics/issues/issue-71611.full.stderr index 6f6a9fc21a6..e115630b64e 100644 --- a/tests/ui/const-generics/issues/issue-71611.full.stderr +++ b/tests/ui/const-generics/issues/issue-71611.full.stderr @@ -3,8 +3,6 @@ error[E0770]: the type of const parameters must not depend on other generic para | LL | fn func<A, const F: fn(inner: A)>(outer: A) { | ^ the type must not depend on the parameter `A` - | - = note: type parameters may not be used in the type of const parameters error: aborting due to 1 previous error diff --git a/tests/ui/const-generics/issues/issue-71611.min.stderr b/tests/ui/const-generics/issues/issue-71611.min.stderr index 7252bfd1d6a..b2e2e5cb445 100644 --- a/tests/ui/const-generics/issues/issue-71611.min.stderr +++ b/tests/ui/const-generics/issues/issue-71611.min.stderr @@ -3,8 +3,6 @@ error[E0770]: the type of const parameters must not depend on other generic para | LL | fn func<A, const F: fn(inner: A)>(outer: A) { | ^ the type must not depend on the parameter `A` - | - = note: type parameters may not be used in the type of const parameters error: using function pointers as const generic parameters is forbidden --> $DIR/issue-71611.rs:5:21 diff --git a/tests/ui/const-generics/issues/issue-88119.stderr b/tests/ui/const-generics/issues/issue-88119.stderr index c497f1b6d0b..94f06bbbbc4 100644 --- a/tests/ui/const-generics/issues/issue-88119.stderr +++ b/tests/ui/const-generics/issues/issue-88119.stderr @@ -6,30 +6,90 @@ LL | #![feature(const_trait_impl, generic_const_exprs)] | = help: remove one of these features -error[E0284]: type annotations needed: cannot satisfy `the constant `name_len::<T>()` can be evaluated` +error[E0275]: overflow evaluating the requirement `&T: ~const ConstName` + --> $DIR/issue-88119.rs:19:49 + | +LL | impl<T: ?Sized + ConstName> const ConstName for &T + | ^^ + +error[E0275]: overflow evaluating the requirement `&T: ConstName` + --> $DIR/issue-88119.rs:19:49 + | +LL | impl<T: ?Sized + ConstName> const ConstName for &T + | ^^ + +error[E0275]: overflow evaluating the requirement `[(); name_len::<T>()] well-formed` --> $DIR/issue-88119.rs:21:5 | LL | [(); name_len::<T>()]:, - | ^^^^^^^^^^^^^^^^^^^^^ cannot satisfy `the constant `name_len::<T>()` can be evaluated` + | ^^^^^^^^^^^^^^^^^^^^^ | note: required by a bound in `<&T as ConstName>` + --> $DIR/issue-88119.rs:21:5 + | +LL | [(); name_len::<T>()]:, + | ^^^^^^^^^^^^^^^^^^^^^ required by this bound in `<&T as ConstName>` + +error[E0275]: overflow evaluating the requirement `[(); name_len::<T>()] well-formed` --> $DIR/issue-88119.rs:21:10 | LL | [(); name_len::<T>()]:, - | ^^^^^^^^^^^^^^^ required by this bound in `<&T as ConstName>` + | ^^^^^^^^^^^^^^^ + | +note: required by a bound in `<&T as ConstName>` + --> $DIR/issue-88119.rs:21:5 + | +LL | [(); name_len::<T>()]:, + | ^^^^^^^^^^^^^^^^^^^^^ required by this bound in `<&T as ConstName>` + +error[E0275]: overflow evaluating the requirement `&mut T: ~const ConstName` + --> $DIR/issue-88119.rs:26:49 + | +LL | impl<T: ?Sized + ConstName> const ConstName for &mut T + | ^^^^^^ -error[E0284]: type annotations needed: cannot satisfy `the constant `name_len::<T>()` can be evaluated` +error[E0275]: overflow evaluating the requirement `&mut T: ConstName` + --> $DIR/issue-88119.rs:26:49 + | +LL | impl<T: ?Sized + ConstName> const ConstName for &mut T + | ^^^^^^ + +error[E0275]: overflow evaluating the requirement `[(); name_len::<T>()] well-formed` --> $DIR/issue-88119.rs:28:5 | LL | [(); name_len::<T>()]:, - | ^^^^^^^^^^^^^^^^^^^^^ cannot satisfy `the constant `name_len::<T>()` can be evaluated` + | ^^^^^^^^^^^^^^^^^^^^^ | note: required by a bound in `<&mut T as ConstName>` + --> $DIR/issue-88119.rs:28:5 + | +LL | [(); name_len::<T>()]:, + | ^^^^^^^^^^^^^^^^^^^^^ required by this bound in `<&mut T as ConstName>` + +error[E0275]: overflow evaluating the requirement `[(); name_len::<T>()] well-formed` --> $DIR/issue-88119.rs:28:10 | LL | [(); name_len::<T>()]:, - | ^^^^^^^^^^^^^^^ required by this bound in `<&mut T as ConstName>` + | ^^^^^^^^^^^^^^^ + | +note: required by a bound in `<&mut T as ConstName>` + --> $DIR/issue-88119.rs:28:5 + | +LL | [(); name_len::<T>()]:, + | ^^^^^^^^^^^^^^^^^^^^^ required by this bound in `<&mut T as ConstName>` + +error[E0275]: overflow evaluating the requirement `&&mut u8: ConstName` + --> $DIR/issue-88119.rs:33:35 + | +LL | pub const ICE_1: &'static [u8] = <&&mut u8 as ConstName>::NAME_BYTES; + | ^^^^^^^^ + +error[E0275]: overflow evaluating the requirement `&mut &u8: ConstName` + --> $DIR/issue-88119.rs:34:35 + | +LL | pub const ICE_2: &'static [u8] = <&mut &u8 as ConstName>::NAME_BYTES; + | ^^^^^^^^ -error: aborting due to 3 previous errors +error: aborting due to 11 previous errors -For more information about this error, try `rustc --explain E0284`. +For more information about this error, try `rustc --explain E0275`. diff --git a/tests/ui/const-generics/issues/issue-88997.stderr b/tests/ui/const-generics/issues/issue-88997.stderr index b49d52dd0ba..505ba0da232 100644 --- a/tests/ui/const-generics/issues/issue-88997.stderr +++ b/tests/ui/const-generics/issues/issue-88997.stderr @@ -3,16 +3,12 @@ error[E0770]: the type of const parameters must not depend on other generic para | LL | struct Range<T: PartialOrd, const MIN: T, const MAX: T>(T) | ^ the type must not depend on the parameter `T` - | - = note: type parameters may not be used in the type of const parameters error[E0770]: the type of const parameters must not depend on other generic parameters --> $DIR/issue-88997.rs:8:54 | LL | struct Range<T: PartialOrd, const MIN: T, const MAX: T>(T) | ^ the type must not depend on the parameter `T` - | - = note: type parameters may not be used in the type of const parameters error: aborting due to 2 previous errors diff --git a/tests/ui/const-generics/issues/issue-90364.stderr b/tests/ui/const-generics/issues/issue-90364.stderr index 6c00a654cde..384ce5da3e2 100644 --- a/tests/ui/const-generics/issues/issue-90364.stderr +++ b/tests/ui/const-generics/issues/issue-90364.stderr @@ -3,8 +3,6 @@ error[E0770]: the type of const parameters must not depend on other generic para | LL | pub struct Foo<T, const H: T>(T) | ^ the type must not depend on the parameter `T` - | - = note: type parameters may not be used in the type of const parameters error: aborting due to 1 previous error diff --git a/tests/ui/const-generics/mgca/ambiguous-assoc-const.rs b/tests/ui/const-generics/mgca/ambiguous-assoc-const.rs new file mode 100644 index 00000000000..d7df9c22afd --- /dev/null +++ b/tests/ui/const-generics/mgca/ambiguous-assoc-const.rs @@ -0,0 +1,15 @@ +#![feature(min_generic_const_args)] +#![expect(incomplete_features)] + +trait Tr { + const N: usize; +} + +struct Blah<const N: usize>; + +fn foo() -> Blah<{ Tr::N }> { + //~^ ERROR ambiguous associated constant + todo!() +} + +fn main() {} diff --git a/tests/ui/const-generics/mgca/ambiguous-assoc-const.stderr b/tests/ui/const-generics/mgca/ambiguous-assoc-const.stderr new file mode 100644 index 00000000000..11c63bdbcf4 --- /dev/null +++ b/tests/ui/const-generics/mgca/ambiguous-assoc-const.stderr @@ -0,0 +1,15 @@ +error[E0223]: ambiguous associated constant + --> $DIR/ambiguous-assoc-const.rs:10:20 + | +LL | fn foo() -> Blah<{ Tr::N }> { + | ^^^^^ + | +help: if there were a type named `Example` that implemented `Tr`, you could use the fully-qualified path + | +LL - fn foo() -> Blah<{ Tr::N }> { +LL + fn foo() -> Blah<{ <Example as Tr>::N }> { + | + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0223`. diff --git a/tests/ui/const-generics/mgca/assoc-const-without-type_const.rs b/tests/ui/const-generics/mgca/assoc-const-without-type_const.rs new file mode 100644 index 00000000000..a11314c11aa --- /dev/null +++ b/tests/ui/const-generics/mgca/assoc-const-without-type_const.rs @@ -0,0 +1,14 @@ +#![feature(min_generic_const_args)] +#![allow(incomplete_features)] + +pub trait Tr { + const SIZE: usize; +} + +fn mk_array<T: Tr>(_x: T) -> [(); T::SIZE] { + //~^ ERROR type_const + [(); T::SIZE] + //~^ ERROR type_const +} + +fn main() {} diff --git a/tests/ui/const-generics/mgca/assoc-const-without-type_const.stderr b/tests/ui/const-generics/mgca/assoc-const-without-type_const.stderr new file mode 100644 index 00000000000..7872e096762 --- /dev/null +++ b/tests/ui/const-generics/mgca/assoc-const-without-type_const.stderr @@ -0,0 +1,18 @@ +error: use of trait associated const without `#[type_const]` + --> $DIR/assoc-const-without-type_const.rs:8:35 + | +LL | fn mk_array<T: Tr>(_x: T) -> [(); T::SIZE] { + | ^^^^^^^ + | + = note: the declaration in the trait must be marked with `#[type_const]` + +error: use of trait associated const without `#[type_const]` + --> $DIR/assoc-const-without-type_const.rs:10:10 + | +LL | [(); T::SIZE] + | ^^^^^^^ + | + = note: the declaration in the trait must be marked with `#[type_const]` + +error: aborting due to 2 previous errors + diff --git a/tests/ui/const-generics/mgca/assoc-const.rs b/tests/ui/const-generics/mgca/assoc-const.rs new file mode 100644 index 00000000000..fb5b4308a7f --- /dev/null +++ b/tests/ui/const-generics/mgca/assoc-const.rs @@ -0,0 +1,15 @@ +//@ check-pass + +#![feature(min_generic_const_args)] +#![allow(incomplete_features)] + +pub trait Tr<X> { + #[type_const] + const SIZE: usize; +} + +fn mk_array<T: Tr<bool>>(_x: T) -> [(); <T as Tr<bool>>::SIZE] { + [(); T::SIZE] +} + +fn main() {} diff --git a/tests/ui/const-generics/mgca/bad-type_const-syntax.rs b/tests/ui/const-generics/mgca/bad-type_const-syntax.rs new file mode 100644 index 00000000000..1e9673a56b5 --- /dev/null +++ b/tests/ui/const-generics/mgca/bad-type_const-syntax.rs @@ -0,0 +1,17 @@ +trait Tr { + #[type_const()] + //~^ ERROR malformed + //~| ERROR experimental + const N: usize; +} + +struct S; + +impl Tr for S { + #[type_const] + //~^ ERROR must only be applied to trait associated constants + //~| ERROR experimental + const N: usize = 0; +} + +fn main() {} diff --git a/tests/ui/const-generics/mgca/bad-type_const-syntax.stderr b/tests/ui/const-generics/mgca/bad-type_const-syntax.stderr new file mode 100644 index 00000000000..579aff849d6 --- /dev/null +++ b/tests/ui/const-generics/mgca/bad-type_const-syntax.stderr @@ -0,0 +1,35 @@ +error: malformed `type_const` attribute input + --> $DIR/bad-type_const-syntax.rs:2:5 + | +LL | #[type_const()] + | ^^^^^^^^^^^^^^^ help: must be of the form: `#[type_const]` + +error[E0658]: the `#[type_const]` attribute is an experimental feature + --> $DIR/bad-type_const-syntax.rs:2:5 + | +LL | #[type_const()] + | ^^^^^^^^^^^^^^^ + | + = note: see issue #132980 <https://github.com/rust-lang/rust/issues/132980> for more information + = help: add `#![feature(min_generic_const_args)]` 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[E0658]: the `#[type_const]` attribute is an experimental feature + --> $DIR/bad-type_const-syntax.rs:11:5 + | +LL | #[type_const] + | ^^^^^^^^^^^^^ + | + = note: see issue #132980 <https://github.com/rust-lang/rust/issues/132980> for more information + = help: add `#![feature(min_generic_const_args)]` 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: `#[type_const]` must only be applied to trait associated constants + --> $DIR/bad-type_const-syntax.rs:11:5 + | +LL | #[type_const] + | ^^^^^^^^^^^^^ + +error: aborting due to 4 previous errors + +For more information about this error, try `rustc --explain E0658`. diff --git a/tests/ui/const-generics/mgca/inherent-const-gating.rs b/tests/ui/const-generics/mgca/inherent-const-gating.rs new file mode 100644 index 00000000000..c39b8e6f7f6 --- /dev/null +++ b/tests/ui/const-generics/mgca/inherent-const-gating.rs @@ -0,0 +1,13 @@ +#![feature(min_generic_const_args)] +#![allow(incomplete_features)] + +struct S; + +impl S { + const N: usize = 42; +} + +fn main() { + let _x: [(); S::N] = todo!(); + //~^ ERROR inherent associated types are unstable +} diff --git a/tests/ui/const-generics/mgca/inherent-const-gating.stderr b/tests/ui/const-generics/mgca/inherent-const-gating.stderr new file mode 100644 index 00000000000..71bb11ae700 --- /dev/null +++ b/tests/ui/const-generics/mgca/inherent-const-gating.stderr @@ -0,0 +1,13 @@ +error[E0658]: inherent associated types are unstable + --> $DIR/inherent-const-gating.rs:11:18 + | +LL | let _x: [(); S::N] = todo!(); + | ^^^^ + | + = note: see issue #8995 <https://github.com/rust-lang/rust/issues/8995> for more information + = help: add `#![feature(inherent_associated_types)]` 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 + +For more information about this error, try `rustc --explain E0658`. diff --git a/tests/ui/const-ptr/forbidden_slices.rs b/tests/ui/const-ptr/forbidden_slices.rs index 59ea92c5ab3..001cfd66ad1 100644 --- a/tests/ui/const-ptr/forbidden_slices.rs +++ b/tests/ui/const-ptr/forbidden_slices.rs @@ -48,9 +48,11 @@ pub static S8: &[u64] = unsafe { pub static R0: &[u32] = unsafe { from_ptr_range(ptr::null()..ptr::null()) }; //~^ ERROR it is undefined behavior to use this value pub static R1: &[()] = unsafe { from_ptr_range(ptr::null()..ptr::null()) }; // errors inside libcore +//~^ ERROR could not evaluate static initializer pub static R2: &[u32] = unsafe { let ptr = &D0 as *const u32; from_ptr_range(ptr..ptr.add(2)) // errors inside libcore + //~^ ERROR could not evaluate static initializer }; pub static R4: &[u8] = unsafe { //~^ ERROR: it is undefined behavior to use this value @@ -74,13 +76,16 @@ pub static R7: &[u16] = unsafe { }; pub static R8: &[u64] = unsafe { let ptr = (&D4 as *const [u32; 2] as *const u32).byte_add(1).cast::<u64>(); - from_ptr_range(ptr..ptr.add(1)) //~ inside `R8` + from_ptr_range(ptr..ptr.add(1)) + //~^ ERROR could not evaluate static initializer }; // This is sneaky: &D0 and &D0 point to different objects // (even if at runtime they have the same address) pub static R9: &[u32] = unsafe { from_ptr_range(&D0..(&D0 as *const u32).add(1)) }; +//~^ ERROR could not evaluate static initializer pub static R10: &[u32] = unsafe { from_ptr_range(&D0..&D0) }; +//~^ ERROR could not evaluate static initializer const D0: u32 = 0x11111111; // Constant chosen for endianness-independent behavior. const D1: MaybeUninit<&u32> = MaybeUninit::uninit(); diff --git a/tests/ui/const-ptr/forbidden_slices.stderr b/tests/ui/const-ptr/forbidden_slices.stderr index df588fcc5e1..a4e9c972ceb 100644 --- a/tests/ui/const-ptr/forbidden_slices.stderr +++ b/tests/ui/const-ptr/forbidden_slices.stderr @@ -100,36 +100,28 @@ LL | pub static R0: &[u32] = unsafe { from_ptr_range(ptr::null()..ptr::null()) } } error[E0080]: could not evaluate static initializer - --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL + --> $DIR/forbidden_slices.rs:50:33 | - = note: the evaluated program panicked at 'assertion failed: 0 < pointee_size && pointee_size <= isize::MAX as usize', $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL +LL | pub static R1: &[()] = unsafe { from_ptr_range(ptr::null()..ptr::null()) }; // errors inside libcore + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation panicked: assertion failed: 0 < pointee_size && pointee_size <= isize::MAX as usize | -note: inside `std::ptr::const_ptr::<impl *const ()>::offset_from_unsigned` - --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL note: inside `from_ptr_range::<'_, ()>` --> $SRC_DIR/core/src/slice/raw.rs:LL:COL -note: inside `R1` - --> $DIR/forbidden_slices.rs:50:33 - | -LL | pub static R1: &[()] = unsafe { from_ptr_range(ptr::null()..ptr::null()) }; // errors inside libcore - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +note: inside `std::ptr::const_ptr::<impl *const ()>::offset_from_unsigned` + --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL = note: this error originates in the macro `assert` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0080]: could not evaluate static initializer - --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL + --> $DIR/forbidden_slices.rs:54:25 | - = note: out-of-bounds pointer arithmetic: expected a pointer to 8 bytes of memory, but got ALLOC10 which is only 4 bytes from the end of the allocation +LL | from_ptr_range(ptr..ptr.add(2)) // errors inside libcore + | ^^^^^^^^^^ out-of-bounds pointer arithmetic: expected a pointer to 8 bytes of memory, but got ALLOC10 which is only 4 bytes from the end of the allocation | note: inside `std::ptr::const_ptr::<impl *const u32>::add` --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL -note: inside `R2` - --> $DIR/forbidden_slices.rs:53:25 - | -LL | from_ptr_range(ptr..ptr.add(2)) // errors inside libcore - | ^^^^^^^^^^ error[E0080]: it is undefined behavior to use this value - --> $DIR/forbidden_slices.rs:55:1 + --> $DIR/forbidden_slices.rs:57:1 | LL | pub static R4: &[u8] = unsafe { | ^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>[0]: encountered uninitialized memory, but expected an integer @@ -140,7 +132,7 @@ LL | pub static R4: &[u8] = unsafe { } error[E0080]: it is undefined behavior to use this value - --> $DIR/forbidden_slices.rs:60:1 + --> $DIR/forbidden_slices.rs:62:1 | LL | pub static R5: &[u8] = unsafe { | ^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>[0]: encountered a pointer, but expected an integer @@ -153,7 +145,7 @@ LL | pub static R5: &[u8] = unsafe { = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported error[E0080]: it is undefined behavior to use this value - --> $DIR/forbidden_slices.rs:65:1 + --> $DIR/forbidden_slices.rs:67:1 | LL | pub static R6: &[bool] = unsafe { | ^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>[0]: encountered 0x11, but expected a boolean @@ -164,7 +156,7 @@ LL | pub static R6: &[bool] = unsafe { } error[E0080]: it is undefined behavior to use this value - --> $DIR/forbidden_slices.rs:70:1 + --> $DIR/forbidden_slices.rs:72:1 | LL | pub static R7: &[u16] = unsafe { | ^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered an unaligned reference (required 2 byte alignment but found 1) @@ -175,47 +167,35 @@ LL | pub static R7: &[u16] = unsafe { } error[E0080]: could not evaluate static initializer - --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL + --> $DIR/forbidden_slices.rs:79:25 | - = note: out-of-bounds pointer arithmetic: expected a pointer to 8 bytes of memory, but got ALLOC11+0x1 which is only 7 bytes from the end of the allocation +LL | from_ptr_range(ptr..ptr.add(1)) + | ^^^^^^^^^^ out-of-bounds pointer arithmetic: expected a pointer to 8 bytes of memory, but got ALLOC11+0x1 which is only 7 bytes from the end of the allocation | note: inside `std::ptr::const_ptr::<impl *const u64>::add` --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL -note: inside `R8` - --> $DIR/forbidden_slices.rs:77:25 - | -LL | from_ptr_range(ptr..ptr.add(1)) - | ^^^^^^^^^^ error[E0080]: could not evaluate static initializer - --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL + --> $DIR/forbidden_slices.rs:85:34 | - = note: `ptr_offset_from_unsigned` called on two different pointers that are not both derived from the same allocation +LL | pub static R9: &[u32] = unsafe { from_ptr_range(&D0..(&D0 as *const u32).add(1)) }; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `ptr_offset_from_unsigned` called on two different pointers that are not both derived from the same allocation | -note: inside `std::ptr::const_ptr::<impl *const u32>::offset_from_unsigned` - --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL note: inside `from_ptr_range::<'_, u32>` --> $SRC_DIR/core/src/slice/raw.rs:LL:COL -note: inside `R9` - --> $DIR/forbidden_slices.rs:82:34 - | -LL | pub static R9: &[u32] = unsafe { from_ptr_range(&D0..(&D0 as *const u32).add(1)) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +note: inside `std::ptr::const_ptr::<impl *const u32>::offset_from_unsigned` + --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL error[E0080]: could not evaluate static initializer - --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL + --> $DIR/forbidden_slices.rs:87:35 | - = note: `ptr_offset_from_unsigned` called on two different pointers that are not both derived from the same allocation +LL | pub static R10: &[u32] = unsafe { from_ptr_range(&D0..&D0) }; + | ^^^^^^^^^^^^^^^^^^^^^^^^ `ptr_offset_from_unsigned` called on two different pointers that are not both derived from the same allocation | -note: inside `std::ptr::const_ptr::<impl *const u32>::offset_from_unsigned` - --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL note: inside `from_ptr_range::<'_, u32>` --> $SRC_DIR/core/src/slice/raw.rs:LL:COL -note: inside `R10` - --> $DIR/forbidden_slices.rs:83:35 - | -LL | pub static R10: &[u32] = unsafe { from_ptr_range(&D0..&D0) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^ +note: inside `std::ptr::const_ptr::<impl *const u32>::offset_from_unsigned` + --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL error: aborting due to 18 previous errors diff --git a/tests/ui/const-ptr/out_of_bounds_read.stderr b/tests/ui/const-ptr/out_of_bounds_read.stderr index 7f354963eb1..899e151c9b8 100644 --- a/tests/ui/const-ptr/out_of_bounds_read.stderr +++ b/tests/ui/const-ptr/out_of_bounds_read.stderr @@ -1,45 +1,33 @@ error[E0080]: evaluation of constant value failed - --> $SRC_DIR/core/src/ptr/mod.rs:LL:COL + --> $DIR/out_of_bounds_read.rs:10:33 | - = note: memory access failed: expected a pointer to 4 bytes of memory, but got ALLOC0+0x4 which is at or beyond the end of the allocation of size 4 bytes +LL | const _READ: u32 = unsafe { ptr::read(PAST_END_PTR) }; + | ^^^^^^^^^^^^^^^^^^^^^^^ memory access failed: expected a pointer to 4 bytes of memory, but got ALLOC0+0x4 which is at or beyond the end of the allocation of size 4 bytes | note: inside `std::ptr::read::<u32>` --> $SRC_DIR/core/src/ptr/mod.rs:LL:COL -note: inside `_READ` - --> $DIR/out_of_bounds_read.rs:10:33 - | -LL | const _READ: u32 = unsafe { ptr::read(PAST_END_PTR) }; - | ^^^^^^^^^^^^^^^^^^^^^^^ error[E0080]: evaluation of constant value failed - --> $SRC_DIR/core/src/ptr/mod.rs:LL:COL + --> $DIR/out_of_bounds_read.rs:11:39 | - = note: memory access failed: expected a pointer to 4 bytes of memory, but got ALLOC0+0x4 which is at or beyond the end of the allocation of size 4 bytes +LL | const _CONST_READ: u32 = unsafe { PAST_END_PTR.read() }; + | ^^^^^^^^^^^^^^^^^^^ memory access failed: expected a pointer to 4 bytes of memory, but got ALLOC0+0x4 which is at or beyond the end of the allocation of size 4 bytes | -note: inside `std::ptr::read::<u32>` - --> $SRC_DIR/core/src/ptr/mod.rs:LL:COL note: inside `std::ptr::const_ptr::<impl *const u32>::read` --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL -note: inside `_CONST_READ` - --> $DIR/out_of_bounds_read.rs:11:39 - | -LL | const _CONST_READ: u32 = unsafe { PAST_END_PTR.read() }; - | ^^^^^^^^^^^^^^^^^^^ +note: inside `std::ptr::read::<u32>` + --> $SRC_DIR/core/src/ptr/mod.rs:LL:COL error[E0080]: evaluation of constant value failed - --> $SRC_DIR/core/src/ptr/mod.rs:LL:COL + --> $DIR/out_of_bounds_read.rs:12:37 | - = note: memory access failed: expected a pointer to 4 bytes of memory, but got ALLOC0+0x4 which is at or beyond the end of the allocation of size 4 bytes +LL | const _MUT_READ: u32 = unsafe { (PAST_END_PTR as *mut u32).read() }; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ memory access failed: expected a pointer to 4 bytes of memory, but got ALLOC0+0x4 which is at or beyond the end of the allocation of size 4 bytes | -note: inside `std::ptr::read::<u32>` - --> $SRC_DIR/core/src/ptr/mod.rs:LL:COL note: inside `std::ptr::mut_ptr::<impl *mut u32>::read` --> $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL -note: inside `_MUT_READ` - --> $DIR/out_of_bounds_read.rs:12:37 - | -LL | const _MUT_READ: u32 = unsafe { (PAST_END_PTR as *mut u32).read() }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +note: inside `std::ptr::read::<u32>` + --> $SRC_DIR/core/src/ptr/mod.rs:LL:COL error: aborting due to 3 previous errors diff --git a/tests/ui/consts/assert-type-intrinsics.stderr b/tests/ui/consts/assert-type-intrinsics.stderr index 66c4f0f9cd6..92c0610a248 100644 --- a/tests/ui/consts/assert-type-intrinsics.stderr +++ b/tests/ui/consts/assert-type-intrinsics.stderr @@ -2,19 +2,19 @@ error[E0080]: evaluation of constant value failed --> $DIR/assert-type-intrinsics.rs:11:9 | LL | MaybeUninit::<!>::uninit().assume_init(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the evaluated program panicked at 'aborted execution: attempted to instantiate uninhabited type `!`', $DIR/assert-type-intrinsics.rs:11:36 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation panicked: aborted execution: attempted to instantiate uninhabited type `!` error[E0080]: evaluation of constant value failed --> $DIR/assert-type-intrinsics.rs:15:9 | LL | intrinsics::assert_mem_uninitialized_valid::<&'static i32>(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the evaluated program panicked at 'aborted execution: attempted to leave type `&i32` uninitialized, which is invalid', $DIR/assert-type-intrinsics.rs:15:9 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation panicked: aborted execution: attempted to leave type `&i32` uninitialized, which is invalid error[E0080]: evaluation of constant value failed --> $DIR/assert-type-intrinsics.rs:19:9 | LL | intrinsics::assert_zero_valid::<&'static i32>(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the evaluated program panicked at 'aborted execution: attempted to zero-initialize type `&i32`, which is invalid', $DIR/assert-type-intrinsics.rs:19:9 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation panicked: aborted execution: attempted to zero-initialize type `&i32`, which is invalid error: aborting due to 3 previous errors diff --git a/tests/ui/consts/const-eval/const_fn_ptr_fail2.rs b/tests/ui/consts/const-eval/const_fn_ptr_fail2.rs index 87f8b52a650..7db8c6e81ab 100644 --- a/tests/ui/consts/const-eval/const_fn_ptr_fail2.rs +++ b/tests/ui/consts/const-eval/const_fn_ptr_fail2.rs @@ -7,12 +7,18 @@ const X: fn(usize) -> usize = double; const fn bar(x: fn(usize) -> usize, y: usize) -> usize { x(y) - //~^ ERROR evaluation of constant value failed - //~| ERROR evaluation of constant value failed + //~^ NOTE inside `bar` + //~| NOTE the failure occurred here + //~| NOTE inside `bar` + //~| NOTE the failure occurred here } const Y: usize = bar(X, 2); // FIXME: should fail to typeck someday +//~^ ERROR evaluation of constant value failed +//~| NOTE calling non-const function `double` const Z: usize = bar(double, 2); // FIXME: should fail to typeck someday +//~^ ERROR evaluation of constant value failed +//~| NOTE calling non-const function `double` fn main() { assert_eq!(Y, 4); diff --git a/tests/ui/consts/const-eval/const_fn_ptr_fail2.stderr b/tests/ui/consts/const-eval/const_fn_ptr_fail2.stderr index 0734f479f98..a4d2e26c3af 100644 --- a/tests/ui/consts/const-eval/const_fn_ptr_fail2.stderr +++ b/tests/ui/consts/const-eval/const_fn_ptr_fail2.stderr @@ -1,36 +1,26 @@ error[E0080]: evaluation of constant value failed - --> $DIR/const_fn_ptr_fail2.rs:9:5 + --> $DIR/const_fn_ptr_fail2.rs:16:18 | -LL | x(y) - | ^^^^ calling non-const function `double` +LL | const Y: usize = bar(X, 2); // FIXME: should fail to typeck someday + | ^^^^^^^^^ calling non-const function `double` | note: inside `bar` --> $DIR/const_fn_ptr_fail2.rs:9:5 | LL | x(y) - | ^^^^ -note: inside `Y` - --> $DIR/const_fn_ptr_fail2.rs:14:18 - | -LL | const Y: usize = bar(X, 2); // FIXME: should fail to typeck someday - | ^^^^^^^^^ + | ^^^^ the failure occurred here error[E0080]: evaluation of constant value failed - --> $DIR/const_fn_ptr_fail2.rs:9:5 + --> $DIR/const_fn_ptr_fail2.rs:19:18 | -LL | x(y) - | ^^^^ calling non-const function `double` +LL | const Z: usize = bar(double, 2); // FIXME: should fail to typeck someday + | ^^^^^^^^^^^^^^ calling non-const function `double` | note: inside `bar` --> $DIR/const_fn_ptr_fail2.rs:9:5 | LL | x(y) - | ^^^^ -note: inside `Z` - --> $DIR/const_fn_ptr_fail2.rs:15:18 - | -LL | const Z: usize = bar(double, 2); // FIXME: should fail to typeck someday - | ^^^^^^^^^^^^^^ + | ^^^^ the failure occurred here warning: skipping const checks | diff --git a/tests/ui/consts/const-eval/const_panic-normalize-tabs-115498.stderr b/tests/ui/consts/const-eval/const_panic-normalize-tabs-115498.stderr index 5f4af25611f..64e227c4f45 100644 --- a/tests/ui/consts/const-eval/const_panic-normalize-tabs-115498.stderr +++ b/tests/ui/consts/const-eval/const_panic-normalize-tabs-115498.stderr @@ -2,7 +2,7 @@ error[E0080]: evaluation of constant value failed --> $DIR/const_panic-normalize-tabs-115498.rs:3:17 | LL | struct Bug([u8; panic!{"\t"}]); - | ^^^^^^^^^^^^ the evaluated program panicked at ' ', $DIR/const_panic-normalize-tabs-115498.rs:3:17 + | ^^^^^^^^^^^^ evaluation panicked: | = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/tests/ui/consts/const-eval/const_panic.stderr b/tests/ui/consts/const-eval/const_panic.stderr index 0f7be46072d..0816b04faca 100644 --- a/tests/ui/consts/const-eval/const_panic.stderr +++ b/tests/ui/consts/const-eval/const_panic.stderr @@ -2,7 +2,7 @@ error[E0080]: evaluation of constant value failed --> $DIR/const_panic.rs:6:15 | LL | const Z: () = std::panic!("cheese"); - | ^^^^^^^^^^^^^^^^^^^^^ the evaluated program panicked at 'cheese', $DIR/const_panic.rs:6:15 + | ^^^^^^^^^^^^^^^^^^^^^ evaluation panicked: cheese | = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `std::panic` (in Nightly builds, run with -Z macro-backtrace for more info) @@ -10,7 +10,7 @@ error[E0080]: evaluation of constant value failed --> $DIR/const_panic.rs:9:16 | LL | const Z2: () = std::panic!(); - | ^^^^^^^^^^^^^ the evaluated program panicked at 'explicit panic', $DIR/const_panic.rs:9:16 + | ^^^^^^^^^^^^^ evaluation panicked: explicit panic | = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `std::panic` (in Nightly builds, run with -Z macro-backtrace for more info) @@ -18,7 +18,7 @@ error[E0080]: evaluation of constant value failed --> $DIR/const_panic.rs:12:15 | LL | const Y: () = std::unreachable!(); - | ^^^^^^^^^^^^^^^^^^^ the evaluated program panicked at 'internal error: entered unreachable code', $DIR/const_panic.rs:12:15 + | ^^^^^^^^^^^^^^^^^^^ evaluation panicked: internal error: entered unreachable code | = note: this error originates in the macro `$crate::panic::unreachable_2015` which comes from the expansion of the macro `std::unreachable` (in Nightly builds, run with -Z macro-backtrace for more info) @@ -26,7 +26,7 @@ error[E0080]: evaluation of constant value failed --> $DIR/const_panic.rs:15:15 | LL | const X: () = std::unimplemented!(); - | ^^^^^^^^^^^^^^^^^^^^^ the evaluated program panicked at 'not implemented', $DIR/const_panic.rs:15:15 + | ^^^^^^^^^^^^^^^^^^^^^ evaluation panicked: not implemented | = note: this error originates in the macro `std::unimplemented` (in Nightly builds, run with -Z macro-backtrace for more info) @@ -34,7 +34,7 @@ error[E0080]: evaluation of constant value failed --> $DIR/const_panic.rs:18:15 | LL | const W: () = std::panic!(MSG); - | ^^^^^^^^^^^^^^^^ the evaluated program panicked at 'hello', $DIR/const_panic.rs:18:15 + | ^^^^^^^^^^^^^^^^ evaluation panicked: hello | = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `std::panic` (in Nightly builds, run with -Z macro-backtrace for more info) @@ -42,7 +42,7 @@ error[E0080]: evaluation of constant value failed --> $DIR/const_panic.rs:21:16 | LL | const W2: () = std::panic!("{}", MSG); - | ^^^^^^^^^^^^^^^^^^^^^^ the evaluated program panicked at 'hello', $DIR/const_panic.rs:21:16 + | ^^^^^^^^^^^^^^^^^^^^^^ evaluation panicked: hello | = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `std::panic` (in Nightly builds, run with -Z macro-backtrace for more info) @@ -50,7 +50,7 @@ error[E0080]: evaluation of constant value failed --> $DIR/const_panic.rs:24:20 | LL | const Z_CORE: () = core::panic!("cheese"); - | ^^^^^^^^^^^^^^^^^^^^^^ the evaluated program panicked at 'cheese', $DIR/const_panic.rs:24:20 + | ^^^^^^^^^^^^^^^^^^^^^^ evaluation panicked: cheese | = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `core::panic` (in Nightly builds, run with -Z macro-backtrace for more info) @@ -58,7 +58,7 @@ error[E0080]: evaluation of constant value failed --> $DIR/const_panic.rs:27:21 | LL | const Z2_CORE: () = core::panic!(); - | ^^^^^^^^^^^^^^ the evaluated program panicked at 'explicit panic', $DIR/const_panic.rs:27:21 + | ^^^^^^^^^^^^^^ evaluation panicked: explicit panic | = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `core::panic` (in Nightly builds, run with -Z macro-backtrace for more info) @@ -66,7 +66,7 @@ error[E0080]: evaluation of constant value failed --> $DIR/const_panic.rs:30:20 | LL | const Y_CORE: () = core::unreachable!(); - | ^^^^^^^^^^^^^^^^^^^^ the evaluated program panicked at 'internal error: entered unreachable code', $DIR/const_panic.rs:30:20 + | ^^^^^^^^^^^^^^^^^^^^ evaluation panicked: internal error: entered unreachable code | = note: this error originates in the macro `$crate::panic::unreachable_2015` which comes from the expansion of the macro `core::unreachable` (in Nightly builds, run with -Z macro-backtrace for more info) @@ -74,7 +74,7 @@ error[E0080]: evaluation of constant value failed --> $DIR/const_panic.rs:33:20 | LL | const X_CORE: () = core::unimplemented!(); - | ^^^^^^^^^^^^^^^^^^^^^^ the evaluated program panicked at 'not implemented', $DIR/const_panic.rs:33:20 + | ^^^^^^^^^^^^^^^^^^^^^^ evaluation panicked: not implemented | = note: this error originates in the macro `core::unimplemented` (in Nightly builds, run with -Z macro-backtrace for more info) @@ -82,7 +82,7 @@ error[E0080]: evaluation of constant value failed --> $DIR/const_panic.rs:36:20 | LL | const W_CORE: () = core::panic!(MSG); - | ^^^^^^^^^^^^^^^^^ the evaluated program panicked at 'hello', $DIR/const_panic.rs:36:20 + | ^^^^^^^^^^^^^^^^^ evaluation panicked: hello | = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `core::panic` (in Nightly builds, run with -Z macro-backtrace for more info) @@ -90,7 +90,7 @@ error[E0080]: evaluation of constant value failed --> $DIR/const_panic.rs:39:21 | LL | const W2_CORE: () = core::panic!("{}", MSG); - | ^^^^^^^^^^^^^^^^^^^^^^^ the evaluated program panicked at 'hello', $DIR/const_panic.rs:39:21 + | ^^^^^^^^^^^^^^^^^^^^^^^ evaluation panicked: hello | = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `core::panic` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/tests/ui/consts/const-eval/const_panic_2021.stderr b/tests/ui/consts/const-eval/const_panic_2021.stderr index 192fa3a12c2..4faa2a1e4cf 100644 --- a/tests/ui/consts/const-eval/const_panic_2021.stderr +++ b/tests/ui/consts/const-eval/const_panic_2021.stderr @@ -2,7 +2,7 @@ error[E0080]: evaluation of constant value failed --> $DIR/const_panic_2021.rs:6:15 | LL | const A: () = std::panic!("blåhaj"); - | ^^^^^^^^^^^^^^^^^^^^^ the evaluated program panicked at 'blåhaj', $DIR/const_panic_2021.rs:6:15 + | ^^^^^^^^^^^^^^^^^^^^^ evaluation panicked: blåhaj | = note: this error originates in the macro `$crate::panic::panic_2021` which comes from the expansion of the macro `std::panic` (in Nightly builds, run with -Z macro-backtrace for more info) @@ -10,7 +10,7 @@ error[E0080]: evaluation of constant value failed --> $DIR/const_panic_2021.rs:9:15 | LL | const B: () = std::panic!(); - | ^^^^^^^^^^^^^ the evaluated program panicked at 'explicit panic', $DIR/const_panic_2021.rs:9:15 + | ^^^^^^^^^^^^^ evaluation panicked: explicit panic | = note: this error originates in the macro `$crate::panic::panic_2021` which comes from the expansion of the macro `std::panic` (in Nightly builds, run with -Z macro-backtrace for more info) @@ -18,7 +18,7 @@ error[E0080]: evaluation of constant value failed --> $DIR/const_panic_2021.rs:12:15 | LL | const C: () = std::unreachable!(); - | ^^^^^^^^^^^^^^^^^^^ the evaluated program panicked at 'internal error: entered unreachable code', $DIR/const_panic_2021.rs:12:15 + | ^^^^^^^^^^^^^^^^^^^ evaluation panicked: internal error: entered unreachable code | = note: this error originates in the macro `$crate::panic::unreachable_2021` which comes from the expansion of the macro `std::unreachable` (in Nightly builds, run with -Z macro-backtrace for more info) @@ -26,7 +26,7 @@ error[E0080]: evaluation of constant value failed --> $DIR/const_panic_2021.rs:15:15 | LL | const D: () = std::unimplemented!(); - | ^^^^^^^^^^^^^^^^^^^^^ the evaluated program panicked at 'not implemented', $DIR/const_panic_2021.rs:15:15 + | ^^^^^^^^^^^^^^^^^^^^^ evaluation panicked: not implemented | = note: this error originates in the macro `std::unimplemented` (in Nightly builds, run with -Z macro-backtrace for more info) @@ -34,7 +34,7 @@ error[E0080]: evaluation of constant value failed --> $DIR/const_panic_2021.rs:18:15 | LL | const E: () = std::panic!("{}", MSG); - | ^^^^^^^^^^^^^^^^^^^^^^ the evaluated program panicked at 'hello', $DIR/const_panic_2021.rs:18:15 + | ^^^^^^^^^^^^^^^^^^^^^^ evaluation panicked: hello | = note: this error originates in the macro `$crate::panic::panic_2021` which comes from the expansion of the macro `std::panic` (in Nightly builds, run with -Z macro-backtrace for more info) @@ -42,7 +42,7 @@ error[E0080]: evaluation of constant value failed --> $DIR/const_panic_2021.rs:21:20 | LL | const A_CORE: () = core::panic!("shark"); - | ^^^^^^^^^^^^^^^^^^^^^ the evaluated program panicked at 'shark', $DIR/const_panic_2021.rs:21:20 + | ^^^^^^^^^^^^^^^^^^^^^ evaluation panicked: shark | = note: this error originates in the macro `$crate::panic::panic_2021` which comes from the expansion of the macro `core::panic` (in Nightly builds, run with -Z macro-backtrace for more info) @@ -50,7 +50,7 @@ error[E0080]: evaluation of constant value failed --> $DIR/const_panic_2021.rs:24:20 | LL | const B_CORE: () = core::panic!(); - | ^^^^^^^^^^^^^^ the evaluated program panicked at 'explicit panic', $DIR/const_panic_2021.rs:24:20 + | ^^^^^^^^^^^^^^ evaluation panicked: explicit panic | = note: this error originates in the macro `$crate::panic::panic_2021` which comes from the expansion of the macro `core::panic` (in Nightly builds, run with -Z macro-backtrace for more info) @@ -58,7 +58,7 @@ error[E0080]: evaluation of constant value failed --> $DIR/const_panic_2021.rs:27:20 | LL | const C_CORE: () = core::unreachable!(); - | ^^^^^^^^^^^^^^^^^^^^ the evaluated program panicked at 'internal error: entered unreachable code', $DIR/const_panic_2021.rs:27:20 + | ^^^^^^^^^^^^^^^^^^^^ evaluation panicked: internal error: entered unreachable code | = note: this error originates in the macro `$crate::panic::unreachable_2021` which comes from the expansion of the macro `core::unreachable` (in Nightly builds, run with -Z macro-backtrace for more info) @@ -66,7 +66,7 @@ error[E0080]: evaluation of constant value failed --> $DIR/const_panic_2021.rs:30:20 | LL | const D_CORE: () = core::unimplemented!(); - | ^^^^^^^^^^^^^^^^^^^^^^ the evaluated program panicked at 'not implemented', $DIR/const_panic_2021.rs:30:20 + | ^^^^^^^^^^^^^^^^^^^^^^ evaluation panicked: not implemented | = note: this error originates in the macro `core::unimplemented` (in Nightly builds, run with -Z macro-backtrace for more info) @@ -74,7 +74,7 @@ error[E0080]: evaluation of constant value failed --> $DIR/const_panic_2021.rs:33:20 | LL | const E_CORE: () = core::panic!("{}", MSG); - | ^^^^^^^^^^^^^^^^^^^^^^^ the evaluated program panicked at 'hello', $DIR/const_panic_2021.rs:33:20 + | ^^^^^^^^^^^^^^^^^^^^^^^ evaluation panicked: hello | = note: this error originates in the macro `$crate::panic::panic_2021` which comes from the expansion of the macro `core::panic` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/tests/ui/consts/const-eval/const_panic_libcore_bin.stderr b/tests/ui/consts/const-eval/const_panic_libcore_bin.stderr index df19ed4a898..11e70c48499 100644 --- a/tests/ui/consts/const-eval/const_panic_libcore_bin.stderr +++ b/tests/ui/consts/const-eval/const_panic_libcore_bin.stderr @@ -2,7 +2,7 @@ error[E0080]: evaluation of constant value failed --> $DIR/const_panic_libcore_bin.rs:8:15 | LL | const Z: () = panic!("cheese"); - | ^^^^^^^^^^^^^^^^ the evaluated program panicked at 'cheese', $DIR/const_panic_libcore_bin.rs:8:15 + | ^^^^^^^^^^^^^^^^ evaluation panicked: cheese | = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info) @@ -10,7 +10,7 @@ error[E0080]: evaluation of constant value failed --> $DIR/const_panic_libcore_bin.rs:11:15 | LL | const Y: () = unreachable!(); - | ^^^^^^^^^^^^^^ the evaluated program panicked at 'internal error: entered unreachable code', $DIR/const_panic_libcore_bin.rs:11:15 + | ^^^^^^^^^^^^^^ evaluation panicked: internal error: entered unreachable code | = note: this error originates in the macro `$crate::panic::unreachable_2015` which comes from the expansion of the macro `unreachable` (in Nightly builds, run with -Z macro-backtrace for more info) @@ -18,7 +18,7 @@ error[E0080]: evaluation of constant value failed --> $DIR/const_panic_libcore_bin.rs:14:15 | LL | const X: () = unimplemented!(); - | ^^^^^^^^^^^^^^^^ the evaluated program panicked at 'not implemented', $DIR/const_panic_libcore_bin.rs:14:15 + | ^^^^^^^^^^^^^^^^ evaluation panicked: not implemented | = note: this error originates in the macro `unimplemented` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/tests/ui/consts/const-eval/const_panic_track_caller.rs b/tests/ui/consts/const-eval/const_panic_track_caller.rs index 9cf7a3ba7dc..799a59d16ca 100644 --- a/tests/ui/consts/const-eval/const_panic_track_caller.rs +++ b/tests/ui/consts/const-eval/const_panic_track_caller.rs @@ -12,11 +12,10 @@ const fn b() -> u32 { } const fn c() -> u32 { - b() - //~^ ERROR evaluation of constant value failed - //~| NOTE the evaluated program panicked - //~| NOTE inside + b() //~ NOTE inside `c` + //~^ NOTE the failure occurred here } const X: u32 = c(); -//~^ NOTE inside +//~^ ERROR evaluation of constant value failed +//~| NOTE hey diff --git a/tests/ui/consts/const-eval/const_panic_track_caller.stderr b/tests/ui/consts/const-eval/const_panic_track_caller.stderr index a7df82705b8..8736a8c9409 100644 --- a/tests/ui/consts/const-eval/const_panic_track_caller.stderr +++ b/tests/ui/consts/const-eval/const_panic_track_caller.stderr @@ -1,19 +1,14 @@ error[E0080]: evaluation of constant value failed - --> $DIR/const_panic_track_caller.rs:15:5 + --> $DIR/const_panic_track_caller.rs:19:16 | -LL | b() - | ^^^ the evaluated program panicked at 'hey', $DIR/const_panic_track_caller.rs:15:5 +LL | const X: u32 = c(); + | ^^^ evaluation panicked: hey | note: inside `c` --> $DIR/const_panic_track_caller.rs:15:5 | LL | b() - | ^^^ -note: inside `X` - --> $DIR/const_panic_track_caller.rs:21:16 - | -LL | const X: u32 = c(); - | ^^^ + | ^^^ the failure occurred here error: aborting due to 1 previous error diff --git a/tests/ui/consts/const-eval/heap/alloc_intrinsic_errors.rs b/tests/ui/consts/const-eval/heap/alloc_intrinsic_errors.rs index 9cf9360dcbd..c1a544031c2 100644 --- a/tests/ui/consts/const-eval/heap/alloc_intrinsic_errors.rs +++ b/tests/ui/consts/const-eval/heap/alloc_intrinsic_errors.rs @@ -2,11 +2,10 @@ #![feature(const_heap)] use std::intrinsics; -const FOO: i32 = foo(); +const FOO: i32 = foo(); //~ error: evaluation of constant value failed const fn foo() -> i32 { unsafe { - let _ = intrinsics::const_allocate(4, 3) as *mut i32; - //~^ error: evaluation of constant value failed + let _ = intrinsics::const_allocate(4, 3) as *mut i32; //~ inside `foo` } 1 } diff --git a/tests/ui/consts/const-eval/heap/alloc_intrinsic_errors.stderr b/tests/ui/consts/const-eval/heap/alloc_intrinsic_errors.stderr index 2fd7222da52..e1cb7a83996 100644 --- a/tests/ui/consts/const-eval/heap/alloc_intrinsic_errors.stderr +++ b/tests/ui/consts/const-eval/heap/alloc_intrinsic_errors.stderr @@ -1,19 +1,14 @@ error[E0080]: evaluation of constant value failed - --> $DIR/alloc_intrinsic_errors.rs:8:17 + --> $DIR/alloc_intrinsic_errors.rs:5:18 | -LL | let _ = intrinsics::const_allocate(4, 3) as *mut i32; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ invalid align passed to `const_allocate`: 3 is not a power of 2 +LL | const FOO: i32 = foo(); + | ^^^^^ invalid align passed to `const_allocate`: 3 is not a power of 2 | note: inside `foo` --> $DIR/alloc_intrinsic_errors.rs:8:17 | LL | let _ = intrinsics::const_allocate(4, 3) as *mut i32; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -note: inside `FOO` - --> $DIR/alloc_intrinsic_errors.rs:5:18 - | -LL | const FOO: i32 = foo(); - | ^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the failure occurred here error: aborting due to 1 previous error diff --git a/tests/ui/consts/const-eval/panic-assoc-never-type.stderr b/tests/ui/consts/const-eval/panic-assoc-never-type.stderr index eef39255927..efdbbe5698f 100644 --- a/tests/ui/consts/const-eval/panic-assoc-never-type.stderr +++ b/tests/ui/consts/const-eval/panic-assoc-never-type.stderr @@ -2,7 +2,7 @@ error[E0080]: evaluation of constant value failed --> $DIR/panic-assoc-never-type.rs:9:21 | LL | const VOID: ! = panic!(); - | ^^^^^^^^ the evaluated program panicked at 'explicit panic', $DIR/panic-assoc-never-type.rs:9:21 + | ^^^^^^^^ evaluation panicked: explicit panic | = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/tests/ui/consts/const-eval/panic-never-type.stderr b/tests/ui/consts/const-eval/panic-never-type.stderr index d3ba3eefb1a..30a320f8db2 100644 --- a/tests/ui/consts/const-eval/panic-never-type.stderr +++ b/tests/ui/consts/const-eval/panic-never-type.stderr @@ -2,7 +2,7 @@ error[E0080]: evaluation of constant value failed --> $DIR/panic-never-type.rs:4:17 | LL | const VOID: ! = panic!(); - | ^^^^^^^^ the evaluated program panicked at 'explicit panic', $DIR/panic-never-type.rs:4:17 + | ^^^^^^^^ evaluation panicked: explicit panic | = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/tests/ui/consts/const-eval/parse_ints.rs b/tests/ui/consts/const-eval/parse_ints.rs index cb9a3eb4312..309b7ee5d27 100644 --- a/tests/ui/consts/const-eval/parse_ints.rs +++ b/tests/ui/consts/const-eval/parse_ints.rs @@ -2,7 +2,7 @@ const _OK: () = match i32::from_str_radix("-1234", 10) { Ok(x) => assert!(x == -1234), Err(_) => panic!(), }; -const _TOO_LOW: () = { u64::from_str_radix("12345ABCD", 1); }; -const _TOO_HIGH: () = { u64::from_str_radix("12345ABCD", 37); }; +const _TOO_LOW: () = { u64::from_str_radix("12345ABCD", 1); }; //~ ERROR evaluation of constant value failed +const _TOO_HIGH: () = { u64::from_str_radix("12345ABCD", 37); }; //~ ERROR evaluation of constant value failed fn main () {} diff --git a/tests/ui/consts/const-eval/parse_ints.stderr b/tests/ui/consts/const-eval/parse_ints.stderr index 189d3c3958b..7a855bb9e5c 100644 --- a/tests/ui/consts/const-eval/parse_ints.stderr +++ b/tests/ui/consts/const-eval/parse_ints.stderr @@ -1,33 +1,25 @@ error[E0080]: evaluation of constant value failed - --> $SRC_DIR/core/src/num/mod.rs:LL:COL + --> $DIR/parse_ints.rs:5:24 | - = note: the evaluated program panicked at 'from_ascii_radix: radix must lie in the range `[2, 36]`', $SRC_DIR/core/src/num/mod.rs:LL:COL +LL | const _TOO_LOW: () = { u64::from_str_radix("12345ABCD", 1); }; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation panicked: from_ascii_radix: radix must lie in the range `[2, 36]` | -note: inside `core::num::<impl u64>::from_ascii_radix` - --> $SRC_DIR/core/src/num/mod.rs:LL:COL note: inside `core::num::<impl u64>::from_str_radix` --> $SRC_DIR/core/src/num/mod.rs:LL:COL -note: inside `_TOO_LOW` - --> $DIR/parse_ints.rs:5:24 - | -LL | const _TOO_LOW: () = { u64::from_str_radix("12345ABCD", 1); }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +note: inside `core::num::<impl u64>::from_ascii_radix` + --> $SRC_DIR/core/src/num/mod.rs:LL:COL = note: this error originates in the macro `from_str_int_impl` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0080]: evaluation of constant value failed - --> $SRC_DIR/core/src/num/mod.rs:LL:COL + --> $DIR/parse_ints.rs:6:25 | - = note: the evaluated program panicked at 'from_ascii_radix: radix must lie in the range `[2, 36]`', $SRC_DIR/core/src/num/mod.rs:LL:COL +LL | const _TOO_HIGH: () = { u64::from_str_radix("12345ABCD", 37); }; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation panicked: from_ascii_radix: radix must lie in the range `[2, 36]` | -note: inside `core::num::<impl u64>::from_ascii_radix` - --> $SRC_DIR/core/src/num/mod.rs:LL:COL note: inside `core::num::<impl u64>::from_str_radix` --> $SRC_DIR/core/src/num/mod.rs:LL:COL -note: inside `_TOO_HIGH` - --> $DIR/parse_ints.rs:6:25 - | -LL | const _TOO_HIGH: () = { u64::from_str_radix("12345ABCD", 37); }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +note: inside `core::num::<impl u64>::from_ascii_radix` + --> $SRC_DIR/core/src/num/mod.rs:LL:COL = note: this error originates in the macro `from_str_int_impl` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 2 previous errors diff --git a/tests/ui/consts/const-eval/raw-pointer-ub.rs b/tests/ui/consts/const-eval/raw-pointer-ub.rs index 5724293f145..478e93a910e 100644 --- a/tests/ui/consts/const-eval/raw-pointer-ub.rs +++ b/tests/ui/consts/const-eval/raw-pointer-ub.rs @@ -17,7 +17,10 @@ const MISALIGNED_COPY: () = unsafe { let y = x.as_ptr().cast::<u32>(); let mut z = 123; y.copy_to_nonoverlapping(&mut z, 1); - //~^NOTE + //~^ ERROR evaluation of constant value failed + //~| NOTE inside `std::ptr::const_ptr + //~| NOTE inside `copy_nonoverlapping::<u32>` + //~| NOTE accessing memory with alignment 1, but alignment 4 is required // The actual error points into the implementation of `copy_to_nonoverlapping`. }; diff --git a/tests/ui/consts/const-eval/raw-pointer-ub.stderr b/tests/ui/consts/const-eval/raw-pointer-ub.stderr index c3360c8b3e2..4fff293b2ee 100644 --- a/tests/ui/consts/const-eval/raw-pointer-ub.stderr +++ b/tests/ui/consts/const-eval/raw-pointer-ub.stderr @@ -11,28 +11,24 @@ LL | *ptr = 0; | ^^^^^^^^ accessing memory based on pointer with alignment 1, but alignment 4 is required error[E0080]: evaluation of constant value failed - --> $SRC_DIR/core/src/intrinsics/mod.rs:LL:COL + --> $DIR/raw-pointer-ub.rs:19:5 | - = note: accessing memory with alignment 1, but alignment 4 is required +LL | y.copy_to_nonoverlapping(&mut z, 1); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ accessing memory with alignment 1, but alignment 4 is required | -note: inside `copy_nonoverlapping::<u32>` - --> $SRC_DIR/core/src/intrinsics/mod.rs:LL:COL note: inside `std::ptr::const_ptr::<impl *const u32>::copy_to_nonoverlapping` --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL -note: inside `MISALIGNED_COPY` - --> $DIR/raw-pointer-ub.rs:19:5 - | -LL | y.copy_to_nonoverlapping(&mut z, 1); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +note: inside `copy_nonoverlapping::<u32>` + --> $SRC_DIR/core/src/intrinsics/mod.rs:LL:COL error[E0080]: evaluation of constant value failed - --> $DIR/raw-pointer-ub.rs:31:16 + --> $DIR/raw-pointer-ub.rs:34:16 | LL | let _val = (*ptr).0; | ^^^^^^^^ accessing memory based on pointer with alignment 4, but alignment 16 is required error[E0080]: evaluation of constant value failed - --> $DIR/raw-pointer-ub.rs:38:16 + --> $DIR/raw-pointer-ub.rs:41:16 | LL | let _val = *ptr; | ^^^^ memory access failed: expected a pointer to 8 bytes of memory, but got ALLOC0 which is only 4 bytes from the end of the allocation diff --git a/tests/ui/consts/const-eval/simd/insert_extract.rs b/tests/ui/consts/const-eval/simd/insert_extract.rs index e5873ea26e8..fc97f9ec141 100644 --- a/tests/ui/consts/const-eval/simd/insert_extract.rs +++ b/tests/ui/consts/const-eval/simd/insert_extract.rs @@ -1,28 +1,19 @@ //@ run-pass #![feature(repr_simd)] -#![feature(intrinsics, rustc_attrs)] +#![feature(intrinsics, core_intrinsics, rustc_attrs)] #![feature(staged_api)] #![stable(feature = "foo", since = "1.3.37")] #![allow(non_camel_case_types)] -// repr(simd) now only supports array types -#[repr(simd)] struct i8x1([i8; 1]); -#[repr(simd)] struct u16x2([u16; 2]); -#[repr(simd)] struct f32x4([f32; 4]); - -#[stable(feature = "foo", since = "1.3.37")] -#[rustc_const_stable(feature = "foo", since = "1.3.37")] -#[rustc_intrinsic] -const unsafe fn simd_insert<T, U>(_x: T, _idx: u32, _val: U) -> T { - unimplemented!() -} +use std::intrinsics::simd::{simd_extract, simd_insert}; -#[stable(feature = "foo", since = "1.3.37")] -#[rustc_const_stable(feature = "foo", since = "1.3.37")] -#[rustc_intrinsic] -const unsafe fn simd_extract<T, U>(_x: T, _idx: u32) -> U { - unimplemented!() -} +// repr(simd) now only supports array types +#[repr(simd)] +struct i8x1([i8; 1]); +#[repr(simd)] +struct u16x2([u16; 2]); +#[repr(simd)] +struct f32x4([f32; 4]); fn main() { { diff --git a/tests/ui/consts/const-eval/transmute-size-mismatch.rs b/tests/ui/consts/const-eval/transmute-size-mismatch.rs index 2410baea28c..8a7fd8257b0 100644 --- a/tests/ui/consts/const-eval/transmute-size-mismatch.rs +++ b/tests/ui/consts/const-eval/transmute-size-mismatch.rs @@ -10,15 +10,19 @@ const unsafe fn mir_transmute<T, U>(x: T) -> U { mir!{ { RET = CastTransmute(x); - //~^ ERROR evaluation of constant value failed - //~| ERROR evaluation of constant value failed + //~^ NOTE inside `mir_transmute + //~| NOTE inside `mir_transmute + //~| NOTE the failure occurred here + //~| NOTE the failure occurred here Return() } } } -const FROM_BIGGER: u16 = unsafe { mir_transmute(123_i32) }; +const FROM_BIGGER: u16 = unsafe { mir_transmute(123_i32) }; //~ ERROR evaluation of constant value failed +//~^ NOTE transmuting from 4-byte type to 2-byte type: `i32` -> `u16` -const FROM_SMALLER: u32 = unsafe { mir_transmute(123_i16) }; +const FROM_SMALLER: u32 = unsafe { mir_transmute(123_i16) }; //~ ERROR evaluation of constant value failed +//~^ NOTE transmuting from 2-byte type to 4-byte type: `i16` -> `u32` fn main() {} diff --git a/tests/ui/consts/const-eval/transmute-size-mismatch.stderr b/tests/ui/consts/const-eval/transmute-size-mismatch.stderr index e051491d343..888df16ec4e 100644 --- a/tests/ui/consts/const-eval/transmute-size-mismatch.stderr +++ b/tests/ui/consts/const-eval/transmute-size-mismatch.stderr @@ -1,36 +1,26 @@ error[E0080]: evaluation of constant value failed - --> $DIR/transmute-size-mismatch.rs:12:13 + --> $DIR/transmute-size-mismatch.rs:22:35 | -LL | RET = CastTransmute(x); - | ^^^^^^^^^^^^^^^^^^^^^^ transmuting from 4-byte type to 2-byte type: `i32` -> `u16` +LL | const FROM_BIGGER: u16 = unsafe { mir_transmute(123_i32) }; + | ^^^^^^^^^^^^^^^^^^^^^^ transmuting from 4-byte type to 2-byte type: `i32` -> `u16` | note: inside `mir_transmute::<i32, u16>` --> $DIR/transmute-size-mismatch.rs:12:13 | LL | RET = CastTransmute(x); - | ^^^^^^^^^^^^^^^^^^^^^^ -note: inside `FROM_BIGGER` - --> $DIR/transmute-size-mismatch.rs:20:35 - | -LL | const FROM_BIGGER: u16 = unsafe { mir_transmute(123_i32) }; - | ^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^ the failure occurred here error[E0080]: evaluation of constant value failed - --> $DIR/transmute-size-mismatch.rs:12:13 + --> $DIR/transmute-size-mismatch.rs:25:36 | -LL | RET = CastTransmute(x); - | ^^^^^^^^^^^^^^^^^^^^^^ transmuting from 2-byte type to 4-byte type: `i16` -> `u32` +LL | const FROM_SMALLER: u32 = unsafe { mir_transmute(123_i16) }; + | ^^^^^^^^^^^^^^^^^^^^^^ transmuting from 2-byte type to 4-byte type: `i16` -> `u32` | note: inside `mir_transmute::<i16, u32>` --> $DIR/transmute-size-mismatch.rs:12:13 | LL | RET = CastTransmute(x); - | ^^^^^^^^^^^^^^^^^^^^^^ -note: inside `FROM_SMALLER` - --> $DIR/transmute-size-mismatch.rs:22:36 - | -LL | const FROM_SMALLER: u32 = unsafe { mir_transmute(123_i16) }; - | ^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^ the failure occurred here error: aborting due to 2 previous errors diff --git a/tests/ui/consts/const-eval/ub-enum.rs b/tests/ui/consts/const-eval/ub-enum.rs index 11cd87023d1..5be444e667a 100644 --- a/tests/ui/consts/const-eval/ub-enum.rs +++ b/tests/ui/consts/const-eval/ub-enum.rs @@ -101,7 +101,7 @@ const BAD_UNINHABITED_WITH_DATA2: Result<(i32, !), (i32, Never)> = unsafe { mem: const TEST_ICE_89765: () = { // This is a regression test for https://github.com/rust-lang/rust/issues/89765. unsafe { std::mem::discriminant(&*(&() as *const () as *const Never)); }; - //~^ inside `TEST_ICE_89765` + //~^ ERROR evaluation of constant value failed }; fn main() { diff --git a/tests/ui/consts/const-eval/ub-enum.stderr b/tests/ui/consts/const-eval/ub-enum.stderr index a0712f64c7b..cfb7eaf537a 100644 --- a/tests/ui/consts/const-eval/ub-enum.stderr +++ b/tests/ui/consts/const-eval/ub-enum.stderr @@ -117,17 +117,13 @@ LL | const BAD_UNINHABITED_WITH_DATA2: Result<(i32, !), (i32, Never)> = unsafe { | ^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<enum-tag>: encountered an uninhabited enum variant error[E0080]: evaluation of constant value failed - --> $SRC_DIR/core/src/mem/mod.rs:LL:COL + --> $DIR/ub-enum.rs:103:14 | - = note: read discriminant of an uninhabited enum variant +LL | unsafe { std::mem::discriminant(&*(&() as *const () as *const Never)); }; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ read discriminant of an uninhabited enum variant | note: inside `discriminant::<Never>` --> $SRC_DIR/core/src/mem/mod.rs:LL:COL -note: inside `TEST_ICE_89765` - --> $DIR/ub-enum.rs:103:14 - | -LL | unsafe { std::mem::discriminant(&*(&() as *const () as *const Never)); }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 14 previous errors diff --git a/tests/ui/consts/const-eval/ub-invalid-values.rs b/tests/ui/consts/const-eval/ub-invalid-values.rs index 1724a88dd3d..c0b68d7619a 100644 --- a/tests/ui/consts/const-eval/ub-invalid-values.rs +++ b/tests/ui/consts/const-eval/ub-invalid-values.rs @@ -1,11 +1,12 @@ const fn bool_cast(ptr: *const bool) { unsafe { - let _val = *ptr as u32; //~ERROR: evaluation of constant value failed - //~^ interpreting an invalid 8-bit value as a bool + let _val = *ptr as u32; //~ NOTE inside `bool_cast` + //~^ NOTE the failure occurred here }} const _: () = { let v = 3_u8; - bool_cast(&v as *const u8 as *const bool); + bool_cast(&v as *const u8 as *const bool); //~ ERROR: evaluation of constant value failed + //~^ NOTE interpreting an invalid 8-bit value as a bool }; fn main() {} diff --git a/tests/ui/consts/const-eval/ub-invalid-values.stderr b/tests/ui/consts/const-eval/ub-invalid-values.stderr index edf72f731e5..76952c1f1a3 100644 --- a/tests/ui/consts/const-eval/ub-invalid-values.stderr +++ b/tests/ui/consts/const-eval/ub-invalid-values.stderr @@ -1,19 +1,14 @@ error[E0080]: evaluation of constant value failed - --> $DIR/ub-invalid-values.rs:2:16 + --> $DIR/ub-invalid-values.rs:8:5 | -LL | let _val = *ptr as u32; - | ^^^^^^^^^^^ interpreting an invalid 8-bit value as a bool: 0x03 +LL | bool_cast(&v as *const u8 as *const bool); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ interpreting an invalid 8-bit value as a bool: 0x03 | note: inside `bool_cast` --> $DIR/ub-invalid-values.rs:2:16 | LL | let _val = *ptr as u32; - | ^^^^^^^^^^^ -note: inside `_` - --> $DIR/ub-invalid-values.rs:8:5 - | -LL | bool_cast(&v as *const u8 as *const bool); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^ the failure occurred here error: aborting due to 1 previous error diff --git a/tests/ui/consts/const-eval/ub-ref-ptr.rs b/tests/ui/consts/const-eval/ub-ref-ptr.rs index 78d6fb5b65b..50e510a3d54 100644 --- a/tests/ui/consts/const-eval/ub-ref-ptr.rs +++ b/tests/ui/consts/const-eval/ub-ref-ptr.rs @@ -63,7 +63,7 @@ const DATA_FN_PTR: fn() = unsafe { mem::transmute(&13) }; const UNALIGNED_READ: () = unsafe { let x = &[0u8; 4]; let ptr = x.as_ptr().cast::<u32>(); - ptr.read(); //~ inside `UNALIGNED_READ` + ptr.read(); //~ ERROR evaluation of constant value failed }; diff --git a/tests/ui/consts/const-eval/ub-ref-ptr.stderr b/tests/ui/consts/const-eval/ub-ref-ptr.stderr index 3bbf2977392..72a523282e6 100644 --- a/tests/ui/consts/const-eval/ub-ref-ptr.stderr +++ b/tests/ui/consts/const-eval/ub-ref-ptr.stderr @@ -149,19 +149,15 @@ LL | const DATA_FN_PTR: fn() = unsafe { mem::transmute(&13) }; } error[E0080]: evaluation of constant value failed - --> $SRC_DIR/core/src/ptr/mod.rs:LL:COL + --> $DIR/ub-ref-ptr.rs:66:5 | - = note: accessing memory based on pointer with alignment 1, but alignment 4 is required +LL | ptr.read(); + | ^^^^^^^^^^ accessing memory based on pointer with alignment 1, but alignment 4 is required | -note: inside `std::ptr::read::<u32>` - --> $SRC_DIR/core/src/ptr/mod.rs:LL:COL note: inside `std::ptr::const_ptr::<impl *const u32>::read` --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL -note: inside `UNALIGNED_READ` - --> $DIR/ub-ref-ptr.rs:66:5 - | -LL | ptr.read(); - | ^^^^^^^^^^ +note: inside `std::ptr::read::<u32>` + --> $SRC_DIR/core/src/ptr/mod.rs:LL:COL error: aborting due to 15 previous errors diff --git a/tests/ui/consts/const-eval/unwind-abort.rs b/tests/ui/consts/const-eval/unwind-abort.rs index 8d5ed876e43..fee53f8528d 100644 --- a/tests/ui/consts/const-eval/unwind-abort.rs +++ b/tests/ui/consts/const-eval/unwind-abort.rs @@ -1,8 +1,8 @@ const extern "C" fn foo() { - panic!() //~ ERROR evaluation of constant value failed + panic!() //~ inside `foo` } -const _: () = foo(); +const _: () = foo(); //~ ERROR evaluation of constant value failed // Ensure that the CTFE engine handles calls to `extern "C"` aborting gracefully fn main() { diff --git a/tests/ui/consts/const-eval/unwind-abort.stderr b/tests/ui/consts/const-eval/unwind-abort.stderr index 340f1dbe841..96c0dd7c5e9 100644 --- a/tests/ui/consts/const-eval/unwind-abort.stderr +++ b/tests/ui/consts/const-eval/unwind-abort.stderr @@ -1,19 +1,14 @@ error[E0080]: evaluation of constant value failed - --> $DIR/unwind-abort.rs:2:5 + --> $DIR/unwind-abort.rs:5:15 | -LL | panic!() - | ^^^^^^^^ the evaluated program panicked at 'explicit panic', $DIR/unwind-abort.rs:2:5 +LL | const _: () = foo(); + | ^^^^^ evaluation panicked: explicit panic | note: inside `foo` --> $DIR/unwind-abort.rs:2:5 | LL | panic!() - | ^^^^^^^^ -note: inside `_` - --> $DIR/unwind-abort.rs:5:15 - | -LL | const _: () = foo(); - | ^^^^^ + | ^^^^^^^^ the failure occurred here = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 1 previous error diff --git a/tests/ui/consts/const-eval/validate_uninhabited_zsts.rs b/tests/ui/consts/const-eval/validate_uninhabited_zsts.rs index 261dea6182d..c4df93b6239 100644 --- a/tests/ui/consts/const-eval/validate_uninhabited_zsts.rs +++ b/tests/ui/consts/const-eval/validate_uninhabited_zsts.rs @@ -1,6 +1,5 @@ const fn foo() -> ! { - unsafe { std::mem::transmute(()) } - //~^ ERROR evaluation of constant value failed + unsafe { std::mem::transmute(()) } //~ inside `foo` } // Type defined in a submodule, so that it is not "visibly" @@ -14,6 +13,7 @@ pub mod empty { } const FOO: [empty::Empty; 3] = [foo(); 3]; +//~^ ERROR evaluation of constant value failed const BAR: [empty::Empty; 3] = [unsafe { std::mem::transmute(()) }; 3]; //~^ ERROR evaluation of constant value failed diff --git a/tests/ui/consts/const-eval/validate_uninhabited_zsts.stderr b/tests/ui/consts/const-eval/validate_uninhabited_zsts.stderr index d9f1780f7b9..29311fdb25a 100644 --- a/tests/ui/consts/const-eval/validate_uninhabited_zsts.stderr +++ b/tests/ui/consts/const-eval/validate_uninhabited_zsts.stderr @@ -1,19 +1,14 @@ error[E0080]: evaluation of constant value failed - --> $DIR/validate_uninhabited_zsts.rs:2:14 + --> $DIR/validate_uninhabited_zsts.rs:15:33 | -LL | unsafe { std::mem::transmute(()) } - | ^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a value of the never type `!` +LL | const FOO: [empty::Empty; 3] = [foo(); 3]; + | ^^^^^ constructing invalid value: encountered a value of the never type `!` | note: inside `foo` --> $DIR/validate_uninhabited_zsts.rs:2:14 | LL | unsafe { std::mem::transmute(()) } - | ^^^^^^^^^^^^^^^^^^^^^^^ -note: inside `FOO` - --> $DIR/validate_uninhabited_zsts.rs:16:33 - | -LL | const FOO: [empty::Empty; 3] = [foo(); 3]; - | ^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^ the failure occurred here error[E0080]: evaluation of constant value failed --> $DIR/validate_uninhabited_zsts.rs:18:42 diff --git a/tests/ui/consts/const-fn-in-vec.rs b/tests/ui/consts/const-fn-in-vec.rs index 0483800efef..d1430bc8e00 100644 --- a/tests/ui/consts/const-fn-in-vec.rs +++ b/tests/ui/consts/const-fn-in-vec.rs @@ -1,11 +1,16 @@ static _MAYBE_STRINGS: [Option<String>; 5] = [None; 5]; //~^ ERROR the trait bound `String: Copy` is not satisfied -fn main() { - // should hint to create an inline `const` block - // or to create a new `const` item +// should hint to create an inline `const` block +// or to create a new `const` item +fn foo() { let _strings: [String; 5] = [String::new(); 5]; //~^ ERROR the trait bound `String: Copy` is not satisfied +} + +fn bar() { let _maybe_strings: [Option<String>; 5] = [None; 5]; //~^ ERROR the trait bound `String: Copy` is not satisfied } + +fn main() {} diff --git a/tests/ui/consts/const-fn-in-vec.stderr b/tests/ui/consts/const-fn-in-vec.stderr index b31e180fea2..5be26d7c121 100644 --- a/tests/ui/consts/const-fn-in-vec.stderr +++ b/tests/ui/consts/const-fn-in-vec.stderr @@ -22,7 +22,7 @@ LL | let _strings: [String; 5] = [String::new(); 5]; = note: the `Copy` trait is required because this value will be copied for each element of the array error[E0277]: the trait bound `String: Copy` is not satisfied - --> $DIR/const-fn-in-vec.rs:9:48 + --> $DIR/const-fn-in-vec.rs:12:48 | LL | let _maybe_strings: [Option<String>; 5] = [None; 5]; | ^^^^ diff --git a/tests/ui/consts/const-ptr-is-null.rs b/tests/ui/consts/const-ptr-is-null.rs index 0abd9afa422..319f6b1a62b 100644 --- a/tests/ui/consts/const-ptr-is-null.rs +++ b/tests/ui/consts/const-ptr-is-null.rs @@ -19,7 +19,7 @@ const MAYBE_NULL: () = { assert!(!ptr.wrapping_byte_sub(1).is_null()); // ... but once we shift outside the allocation, with an offset divisible by 4, // we might become null. - assert!(!ptr.wrapping_sub(512).is_null()); //~inside `MAYBE_NULL` + assert!(!ptr.wrapping_sub(512).is_null()); //~ ERROR evaluation of constant value failed }; fn main() {} diff --git a/tests/ui/consts/const-ptr-is-null.stderr b/tests/ui/consts/const-ptr-is-null.stderr index 5ef79790d93..ff2db14a2f5 100644 --- a/tests/ui/consts/const-ptr-is-null.stderr +++ b/tests/ui/consts/const-ptr-is-null.stderr @@ -1,18 +1,14 @@ error[E0080]: evaluation of constant value failed - --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL + --> $DIR/const-ptr-is-null.rs:22:14 | - = note: the evaluated program panicked at 'null-ness of this pointer cannot be determined in const context', $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL +LL | assert!(!ptr.wrapping_sub(512).is_null()); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation panicked: null-ness of this pointer cannot be determined in const context | -note: inside `std::ptr::const_ptr::<impl *const T>::is_null::compiletime` - --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL note: inside `std::ptr::const_ptr::<impl *const i32>::is_null` --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL -note: inside `MAYBE_NULL` - --> $DIR/const-ptr-is-null.rs:22:14 - | -LL | assert!(!ptr.wrapping_sub(512).is_null()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - = note: this error originates in the macro `$crate::panic::panic_2021` which comes from the expansion of the macro `const_eval_select` (in Nightly builds, run with -Z macro-backtrace for more info) +note: inside `std::ptr::const_ptr::<impl *const T>::is_null::compiletime` + --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL + = note: this error originates in the macro `$crate::intrinsics::const_eval_select` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 1 previous error diff --git a/tests/ui/consts/const-slice-array-deref.stderr b/tests/ui/consts/const-slice-array-deref.stderr index 346685380cc..b1d06928088 100644 --- a/tests/ui/consts/const-slice-array-deref.stderr +++ b/tests/ui/consts/const-slice-array-deref.stderr @@ -5,6 +5,7 @@ LL | const ONE: [u16] = [1]; | ^^^^^ doesn't have a size known at compile-time | = help: the trait `Sized` is not implemented for `[u16]` + = note: statics and constants must have a statically known size error[E0308]: mismatched types --> $DIR/const-slice-array-deref.rs:1:20 diff --git a/tests/ui/consts/const-unsized.stderr b/tests/ui/consts/const-unsized.stderr index 7931d7adafd..8328e19aac2 100644 --- a/tests/ui/consts/const-unsized.stderr +++ b/tests/ui/consts/const-unsized.stderr @@ -5,6 +5,7 @@ LL | const CONST_0: dyn Debug + Sync = *(&0 as &(dyn Debug + Sync)); | ^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | = help: the trait `Sized` is not implemented for `(dyn Debug + Sync + 'static)` + = note: statics and constants must have a statically known size error[E0277]: the size for values of type `str` cannot be known at compilation time --> $DIR/const-unsized.rs:7:18 @@ -13,6 +14,7 @@ LL | const CONST_FOO: str = *"foo"; | ^^^ doesn't have a size known at compile-time | = help: the trait `Sized` is not implemented for `str` + = note: statics and constants must have a statically known size error[E0277]: the size for values of type `(dyn Debug + Sync + 'static)` cannot be known at compilation time --> $DIR/const-unsized.rs:11:18 @@ -21,6 +23,7 @@ LL | static STATIC_1: dyn Debug + Sync = *(&1 as &(dyn Debug + Sync)); | ^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | = help: the trait `Sized` is not implemented for `(dyn Debug + Sync + 'static)` + = note: statics and constants must have a statically known size error[E0277]: the size for values of type `str` cannot be known at compilation time --> $DIR/const-unsized.rs:15:20 @@ -29,6 +32,7 @@ LL | static STATIC_BAR: str = *"bar"; | ^^^ doesn't have a size known at compile-time | = help: the trait `Sized` is not implemented for `str` + = note: statics and constants must have a statically known size error[E0507]: cannot move out of a shared reference --> $DIR/const-unsized.rs:3:35 diff --git a/tests/ui/consts/const-unwrap.rs b/tests/ui/consts/const-unwrap.rs index ea0a15af1be..d48078a0834 100644 --- a/tests/ui/consts/const-unwrap.rs +++ b/tests/ui/consts/const-unwrap.rs @@ -5,7 +5,7 @@ const FOO: i32 = Some(42i32).unwrap(); const BAR: i32 = Option::<i32>::None.unwrap(); //~^ ERROR: evaluation of constant value failed -//~| NOTE: the evaluated program panicked +//~| NOTE: called `Option::unwrap()` on a `None` value const BAZ: i32 = Option::<i32>::None.expect("absolutely not!"); //~^ ERROR: evaluation of constant value failed diff --git a/tests/ui/consts/const-unwrap.stderr b/tests/ui/consts/const-unwrap.stderr index aa5dd9a5c36..832c95992c8 100644 --- a/tests/ui/consts/const-unwrap.stderr +++ b/tests/ui/consts/const-unwrap.stderr @@ -2,13 +2,13 @@ error[E0080]: evaluation of constant value failed --> $DIR/const-unwrap.rs:6:18 | LL | const BAR: i32 = Option::<i32>::None.unwrap(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the evaluated program panicked at 'called `Option::unwrap()` on a `None` value', $DIR/const-unwrap.rs:6:38 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation panicked: called `Option::unwrap()` on a `None` value error[E0080]: evaluation of constant value failed --> $DIR/const-unwrap.rs:10:18 | LL | const BAZ: i32 = Option::<i32>::None.expect("absolutely not!"); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the evaluated program panicked at 'absolutely not!', $DIR/const-unwrap.rs:10:38 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation panicked: absolutely not! error: aborting due to 2 previous errors diff --git a/tests/ui/consts/const_refs_to_static-ice-121413.stderr b/tests/ui/consts/const_refs_to_static-ice-121413.stderr index 8665d9b6852..3980a7e9b93 100644 --- a/tests/ui/consts/const_refs_to_static-ice-121413.stderr +++ b/tests/ui/consts/const_refs_to_static-ice-121413.stderr @@ -30,6 +30,7 @@ LL | static FOO: Sync = AtomicUsize::new(0); | ^^^^ doesn't have a size known at compile-time | = help: the trait `Sized` is not implemented for `(dyn Sync + 'static)` + = note: statics and constants must have a statically known size error: aborting due to 2 previous errors; 1 warning emitted diff --git a/tests/ui/consts/const_unsafe_unreachable_ub.rs b/tests/ui/consts/const_unsafe_unreachable_ub.rs index 705e208b56d..a3f7fd46a75 100644 --- a/tests/ui/consts/const_unsafe_unreachable_ub.rs +++ b/tests/ui/consts/const_unsafe_unreachable_ub.rs @@ -1,13 +1,14 @@ -//@ error-pattern: evaluation of constant value failed - const unsafe fn foo(x: bool) -> bool { match x { true => true, - false => std::hint::unreachable_unchecked(), + false => std::hint::unreachable_unchecked(), //~ NOTE inside `foo` } } const BAR: bool = unsafe { foo(false) }; +//~^ ERROR evaluation of constant value failed +//~| NOTE entering unreachable code +//~| NOTE inside `unreachable_unchecked` fn main() { assert_eq!(BAR, true); diff --git a/tests/ui/consts/const_unsafe_unreachable_ub.stderr b/tests/ui/consts/const_unsafe_unreachable_ub.stderr index 6394563e2bb..079ed77b219 100644 --- a/tests/ui/consts/const_unsafe_unreachable_ub.stderr +++ b/tests/ui/consts/const_unsafe_unreachable_ub.stderr @@ -1,20 +1,16 @@ error[E0080]: evaluation of constant value failed - --> $SRC_DIR/core/src/hint.rs:LL:COL + --> $DIR/const_unsafe_unreachable_ub.rs:8:28 | - = note: entering unreachable code +LL | const BAR: bool = unsafe { foo(false) }; + | ^^^^^^^^^^ entering unreachable code | -note: inside `unreachable_unchecked` - --> $SRC_DIR/core/src/hint.rs:LL:COL note: inside `foo` - --> $DIR/const_unsafe_unreachable_ub.rs:6:18 + --> $DIR/const_unsafe_unreachable_ub.rs:4:18 | LL | false => std::hint::unreachable_unchecked(), | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -note: inside `BAR` - --> $DIR/const_unsafe_unreachable_ub.rs:10:28 - | -LL | const BAR: bool = unsafe { foo(false) }; - | ^^^^^^^^^^ +note: inside `unreachable_unchecked` + --> $SRC_DIR/core/src/hint.rs:LL:COL error: aborting due to 1 previous error diff --git a/tests/ui/consts/control-flow/assert.stderr b/tests/ui/consts/control-flow/assert.stderr index 2f863daf760..fc378f57fa4 100644 --- a/tests/ui/consts/control-flow/assert.stderr +++ b/tests/ui/consts/control-flow/assert.stderr @@ -2,7 +2,7 @@ error[E0080]: evaluation of constant value failed --> $DIR/assert.rs:5:15 | LL | const _: () = assert!(false); - | ^^^^^^^^^^^^^^ the evaluated program panicked at 'assertion failed: false', $DIR/assert.rs:5:15 + | ^^^^^^^^^^^^^^ evaluation panicked: assertion failed: false | = note: this error originates in the macro `assert` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/tests/ui/consts/dont-ctfe-unsized-initializer.rs b/tests/ui/consts/dont-ctfe-unsized-initializer.rs new file mode 100644 index 00000000000..cca38b760dc --- /dev/null +++ b/tests/ui/consts/dont-ctfe-unsized-initializer.rs @@ -0,0 +1,7 @@ +static S: str = todo!(); +//~^ ERROR the size for values of type `str` cannot be known at compilation time + +const C: str = todo!(); +//~^ ERROR the size for values of type `str` cannot be known at compilation time + +fn main() {} diff --git a/tests/ui/consts/dont-ctfe-unsized-initializer.stderr b/tests/ui/consts/dont-ctfe-unsized-initializer.stderr new file mode 100644 index 00000000000..e69790fc182 --- /dev/null +++ b/tests/ui/consts/dont-ctfe-unsized-initializer.stderr @@ -0,0 +1,21 @@ +error[E0277]: the size for values of type `str` cannot be known at compilation time + --> $DIR/dont-ctfe-unsized-initializer.rs:1:11 + | +LL | static S: str = todo!(); + | ^^^ doesn't have a size known at compile-time + | + = help: the trait `Sized` is not implemented for `str` + = note: statics and constants must have a statically known size + +error[E0277]: the size for values of type `str` cannot be known at compilation time + --> $DIR/dont-ctfe-unsized-initializer.rs:4:10 + | +LL | const C: str = todo!(); + | ^^^ doesn't have a size known at compile-time + | + = help: the trait `Sized` is not implemented for `str` + = note: statics and constants must have a statically known size + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/consts/issue-32829.stderr b/tests/ui/consts/issue-32829.stderr index 8eee87af8e1..0cbc73cfaa3 100644 --- a/tests/ui/consts/issue-32829.stderr +++ b/tests/ui/consts/issue-32829.stderr @@ -2,7 +2,7 @@ error[E0080]: could not evaluate static initializer --> $DIR/issue-32829.rs:1:22 | LL | static S : u64 = { { panic!("foo"); 0 } }; - | ^^^^^^^^^^^^^ the evaluated program panicked at 'foo', $DIR/issue-32829.rs:1:22 + | ^^^^^^^^^^^^^ evaluation panicked: foo | = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/tests/ui/consts/issue-39974.stderr b/tests/ui/consts/issue-39974.stderr index a371ea5709e..d03f709b0ea 100644 --- a/tests/ui/consts/issue-39974.stderr +++ b/tests/ui/consts/issue-39974.stderr @@ -1,4 +1,10 @@ error[E0308]: mismatched types + --> $DIR/issue-39974.rs:5:19 + | +LL | f: [[f64; 2]; LENGTH], + | ^^^^^^ expected `usize`, found `f64` + +error[E0308]: mismatched types --> $DIR/issue-39974.rs:1:21 | LL | const LENGTH: f64 = 2; @@ -9,12 +15,6 @@ help: use a float literal LL | const LENGTH: f64 = 2.0; | ++ -error[E0308]: mismatched types - --> $DIR/issue-39974.rs:5:19 - | -LL | f: [[f64; 2]; LENGTH], - | ^^^^^^ expected `usize`, found `f64` - error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/consts/issue-66693-panic-in-array-len.stderr b/tests/ui/consts/issue-66693-panic-in-array-len.stderr index 1585ea317d9..9cf5ad126f3 100644 --- a/tests/ui/consts/issue-66693-panic-in-array-len.stderr +++ b/tests/ui/consts/issue-66693-panic-in-array-len.stderr @@ -10,7 +10,7 @@ error[E0080]: evaluation of constant value failed --> $DIR/issue-66693-panic-in-array-len.rs:10:21 | LL | let _ = [false; panic!()]; - | ^^^^^^^^ the evaluated program panicked at 'explicit panic', $DIR/issue-66693-panic-in-array-len.rs:10:21 + | ^^^^^^^^ evaluation panicked: explicit panic | = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/tests/ui/consts/issue-66693.stderr b/tests/ui/consts/issue-66693.stderr index a435ace4773..46f30a8cbab 100644 --- a/tests/ui/consts/issue-66693.stderr +++ b/tests/ui/consts/issue-66693.stderr @@ -18,7 +18,7 @@ error[E0080]: evaluation of constant value failed --> $DIR/issue-66693.rs:16:15 | LL | const _: () = panic!(); - | ^^^^^^^^ the evaluated program panicked at 'explicit panic', $DIR/issue-66693.rs:16:15 + | ^^^^^^^^ evaluation panicked: explicit panic | = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info) @@ -26,7 +26,7 @@ error[E0080]: could not evaluate static initializer --> $DIR/issue-66693.rs:18:19 | LL | static _BAR: () = panic!("panic in static"); - | ^^^^^^^^^^^^^^^^^^^^^^^^^ the evaluated program panicked at 'panic in static', $DIR/issue-66693.rs:18:19 + | ^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation panicked: panic in static | = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/tests/ui/consts/issue-76064.stderr b/tests/ui/consts/issue-76064.stderr index fabebdb1a77..55059220388 100644 --- a/tests/ui/consts/issue-76064.stderr +++ b/tests/ui/consts/issue-76064.stderr @@ -2,7 +2,7 @@ error[E0080]: evaluation of constant value failed --> $DIR/issue-76064.rs:1:17 | LL | struct Bug([u8; panic!("panic")]); - | ^^^^^^^^^^^^^^^ the evaluated program panicked at 'panic', $DIR/issue-76064.rs:1:17 + | ^^^^^^^^^^^^^^^ evaluation panicked: panic | = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/tests/ui/consts/issue-miri-1910.rs b/tests/ui/consts/issue-miri-1910.rs index 107d9742b92..d194dd3c78b 100644 --- a/tests/ui/consts/issue-miri-1910.rs +++ b/tests/ui/consts/issue-miri-1910.rs @@ -5,6 +5,7 @@ const C: () = unsafe { let foo = Some(&42 as *const i32); let one_and_a_half_pointers = std::mem::size_of::<*const i32>()/2*3; (&foo as *const _ as *const u8).add(one_and_a_half_pointers).read(); + //~^ ERROR evaluation of constant value failed }; fn main() { diff --git a/tests/ui/consts/issue-miri-1910.stderr b/tests/ui/consts/issue-miri-1910.stderr index 32beed5dba0..59cbccc13a7 100644 --- a/tests/ui/consts/issue-miri-1910.stderr +++ b/tests/ui/consts/issue-miri-1910.stderr @@ -1,17 +1,13 @@ error[E0080]: evaluation of constant value failed - --> $SRC_DIR/core/src/ptr/mod.rs:LL:COL + --> $DIR/issue-miri-1910.rs:7:5 | - = note: unable to turn pointer into integer +LL | (&foo as *const _ as *const u8).add(one_and_a_half_pointers).read(); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into integer | -note: inside `std::ptr::read::<u8>` - --> $SRC_DIR/core/src/ptr/mod.rs:LL:COL note: inside `std::ptr::const_ptr::<impl *const u8>::read` --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL -note: inside `C` - --> $DIR/issue-miri-1910.rs:7:5 - | -LL | (&foo as *const _ as *const u8).add(one_and_a_half_pointers).read(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +note: inside `std::ptr::read::<u8>` + --> $SRC_DIR/core/src/ptr/mod.rs:LL:COL = help: this code performed an operation that depends on the underlying bytes representing a pointer = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported diff --git a/tests/ui/consts/miri_unleashed/abi-mismatch.rs b/tests/ui/consts/miri_unleashed/abi-mismatch.rs index da5b1dd5802..ea640ae78d5 100644 --- a/tests/ui/consts/miri_unleashed/abi-mismatch.rs +++ b/tests/ui/consts/miri_unleashed/abi-mismatch.rs @@ -4,13 +4,12 @@ const extern "C" fn c_fn() {} const fn call_rust_fn(my_fn: extern "Rust" fn()) { - my_fn(); - //~^ ERROR could not evaluate static initializer - //~| NOTE calling a function with calling convention C using calling convention Rust - //~| NOTE inside `call_rust_fn` + my_fn(); //~ NOTE inside `call_rust_fn` + //~^ NOTE the failure occurred here } static VAL: () = call_rust_fn(unsafe { std::mem::transmute(c_fn as extern "C" fn()) }); -//~^ NOTE inside `VAL` +//~^ ERROR could not evaluate static initializer +//~| NOTE calling a function with calling convention C using calling convention Rust fn main() {} diff --git a/tests/ui/consts/miri_unleashed/abi-mismatch.stderr b/tests/ui/consts/miri_unleashed/abi-mismatch.stderr index 639795efae7..88623b134b0 100644 --- a/tests/ui/consts/miri_unleashed/abi-mismatch.stderr +++ b/tests/ui/consts/miri_unleashed/abi-mismatch.stderr @@ -1,19 +1,14 @@ error[E0080]: could not evaluate static initializer - --> $DIR/abi-mismatch.rs:7:5 + --> $DIR/abi-mismatch.rs:11:18 | -LL | my_fn(); - | ^^^^^^^ calling a function with calling convention C using calling convention Rust +LL | static VAL: () = call_rust_fn(unsafe { std::mem::transmute(c_fn as extern "C" fn()) }); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ calling a function with calling convention C using calling convention Rust | note: inside `call_rust_fn` --> $DIR/abi-mismatch.rs:7:5 | LL | my_fn(); - | ^^^^^^^ -note: inside `VAL` - --> $DIR/abi-mismatch.rs:13:18 - | -LL | static VAL: () = call_rust_fn(unsafe { std::mem::transmute(c_fn as extern "C" fn()) }); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^ the failure occurred here warning: skipping const checks | diff --git a/tests/ui/consts/miri_unleashed/assoc_const.rs b/tests/ui/consts/miri_unleashed/assoc_const.rs index db37197f190..96b47ff4e5e 100644 --- a/tests/ui/consts/miri_unleashed/assoc_const.rs +++ b/tests/ui/consts/miri_unleashed/assoc_const.rs @@ -9,7 +9,7 @@ trait Foo<T> { } trait Bar<T, U: Foo<T>> { - const F: u32 = (U::X, 42).1; + const F: u32 = (U::X, 42).1; //~ ERROR } impl Foo<u32> for () { @@ -26,5 +26,5 @@ fn main() { // this is fine, but would have been forbidden by the static checks on `F` let x = <() as Bar<u32, ()>>::F; // this test only causes errors due to the line below, so post-monomorphization - let y = <String as Bar<Vec<u32>, String>>::F; //~ constant + let y = <String as Bar<Vec<u32>, String>>::F; } diff --git a/tests/ui/consts/miri_unleashed/assoc_const.stderr b/tests/ui/consts/miri_unleashed/assoc_const.stderr index 3303a784265..f259765f6e5 100644 --- a/tests/ui/consts/miri_unleashed/assoc_const.stderr +++ b/tests/ui/consts/miri_unleashed/assoc_const.stderr @@ -1,17 +1,13 @@ -error[E0080]: evaluation of `<String as Bar<Vec<u32>, String>>::F` failed - --> $SRC_DIR/core/src/ptr/mod.rs:LL:COL +error[E0080]: evaluation of `std::ptr::drop_in_place::<Vec<u32>> - shim(Some(Vec<u32>))` failed + --> $DIR/assoc_const.rs:12:31 | - = note: calling non-const function `<Vec<u32> as Drop>::drop` +LL | const F: u32 = (U::X, 42).1; + | ^ calling non-const function `<Vec<u32> as Drop>::drop` | -note: inside `std::ptr::drop_in_place::<Vec<u32>> - shim(Some(Vec<u32>))` - --> $SRC_DIR/core/src/ptr/mod.rs:LL:COL note: inside `std::ptr::drop_in_place::<(Vec<u32>, u32)> - shim(Some((Vec<u32>, u32)))` --> $SRC_DIR/core/src/ptr/mod.rs:LL:COL -note: inside `<String as Bar<Vec<u32>, String>>::F` - --> $DIR/assoc_const.rs:12:31 - | -LL | const F: u32 = (U::X, 42).1; - | ^ +note: inside `std::ptr::drop_in_place::<Vec<u32>> - shim(Some(Vec<u32>))` + --> $SRC_DIR/core/src/ptr/mod.rs:LL:COL note: erroneous constant encountered --> $DIR/assoc_const.rs:29:13 diff --git a/tests/ui/consts/miri_unleashed/drop.stderr b/tests/ui/consts/miri_unleashed/drop.stderr index 5c415b5bac1..40a29d5a819 100644 --- a/tests/ui/consts/miri_unleashed/drop.stderr +++ b/tests/ui/consts/miri_unleashed/drop.stderr @@ -1,15 +1,11 @@ error[E0080]: could not evaluate static initializer - --> $SRC_DIR/core/src/ptr/mod.rs:LL:COL + --> $DIR/drop.rs:17:1 | - = note: calling non-const function `<Vec<i32> as Drop>::drop` +LL | }; + | ^ calling non-const function `<Vec<i32> as Drop>::drop` | note: inside `std::ptr::drop_in_place::<Vec<i32>> - shim(Some(Vec<i32>))` --> $SRC_DIR/core/src/ptr/mod.rs:LL:COL -note: inside `TEST_BAD` - --> $DIR/drop.rs:17:1 - | -LL | }; - | ^ warning: skipping const checks | diff --git a/tests/ui/consts/missing_span_in_backtrace.rs b/tests/ui/consts/missing_span_in_backtrace.rs index 703cc7fbf89..c8c7453daa1 100644 --- a/tests/ui/consts/missing_span_in_backtrace.rs +++ b/tests/ui/consts/missing_span_in_backtrace.rs @@ -13,7 +13,7 @@ const X: () = { // Swap them, bytewise. unsafe { - ptr::swap_nonoverlapping( + ptr::swap_nonoverlapping( //~ ERROR evaluation of constant value failed &mut ptr1 as *mut _ as *mut MaybeUninit<u8>, &mut ptr2 as *mut _ as *mut MaybeUninit<u8>, mem::size_of::<&i32>(), diff --git a/tests/ui/consts/missing_span_in_backtrace.stderr b/tests/ui/consts/missing_span_in_backtrace.stderr index 05ae7305dbc..2f3a65302bd 100644 --- a/tests/ui/consts/missing_span_in_backtrace.stderr +++ b/tests/ui/consts/missing_span_in_backtrace.stderr @@ -1,17 +1,4 @@ error[E0080]: evaluation of constant value failed - --> $SRC_DIR/core/src/ptr/mod.rs:LL:COL - | - = note: unable to copy parts of a pointer from memory at ALLOC0 - | -note: inside `std::ptr::read::<MaybeUninit<MaybeUninit<u8>>>` - --> $SRC_DIR/core/src/ptr/mod.rs:LL:COL -note: inside `std::ptr::swap_nonoverlapping_simple_untyped::<MaybeUninit<u8>>` - --> $SRC_DIR/core/src/ptr/mod.rs:LL:COL -note: inside `swap_nonoverlapping::compiletime::<MaybeUninit<u8>>` - --> $SRC_DIR/core/src/ptr/mod.rs:LL:COL -note: inside `swap_nonoverlapping::<MaybeUninit<u8>>` - --> $SRC_DIR/core/src/ptr/mod.rs:LL:COL -note: inside `X` --> $DIR/missing_span_in_backtrace.rs:16:9 | 16 | / ptr::swap_nonoverlapping( @@ -19,7 +6,16 @@ note: inside `X` 18 | | &mut ptr2 as *mut _ as *mut MaybeUninit<u8>, 19 | | mem::size_of::<&i32>(), 20 | | ); - | |_________^ + | |_________^ unable to copy parts of a pointer from memory at ALLOC0 + | +note: inside `swap_nonoverlapping::<MaybeUninit<u8>>` + --> $SRC_DIR/core/src/ptr/mod.rs:LL:COL +note: inside `swap_nonoverlapping::compiletime::<MaybeUninit<u8>>` + --> $SRC_DIR/core/src/ptr/mod.rs:LL:COL +note: inside `std::ptr::swap_nonoverlapping_simple_untyped::<MaybeUninit<u8>>` + --> $SRC_DIR/core/src/ptr/mod.rs:LL:COL +note: inside `std::ptr::read::<MaybeUninit<MaybeUninit<u8>>>` + --> $SRC_DIR/core/src/ptr/mod.rs:LL:COL = help: this code performed an operation that depends on the underlying bytes representing a pointer = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported = note: this error originates in the macro `$crate::intrinsics::const_eval_select` which comes from the expansion of the macro `const_eval_select` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/tests/ui/consts/offset_from_ub.rs b/tests/ui/consts/offset_from_ub.rs index 39384bf0c8b..53d9c7a39da 100644 --- a/tests/ui/consts/offset_from_ub.rs +++ b/tests/ui/consts/offset_from_ub.rs @@ -21,7 +21,7 @@ pub const DIFFERENT_ALLOC: usize = { }; pub const NOT_PTR: usize = { - unsafe { (42 as *const u8).offset_from(&5u8) as usize } + unsafe { (42 as *const u8).offset_from(&5u8) as usize } //~ ERROR evaluation of constant value failed }; pub const NOT_MULTIPLE_OF_SIZE: isize = { @@ -107,13 +107,13 @@ pub const OFFSET_VERY_FAR1: isize = { let ptr1 = ptr::null::<u8>(); let ptr2 = ptr1.wrapping_offset(isize::MAX); unsafe { ptr2.offset_from(ptr1) } - //~^ inside + //~^ ERROR evaluation of constant value failed }; pub const OFFSET_VERY_FAR2: isize = { let ptr1 = ptr::null::<u8>(); let ptr2 = ptr1.wrapping_offset(isize::MAX); unsafe { ptr1.offset_from(ptr2.wrapping_offset(1)) } - //~^ inside + //~^ ERROR evaluation of constant value failed }; // If the pointers are the same, OOB/null/UAF is fine. diff --git a/tests/ui/consts/offset_from_ub.stderr b/tests/ui/consts/offset_from_ub.stderr index 8cfbdd13190..08e42c9f30b 100644 --- a/tests/ui/consts/offset_from_ub.stderr +++ b/tests/ui/consts/offset_from_ub.stderr @@ -5,17 +5,13 @@ LL | let offset = unsafe { ptr_offset_from(field_ptr, base_ptr) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `ptr_offset_from` called on two different pointers that are not both derived from the same allocation error[E0080]: evaluation of constant value failed - --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL + --> $DIR/offset_from_ub.rs:24:14 | - = note: `ptr_offset_from` called on two different pointers that are not both derived from the same allocation +LL | unsafe { (42 as *const u8).offset_from(&5u8) as usize } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `ptr_offset_from` called on two different pointers that are not both derived from the same allocation | note: inside `std::ptr::const_ptr::<impl *const u8>::offset_from` --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL -note: inside `NOT_PTR` - --> $DIR/offset_from_ub.rs:24:14 - | -LL | unsafe { (42 as *const u8).offset_from(&5u8) as usize } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0080]: evaluation of constant value failed --> $DIR/offset_from_ub.rs:31:14 @@ -78,30 +74,22 @@ LL | unsafe { ptr_offset_from_unsigned(ptr2, ptr1) } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `ptr_offset_from_unsigned` called when first pointer is too far ahead of second error[E0080]: evaluation of constant value failed - --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL + --> $DIR/offset_from_ub.rs:109:14 | - = note: `ptr_offset_from` called on two different pointers that are not both derived from the same allocation +LL | unsafe { ptr2.offset_from(ptr1) } + | ^^^^^^^^^^^^^^^^^^^^^^ `ptr_offset_from` called on two different pointers that are not both derived from the same allocation | note: inside `std::ptr::const_ptr::<impl *const u8>::offset_from` --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL -note: inside `OFFSET_VERY_FAR1` - --> $DIR/offset_from_ub.rs:109:14 - | -LL | unsafe { ptr2.offset_from(ptr1) } - | ^^^^^^^^^^^^^^^^^^^^^^ error[E0080]: evaluation of constant value failed - --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL + --> $DIR/offset_from_ub.rs:115:14 | - = note: `ptr_offset_from` called when first pointer is too far before second +LL | unsafe { ptr1.offset_from(ptr2.wrapping_offset(1)) } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `ptr_offset_from` called when first pointer is too far before second | note: inside `std::ptr::const_ptr::<impl *const u8>::offset_from` --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL -note: inside `OFFSET_VERY_FAR2` - --> $DIR/offset_from_ub.rs:115:14 - | -LL | unsafe { ptr1.offset_from(ptr2.wrapping_offset(1)) } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 14 previous errors diff --git a/tests/ui/consts/offset_ub.rs b/tests/ui/consts/offset_ub.rs index dda6dd388f2..8c52586c485 100644 --- a/tests/ui/consts/offset_ub.rs +++ b/tests/ui/consts/offset_ub.rs @@ -5,21 +5,21 @@ use std::ptr; //@ normalize-stderr: "\d+ bytes" -> "$$BYTES bytes" -pub const BEFORE_START: *const u8 = unsafe { (&0u8 as *const u8).offset(-1) }; //~NOTE -pub const AFTER_END: *const u8 = unsafe { (&0u8 as *const u8).offset(2) }; //~NOTE -pub const AFTER_ARRAY: *const u8 = unsafe { [0u8; 100].as_ptr().offset(101) }; //~NOTE +pub const BEFORE_START: *const u8 = unsafe { (&0u8 as *const u8).offset(-1) }; //~ ERROR +pub const AFTER_END: *const u8 = unsafe { (&0u8 as *const u8).offset(2) }; //~ ERROR +pub const AFTER_ARRAY: *const u8 = unsafe { [0u8; 100].as_ptr().offset(101) }; //~ ERROR -pub const OVERFLOW: *const u16 = unsafe { [0u16; 1].as_ptr().offset(isize::MAX) }; //~NOTE -pub const UNDERFLOW: *const u16 = unsafe { [0u16; 1].as_ptr().offset(isize::MIN) }; //~NOTE -pub const OVERFLOW_ADDRESS_SPACE: *const u8 = unsafe { (usize::MAX as *const u8).offset(2) }; //~NOTE -pub const UNDERFLOW_ADDRESS_SPACE: *const u8 = unsafe { (1 as *const u8).offset(-2) }; //~NOTE -pub const NEGATIVE_OFFSET: *const u8 = unsafe { [0u8; 1].as_ptr().wrapping_offset(-2).offset(-2) }; //~NOTE +pub const OVERFLOW: *const u16 = unsafe { [0u16; 1].as_ptr().offset(isize::MAX) }; //~ ERROR +pub const UNDERFLOW: *const u16 = unsafe { [0u16; 1].as_ptr().offset(isize::MIN) }; //~ ERROR +pub const OVERFLOW_ADDRESS_SPACE: *const u8 = unsafe { (usize::MAX as *const u8).offset(2) }; //~ ERROR +pub const UNDERFLOW_ADDRESS_SPACE: *const u8 = unsafe { (1 as *const u8).offset(-2) }; //~ ERROR +pub const NEGATIVE_OFFSET: *const u8 = unsafe { [0u8; 1].as_ptr().wrapping_offset(-2).offset(-2) }; //~ ERROR -pub const ZERO_SIZED_ALLOC: *const u8 = unsafe { [0u8; 0].as_ptr().offset(1) }; //~NOTE -pub const DANGLING: *const u8 = unsafe { ptr::NonNull::<u8>::dangling().as_ptr().offset(4) }; //~NOTE +pub const ZERO_SIZED_ALLOC: *const u8 = unsafe { [0u8; 0].as_ptr().offset(1) }; //~ ERROR +pub const DANGLING: *const u8 = unsafe { ptr::NonNull::<u8>::dangling().as_ptr().offset(4) }; //~ ERROR // Make sure that we don't panic when computing abs(offset*size_of::<T>()) -pub const UNDERFLOW_ABS: *const u8 = unsafe { (usize::MAX as *const u8).offset(isize::MIN) }; //~NOTE +pub const UNDERFLOW_ABS: *const u8 = unsafe { (usize::MAX as *const u8).offset(isize::MIN) }; //~ ERROR // Offset-by-zero is allowed. pub const NULL_OFFSET_ZERO: *const u8 = unsafe { ptr::null::<u8>().offset(0) }; diff --git a/tests/ui/consts/offset_ub.stderr b/tests/ui/consts/offset_ub.stderr index 779cb9654f4..a247ad25465 100644 --- a/tests/ui/consts/offset_ub.stderr +++ b/tests/ui/consts/offset_ub.stderr @@ -1,145 +1,101 @@ error[E0080]: evaluation of constant value failed - --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL + --> $DIR/offset_ub.rs:8:46 | - = note: out-of-bounds pointer arithmetic: expected a pointer to the end of 1 byte of memory, but got ALLOC0 which is at the beginning of the allocation +LL | pub const BEFORE_START: *const u8 = unsafe { (&0u8 as *const u8).offset(-1) }; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ out-of-bounds pointer arithmetic: expected a pointer to the end of 1 byte of memory, but got ALLOC0 which is at the beginning of the allocation | note: inside `std::ptr::const_ptr::<impl *const u8>::offset` --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL -note: inside `BEFORE_START` - --> $DIR/offset_ub.rs:8:46 - | -LL | pub const BEFORE_START: *const u8 = unsafe { (&0u8 as *const u8).offset(-1) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0080]: evaluation of constant value failed - --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL + --> $DIR/offset_ub.rs:9:43 | - = note: out-of-bounds pointer arithmetic: expected a pointer to $BYTES bytes of memory, but got ALLOC1 which is only 1 byte from the end of the allocation +LL | pub const AFTER_END: *const u8 = unsafe { (&0u8 as *const u8).offset(2) }; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ out-of-bounds pointer arithmetic: expected a pointer to $BYTES bytes of memory, but got ALLOC1 which is only 1 byte from the end of the allocation | note: inside `std::ptr::const_ptr::<impl *const u8>::offset` --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL -note: inside `AFTER_END` - --> $DIR/offset_ub.rs:9:43 - | -LL | pub const AFTER_END: *const u8 = unsafe { (&0u8 as *const u8).offset(2) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0080]: evaluation of constant value failed - --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL + --> $DIR/offset_ub.rs:10:45 | - = note: out-of-bounds pointer arithmetic: expected a pointer to $BYTES bytes of memory, but got ALLOC2 which is only $BYTES bytes from the end of the allocation +LL | pub const AFTER_ARRAY: *const u8 = unsafe { [0u8; 100].as_ptr().offset(101) }; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ out-of-bounds pointer arithmetic: expected a pointer to $BYTES bytes of memory, but got ALLOC2 which is only $BYTES bytes from the end of the allocation | note: inside `std::ptr::const_ptr::<impl *const u8>::offset` --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL -note: inside `AFTER_ARRAY` - --> $DIR/offset_ub.rs:10:45 - | -LL | pub const AFTER_ARRAY: *const u8 = unsafe { [0u8; 100].as_ptr().offset(101) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0080]: evaluation of constant value failed - --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL + --> $DIR/offset_ub.rs:12:43 | - = note: overflowing pointer arithmetic: the total offset in bytes does not fit in an `isize` +LL | pub const OVERFLOW: *const u16 = unsafe { [0u16; 1].as_ptr().offset(isize::MAX) }; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ overflowing pointer arithmetic: the total offset in bytes does not fit in an `isize` | note: inside `std::ptr::const_ptr::<impl *const u16>::offset` --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL -note: inside `OVERFLOW` - --> $DIR/offset_ub.rs:12:43 - | -LL | pub const OVERFLOW: *const u16 = unsafe { [0u16; 1].as_ptr().offset(isize::MAX) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0080]: evaluation of constant value failed - --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL + --> $DIR/offset_ub.rs:13:44 | - = note: overflowing pointer arithmetic: the total offset in bytes does not fit in an `isize` +LL | pub const UNDERFLOW: *const u16 = unsafe { [0u16; 1].as_ptr().offset(isize::MIN) }; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ overflowing pointer arithmetic: the total offset in bytes does not fit in an `isize` | note: inside `std::ptr::const_ptr::<impl *const u16>::offset` --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL -note: inside `UNDERFLOW` - --> $DIR/offset_ub.rs:13:44 - | -LL | pub const UNDERFLOW: *const u16 = unsafe { [0u16; 1].as_ptr().offset(isize::MIN) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0080]: evaluation of constant value failed - --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL + --> $DIR/offset_ub.rs:14:56 | - = note: out-of-bounds pointer arithmetic: expected a pointer to $BYTES bytes of memory, but got 0xf..f[noalloc] which is a dangling pointer (it has no provenance) +LL | pub const OVERFLOW_ADDRESS_SPACE: *const u8 = unsafe { (usize::MAX as *const u8).offset(2) }; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ out-of-bounds pointer arithmetic: expected a pointer to $BYTES bytes of memory, but got 0xf..f[noalloc] which is a dangling pointer (it has no provenance) | note: inside `std::ptr::const_ptr::<impl *const u8>::offset` --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL -note: inside `OVERFLOW_ADDRESS_SPACE` - --> $DIR/offset_ub.rs:14:56 - | -LL | pub const OVERFLOW_ADDRESS_SPACE: *const u8 = unsafe { (usize::MAX as *const u8).offset(2) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0080]: evaluation of constant value failed - --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL + --> $DIR/offset_ub.rs:15:57 | - = note: out-of-bounds pointer arithmetic: expected a pointer to the end of $BYTES bytes of memory, but got 0x1[noalloc] which is a dangling pointer (it has no provenance) +LL | pub const UNDERFLOW_ADDRESS_SPACE: *const u8 = unsafe { (1 as *const u8).offset(-2) }; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ out-of-bounds pointer arithmetic: expected a pointer to the end of $BYTES bytes of memory, but got 0x1[noalloc] which is a dangling pointer (it has no provenance) | note: inside `std::ptr::const_ptr::<impl *const u8>::offset` --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL -note: inside `UNDERFLOW_ADDRESS_SPACE` - --> $DIR/offset_ub.rs:15:57 - | -LL | pub const UNDERFLOW_ADDRESS_SPACE: *const u8 = unsafe { (1 as *const u8).offset(-2) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0080]: evaluation of constant value failed - --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL + --> $DIR/offset_ub.rs:16:49 | - = note: out-of-bounds pointer arithmetic: expected a pointer to the end of $BYTES bytes of memory, but got ALLOC3-0x2 which points to before the beginning of the allocation +LL | pub const NEGATIVE_OFFSET: *const u8 = unsafe { [0u8; 1].as_ptr().wrapping_offset(-2).offset(-2) }; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ out-of-bounds pointer arithmetic: expected a pointer to the end of $BYTES bytes of memory, but got ALLOC3-0x2 which points to before the beginning of the allocation | note: inside `std::ptr::const_ptr::<impl *const u8>::offset` --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL -note: inside `NEGATIVE_OFFSET` - --> $DIR/offset_ub.rs:16:49 - | -LL | pub const NEGATIVE_OFFSET: *const u8 = unsafe { [0u8; 1].as_ptr().wrapping_offset(-2).offset(-2) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0080]: evaluation of constant value failed - --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL + --> $DIR/offset_ub.rs:18:50 | - = note: out-of-bounds pointer arithmetic: expected a pointer to 1 byte of memory, but got ALLOC4 which is at or beyond the end of the allocation of size $BYTES bytes +LL | pub const ZERO_SIZED_ALLOC: *const u8 = unsafe { [0u8; 0].as_ptr().offset(1) }; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ out-of-bounds pointer arithmetic: expected a pointer to 1 byte of memory, but got ALLOC4 which is at or beyond the end of the allocation of size $BYTES bytes | note: inside `std::ptr::const_ptr::<impl *const u8>::offset` --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL -note: inside `ZERO_SIZED_ALLOC` - --> $DIR/offset_ub.rs:18:50 - | -LL | pub const ZERO_SIZED_ALLOC: *const u8 = unsafe { [0u8; 0].as_ptr().offset(1) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0080]: evaluation of constant value failed - --> $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL + --> $DIR/offset_ub.rs:19:42 | - = note: out-of-bounds pointer arithmetic: expected a pointer to $BYTES bytes of memory, but got 0x1[noalloc] which is a dangling pointer (it has no provenance) +LL | pub const DANGLING: *const u8 = unsafe { ptr::NonNull::<u8>::dangling().as_ptr().offset(4) }; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ out-of-bounds pointer arithmetic: expected a pointer to $BYTES bytes of memory, but got 0x1[noalloc] which is a dangling pointer (it has no provenance) | note: inside `std::ptr::mut_ptr::<impl *mut u8>::offset` --> $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL -note: inside `DANGLING` - --> $DIR/offset_ub.rs:19:42 - | -LL | pub const DANGLING: *const u8 = unsafe { ptr::NonNull::<u8>::dangling().as_ptr().offset(4) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0080]: evaluation of constant value failed - --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL + --> $DIR/offset_ub.rs:22:47 | - = note: out-of-bounds pointer arithmetic: expected a pointer to the end of $BYTES bytes of memory, but got 0xf..f[noalloc] which is a dangling pointer (it has no provenance) +LL | pub const UNDERFLOW_ABS: *const u8 = unsafe { (usize::MAX as *const u8).offset(isize::MIN) }; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ out-of-bounds pointer arithmetic: expected a pointer to the end of $BYTES bytes of memory, but got 0xf..f[noalloc] which is a dangling pointer (it has no provenance) | note: inside `std::ptr::const_ptr::<impl *const u8>::offset` --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL -note: inside `UNDERFLOW_ABS` - --> $DIR/offset_ub.rs:22:47 - | -LL | pub const UNDERFLOW_ABS: *const u8 = unsafe { (usize::MAX as *const u8).offset(isize::MIN) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 11 previous errors diff --git a/tests/ui/consts/qualif-indirect-mutation-fail.rs b/tests/ui/consts/qualif-indirect-mutation-fail.rs index 0f59a86b7cc..4abb231c29f 100644 --- a/tests/ui/consts/qualif-indirect-mutation-fail.rs +++ b/tests/ui/consts/qualif-indirect-mutation-fail.rs @@ -15,7 +15,7 @@ pub const A1: () = { let b = &mut y; std::mem::swap(a, b); std::mem::forget(y); -}; +}; //~ ERROR evaluation of constant value failed // Mutable borrow of a type with drop impl. pub const A2: () = { @@ -26,7 +26,7 @@ pub const A2: () = { std::mem::swap(a, b); std::mem::forget(y); let _z = x; //~ ERROR destructor of -}; +}; //~ ERROR evaluation of constant value failed // Shared borrow of a type that might be !Freeze and Drop. pub const fn g1<T>() { diff --git a/tests/ui/consts/qualif-indirect-mutation-fail.stderr b/tests/ui/consts/qualif-indirect-mutation-fail.stderr index e76d7d3b670..d3bb01af754 100644 --- a/tests/ui/consts/qualif-indirect-mutation-fail.stderr +++ b/tests/ui/consts/qualif-indirect-mutation-fail.stderr @@ -8,21 +8,17 @@ LL | }; | - value is dropped here error[E0080]: evaluation of constant value failed - --> $SRC_DIR/core/src/ptr/mod.rs:LL:COL + --> $DIR/qualif-indirect-mutation-fail.rs:18:1 | - = note: calling non-const function `<Vec<u8> as Drop>::drop` +LL | }; + | ^ calling non-const function `<Vec<u8> as Drop>::drop` | -note: inside `std::ptr::drop_in_place::<Vec<u8>> - shim(Some(Vec<u8>))` +note: inside `std::ptr::drop_in_place::<Option<String>> - shim(Some(Option<String>))` --> $SRC_DIR/core/src/ptr/mod.rs:LL:COL note: inside `std::ptr::drop_in_place::<String> - shim(Some(String))` --> $SRC_DIR/core/src/ptr/mod.rs:LL:COL -note: inside `std::ptr::drop_in_place::<Option<String>> - shim(Some(Option<String>))` +note: inside `std::ptr::drop_in_place::<Vec<u8>> - shim(Some(Vec<u8>))` --> $SRC_DIR/core/src/ptr/mod.rs:LL:COL -note: inside `A1` - --> $DIR/qualif-indirect-mutation-fail.rs:18:1 - | -LL | }; - | ^ error[E0493]: destructor of `Option<String>` cannot be evaluated at compile-time --> $DIR/qualif-indirect-mutation-fail.rs:28:9 @@ -33,21 +29,17 @@ LL | }; | - value is dropped here error[E0080]: evaluation of constant value failed - --> $SRC_DIR/core/src/ptr/mod.rs:LL:COL + --> $DIR/qualif-indirect-mutation-fail.rs:29:1 | - = note: calling non-const function `<Vec<u8> as Drop>::drop` +LL | }; + | ^ calling non-const function `<Vec<u8> as Drop>::drop` | -note: inside `std::ptr::drop_in_place::<Vec<u8>> - shim(Some(Vec<u8>))` +note: inside `std::ptr::drop_in_place::<Option<String>> - shim(Some(Option<String>))` --> $SRC_DIR/core/src/ptr/mod.rs:LL:COL note: inside `std::ptr::drop_in_place::<String> - shim(Some(String))` --> $SRC_DIR/core/src/ptr/mod.rs:LL:COL -note: inside `std::ptr::drop_in_place::<Option<String>> - shim(Some(Option<String>))` +note: inside `std::ptr::drop_in_place::<Vec<u8>> - shim(Some(Vec<u8>))` --> $SRC_DIR/core/src/ptr/mod.rs:LL:COL -note: inside `A2` - --> $DIR/qualif-indirect-mutation-fail.rs:29:1 - | -LL | }; - | ^ error[E0493]: destructor of `(u32, Option<String>)` cannot be evaluated at compile-time --> $DIR/qualif-indirect-mutation-fail.rs:6:9 diff --git a/tests/ui/consts/recursive.rs b/tests/ui/consts/recursive.rs index 5d736e31bcb..b5703d11310 100644 --- a/tests/ui/consts/recursive.rs +++ b/tests/ui/consts/recursive.rs @@ -2,9 +2,8 @@ const fn f<T>(x: T) { //~ WARN function cannot return without recursing f(x); - //~^ ERROR evaluation of constant value failed } -const X: () = f(1); +const X: () = f(1); //~ ERROR evaluation of constant value failed fn main() {} diff --git a/tests/ui/consts/recursive.stderr b/tests/ui/consts/recursive.stderr index 0046005c74f..fd38b078b94 100644 --- a/tests/ui/consts/recursive.stderr +++ b/tests/ui/consts/recursive.stderr @@ -10,26 +10,21 @@ LL | f(x); = note: `#[warn(unconditional_recursion)]` on by default error[E0080]: evaluation of constant value failed - --> $DIR/recursive.rs:4:5 + --> $DIR/recursive.rs:7:15 | -LL | f(x); - | ^^^^ reached the configured maximum number of stack frames +LL | const X: () = f(1); + | ^^^^ reached the configured maximum number of stack frames | -note: inside `f::<i32>` +note: [... 126 additional calls inside `f::<i32>` ...] --> $DIR/recursive.rs:4:5 | LL | f(x); | ^^^^ -note: [... 126 additional calls inside `f::<i32>` ...] +note: inside `f::<i32>` --> $DIR/recursive.rs:4:5 | LL | f(x); - | ^^^^ -note: inside `X` - --> $DIR/recursive.rs:8:15 - | -LL | const X: () = f(1); - | ^^^^ + | ^^^^ the failure occurred here error: aborting due to 1 previous error; 1 warning emitted diff --git a/tests/ui/consts/required-consts/collect-in-called-fn.noopt.stderr b/tests/ui/consts/required-consts/collect-in-called-fn.noopt.stderr index c3b641a899a..08d0b338728 100644 --- a/tests/ui/consts/required-consts/collect-in-called-fn.noopt.stderr +++ b/tests/ui/consts/required-consts/collect-in-called-fn.noopt.stderr @@ -2,7 +2,7 @@ error[E0080]: evaluation of `Fail::<i32>::C` failed --> $DIR/collect-in-called-fn.rs:10:19 | LL | const C: () = panic!(); - | ^^^^^^^^ the evaluated program panicked at 'explicit panic', $DIR/collect-in-called-fn.rs:10:19 + | ^^^^^^^^ evaluation panicked: explicit panic | = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/tests/ui/consts/required-consts/collect-in-called-fn.opt.stderr b/tests/ui/consts/required-consts/collect-in-called-fn.opt.stderr index c3b641a899a..08d0b338728 100644 --- a/tests/ui/consts/required-consts/collect-in-called-fn.opt.stderr +++ b/tests/ui/consts/required-consts/collect-in-called-fn.opt.stderr @@ -2,7 +2,7 @@ error[E0080]: evaluation of `Fail::<i32>::C` failed --> $DIR/collect-in-called-fn.rs:10:19 | LL | const C: () = panic!(); - | ^^^^^^^^ the evaluated program panicked at 'explicit panic', $DIR/collect-in-called-fn.rs:10:19 + | ^^^^^^^^ evaluation panicked: explicit panic | = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/tests/ui/consts/required-consts/collect-in-dead-closure.noopt.stderr b/tests/ui/consts/required-consts/collect-in-dead-closure.noopt.stderr index 75c3575a110..41fe2cf84e4 100644 --- a/tests/ui/consts/required-consts/collect-in-dead-closure.noopt.stderr +++ b/tests/ui/consts/required-consts/collect-in-dead-closure.noopt.stderr @@ -2,7 +2,7 @@ error[E0080]: evaluation of `Fail::<i32>::C` failed --> $DIR/collect-in-dead-closure.rs:9:19 | LL | const C: () = panic!(); - | ^^^^^^^^ the evaluated program panicked at 'explicit panic', $DIR/collect-in-dead-closure.rs:9:19 + | ^^^^^^^^ evaluation panicked: explicit panic | = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/tests/ui/consts/required-consts/collect-in-dead-closure.opt.stderr b/tests/ui/consts/required-consts/collect-in-dead-closure.opt.stderr index 75c3575a110..41fe2cf84e4 100644 --- a/tests/ui/consts/required-consts/collect-in-dead-closure.opt.stderr +++ b/tests/ui/consts/required-consts/collect-in-dead-closure.opt.stderr @@ -2,7 +2,7 @@ error[E0080]: evaluation of `Fail::<i32>::C` failed --> $DIR/collect-in-dead-closure.rs:9:19 | LL | const C: () = panic!(); - | ^^^^^^^^ the evaluated program panicked at 'explicit panic', $DIR/collect-in-dead-closure.rs:9:19 + | ^^^^^^^^ evaluation panicked: explicit panic | = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/tests/ui/consts/required-consts/collect-in-dead-drop.noopt.stderr b/tests/ui/consts/required-consts/collect-in-dead-drop.noopt.stderr index 73790f7517d..b62b25bd3aa 100644 --- a/tests/ui/consts/required-consts/collect-in-dead-drop.noopt.stderr +++ b/tests/ui/consts/required-consts/collect-in-dead-drop.noopt.stderr @@ -2,7 +2,7 @@ error[E0080]: evaluation of `Fail::<i32>::C` failed --> $DIR/collect-in-dead-drop.rs:9:19 | LL | const C: () = panic!(); - | ^^^^^^^^ the evaluated program panicked at 'explicit panic', $DIR/collect-in-dead-drop.rs:9:19 + | ^^^^^^^^ evaluation panicked: explicit panic | = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/tests/ui/consts/required-consts/collect-in-dead-drop.opt.stderr b/tests/ui/consts/required-consts/collect-in-dead-drop.opt.stderr index 73790f7517d..b62b25bd3aa 100644 --- a/tests/ui/consts/required-consts/collect-in-dead-drop.opt.stderr +++ b/tests/ui/consts/required-consts/collect-in-dead-drop.opt.stderr @@ -2,7 +2,7 @@ error[E0080]: evaluation of `Fail::<i32>::C` failed --> $DIR/collect-in-dead-drop.rs:9:19 | LL | const C: () = panic!(); - | ^^^^^^^^ the evaluated program panicked at 'explicit panic', $DIR/collect-in-dead-drop.rs:9:19 + | ^^^^^^^^ evaluation panicked: explicit panic | = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/tests/ui/consts/required-consts/collect-in-dead-fn-behind-assoc-type.noopt.stderr b/tests/ui/consts/required-consts/collect-in-dead-fn-behind-assoc-type.noopt.stderr index 706c0d55b62..c8a7cf983c4 100644 --- a/tests/ui/consts/required-consts/collect-in-dead-fn-behind-assoc-type.noopt.stderr +++ b/tests/ui/consts/required-consts/collect-in-dead-fn-behind-assoc-type.noopt.stderr @@ -2,7 +2,7 @@ error[E0080]: evaluation of `Fail::<i32>::C` failed --> $DIR/collect-in-dead-fn-behind-assoc-type.rs:10:19 | LL | const C: () = panic!(); - | ^^^^^^^^ the evaluated program panicked at 'explicit panic', $DIR/collect-in-dead-fn-behind-assoc-type.rs:10:19 + | ^^^^^^^^ evaluation panicked: explicit panic | = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/tests/ui/consts/required-consts/collect-in-dead-fn-behind-assoc-type.opt.stderr b/tests/ui/consts/required-consts/collect-in-dead-fn-behind-assoc-type.opt.stderr index 706c0d55b62..c8a7cf983c4 100644 --- a/tests/ui/consts/required-consts/collect-in-dead-fn-behind-assoc-type.opt.stderr +++ b/tests/ui/consts/required-consts/collect-in-dead-fn-behind-assoc-type.opt.stderr @@ -2,7 +2,7 @@ error[E0080]: evaluation of `Fail::<i32>::C` failed --> $DIR/collect-in-dead-fn-behind-assoc-type.rs:10:19 | LL | const C: () = panic!(); - | ^^^^^^^^ the evaluated program panicked at 'explicit panic', $DIR/collect-in-dead-fn-behind-assoc-type.rs:10:19 + | ^^^^^^^^ evaluation panicked: explicit panic | = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/tests/ui/consts/required-consts/collect-in-dead-fn-behind-generic.noopt.stderr b/tests/ui/consts/required-consts/collect-in-dead-fn-behind-generic.noopt.stderr index 581edd2b7b8..1e68d66cf5e 100644 --- a/tests/ui/consts/required-consts/collect-in-dead-fn-behind-generic.noopt.stderr +++ b/tests/ui/consts/required-consts/collect-in-dead-fn-behind-generic.noopt.stderr @@ -2,7 +2,7 @@ error[E0080]: evaluation of `Fail::<i32>::C` failed --> $DIR/collect-in-dead-fn-behind-generic.rs:9:19 | LL | const C: () = panic!(); - | ^^^^^^^^ the evaluated program panicked at 'explicit panic', $DIR/collect-in-dead-fn-behind-generic.rs:9:19 + | ^^^^^^^^ evaluation panicked: explicit panic | = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/tests/ui/consts/required-consts/collect-in-dead-fn-behind-generic.opt.stderr b/tests/ui/consts/required-consts/collect-in-dead-fn-behind-generic.opt.stderr index 581edd2b7b8..1e68d66cf5e 100644 --- a/tests/ui/consts/required-consts/collect-in-dead-fn-behind-generic.opt.stderr +++ b/tests/ui/consts/required-consts/collect-in-dead-fn-behind-generic.opt.stderr @@ -2,7 +2,7 @@ error[E0080]: evaluation of `Fail::<i32>::C` failed --> $DIR/collect-in-dead-fn-behind-generic.rs:9:19 | LL | const C: () = panic!(); - | ^^^^^^^^ the evaluated program panicked at 'explicit panic', $DIR/collect-in-dead-fn-behind-generic.rs:9:19 + | ^^^^^^^^ evaluation panicked: explicit panic | = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/tests/ui/consts/required-consts/collect-in-dead-fn-behind-opaque-type.noopt.stderr b/tests/ui/consts/required-consts/collect-in-dead-fn-behind-opaque-type.noopt.stderr index 07e46b8a816..a9cc56fba45 100644 --- a/tests/ui/consts/required-consts/collect-in-dead-fn-behind-opaque-type.noopt.stderr +++ b/tests/ui/consts/required-consts/collect-in-dead-fn-behind-opaque-type.noopt.stderr @@ -2,7 +2,7 @@ error[E0080]: evaluation of `m::Fail::<i32>::C` failed --> $DIR/collect-in-dead-fn-behind-opaque-type.rs:11:23 | LL | const C: () = panic!(); - | ^^^^^^^^ the evaluated program panicked at 'explicit panic', $DIR/collect-in-dead-fn-behind-opaque-type.rs:11:23 + | ^^^^^^^^ evaluation panicked: explicit panic | = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/tests/ui/consts/required-consts/collect-in-dead-fn-behind-opaque-type.opt.stderr b/tests/ui/consts/required-consts/collect-in-dead-fn-behind-opaque-type.opt.stderr index 07e46b8a816..a9cc56fba45 100644 --- a/tests/ui/consts/required-consts/collect-in-dead-fn-behind-opaque-type.opt.stderr +++ b/tests/ui/consts/required-consts/collect-in-dead-fn-behind-opaque-type.opt.stderr @@ -2,7 +2,7 @@ error[E0080]: evaluation of `m::Fail::<i32>::C` failed --> $DIR/collect-in-dead-fn-behind-opaque-type.rs:11:23 | LL | const C: () = panic!(); - | ^^^^^^^^ the evaluated program panicked at 'explicit panic', $DIR/collect-in-dead-fn-behind-opaque-type.rs:11:23 + | ^^^^^^^^ evaluation panicked: explicit panic | = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/tests/ui/consts/required-consts/collect-in-dead-fn.noopt.stderr b/tests/ui/consts/required-consts/collect-in-dead-fn.noopt.stderr index 52462076ff9..ec549561a17 100644 --- a/tests/ui/consts/required-consts/collect-in-dead-fn.noopt.stderr +++ b/tests/ui/consts/required-consts/collect-in-dead-fn.noopt.stderr @@ -2,7 +2,7 @@ error[E0080]: evaluation of `Fail::<i32>::C` failed --> $DIR/collect-in-dead-fn.rs:9:19 | LL | const C: () = panic!(); - | ^^^^^^^^ the evaluated program panicked at 'explicit panic', $DIR/collect-in-dead-fn.rs:9:19 + | ^^^^^^^^ evaluation panicked: explicit panic | = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/tests/ui/consts/required-consts/collect-in-dead-fn.opt.stderr b/tests/ui/consts/required-consts/collect-in-dead-fn.opt.stderr index 52462076ff9..ec549561a17 100644 --- a/tests/ui/consts/required-consts/collect-in-dead-fn.opt.stderr +++ b/tests/ui/consts/required-consts/collect-in-dead-fn.opt.stderr @@ -2,7 +2,7 @@ error[E0080]: evaluation of `Fail::<i32>::C` failed --> $DIR/collect-in-dead-fn.rs:9:19 | LL | const C: () = panic!(); - | ^^^^^^^^ the evaluated program panicked at 'explicit panic', $DIR/collect-in-dead-fn.rs:9:19 + | ^^^^^^^^ evaluation panicked: explicit panic | = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/tests/ui/consts/required-consts/collect-in-dead-fnptr-in-const.noopt.stderr b/tests/ui/consts/required-consts/collect-in-dead-fnptr-in-const.noopt.stderr index dea2a342383..dfaf69d52b2 100644 --- a/tests/ui/consts/required-consts/collect-in-dead-fnptr-in-const.noopt.stderr +++ b/tests/ui/consts/required-consts/collect-in-dead-fnptr-in-const.noopt.stderr @@ -2,7 +2,7 @@ error[E0080]: evaluation of `Late::<i32>::FAIL` failed --> $DIR/collect-in-dead-fnptr-in-const.rs:9:22 | LL | const FAIL: () = panic!(); - | ^^^^^^^^ the evaluated program panicked at 'explicit panic', $DIR/collect-in-dead-fnptr-in-const.rs:9:22 + | ^^^^^^^^ evaluation panicked: explicit panic | = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/tests/ui/consts/required-consts/collect-in-dead-fnptr-in-const.opt.stderr b/tests/ui/consts/required-consts/collect-in-dead-fnptr-in-const.opt.stderr index dea2a342383..dfaf69d52b2 100644 --- a/tests/ui/consts/required-consts/collect-in-dead-fnptr-in-const.opt.stderr +++ b/tests/ui/consts/required-consts/collect-in-dead-fnptr-in-const.opt.stderr @@ -2,7 +2,7 @@ error[E0080]: evaluation of `Late::<i32>::FAIL` failed --> $DIR/collect-in-dead-fnptr-in-const.rs:9:22 | LL | const FAIL: () = panic!(); - | ^^^^^^^^ the evaluated program panicked at 'explicit panic', $DIR/collect-in-dead-fnptr-in-const.rs:9:22 + | ^^^^^^^^ evaluation panicked: explicit panic | = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/tests/ui/consts/required-consts/collect-in-dead-fnptr.noopt.stderr b/tests/ui/consts/required-consts/collect-in-dead-fnptr.noopt.stderr index 51c68782687..7cbd423cdc0 100644 --- a/tests/ui/consts/required-consts/collect-in-dead-fnptr.noopt.stderr +++ b/tests/ui/consts/required-consts/collect-in-dead-fnptr.noopt.stderr @@ -2,7 +2,7 @@ error[E0080]: evaluation of `Fail::<i32>::C` failed --> $DIR/collect-in-dead-fnptr.rs:9:19 | LL | const C: () = panic!(); - | ^^^^^^^^ the evaluated program panicked at 'explicit panic', $DIR/collect-in-dead-fnptr.rs:9:19 + | ^^^^^^^^ evaluation panicked: explicit panic | = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/tests/ui/consts/required-consts/collect-in-dead-fnptr.opt.stderr b/tests/ui/consts/required-consts/collect-in-dead-fnptr.opt.stderr index 51c68782687..7cbd423cdc0 100644 --- a/tests/ui/consts/required-consts/collect-in-dead-fnptr.opt.stderr +++ b/tests/ui/consts/required-consts/collect-in-dead-fnptr.opt.stderr @@ -2,7 +2,7 @@ error[E0080]: evaluation of `Fail::<i32>::C` failed --> $DIR/collect-in-dead-fnptr.rs:9:19 | LL | const C: () = panic!(); - | ^^^^^^^^ the evaluated program panicked at 'explicit panic', $DIR/collect-in-dead-fnptr.rs:9:19 + | ^^^^^^^^ evaluation panicked: explicit panic | = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/tests/ui/consts/required-consts/collect-in-dead-move.noopt.stderr b/tests/ui/consts/required-consts/collect-in-dead-move.noopt.stderr index 2ab1f80e2d3..58e9d7a2c9a 100644 --- a/tests/ui/consts/required-consts/collect-in-dead-move.noopt.stderr +++ b/tests/ui/consts/required-consts/collect-in-dead-move.noopt.stderr @@ -2,7 +2,7 @@ error[E0080]: evaluation of `Fail::<i32>::C` failed --> $DIR/collect-in-dead-move.rs:9:19 | LL | const C: () = panic!(); - | ^^^^^^^^ the evaluated program panicked at 'explicit panic', $DIR/collect-in-dead-move.rs:9:19 + | ^^^^^^^^ evaluation panicked: explicit panic | = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/tests/ui/consts/required-consts/collect-in-dead-move.opt.stderr b/tests/ui/consts/required-consts/collect-in-dead-move.opt.stderr index 2ab1f80e2d3..58e9d7a2c9a 100644 --- a/tests/ui/consts/required-consts/collect-in-dead-move.opt.stderr +++ b/tests/ui/consts/required-consts/collect-in-dead-move.opt.stderr @@ -2,7 +2,7 @@ error[E0080]: evaluation of `Fail::<i32>::C` failed --> $DIR/collect-in-dead-move.rs:9:19 | LL | const C: () = panic!(); - | ^^^^^^^^ the evaluated program panicked at 'explicit panic', $DIR/collect-in-dead-move.rs:9:19 + | ^^^^^^^^ evaluation panicked: explicit panic | = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/tests/ui/consts/required-consts/collect-in-dead-vtable.noopt.stderr b/tests/ui/consts/required-consts/collect-in-dead-vtable.noopt.stderr index b4e18706489..6c78ca79fd6 100644 --- a/tests/ui/consts/required-consts/collect-in-dead-vtable.noopt.stderr +++ b/tests/ui/consts/required-consts/collect-in-dead-vtable.noopt.stderr @@ -2,7 +2,7 @@ error[E0080]: evaluation of `Fail::<i32>::C` failed --> $DIR/collect-in-dead-vtable.rs:9:19 | LL | const C: () = panic!(); - | ^^^^^^^^ the evaluated program panicked at 'explicit panic', $DIR/collect-in-dead-vtable.rs:9:19 + | ^^^^^^^^ evaluation panicked: explicit panic | = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/tests/ui/consts/required-consts/collect-in-dead-vtable.opt.stderr b/tests/ui/consts/required-consts/collect-in-dead-vtable.opt.stderr index b4e18706489..6c78ca79fd6 100644 --- a/tests/ui/consts/required-consts/collect-in-dead-vtable.opt.stderr +++ b/tests/ui/consts/required-consts/collect-in-dead-vtable.opt.stderr @@ -2,7 +2,7 @@ error[E0080]: evaluation of `Fail::<i32>::C` failed --> $DIR/collect-in-dead-vtable.rs:9:19 | LL | const C: () = panic!(); - | ^^^^^^^^ the evaluated program panicked at 'explicit panic', $DIR/collect-in-dead-vtable.rs:9:19 + | ^^^^^^^^ evaluation panicked: explicit panic | = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/tests/ui/consts/required-consts/collect-in-promoted-const.noopt.stderr b/tests/ui/consts/required-consts/collect-in-promoted-const.noopt.stderr index a50c49d5362..fd231e1101d 100644 --- a/tests/ui/consts/required-consts/collect-in-promoted-const.noopt.stderr +++ b/tests/ui/consts/required-consts/collect-in-promoted-const.noopt.stderr @@ -2,7 +2,7 @@ error[E0080]: evaluation of `Fail::<i32>::C` failed --> $DIR/collect-in-promoted-const.rs:9:19 | LL | const C: () = panic!(); - | ^^^^^^^^ the evaluated program panicked at 'explicit panic', $DIR/collect-in-promoted-const.rs:9:19 + | ^^^^^^^^ evaluation panicked: explicit panic | = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/tests/ui/consts/required-consts/collect-in-promoted-const.opt.stderr b/tests/ui/consts/required-consts/collect-in-promoted-const.opt.stderr index cf0aa8ef7a7..0f3f77769ad 100644 --- a/tests/ui/consts/required-consts/collect-in-promoted-const.opt.stderr +++ b/tests/ui/consts/required-consts/collect-in-promoted-const.opt.stderr @@ -2,7 +2,7 @@ error[E0080]: evaluation of `Fail::<T>::C` failed --> $DIR/collect-in-promoted-const.rs:9:19 | LL | const C: () = panic!(); - | ^^^^^^^^ the evaluated program panicked at 'explicit panic', $DIR/collect-in-promoted-const.rs:9:19 + | ^^^^^^^^ evaluation panicked: explicit panic | = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info) @@ -16,7 +16,7 @@ error[E0080]: evaluation of `Fail::<i32>::C` failed --> $DIR/collect-in-promoted-const.rs:9:19 | LL | const C: () = panic!(); - | ^^^^^^^^ the evaluated program panicked at 'explicit panic', $DIR/collect-in-promoted-const.rs:9:19 + | ^^^^^^^^ evaluation panicked: explicit panic | = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/tests/ui/consts/required-consts/interpret-in-const-called-fn.noopt.stderr b/tests/ui/consts/required-consts/interpret-in-const-called-fn.noopt.stderr index 0e3bbbcc2ec..d2145089028 100644 --- a/tests/ui/consts/required-consts/interpret-in-const-called-fn.noopt.stderr +++ b/tests/ui/consts/required-consts/interpret-in-const-called-fn.noopt.stderr @@ -2,7 +2,7 @@ error[E0080]: evaluation of `Fail::<i32>::C` failed --> $DIR/interpret-in-const-called-fn.rs:8:19 | LL | const C: () = panic!(); - | ^^^^^^^^ the evaluated program panicked at 'explicit panic', $DIR/interpret-in-const-called-fn.rs:8:19 + | ^^^^^^^^ evaluation panicked: explicit panic | = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/tests/ui/consts/required-consts/interpret-in-const-called-fn.opt.stderr b/tests/ui/consts/required-consts/interpret-in-const-called-fn.opt.stderr index 0e3bbbcc2ec..d2145089028 100644 --- a/tests/ui/consts/required-consts/interpret-in-const-called-fn.opt.stderr +++ b/tests/ui/consts/required-consts/interpret-in-const-called-fn.opt.stderr @@ -2,7 +2,7 @@ error[E0080]: evaluation of `Fail::<i32>::C` failed --> $DIR/interpret-in-const-called-fn.rs:8:19 | LL | const C: () = panic!(); - | ^^^^^^^^ the evaluated program panicked at 'explicit panic', $DIR/interpret-in-const-called-fn.rs:8:19 + | ^^^^^^^^ evaluation panicked: explicit panic | = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/tests/ui/consts/required-consts/interpret-in-promoted.noopt.stderr b/tests/ui/consts/required-consts/interpret-in-promoted.noopt.stderr index 6ab991b6471..2bd0b92d4c2 100644 --- a/tests/ui/consts/required-consts/interpret-in-promoted.noopt.stderr +++ b/tests/ui/consts/required-consts/interpret-in-promoted.noopt.stderr @@ -1,20 +1,16 @@ error[E0080]: evaluation of constant value failed - --> $SRC_DIR/core/src/hint.rs:LL:COL + --> $DIR/interpret-in-promoted.rs:13:28 | - = note: entering unreachable code +LL | let _x: &'static () = &ub(); + | ^^^^ entering unreachable code | -note: inside `unreachable_unchecked` - --> $SRC_DIR/core/src/hint.rs:LL:COL note: inside `ub` --> $DIR/interpret-in-promoted.rs:7:5 | LL | std::hint::unreachable_unchecked(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -note: inside `FOO` - --> $DIR/interpret-in-promoted.rs:13:28 - | -LL | let _x: &'static () = &ub(); - | ^^^^ +note: inside `unreachable_unchecked` + --> $SRC_DIR/core/src/hint.rs:LL:COL note: erroneous constant encountered --> $DIR/interpret-in-promoted.rs:13:27 diff --git a/tests/ui/consts/required-consts/interpret-in-promoted.opt.stderr b/tests/ui/consts/required-consts/interpret-in-promoted.opt.stderr index 6ab991b6471..2bd0b92d4c2 100644 --- a/tests/ui/consts/required-consts/interpret-in-promoted.opt.stderr +++ b/tests/ui/consts/required-consts/interpret-in-promoted.opt.stderr @@ -1,20 +1,16 @@ error[E0080]: evaluation of constant value failed - --> $SRC_DIR/core/src/hint.rs:LL:COL + --> $DIR/interpret-in-promoted.rs:13:28 | - = note: entering unreachable code +LL | let _x: &'static () = &ub(); + | ^^^^ entering unreachable code | -note: inside `unreachable_unchecked` - --> $SRC_DIR/core/src/hint.rs:LL:COL note: inside `ub` --> $DIR/interpret-in-promoted.rs:7:5 | LL | std::hint::unreachable_unchecked(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -note: inside `FOO` - --> $DIR/interpret-in-promoted.rs:13:28 - | -LL | let _x: &'static () = &ub(); - | ^^^^ +note: inside `unreachable_unchecked` + --> $SRC_DIR/core/src/hint.rs:LL:COL note: erroneous constant encountered --> $DIR/interpret-in-promoted.rs:13:27 diff --git a/tests/ui/consts/required-consts/interpret-in-promoted.rs b/tests/ui/consts/required-consts/interpret-in-promoted.rs index 48caece6ff5..2c7b3375054 100644 --- a/tests/ui/consts/required-consts/interpret-in-promoted.rs +++ b/tests/ui/consts/required-consts/interpret-in-promoted.rs @@ -4,13 +4,13 @@ //! Make sure we evaluate const fn calls even if they get promoted and their result ignored. const unsafe fn ub() { - std::hint::unreachable_unchecked(); + std::hint::unreachable_unchecked(); //~ inside `ub` } pub const FOO: () = unsafe { // Make sure that this gets promoted and then fails to evaluate, and we deal with that // correctly. - let _x: &'static () = &ub(); //~ erroneous constant + let _x: &'static () = &ub(); //~ ERROR evaluation of constant value failed }; fn main() {} diff --git a/tests/ui/consts/required-consts/interpret-in-static.noopt.stderr b/tests/ui/consts/required-consts/interpret-in-static.noopt.stderr index 5e8da609e76..f999bf370b8 100644 --- a/tests/ui/consts/required-consts/interpret-in-static.noopt.stderr +++ b/tests/ui/consts/required-consts/interpret-in-static.noopt.stderr @@ -2,7 +2,7 @@ error[E0080]: evaluation of `Fail::<i32>::C` failed --> $DIR/interpret-in-static.rs:8:19 | LL | const C: () = panic!(); - | ^^^^^^^^ the evaluated program panicked at 'explicit panic', $DIR/interpret-in-static.rs:8:19 + | ^^^^^^^^ evaluation panicked: explicit panic | = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/tests/ui/consts/required-consts/interpret-in-static.opt.stderr b/tests/ui/consts/required-consts/interpret-in-static.opt.stderr index 5e8da609e76..f999bf370b8 100644 --- a/tests/ui/consts/required-consts/interpret-in-static.opt.stderr +++ b/tests/ui/consts/required-consts/interpret-in-static.opt.stderr @@ -2,7 +2,7 @@ error[E0080]: evaluation of `Fail::<i32>::C` failed --> $DIR/interpret-in-static.rs:8:19 | LL | const C: () = panic!(); - | ^^^^^^^^ the evaluated program panicked at 'explicit panic', $DIR/interpret-in-static.rs:8:19 + | ^^^^^^^^ evaluation panicked: explicit panic | = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/tests/ui/consts/uninhabited-const-issue-61744.rs b/tests/ui/consts/uninhabited-const-issue-61744.rs index 19ee842c36b..743aaf58ef5 100644 --- a/tests/ui/consts/uninhabited-const-issue-61744.rs +++ b/tests/ui/consts/uninhabited-const-issue-61744.rs @@ -1,7 +1,7 @@ //@ build-fail pub const unsafe fn fake_type<T>() -> T { - hint_unreachable() //~ ERROR evaluation of `<i32 as Const>::CONSTANT` failed + hint_unreachable() //~ inside } pub const unsafe fn hint_unreachable() -> ! { @@ -9,7 +9,7 @@ pub const unsafe fn hint_unreachable() -> ! { } trait Const { - const CONSTANT: i32 = unsafe { fake_type() }; //~ inside + const CONSTANT: i32 = unsafe { fake_type() }; //~ ERROR evaluation of `fake_type::<!>` failed } impl<T> Const for T {} diff --git a/tests/ui/consts/uninhabited-const-issue-61744.stderr b/tests/ui/consts/uninhabited-const-issue-61744.stderr index 7575ad730b3..dd175b92593 100644 --- a/tests/ui/consts/uninhabited-const-issue-61744.stderr +++ b/tests/ui/consts/uninhabited-const-issue-61744.stderr @@ -1,10 +1,10 @@ -error[E0080]: evaluation of `<i32 as Const>::CONSTANT` failed - --> $DIR/uninhabited-const-issue-61744.rs:4:5 +error[E0080]: evaluation of `fake_type::<!>` failed + --> $DIR/uninhabited-const-issue-61744.rs:12:36 | -LL | hint_unreachable() - | ^^^^^^^^^^^^^^^^^^ reached the configured maximum number of stack frames +LL | const CONSTANT: i32 = unsafe { fake_type() }; + | ^^^^^^^^^^^ reached the configured maximum number of stack frames | -note: inside `fake_type::<!>` +note: inside `fake_type::<i32>` --> $DIR/uninhabited-const-issue-61744.rs:4:5 | LL | hint_unreachable() @@ -634,16 +634,11 @@ note: inside `hint_unreachable` | LL | fake_type() | ^^^^^^^^^^^ -note: inside `fake_type::<i32>` +note: inside `fake_type::<!>` --> $DIR/uninhabited-const-issue-61744.rs:4:5 | LL | hint_unreachable() - | ^^^^^^^^^^^^^^^^^^ -note: inside `<i32 as Const>::CONSTANT` - --> $DIR/uninhabited-const-issue-61744.rs:12:36 - | -LL | const CONSTANT: i32 = unsafe { fake_type() }; - | ^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^ the failure occurred here error: aborting due to 1 previous error diff --git a/tests/ui/coroutine/gen_block.e2024.stderr b/tests/ui/coroutine/gen_block.e2024.stderr index 0491bdbc2e1..347f111e79f 100644 --- a/tests/ui/coroutine/gen_block.e2024.stderr +++ b/tests/ui/coroutine/gen_block.e2024.stderr @@ -18,16 +18,6 @@ LL | let _ = #[coroutine] || {}; = help: add `#![feature(coroutines)]` 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[E0658]: yield syntax is experimental - --> $DIR/gen_block.rs:16:16 - | -LL | let _ = || yield true; - | ^^^^^^^^^^ - | - = note: see issue #43122 <https://github.com/rust-lang/rust/issues/43122> for more information - = help: add `#![feature(coroutines)]` 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: `yield` can only be used in `#[coroutine]` closures, or `gen` blocks --> $DIR/gen_block.rs:16:16 | @@ -39,23 +29,13 @@ help: use `#[coroutine]` to make this closure a coroutine LL | let _ = #[coroutine] || yield true; | ++++++++++++ -error[E0658]: yield syntax is experimental - --> $DIR/gen_block.rs:20:29 - | -LL | let _ = #[coroutine] || yield true; - | ^^^^^^^^^^ - | - = note: see issue #43122 <https://github.com/rust-lang/rust/issues/43122> for more information - = help: add `#![feature(coroutines)]` 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[E0282]: type annotations needed --> $DIR/gen_block.rs:7:13 | LL | let x = gen {}; | ^^^^^^ cannot infer type -error: aborting due to 6 previous errors +error: aborting due to 4 previous errors Some errors have detailed explanations: E0282, E0658. For more information about an error, try `rustc --explain E0282`. diff --git a/tests/ui/coroutine/gen_block.none.stderr b/tests/ui/coroutine/gen_block.none.stderr index 43437793005..ed744f2957a 100644 --- a/tests/ui/coroutine/gen_block.none.stderr +++ b/tests/ui/coroutine/gen_block.none.stderr @@ -71,7 +71,7 @@ LL | let _ = || yield true; | ^^^^^^^^^^ | = note: see issue #43122 <https://github.com/rust-lang/rust/issues/43122> for more information - = help: add `#![feature(coroutines)]` to the crate attributes to enable + = help: add `#![feature(yield_expr)]` 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: `yield` can only be used in `#[coroutine]` closures, or `gen` blocks @@ -92,7 +92,7 @@ LL | let _ = #[coroutine] || yield true; | ^^^^^^^^^^ | = note: see issue #43122 <https://github.com/rust-lang/rust/issues/43122> for more information - = help: add `#![feature(coroutines)]` to the crate attributes to enable + = help: add `#![feature(yield_expr)]` 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 11 previous errors diff --git a/tests/ui/coroutine/gen_block.rs b/tests/ui/coroutine/gen_block.rs index 4494d654eeb..e3734dd4cdf 100644 --- a/tests/ui/coroutine/gen_block.rs +++ b/tests/ui/coroutine/gen_block.rs @@ -14,12 +14,12 @@ fn main() { //[none]~^ ERROR: cannot find let _ = || yield true; //[none]~ ERROR yield syntax is experimental - //~^ ERROR yield syntax is experimental + //[none]~^ ERROR yield syntax is experimental //~^^ ERROR `yield` can only be used in let _ = #[coroutine] || yield true; //[none]~ ERROR yield syntax is experimental //~^ ERROR `#[coroutine]` attribute is an experimental feature - //~^^ ERROR yield syntax is experimental + //[none]~^^ ERROR yield syntax is experimental let _ = #[coroutine] || {}; //~^ ERROR `#[coroutine]` attribute is an experimental feature diff --git a/tests/ui/crate-loading/crateresolve1.stderr b/tests/ui/crate-loading/crateresolve1.stderr index 47131a96bf4..b17330fb9d9 100644 --- a/tests/ui/crate-loading/crateresolve1.stderr +++ b/tests/ui/crate-loading/crateresolve1.stderr @@ -4,9 +4,9 @@ error[E0464]: multiple candidates for `rlib` dependency `crateresolve1` found LL | extern crate crateresolve1; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: candidate #1: $TEST_BUILD_DIR/crate-loading/crateresolve1/auxiliary/libcrateresolve1-1.somelib - = note: candidate #2: $TEST_BUILD_DIR/crate-loading/crateresolve1/auxiliary/libcrateresolve1-2.somelib - = note: candidate #3: $TEST_BUILD_DIR/crate-loading/crateresolve1/auxiliary/libcrateresolve1-3.somelib + = note: candidate #1: $TEST_BUILD_DIR/auxiliary/libcrateresolve1-1.somelib + = note: candidate #2: $TEST_BUILD_DIR/auxiliary/libcrateresolve1-2.somelib + = note: candidate #3: $TEST_BUILD_DIR/auxiliary/libcrateresolve1-3.somelib error: aborting due to 1 previous error diff --git a/tests/ui/crate-loading/crateresolve2.stderr b/tests/ui/crate-loading/crateresolve2.stderr index 3dc89dabde6..0c488f3fd07 100644 --- a/tests/ui/crate-loading/crateresolve2.stderr +++ b/tests/ui/crate-loading/crateresolve2.stderr @@ -4,9 +4,9 @@ error[E0464]: multiple candidates for `rmeta` dependency `crateresolve2` found LL | extern crate crateresolve2; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: candidate #1: $TEST_BUILD_DIR/crate-loading/crateresolve2/auxiliary/libcrateresolve2-1.rmeta - = note: candidate #2: $TEST_BUILD_DIR/crate-loading/crateresolve2/auxiliary/libcrateresolve2-2.rmeta - = note: candidate #3: $TEST_BUILD_DIR/crate-loading/crateresolve2/auxiliary/libcrateresolve2-3.rmeta + = note: candidate #1: $TEST_BUILD_DIR/auxiliary/libcrateresolve2-1.rmeta + = note: candidate #2: $TEST_BUILD_DIR/auxiliary/libcrateresolve2-2.rmeta + = note: candidate #3: $TEST_BUILD_DIR/auxiliary/libcrateresolve2-3.rmeta error: aborting due to 1 previous error diff --git a/tests/ui/deprecation/deprecation-sanity.rs b/tests/ui/deprecation/deprecation-sanity.rs index 9ea75b68f81..d5b149b18ed 100644 --- a/tests/ui/deprecation/deprecation-sanity.rs +++ b/tests/ui/deprecation/deprecation-sanity.rs @@ -4,16 +4,16 @@ mod bogus_attribute_types_1 { #[deprecated(since = "a", note = "a", reason)] //~ ERROR unknown meta item 'reason' fn f1() { } - #[deprecated(since = "a", note)] //~ ERROR incorrect meta item + #[deprecated(since = "a", note)] //~ ERROR expected a quoted string literal fn f2() { } - #[deprecated(since, note = "a")] //~ ERROR incorrect meta item + #[deprecated(since, note = "a")] //~ ERROR expected a quoted string literal fn f3() { } - #[deprecated(since = "a", note(b))] //~ ERROR incorrect meta item + #[deprecated(since = "a", note(b))] //~ ERROR expected a quoted string literal fn f5() { } - #[deprecated(since(b), note = "a")] //~ ERROR incorrect meta item + #[deprecated(since(b), note = "a")] //~ ERROR expected a quoted string literal fn f6() { } #[deprecated(note = b"test")] //~ ERROR literal in `deprecated` value must be a string diff --git a/tests/ui/deprecation/deprecation-sanity.stderr b/tests/ui/deprecation/deprecation-sanity.stderr index 383212ad9b4..53047d40cb2 100644 --- a/tests/ui/deprecation/deprecation-sanity.stderr +++ b/tests/ui/deprecation/deprecation-sanity.stderr @@ -1,40 +1,28 @@ -error: multiple `deprecated` attributes - --> $DIR/deprecation-sanity.rs:27:1 - | -LL | #[deprecated(since = "a", note = "b")] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute - | -note: attribute also specified here - --> $DIR/deprecation-sanity.rs:26:1 - | -LL | #[deprecated(since = "a", note = "b")] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - error[E0541]: unknown meta item 'reason' --> $DIR/deprecation-sanity.rs:4:43 | LL | #[deprecated(since = "a", note = "a", reason)] | ^^^^^^ expected one of `since`, `note` -error[E0539]: incorrect meta item +error[E0539]: expected a quoted string literal --> $DIR/deprecation-sanity.rs:7:31 | LL | #[deprecated(since = "a", note)] | ^^^^ -error[E0539]: incorrect meta item +error[E0539]: expected a quoted string literal --> $DIR/deprecation-sanity.rs:10:18 | LL | #[deprecated(since, note = "a")] | ^^^^^ -error[E0539]: incorrect meta item +error[E0539]: expected a quoted string literal --> $DIR/deprecation-sanity.rs:13:31 | LL | #[deprecated(since = "a", note(b))] | ^^^^^^^ -error[E0539]: incorrect meta item +error[E0539]: expected a quoted string literal --> $DIR/deprecation-sanity.rs:16:18 | LL | #[deprecated(since(b), note = "a")] @@ -54,6 +42,18 @@ error[E0565]: item in `deprecated` must be a key/value pair LL | #[deprecated("test")] | ^^^^^^ +error: multiple `deprecated` attributes + --> $DIR/deprecation-sanity.rs:27:1 + | +LL | #[deprecated(since = "a", note = "b")] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute + | +note: attribute also specified here + --> $DIR/deprecation-sanity.rs:26:1 + | +LL | #[deprecated(since = "a", note = "b")] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + error[E0538]: multiple 'since' items --> $DIR/deprecation-sanity.rs:30:27 | diff --git a/tests/ui/deprecation/issue-66340-deprecated-attr-non-meta-grammar.rs b/tests/ui/deprecation/issue-66340-deprecated-attr-non-meta-grammar.rs index 6653bd15ddd..c5433151a8f 100644 --- a/tests/ui/deprecation/issue-66340-deprecated-attr-non-meta-grammar.rs +++ b/tests/ui/deprecation/issue-66340-deprecated-attr-non-meta-grammar.rs @@ -3,7 +3,7 @@ // was a well-formed `MetaItem`. fn main() { - foo() + foo() //~ WARNING use of deprecated function `foo` } #[deprecated(note = test)] diff --git a/tests/ui/deprecation/issue-66340-deprecated-attr-non-meta-grammar.stderr b/tests/ui/deprecation/issue-66340-deprecated-attr-non-meta-grammar.stderr index a030da5068c..2ff8534b276 100644 --- a/tests/ui/deprecation/issue-66340-deprecated-attr-non-meta-grammar.stderr +++ b/tests/ui/deprecation/issue-66340-deprecated-attr-non-meta-grammar.stderr @@ -9,5 +9,13 @@ help: surround the identifier with quotation marks to make it into a string lite LL | #[deprecated(note = "test")] | + + -error: aborting due to 1 previous error +warning: use of deprecated function `foo` + --> $DIR/issue-66340-deprecated-attr-non-meta-grammar.rs:6:5 + | +LL | foo() + | ^^^ + | + = note: `#[warn(deprecated)]` on by default + +error: aborting due to 1 previous error; 1 warning emitted diff --git a/tests/ui/deref-non-pointer.stderr b/tests/ui/deref-non-pointer.stderr index 2e5e574fb6c..3ee354819e5 100644 --- a/tests/ui/deref-non-pointer.stderr +++ b/tests/ui/deref-non-pointer.stderr @@ -2,7 +2,7 @@ error[E0614]: type `{integer}` cannot be dereferenced --> $DIR/deref-non-pointer.rs:2:9 | LL | match *1 { - | ^^ + | ^^ can't be dereferenced error: aborting due to 1 previous error diff --git a/tests/ui/deriving/deriving-coerce-pointee-neg.rs b/tests/ui/deriving/deriving-coerce-pointee-neg.rs index 6577500d8eb..2713366945e 100644 --- a/tests/ui/deriving/deriving-coerce-pointee-neg.rs +++ b/tests/ui/deriving/deriving-coerce-pointee-neg.rs @@ -142,4 +142,27 @@ struct TryToWipeRepr<'a, #[pointee] T: ?Sized> { ptr: &'a T, } +#[repr(transparent)] +#[derive(CoercePointee)] +//~^ ERROR for `RcWithId<T>` to have a valid implementation of `CoerceUnsized`, it must be possible to coerce the field of type `Rc<(i32, Box<T>)>` +struct RcWithId<T: ?Sized> { + inner: std::rc::Rc<(i32, Box<T>)>, +} + +#[repr(transparent)] +#[derive(CoercePointee)] +//~^ ERROR implementing `CoerceUnsized` does not allow multiple fields to be coerced +struct MoreThanOneField<T: ?Sized> { + //~^ ERROR transparent struct needs at most one field with non-trivial size or alignment, but has 2 + inner1: Box<T>, + inner2: Box<T>, +} + +struct NotCoercePointeeData<T: ?Sized>(T); + +#[repr(transparent)] +#[derive(CoercePointee)] +//~^ ERROR for `UsingNonCoercePointeeData<T>` to have a valid implementation of `CoerceUnsized`, it must be possible to coerce the field of type `NotCoercePointeeData<T>` +struct UsingNonCoercePointeeData<T: ?Sized>(NotCoercePointeeData<T>); + fn main() {} diff --git a/tests/ui/deriving/deriving-coerce-pointee-neg.stderr b/tests/ui/deriving/deriving-coerce-pointee-neg.stderr index 999214bfa9f..d3d73132078 100644 --- a/tests/ui/deriving/deriving-coerce-pointee-neg.stderr +++ b/tests/ui/deriving/deriving-coerce-pointee-neg.stderr @@ -118,7 +118,55 @@ error[E0802]: `derive(CoercePointee)` is only applicable to `struct` with `repr( LL | struct TryToWipeRepr<'a, #[pointee] T: ?Sized> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error: aborting due to 17 previous errors +error: for `RcWithId<T>` to have a valid implementation of `CoerceUnsized`, it must be possible to coerce the field of type `Rc<(i32, Box<T>)>` + --> $DIR/deriving-coerce-pointee-neg.rs:146:10 + | +LL | #[derive(CoercePointee)] + | ^^^^^^^^^^^^^ +... +LL | inner: std::rc::Rc<(i32, Box<T>)>, + | --------------------------------- `Rc<(i32, Box<T>)>` must be a pointer, reference, or smart pointer that is allowed to be unsized + | + = note: this error originates in the derive macro `CoercePointee` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0375]: implementing `CoerceUnsized` does not allow multiple fields to be coerced + --> $DIR/deriving-coerce-pointee-neg.rs:153:10 + | +LL | #[derive(CoercePointee)] + | ^^^^^^^^^^^^^ + | +note: the trait `CoerceUnsized` may only be implemented when a single field is being coerced + --> $DIR/deriving-coerce-pointee-neg.rs:157:5 + | +LL | inner1: Box<T>, + | ^^^^^^^^^^^^^^ +LL | inner2: Box<T>, + | ^^^^^^^^^^^^^^ + = note: this error originates in the derive macro `CoercePointee` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: for `UsingNonCoercePointeeData<T>` to have a valid implementation of `CoerceUnsized`, it must be possible to coerce the field of type `NotCoercePointeeData<T>` + --> $DIR/deriving-coerce-pointee-neg.rs:164:10 + | +LL | #[derive(CoercePointee)] + | ^^^^^^^^^^^^^ +LL | +LL | struct UsingNonCoercePointeeData<T: ?Sized>(NotCoercePointeeData<T>); + | ----------------------- `NotCoercePointeeData<T>` must be a pointer, reference, or smart pointer that is allowed to be unsized + | + = note: this error originates in the derive macro `CoercePointee` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0690]: transparent struct needs at most one field with non-trivial size or alignment, but has 2 + --> $DIR/deriving-coerce-pointee-neg.rs:155:1 + | +LL | struct MoreThanOneField<T: ?Sized> { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ needs at most one field with non-trivial size or alignment, but has 2 +LL | +LL | inner1: Box<T>, + | -------------- this field has non-zero size or requires alignment +LL | inner2: Box<T>, + | -------------- this field has non-zero size or requires alignment + +error: aborting due to 21 previous errors -Some errors have detailed explanations: E0392, E0802. -For more information about an error, try `rustc --explain E0392`. +Some errors have detailed explanations: E0375, E0392, E0690, E0802. +For more information about an error, try `rustc --explain E0375`. diff --git a/tests/ui/deriving/deriving-with-helper.rs b/tests/ui/deriving/deriving-with-helper.rs index c71d553c892..df98bb6beb9 100644 --- a/tests/ui/deriving/deriving-with-helper.rs +++ b/tests/ui/deriving/deriving-with-helper.rs @@ -1,3 +1,4 @@ +//@ add-core-stubs //@ check-pass //@ compile-flags: --crate-type=lib @@ -8,6 +9,9 @@ #![no_core] +extern crate minicore; +use minicore::*; + #[rustc_builtin_macro] macro derive() {} @@ -26,9 +30,6 @@ mod default { } } -#[lang = "sized"] -trait Sized {} - #[derive(Default)] enum S { #[default] // OK diff --git a/tests/ui/diagnostic-width/E0271.ascii.stderr b/tests/ui/diagnostic-width/E0271.ascii.stderr index 9a9c12a938f..ad5f53e44be 100644 --- a/tests/ui/diagnostic-width/E0271.ascii.stderr +++ b/tests/ui/diagnostic-width/E0271.ascii.stderr @@ -1,5 +1,5 @@ error[E0271]: type mismatch resolving `<Result<..., ()> as Future>::Error == Foo` - --> $DIR/E0271.rs:20:5 + --> $DIR/E0271.rs:19:5 | LL | / Box::new( LL | | Ok::<_, ()>( @@ -10,12 +10,12 @@ LL | | ) | |_____^ type mismatch resolving `<Result<..., ()> as Future>::Error == Foo` | note: expected this to be `Foo` - --> $DIR/E0271.rs:10:18 + --> $DIR/E0271.rs:9:18 | LL | type Error = E; | ^ = note: required for the cast from `Box<Result<..., ()>>` to `Box<...>` - = note: the full name for the type has been written to '$TEST_BUILD_DIR/$FILE.long-type-hash.txt' + = note: the full name for the type has been written to '$TEST_BUILD_DIR/E0271.long-type-$LONG_TYPE_HASH.txt' = note: consider using `--verbose` to print the full type name to the console error: aborting due to 1 previous error diff --git a/tests/ui/diagnostic-width/E0271.rs b/tests/ui/diagnostic-width/E0271.rs index 06187721041..522bfb5b93f 100644 --- a/tests/ui/diagnostic-width/E0271.rs +++ b/tests/ui/diagnostic-width/E0271.rs @@ -1,7 +1,6 @@ //@ revisions: ascii unicode //@[ascii] compile-flags: --diagnostic-width=40 -Zwrite-long-types-to-disk=yes //@[unicode] compile-flags: -Zunstable-options --error-format=human-unicode --diagnostic-width=40 -Zwrite-long-types-to-disk=yes -//@ normalize-stderr: "'\$TEST_BUILD_DIR/.*\.long-type-\d+.txt'" -> "'$$TEST_BUILD_DIR/$$FILE.long-type-hash.txt'" trait Future { type Error; } diff --git a/tests/ui/diagnostic-width/E0271.unicode.stderr b/tests/ui/diagnostic-width/E0271.unicode.stderr index 9c3deae6660..91adf834101 100644 --- a/tests/ui/diagnostic-width/E0271.unicode.stderr +++ b/tests/ui/diagnostic-width/E0271.unicode.stderr @@ -1,5 +1,5 @@ error[E0271]: type mismatch resolving `<Result<..., ()> as Future>::Error == Foo` - ╭▸ $DIR/E0271.rs:20:5 + ╭▸ $DIR/E0271.rs:19:5 │ LL │ ┏ Box::new( LL │ ┃ Ok::<_, ()>( @@ -10,12 +10,12 @@ LL │ ┃ ) │ ┗━━━━━┛ type mismatch resolving `<Result<..., ()> as Future>::Error == Foo` ╰╴ note: expected this to be `Foo` - ╭▸ $DIR/E0271.rs:10:18 + ╭▸ $DIR/E0271.rs:9:18 │ LL │ type Error = E; │ ━ ├ note: required for the cast from `Box<Result<..., ()>>` to `Box<...>` - ├ note: the full name for the type has been written to '$TEST_BUILD_DIR/$FILE.long-type-hash.txt' + ├ note: the full name for the type has been written to '$TEST_BUILD_DIR/E0271.long-type-$LONG_TYPE_HASH.txt' ╰ note: consider using `--verbose` to print the full type name to the console error: aborting due to 1 previous error diff --git a/tests/ui/diagnostic-width/binop.rs b/tests/ui/diagnostic-width/binop.rs index 60ba40b8047..9e4e837f386 100644 --- a/tests/ui/diagnostic-width/binop.rs +++ b/tests/ui/diagnostic-width/binop.rs @@ -1,6 +1,4 @@ //@ compile-flags: --diagnostic-width=60 -Zwrite-long-types-to-disk=yes -// The regex below normalizes the long type file name to make it suitable for compare-modes. -//@ normalize-stderr: "'\$TEST_BUILD_DIR/.*\.long-type-\d+.txt'" -> "'$$TEST_BUILD_DIR/$$FILE.long-type-hash.txt'" type A = (i32, i32, i32, i32); type B = (A, A, A, A); type C = (B, B, B, B); diff --git a/tests/ui/diagnostic-width/binop.stderr b/tests/ui/diagnostic-width/binop.stderr index fd69129c33e..92723df5a9b 100644 --- a/tests/ui/diagnostic-width/binop.stderr +++ b/tests/ui/diagnostic-width/binop.stderr @@ -1,21 +1,21 @@ error[E0369]: cannot add `(..., ..., ..., ...)` to `(..., ..., ..., ...)` - --> $DIR/binop.rs:10:7 + --> $DIR/binop.rs:8:7 | LL | x + x; | - ^ - (..., ..., ..., ...) | | | (..., ..., ..., ...) | - = note: the full name for the type has been written to '$TEST_BUILD_DIR/$FILE.long-type-hash.txt' + = note: the full name for the type has been written to '$TEST_BUILD_DIR/binop.long-type-$LONG_TYPE_HASH.txt' = note: consider using `--verbose` to print the full type name to the console error[E0600]: cannot apply unary operator `!` to type `(..., ..., ..., ...)` - --> $DIR/binop.rs:14:5 + --> $DIR/binop.rs:12:5 | LL | !x; | ^^ cannot apply unary operator `!` | - = note: the full name for the type has been written to '$TEST_BUILD_DIR/$FILE.long-type-hash.txt' + = note: the full name for the type has been written to '$TEST_BUILD_DIR/binop.long-type-$LONG_TYPE_HASH.txt' = note: consider using `--verbose` to print the full type name to the console error: aborting due to 2 previous errors diff --git a/tests/ui/diagnostic-width/long-E0308.ascii.stderr b/tests/ui/diagnostic-width/long-E0308.ascii.stderr index 83da5586188..d1fdd6c4433 100644 --- a/tests/ui/diagnostic-width/long-E0308.ascii.stderr +++ b/tests/ui/diagnostic-width/long-E0308.ascii.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/long-E0308.rs:48:9 + --> $DIR/long-E0308.rs:45:9 | LL | let x: Atype< | _____________- @@ -20,11 +20,11 @@ LL | | )))))))))))))))))))))))))))))); | = note: expected struct `Atype<Btype<..., i32>, i32>` found enum `Result<Result<..., _>, _>` - = note: the full name for the type has been written to '$TEST_BUILD_DIR/$FILE.long-type-hash.txt' + = note: the full name for the type has been written to '$TEST_BUILD_DIR/long-E0308.long-type-$LONG_TYPE_HASH.txt' = note: consider using `--verbose` to print the full type name to the console error[E0308]: mismatched types - --> $DIR/long-E0308.rs:61:26 + --> $DIR/long-E0308.rs:58:26 | LL | ))))))))))))))))) == Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(O... | __________________________^ @@ -36,11 +36,11 @@ LL | | )))))))))))))))))))))))); | = note: expected enum `Option<Result<Option<...>, _>>` found enum `Result<Result<..., _>, _>` - = note: the full name for the type has been written to '$TEST_BUILD_DIR/$FILE.long-type-hash.txt' + = note: the full name for the type has been written to '$TEST_BUILD_DIR/long-E0308.long-type-$LONG_TYPE_HASH.txt' = note: consider using `--verbose` to print the full type name to the console error[E0308]: mismatched types - --> $DIR/long-E0308.rs:92:9 + --> $DIR/long-E0308.rs:89:9 | LL | let x: Atype< | ____________- @@ -56,11 +56,11 @@ LL | | > = (); | = note: expected struct `Atype<Btype<..., i32>, i32>` found unit type `()` - = note: the full name for the type has been written to '$TEST_BUILD_DIR/$FILE.long-type-hash.txt' + = note: the full name for the type has been written to '$TEST_BUILD_DIR/long-E0308.long-type-$LONG_TYPE_HASH.txt' = note: consider using `--verbose` to print the full type name to the console error[E0308]: mismatched types - --> $DIR/long-E0308.rs:95:17 + --> $DIR/long-E0308.rs:92:17 | LL | let _: () = Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(O... | ____________--___^ @@ -74,7 +74,7 @@ LL | | )))))))))))))))))))))))); | = note: expected unit type `()` found enum `Result<Result<..., _>, _>` - = note: the full name for the type has been written to '$TEST_BUILD_DIR/$FILE.long-type-hash.txt' + = note: the full name for the type has been written to '$TEST_BUILD_DIR/long-E0308.long-type-$LONG_TYPE_HASH.txt' = note: consider using `--verbose` to print the full type name to the console error: aborting due to 4 previous errors diff --git a/tests/ui/diagnostic-width/long-E0308.rs b/tests/ui/diagnostic-width/long-E0308.rs index 26383d9418d..94e525e387e 100644 --- a/tests/ui/diagnostic-width/long-E0308.rs +++ b/tests/ui/diagnostic-width/long-E0308.rs @@ -2,9 +2,6 @@ //@[ascii] compile-flags: --diagnostic-width=60 -Zwrite-long-types-to-disk=yes //@[unicode] compile-flags: -Zunstable-options --json=diagnostic-unicode --diagnostic-width=60 -Zwrite-long-types-to-disk=yes -// The regex below normalizes the long type file name to make it suitable for compare-modes. -//@ normalize-stderr: "'\$TEST_BUILD_DIR/.*\.long-type-\d+.txt'" -> "'$$TEST_BUILD_DIR/$$FILE.long-type-hash.txt'" - mod a { // Force the "short path for unique types" machinery to trip up pub struct Atype; diff --git a/tests/ui/diagnostic-width/long-E0308.unicode.stderr b/tests/ui/diagnostic-width/long-E0308.unicode.stderr index 54abf576dbd..69e5ca10067 100644 --- a/tests/ui/diagnostic-width/long-E0308.unicode.stderr +++ b/tests/ui/diagnostic-width/long-E0308.unicode.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - ╭▸ $DIR/long-E0308.rs:48:9 + ╭▸ $DIR/long-E0308.rs:45:9 │ LL │ let x: Atype< │ ┌─────────────┘ @@ -20,11 +20,11 @@ LL │ ┃ )))))))))))))))))))))))))))))); │ ├ note: expected struct `Atype<Btype<..., i32>, i32>` │ found enum `Result<Result<..., _>, _>` - ├ note: the full name for the type has been written to '$TEST_BUILD_DIR/$FILE.long-type-hash.txt' + ├ note: the full name for the type has been written to '$TEST_BUILD_DIR/long-E0308.long-type-$LONG_TYPE_HASH.txt' ╰ note: consider using `--verbose` to print the full type name to the console error[E0308]: mismatched types - ╭▸ $DIR/long-E0308.rs:61:26 + ╭▸ $DIR/long-E0308.rs:58:26 │ LL │ ))))))))))))))))) == Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(… │ ┏━━━━━━━━━━━━━━━━━━━━━━━━━━┛ @@ -36,11 +36,11 @@ LL │ ┃ )))))))))))))))))))))))); │ ├ note: expected enum `Option<Result<Option<...>, _>>` │ found enum `Result<Result<..., _>, _>` - ├ note: the full name for the type has been written to '$TEST_BUILD_DIR/$FILE.long-type-hash.txt' + ├ note: the full name for the type has been written to '$TEST_BUILD_DIR/long-E0308.long-type-$LONG_TYPE_HASH.txt' ╰ note: consider using `--verbose` to print the full type name to the console error[E0308]: mismatched types - ╭▸ $DIR/long-E0308.rs:92:9 + ╭▸ $DIR/long-E0308.rs:89:9 │ LL │ let x: Atype< │ ┌────────────┘ @@ -56,11 +56,11 @@ LL │ │ > = (); │ ├ note: expected struct `Atype<Btype<..., i32>, i32>` │ found unit type `()` - ├ note: the full name for the type has been written to '$TEST_BUILD_DIR/$FILE.long-type-hash.txt' + ├ note: the full name for the type has been written to '$TEST_BUILD_DIR/long-E0308.long-type-$LONG_TYPE_HASH.txt' ╰ note: consider using `--verbose` to print the full type name to the console error[E0308]: mismatched types - ╭▸ $DIR/long-E0308.rs:95:17 + ╭▸ $DIR/long-E0308.rs:92:17 │ LL │ let _: () = Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(… │ ┏━━━━━━━━━━━━┬─━━━┛ @@ -74,7 +74,7 @@ LL │ ┃ )))))))))))))))))))))))); │ ├ note: expected unit type `()` │ found enum `Result<Result<..., _>, _>` - ├ note: the full name for the type has been written to '$TEST_BUILD_DIR/$FILE.long-type-hash.txt' + ├ note: the full name for the type has been written to '$TEST_BUILD_DIR/long-E0308.long-type-$LONG_TYPE_HASH.txt' ╰ note: consider using `--verbose` to print the full type name to the console error: aborting due to 4 previous errors diff --git a/tests/ui/diagnostic-width/long-E0529.rs b/tests/ui/diagnostic-width/long-E0529.rs new file mode 100644 index 00000000000..759a902da7e --- /dev/null +++ b/tests/ui/diagnostic-width/long-E0529.rs @@ -0,0 +1,13 @@ +//@ compile-flags: --diagnostic-width=60 -Zwrite-long-types-to-disk=yes + +type A = (i32, i32, i32, i32); +type B = (A, A, A, A); +type C = (B, B, B, B); +type D = (C, C, C, C); + +fn foo(x: D) { + let [] = x; //~ ERROR expected an array or slice, found `(... + //~^ pattern cannot match with input type `(... +} + +fn main() {} diff --git a/tests/ui/diagnostic-width/long-E0529.stderr b/tests/ui/diagnostic-width/long-E0529.stderr new file mode 100644 index 00000000000..bf3144cc9b6 --- /dev/null +++ b/tests/ui/diagnostic-width/long-E0529.stderr @@ -0,0 +1,12 @@ +error[E0529]: expected an array or slice, found `(..., ..., ..., ...)` + --> $DIR/long-E0529.rs:9:9 + | +LL | let [] = x; + | ^^ pattern cannot match with input type `(..., ..., ..., ...)` + | + = note: the full name for the type has been written to '$TEST_BUILD_DIR/long-E0529.long-type-$LONG_TYPE_HASH.txt' + = note: consider using `--verbose` to print the full type name to the console + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0529`. diff --git a/tests/ui/diagnostic-width/long-E0609.rs b/tests/ui/diagnostic-width/long-E0609.rs new file mode 100644 index 00000000000..a26d16ad12e --- /dev/null +++ b/tests/ui/diagnostic-width/long-E0609.rs @@ -0,0 +1,12 @@ +//@ compile-flags: --diagnostic-width=60 -Zwrite-long-types-to-disk=yes + +type A = (i32, i32, i32, i32); +type B = (A, A, A, A); +type C = (B, B, B, B); +type D = (C, C, C, C); + +fn foo(x: D) { + x.field; //~ ERROR no field `field` on type `(... +} + +fn main() {} diff --git a/tests/ui/diagnostic-width/long-E0609.stderr b/tests/ui/diagnostic-width/long-E0609.stderr new file mode 100644 index 00000000000..36ef8545746 --- /dev/null +++ b/tests/ui/diagnostic-width/long-E0609.stderr @@ -0,0 +1,12 @@ +error[E0609]: no field `field` on type `(..., ..., ..., ...)` + --> $DIR/long-E0609.rs:9:7 + | +LL | x.field; + | ^^^^^ unknown field + | + = note: the full name for the type has been written to '$TEST_BUILD_DIR/long-E0609.long-type-$LONG_TYPE_HASH.txt' + = note: consider using `--verbose` to print the full type name to the console + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0609`. diff --git a/tests/ui/diagnostic-width/long-E0614.rs b/tests/ui/diagnostic-width/long-E0614.rs new file mode 100644 index 00000000000..5e8b3324dd1 --- /dev/null +++ b/tests/ui/diagnostic-width/long-E0614.rs @@ -0,0 +1,12 @@ +//@ compile-flags: --diagnostic-width=60 -Zwrite-long-types-to-disk=yes + +type A = (i32, i32, i32, i32); +type B = (A, A, A, A); +type C = (B, B, B, B); +type D = (C, C, C, C); + +fn foo(x: D) { + *x; //~ ERROR type `(... +} + +fn main() {} diff --git a/tests/ui/diagnostic-width/long-E0614.stderr b/tests/ui/diagnostic-width/long-E0614.stderr new file mode 100644 index 00000000000..18da20da945 --- /dev/null +++ b/tests/ui/diagnostic-width/long-E0614.stderr @@ -0,0 +1,12 @@ +error[E0614]: type `(..., ..., ..., ...)` cannot be dereferenced + --> $DIR/long-E0614.rs:9:5 + | +LL | *x; + | ^^ can't be dereferenced + | + = note: the full name for the type has been written to '$TEST_BUILD_DIR/long-E0614.long-type-$LONG_TYPE_HASH.txt' + = note: consider using `--verbose` to print the full type name to the console + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0614`. diff --git a/tests/ui/diagnostic-width/long-E0618.rs b/tests/ui/diagnostic-width/long-E0618.rs new file mode 100644 index 00000000000..b499bedc394 --- /dev/null +++ b/tests/ui/diagnostic-width/long-E0618.rs @@ -0,0 +1,12 @@ +//@ compile-flags: --diagnostic-width=60 -Zwrite-long-types-to-disk=yes + +type A = (i32, i32, i32, i32); +type B = (A, A, A, A); +type C = (B, B, B, B); +type D = (C, C, C, C); + +fn foo(x: D) { //~ `x` has type `(... + x(); //~ ERROR expected function, found `(... +} + +fn main() {} diff --git a/tests/ui/diagnostic-width/long-E0618.stderr b/tests/ui/diagnostic-width/long-E0618.stderr new file mode 100644 index 00000000000..05bf999c142 --- /dev/null +++ b/tests/ui/diagnostic-width/long-E0618.stderr @@ -0,0 +1,16 @@ +error[E0618]: expected function, found `(..., ..., ..., ...)` + --> $DIR/long-E0618.rs:9:5 + | +LL | fn foo(x: D) { + | - `x` has type `(..., ..., ..., ...)` +LL | x(); + | ^-- + | | + | call expression requires function + | + = note: the full name for the type has been written to '$TEST_BUILD_DIR/long-E0618.long-type-$LONG_TYPE_HASH.txt' + = note: consider using `--verbose` to print the full type name to the console + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0618`. diff --git a/tests/ui/diagnostic-width/long-e0277.rs b/tests/ui/diagnostic-width/long-e0277.rs index 9b3bd8bb728..369fd8daea7 100644 --- a/tests/ui/diagnostic-width/long-e0277.rs +++ b/tests/ui/diagnostic-width/long-e0277.rs @@ -1,6 +1,4 @@ //@ compile-flags: --diagnostic-width=60 -Zwrite-long-types-to-disk=yes -// The regex below normalizes the long type file name to make it suitable for compare-modes. -//@ normalize-stderr: "'\$TEST_BUILD_DIR/.*\.long-type-\d+.txt'" -> "'$$TEST_BUILD_DIR/$$FILE.long-type-hash.txt'" type A = (i32, i32, i32, i32); type B = (A, A, A, A); type C = (B, B, B, B); diff --git a/tests/ui/diagnostic-width/long-e0277.stderr b/tests/ui/diagnostic-width/long-e0277.stderr index a57270df7e2..ff897151165 100644 --- a/tests/ui/diagnostic-width/long-e0277.stderr +++ b/tests/ui/diagnostic-width/long-e0277.stderr @@ -1,21 +1,21 @@ error[E0277]: the trait bound `(..., ..., ..., ...): Trait` is not satisfied - --> $DIR/long-e0277.rs:14:21 + --> $DIR/long-e0277.rs:12:21 | LL | require_trait::<D>(); | ^ unsatisfied trait bound | = help: the trait `Trait` is not implemented for `(..., ..., ..., ...)` help: this trait has no implementations, consider adding one - --> $DIR/long-e0277.rs:9:1 + --> $DIR/long-e0277.rs:7:1 | LL | trait Trait {} | ^^^^^^^^^^^ note: required by a bound in `require_trait` - --> $DIR/long-e0277.rs:11:21 + --> $DIR/long-e0277.rs:9:21 | LL | fn require_trait<T: Trait>() {} | ^^^^^ required by this bound in `require_trait` - = note: the full name for the type has been written to '$TEST_BUILD_DIR/$FILE.long-type-hash.txt' + = note: the full name for the type has been written to '$TEST_BUILD_DIR/long-e0277.long-type-$LONG_TYPE_HASH.txt' = note: consider using `--verbose` to print the full type name to the console error: aborting due to 1 previous error diff --git a/tests/ui/diagnostic-width/long-span.long.stderr b/tests/ui/diagnostic-width/long-span.long.stderr new file mode 100644 index 00000000000..252b17912de --- /dev/null +++ b/tests/ui/diagnostic-width/long-span.long.stderr @@ -0,0 +1,18 @@ +error[E0369]: cannot add `[{integer}; 1680]` to `[{integer}; 1680]` + ╭▸ $DIR/long-span.rs:7:5056 + │ +LL │ …u8 = [0, 0, 0, 0, 0, 0, 0, 0, 0, …, 0, 0, 0, 0, 0, 0, 0] + [0, 0, 0, 0, 0, 0, 0, 0, 0, …, 0, 0, 0, 0, 0, 0, 0]; + │ ┬───────────────────────────…────────────────────── ━ ────────────────────────────…────────────────────── [{integer}; 1680] + │ │ + ╰╴ [{integer}; 1680] + +error[E0308]: mismatched types + ╭▸ $DIR/long-span.rs:9:15 + │ +LL │ …u8 = [0, 0, 0, 0, 0, 0, 0, 0, 0, …, 0, 0, 0, 0, 0, 0, 0]; + ╰╴ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━…━━━━━━━━━━━━━━━━━━━━━━ expected `u8`, found `[{integer}; 1680]` + +error: aborting due to 2 previous errors + +Some errors have detailed explanations: E0308, E0369. +For more information about an error, try `rustc --explain E0308`. diff --git a/tests/ui/diagnostic-width/long-span.longest.stderr b/tests/ui/diagnostic-width/long-span.longest.stderr new file mode 100644 index 00000000000..2e77c368922 --- /dev/null +++ b/tests/ui/diagnostic-width/long-span.longest.stderr @@ -0,0 +1,18 @@ +error[E0369]: cannot add `[{integer}; 1680]` to `[{integer}; 1680]` + --> $DIR/long-span.rs:7:5056 + | +LL | ... = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] + [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]; + | -----------------------------------------...----------------------------------- ^ -----------------------------------------...----------------------------------- [{integer}; 1680] + | | + | [{integer}; 1680] + +error[E0308]: mismatched types + --> $DIR/long-span.rs:9:15 + | +LL | ... = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^...^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `u8`, found `[{integer}; 1680]` + +error: aborting due to 2 previous errors + +Some errors have detailed explanations: E0308, E0369. +For more information about an error, try `rustc --explain E0308`. diff --git a/tests/ui/diagnostic-width/long-span.rs b/tests/ui/diagnostic-width/long-span.rs new file mode 100644 index 00000000000..a3103379e93 --- /dev/null +++ b/tests/ui/diagnostic-width/long-span.rs @@ -0,0 +1,11 @@ +//@ revisions: shortest short long longest +//@[shortest] compile-flags: --diagnostic-width=4 +//@[short] compile-flags: --diagnostic-width=12 -Zunstable-options --json=diagnostic-unicode +//@[long] compile-flags: --diagnostic-width=80 -Zunstable-options --json=diagnostic-unicode +//@[longest] compile-flags: --diagnostic-width=120 +// ignore-tidy-linelength +const C: u8 = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] + [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]; +//~^ ERROR E0369 +const D: u8 = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]; +//~^ ERROR E0308 +fn main() {} diff --git a/tests/ui/diagnostic-width/long-span.short.stderr b/tests/ui/diagnostic-width/long-span.short.stderr new file mode 100644 index 00000000000..b4803e31aaa --- /dev/null +++ b/tests/ui/diagnostic-width/long-span.short.stderr @@ -0,0 +1,18 @@ +error[E0369]: cannot add `[{integer}; 1680]` to `[{integer}; 1680]` + ╭▸ $DIR/long-span.rs:7:5056 + │ +LL │ …u8 = [0, 0, 0…0] + [0, 0, 0…0]; + │ ┬───────…── ━ ────────…── [{integer}; 1680] + │ │ + ╰╴ [{integer}; 1680] + +error[E0308]: mismatched types + ╭▸ $DIR/long-span.rs:9:15 + │ +LL │ …u8 = [0, 0, 0…0]; + ╰╴ ━━━━━━━━…━━ expected `u8`, found `[{integer}; 1680]` + +error: aborting due to 2 previous errors + +Some errors have detailed explanations: E0308, E0369. +For more information about an error, try `rustc --explain E0308`. diff --git a/tests/ui/diagnostic-width/long-span.shortest.stderr b/tests/ui/diagnostic-width/long-span.shortest.stderr new file mode 100644 index 00000000000..1de1a4acd92 --- /dev/null +++ b/tests/ui/diagnostic-width/long-span.shortest.stderr @@ -0,0 +1,18 @@ +error[E0369]: cannot add `[{integer}; 1680]` to `[{integer}; 1680]` + --> $DIR/long-span.rs:7:5056 + | +LL | ... = [0, 0, 0...0] + [0, 0, 0...0]; + | --------...-- ^ --------...-- [{integer}; 1680] + | | + | [{integer}; 1680] + +error[E0308]: mismatched types + --> $DIR/long-span.rs:9:15 + | +LL | ... = [0, 0, 0...0]; + | ^^^^^^^^...^^ expected `u8`, found `[{integer}; 1680]` + +error: aborting due to 2 previous errors + +Some errors have detailed explanations: E0308, E0369. +For more information about an error, try `rustc --explain E0308`. diff --git a/tests/ui/diagnostic-width/non-1-width-unicode-multiline-label.ascii.stderr b/tests/ui/diagnostic-width/non-1-width-unicode-multiline-label.ascii.stderr index 4d8afb6f3ad..60ce0d9a148 100644 --- a/tests/ui/diagnostic-width/non-1-width-unicode-multiline-label.ascii.stderr +++ b/tests/ui/diagnostic-width/non-1-width-unicode-multiline-label.ascii.stderr @@ -1,11 +1,41 @@ error[E0369]: cannot add `&str` to `&str` - --> $DIR/non-1-width-unicode-multiline-label.rs:7:260 + --> $DIR/non-1-width-unicode-multiline-label.rs:7:237 | -LL | ...ཽཾཿ྄ཱྀྀྂྃ྅྆྇ྈྉྊྋྌྍྎྏྐྑྒྒྷྔྕྖྗྙྚྛྜྜྷྞྟྠྡྡྷྣྤྥྦྦྷྨྩྪྫྫྷྭྮྯྰྱྲླྴྵྶྷྸྐྵྺྻྼ྾྿࿀࿁࿂࿃࿄࿅࿆࿇...࿋࿌࿎࿏࿐࿑࿒࿓࿔࿕࿖࿗࿘࿙࿚"; let _a = unicode_is_fun + " really fun!"; - | -------------- ^ -------------- &str - | | | - | | `+` cannot be used to concatenate two `&str` strings - | &str +LL | ...👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦"; let _a = unicode_is_fun + " really fun!"; + | -------------- ^ -------------- &str + | | | + | | `+` cannot be used to concatenate two `&str` strings + | &str + | + = note: string concatenation requires an owned `String` on the left +help: create an owned `String` from a string reference + | +LL | let _ = "👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦"; let _a = unicode_is_fun.to_owned() + " really fun!"; + | +++++++++++ + +error[E0369]: cannot add `&str` to `&str` + --> $DIR/non-1-width-unicode-multiline-label.rs:9:384 + | +LL | ...👧👦👨👩👧👦👨👩👧👦"; let _a = unicode_is_fun + " really fun!"; + | -------------- ^ -------------- &str + | | | + | | `+` cannot be used to concatenate two `&str` strings + | &str + | + = note: string concatenation requires an owned `String` on the left +help: create an owned `String` from a string reference + | +LL | let _ = "👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦"; let _a = unicode_is_fun.to_owned() + " really fun!"; + | +++++++++++ + +error[E0369]: cannot add `&str` to `&str` + --> $DIR/non-1-width-unicode-multiline-label.rs:11:260 + | +LL | ...࿇࿈࿉࿊࿋࿌࿎࿏࿐࿑࿒࿓࿔࿕࿖࿗࿘࿙࿚"; let _a = unicode_is_fun + " really fun!"; + | -------------- ^ -------------- &str + | | | + | | `+` cannot be used to concatenate two `&str` strings + | &str | = note: string concatenation requires an owned `String` on the left help: create an owned `String` from a string reference @@ -13,6 +43,21 @@ help: create an owned `String` from a string reference LL | let _ = "ༀ༁༂༃༄༅༆༇༈༉༊་༌།༎༏༐༑༒༓༔༕༖༗༘༙༚༛༜༝༞༟༠༡༢༣༤༥༦༧༨༩༪༫༬༭༮༯༰༱༲༳༴༵༶༷༸༹༺༻༼༽༾༿ཀཁགགྷངཅཆཇཉཊཋཌཌྷཎཏཐདདྷནཔཕབབྷམཙཚཛཛྷཝཞཟའཡརལཤཥསཧཨཀྵཪཫཬཱཱཱིིུུྲྀཷླྀཹེཻོཽཾཿ྄ཱྀྀྂྃ྅྆྇ྈྉྊྋྌྍྎྏྐྑྒྒྷྔྕྖྗྙྚྛྜྜྷྞྟྠྡྡྷྣྤྥྦྦྷྨྩྪྫྫྷྭྮྯྰྱྲླྴྵྶྷྸྐྵྺྻྼ྾྿࿀࿁࿂࿃࿄࿅࿆࿇࿈࿉࿊࿋࿌࿎࿏࿐࿑࿒࿓࿔࿕࿖࿗࿘࿙࿚"; let _a = unicode_is_fun.to_owned() + " really fun!"; | +++++++++++ -error: aborting due to 1 previous error +error[E0369]: cannot add `&str` to `&str` + --> $DIR/non-1-width-unicode-multiline-label.rs:13:219 + | +LL | ...xxxxxxxxxxxxxxxxxxxx"; let _a = unicode_is_fun + " really fun!"; + | -------------- ^ -------------- &str + | | | + | | `+` cannot be used to concatenate two `&str` strings + | &str + | + = note: string concatenation requires an owned `String` on the left +help: create an owned `String` from a string reference + | +LL | let _ = "xxxxxxx👨👩👧👦xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx👨xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"; let _a = unicode_is_fun.to_owned() + " really fun!"; + | +++++++++++ + +error: aborting due to 4 previous errors For more information about this error, try `rustc --explain E0369`. diff --git a/tests/ui/diagnostic-width/non-1-width-unicode-multiline-label.rs b/tests/ui/diagnostic-width/non-1-width-unicode-multiline-label.rs index e630db8ba42..6b9b27f6297 100644 --- a/tests/ui/diagnostic-width/non-1-width-unicode-multiline-label.rs +++ b/tests/ui/diagnostic-width/non-1-width-unicode-multiline-label.rs @@ -4,6 +4,12 @@ fn main() { let unicode_is_fun = "‱ஹ௸௵꧄.ဪ꧅⸻𒈙𒐫﷽𒌄𒈟𒍼𒁎𒀱𒌧𒅃 𒈓𒍙𒊎𒄡𒅌𒁏𒀰𒐪𒐩𒈙𒐫𪚥"; + let _ = "👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦"; let _a = unicode_is_fun + " really fun!"; + //[ascii]~^ ERROR cannot add `&str` to `&str` + let _ = "👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦"; let _a = unicode_is_fun + " really fun!"; + //[ascii]~^ ERROR cannot add `&str` to `&str` let _ = "ༀ༁༂༃༄༅༆༇༈༉༊་༌།༎༏༐༑༒༓༔༕༖༗༘༙༚༛༜༝༞༟༠༡༢༣༤༥༦༧༨༩༪༫༬༭༮༯༰༱༲༳༴༵༶༷༸༹༺༻༼༽༾༿ཀཁགགྷངཅཆཇཉཊཋཌཌྷཎཏཐདདྷནཔཕབབྷམཙཚཛཛྷཝཞཟའཡརལཤཥསཧཨཀྵཪཫཬཱཱཱིིུུྲྀཷླྀཹེཻོཽཾཿ྄ཱྀྀྂྃ྅྆྇ྈྉྊྋྌྍྎྏྐྑྒྒྷྔྕྖྗྙྚྛྜྜྷྞྟྠྡྡྷྣྤྥྦྦྷྨྩྪྫྫྷྭྮྯྰྱྲླྴྵྶྷྸྐྵྺྻྼ྾྿࿀࿁࿂࿃࿄࿅࿆࿇࿈࿉࿊࿋࿌࿎࿏࿐࿑࿒࿓࿔࿕࿖࿗࿘࿙࿚"; let _a = unicode_is_fun + " really fun!"; //[ascii]~^ ERROR cannot add `&str` to `&str` + let _ = "xxxxxxx👨👩👧👦xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx👨xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"; let _a = unicode_is_fun + " really fun!"; + //[ascii]~^ ERROR cannot add `&str` to `&str` } diff --git a/tests/ui/diagnostic-width/non-1-width-unicode-multiline-label.unicode.stderr b/tests/ui/diagnostic-width/non-1-width-unicode-multiline-label.unicode.stderr index ed8ce770bb7..15b5dd9d7e2 100644 --- a/tests/ui/diagnostic-width/non-1-width-unicode-multiline-label.unicode.stderr +++ b/tests/ui/diagnostic-width/non-1-width-unicode-multiline-label.unicode.stderr @@ -1,11 +1,41 @@ error[E0369]: cannot add `&str` to `&str` - ╭▸ $DIR/non-1-width-unicode-multiline-label.rs:7:260 + ╭▸ $DIR/non-1-width-unicode-multiline-label.rs:7:237 │ -LL │ …ཻོཽཾཿ྄ཱྀྀྂྃ྅྆྇ྈྉྊྋྌྍྎྏྐྑྒྒྷྔྕྖྗྙྚྛྜྜྷྞྟྠྡྡྷྣྤྥྦྦྷྨྩྪྫྫྷྭྮྯྰྱྲླྴྵྶྷྸྐྵྺྻྼ྾྿࿀࿁࿂࿃࿄࿅࿆࿇࿈࿉…࿋࿌࿎࿏࿐࿑࿒࿓࿔࿕࿖࿗࿘࿙࿚"; let _a = unicode_is_fun + " really fun!"; - │ ┬───────────── ┯ ────────────── &str - │ │ │ - │ │ `+` cannot be used to concatenate two `&str` strings - │ &str +LL │ …👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦"; let _a = unicode_is_fun + " really fun!"; + │ ┬───────────── ┯ ────────────── &str + │ │ │ + │ │ `+` cannot be used to concatenate two `&str` strings + │ &str + │ + ╰ note: string concatenation requires an owned `String` on the left +help: create an owned `String` from a string reference + ╭╴ +LL │ let _ = "👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦"; let _a = unicode_is_fun.to_owned() + " really fun!"; + ╰╴ +++++++++++ + +error[E0369]: cannot add `&str` to `&str` + ╭▸ $DIR/non-1-width-unicode-multiline-label.rs:9:384 + │ +LL │ …👨👩👧👦👨👩👧👦👨👩👧👦"; let _a = unicode_is_fun + " really fun!"; + │ ┬───────────── ┯ ────────────── &str + │ │ │ + │ │ `+` cannot be used to concatenate two `&str` strings + │ &str + │ + ╰ note: string concatenation requires an owned `String` on the left +help: create an owned `String` from a string reference + ╭╴ +LL │ let _ = "👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦👨👩👧👦"; let _a = unicode_is_fun.to_owned() + " really fun!"; + ╰╴ +++++++++++ + +error[E0369]: cannot add `&str` to `&str` + ╭▸ $DIR/non-1-width-unicode-multiline-label.rs:11:260 + │ +LL │ …࿅࿆࿇࿈࿉࿊࿋࿌࿎࿏࿐࿑࿒࿓࿔࿕࿖࿗࿘࿙࿚"; let _a = unicode_is_fun + " really fun!"; + │ ┬───────────── ┯ ────────────── &str + │ │ │ + │ │ `+` cannot be used to concatenate two `&str` strings + │ &str │ ╰ note: string concatenation requires an owned `String` on the left help: create an owned `String` from a string reference @@ -13,6 +43,21 @@ help: create an owned `String` from a string reference LL │ let _ = "ༀ༁༂༃༄༅༆༇༈༉༊་༌།༎༏༐༑༒༓༔༕༖༗༘༙༚༛༜༝༞༟༠༡༢༣༤༥༦༧༨༩༪༫༬༭༮༯༰༱༲༳༴༵༶༷༸༹༺༻༼༽༾༿ཀཁགགྷངཅཆཇཉཊཋཌཌྷཎཏཐདདྷནཔཕབབྷམཙཚཛཛྷཝཞཟའཡརལཤཥསཧཨཀྵཪཫཬཱཱཱིིུུྲྀཷླྀཹེཻོཽཾཿ྄ཱྀྀྂྃ྅྆྇ྈྉྊྋྌྍྎྏྐྑྒྒྷྔྕྖྗྙྚྛྜྜྷྞྟྠྡྡྷྣྤྥྦྦྷྨྩྪྫྫྷྭྮྯྰྱྲླྴྵྶྷྸྐྵྺྻྼ྾྿࿀࿁࿂࿃࿄࿅࿆࿇࿈࿉࿊࿋࿌࿎࿏࿐࿑࿒࿓࿔࿕࿖࿗࿘࿙࿚"; let _a = unicode_is_fun.to_owned() + " really fun!"; ╰╴ +++++++++++ -error: aborting due to 1 previous error +error[E0369]: cannot add `&str` to `&str` + ╭▸ $DIR/non-1-width-unicode-multiline-label.rs:13:219 + │ +LL │ …xxxxxxxxxxxxxxxxxxxxxx"; let _a = unicode_is_fun + " really fun!"; + │ ┬───────────── ┯ ────────────── &str + │ │ │ + │ │ `+` cannot be used to concatenate two `&str` strings + │ &str + │ + ╰ note: string concatenation requires an owned `String` on the left +help: create an owned `String` from a string reference + ╭╴ +LL │ let _ = "xxxxxxx👨👩👧👦xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx👨xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"; let _a = unicode_is_fun.to_owned() + " really fun!"; + ╰╴ +++++++++++ + +error: aborting due to 4 previous errors For more information about this error, try `rustc --explain E0369`. diff --git a/tests/ui/diagnostic-width/non-copy-type-moved.rs b/tests/ui/diagnostic-width/non-copy-type-moved.rs index a220c62775e..845457f7e30 100644 --- a/tests/ui/diagnostic-width/non-copy-type-moved.rs +++ b/tests/ui/diagnostic-width/non-copy-type-moved.rs @@ -1,6 +1,4 @@ //@ compile-flags: --diagnostic-width=60 -Zwrite-long-types-to-disk=yes -// The regex below normalizes the long type file name to make it suitable for compare-modes. -//@ normalize-stderr: "'\$TEST_BUILD_DIR/.*\.long-type-\d+.txt'" -> "'$$TEST_BUILD_DIR/$$FILE.long-type-hash.txt'" type A = (String, String, String, String); type B = (A, A, A, A); diff --git a/tests/ui/diagnostic-width/non-copy-type-moved.stderr b/tests/ui/diagnostic-width/non-copy-type-moved.stderr index 254542c7b39..16c01c858b7 100644 --- a/tests/ui/diagnostic-width/non-copy-type-moved.stderr +++ b/tests/ui/diagnostic-width/non-copy-type-moved.stderr @@ -1,5 +1,5 @@ error[E0382]: use of moved value: `x` - --> $DIR/non-copy-type-moved.rs:16:14 + --> $DIR/non-copy-type-moved.rs:14:14 | LL | fn foo(x: D) { | - move occurs because `x` has type `(..., ..., ..., ...)`, which does not implement the `Copy` trait @@ -8,7 +8,7 @@ LL | let _a = x; LL | let _b = x; | ^ value used here after move | - = note: the full name for the type has been written to '$TEST_BUILD_DIR/$FILE.long-type-hash.txt' + = note: the full name for the type has been written to '$TEST_BUILD_DIR/non-copy-type-moved.long-type-$LONG_TYPE_HASH.txt' = note: consider using `--verbose` to print the full type name to the console help: consider cloning the value if the performance cost is acceptable | diff --git a/tests/ui/diagnostic-width/non-whitespace-trimming-unicode.stderr b/tests/ui/diagnostic-width/non-whitespace-trimming-unicode.stderr index da3d8d31892..5408825d8cd 100644 --- a/tests/ui/diagnostic-width/non-whitespace-trimming-unicode.stderr +++ b/tests/ui/diagnostic-width/non-whitespace-trimming-unicode.stderr @@ -1,10 +1,10 @@ error[E0308]: mismatched types --> $DIR/non-whitespace-trimming-unicode.rs:4:415 | -LL | ...♭♮♯♰♱♲♳♴♵♶♷♸♹♺♻♼♽♾♿⚀⚁⚂⚃⚄⚅⚆⚈⚉4"; let _: () = 42; let _: &str = "🦀☀☁☂☃☄★☆☇☈☉☊☋☌☍☎☏☐☑☒☓ ☖☗☘☙☚☛☜☝☞☟☠☡☢☣☤☥☦☧☨☩☪☫☬☭☮☯☰☱☲☳☴☵☶☷☸☹☺☻☼☽☾☿♀♁♂♃♄... - | -- ^^ expected `()`, found integer - | | - | expected due to this +LL | ...♣♤♥♦♧♨♩♪♫♬♭♮♯♰♱♲♳♴♵♶♷♸♹♺♻♼♽♾♿⚀⚁⚂⚃⚄⚅⚆⚈⚉4"; let _: () = 42; let _: &str = "🦀☀☁☂☃☄★☆☇☈☉☊☋☌☍☎☏☐☑☒☓ ☖☗☘☙☚☛☜☝☞☟☠☡☢☣☤☥☦☧☨☩☪☫☬☭☮☯☰☱☲☳☴☵☶☷☸☹☺☻☼... + | -- ^^ expected `()`, found integer + | | + | expected due to this error: aborting due to 1 previous error diff --git a/tests/ui/diagnostic-width/secondary-label-with-long-type.rs b/tests/ui/diagnostic-width/secondary-label-with-long-type.rs index c8845af3183..13fe967ba5f 100644 --- a/tests/ui/diagnostic-width/secondary-label-with-long-type.rs +++ b/tests/ui/diagnostic-width/secondary-label-with-long-type.rs @@ -1,6 +1,4 @@ //@ compile-flags: --diagnostic-width=100 -Zwrite-long-types-to-disk=yes -// The regex below normalizes the long type file name to make it suitable for compare-modes. -//@ normalize-stderr: "'\$TEST_BUILD_DIR/.*\.long-type-\d+.txt'" -> "'$$TEST_BUILD_DIR/$$FILE.long-type-hash.txt'" type A = (i32, i32, i32, i32); type B = (A, A, A, A); diff --git a/tests/ui/diagnostic-width/secondary-label-with-long-type.stderr b/tests/ui/diagnostic-width/secondary-label-with-long-type.stderr index a95e1709148..a99657ca113 100644 --- a/tests/ui/diagnostic-width/secondary-label-with-long-type.stderr +++ b/tests/ui/diagnostic-width/secondary-label-with-long-type.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/secondary-label-with-long-type.rs:11:9 + --> $DIR/secondary-label-with-long-type.rs:9:9 | LL | let () = x; | ^^ - this expression has type `((..., ..., ..., ...), ..., ..., ...)` @@ -8,7 +8,7 @@ LL | let () = x; | = note: expected tuple `((..., ..., ..., ...), ..., ..., ...)` found unit type `()` - = note: the full name for the type has been written to '$TEST_BUILD_DIR/$FILE.long-type-hash.txt' + = note: the full name for the type has been written to '$TEST_BUILD_DIR/secondary-label-with-long-type.long-type-$LONG_TYPE_HASH.txt' = note: consider using `--verbose` to print the full type name to the console error: aborting due to 1 previous error diff --git a/tests/ui/diagnostic-width/tabs-trimming.stderr b/tests/ui/diagnostic-width/tabs-trimming.stderr index 85103fbf6f5..a896345bd70 100644 --- a/tests/ui/diagnostic-width/tabs-trimming.stderr +++ b/tests/ui/diagnostic-width/tabs-trimming.stderr @@ -1,20 +1,20 @@ error[E0408]: variable `v` is not bound in all patterns --> $DIR/tabs-trimming.rs:9:16 | -LL | ... v @ 1 | 2 | 3 => panic!("You gave me too little money {}", v), // Long text here: TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT... - | - ^ ^ pattern doesn't bind `v` - | | | - | | pattern doesn't bind `v` - | variable not in all patterns +LL | ... v @ 1 | 2 | 3 => panic!("You gave me too little money {}", v), // Long text here: TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT... + | - ^ ^ pattern doesn't bind `v` + | | | + | | pattern doesn't bind `v` + | variable not in all patterns error[E0381]: used binding `v` is possibly-uninitialized --> $DIR/tabs-trimming.rs:9:67 | -LL | ... v @ 1 | 2 | 3 => panic!("You gave me too little money {}", v), // Long text here: TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT... - | - ^ `v` used here but it is possibly-uninitialized - | | - | binding initialized here in some conditions - | binding declared here but left uninitialized +LL | ... v @ 1 | 2 | 3 => panic!("You gave me too little money {}", v), // Long text here: TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT... + | - ^ `v` used here but it is possibly-uninitialized + | | + | binding initialized here in some conditions + | binding declared here but left uninitialized | = note: this error originates in the macro `$crate::const_format_args` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/tests/ui/did_you_mean/recursion_limit_deref.stderr b/tests/ui/did_you_mean/recursion_limit_deref.stderr index b0c493faf1e..23341ec6bdc 100644 --- a/tests/ui/did_you_mean/recursion_limit_deref.stderr +++ b/tests/ui/did_you_mean/recursion_limit_deref.stderr @@ -1,3 +1,7 @@ +error: reached the recursion limit finding the struct tail for `K` + | + = help: consider increasing the recursion limit by adding a `#![recursion_limit = "20"]` + error: reached the recursion limit finding the struct tail for `Bottom` | = help: consider increasing the recursion limit by adding a `#![recursion_limit = "20"]` @@ -21,7 +25,7 @@ LL | let x: &Bottom = &t; = note: expected reference `&Bottom` found reference `&Top` -error: aborting due to 3 previous errors +error: aborting due to 4 previous errors Some errors have detailed explanations: E0055, E0308. For more information about an error, try `rustc --explain E0055`. diff --git a/tests/ui/drop/drop-order-comparisons.e2021.stderr b/tests/ui/drop/drop-order-comparisons.e2021.stderr index 158d18f6882..601b0a38412 100644 --- a/tests/ui/drop/drop-order-comparisons.e2021.stderr +++ b/tests/ui/drop/drop-order-comparisons.e2021.stderr @@ -242,6 +242,15 @@ LL | _ = (if let Ok(_) = e.ok(4).as_ref() { | = warning: this changes meaning in Rust 2024 = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/temporary-if-let-scope.html> +note: value invokes this custom destructor + --> $DIR/drop-order-comparisons.rs:571:1 + | +LL | / impl<'b> Drop for LogDrop<'b> { +LL | | fn drop(&mut self) { +LL | | self.0.mark(self.1); +LL | | } +LL | | } + | |_^ help: the value is now dropped here in Edition 2024 --> $DIR/drop-order-comparisons.rs:127:5 | @@ -267,6 +276,15 @@ LL | _ = (if let Ok(_) = e.err(4).as_ref() {} else { | = warning: this changes meaning in Rust 2024 = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/temporary-if-let-scope.html> +note: value invokes this custom destructor + --> $DIR/drop-order-comparisons.rs:571:1 + | +LL | / impl<'b> Drop for LogDrop<'b> { +LL | | fn drop(&mut self) { +LL | | self.0.mark(self.1); +LL | | } +LL | | } + | |_^ help: the value is now dropped here in Edition 2024 --> $DIR/drop-order-comparisons.rs:145:44 | @@ -291,6 +309,15 @@ LL | if let Ok(_) = e.err(4).as_ref() {} else { | = warning: this changes meaning in Rust 2024 = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/temporary-if-let-scope.html> +note: value invokes this custom destructor + --> $DIR/drop-order-comparisons.rs:571:1 + | +LL | / impl<'b> Drop for LogDrop<'b> { +LL | | fn drop(&mut self) { +LL | | self.0.mark(self.1); +LL | | } +LL | | } + | |_^ help: the value is now dropped here in Edition 2024 --> $DIR/drop-order-comparisons.rs:247:43 | @@ -315,6 +342,15 @@ LL | if let true = e.err(9).is_ok() {} else { | = warning: this changes meaning in Rust 2024 = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/temporary-if-let-scope.html> +note: value invokes this custom destructor + --> $DIR/drop-order-comparisons.rs:571:1 + | +LL | / impl<'b> Drop for LogDrop<'b> { +LL | | fn drop(&mut self) { +LL | | self.0.mark(self.1); +LL | | } +LL | | } + | |_^ help: the value is now dropped here in Edition 2024 --> $DIR/drop-order-comparisons.rs:352:41 | @@ -339,6 +375,15 @@ LL | if let Ok(_v) = e.err(8) {} else { | = warning: this changes meaning in Rust 2024 = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/temporary-if-let-scope.html> +note: value invokes this custom destructor + --> $DIR/drop-order-comparisons.rs:571:1 + | +LL | / impl<'b> Drop for LogDrop<'b> { +LL | | fn drop(&mut self) { +LL | | self.0.mark(self.1); +LL | | } +LL | | } + | |_^ help: the value is now dropped here in Edition 2024 --> $DIR/drop-order-comparisons.rs:355:35 | @@ -363,6 +408,15 @@ LL | if let Ok(_) = e.err(7) {} else { | = warning: this changes meaning in Rust 2024 = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/temporary-if-let-scope.html> +note: value invokes this custom destructor + --> $DIR/drop-order-comparisons.rs:571:1 + | +LL | / impl<'b> Drop for LogDrop<'b> { +LL | | fn drop(&mut self) { +LL | | self.0.mark(self.1); +LL | | } +LL | | } + | |_^ help: the value is now dropped here in Edition 2024 --> $DIR/drop-order-comparisons.rs:358:34 | @@ -387,6 +441,15 @@ LL | if let Ok(_) = e.err(6).as_ref() {} else { | = warning: this changes meaning in Rust 2024 = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/temporary-if-let-scope.html> +note: value invokes this custom destructor + --> $DIR/drop-order-comparisons.rs:571:1 + | +LL | / impl<'b> Drop for LogDrop<'b> { +LL | | fn drop(&mut self) { +LL | | self.0.mark(self.1); +LL | | } +LL | | } + | |_^ help: the value is now dropped here in Edition 2024 --> $DIR/drop-order-comparisons.rs:361:43 | @@ -411,6 +474,15 @@ LL | if let Ok(_v) = e.err(5) {} else { | = warning: this changes meaning in Rust 2024 = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/temporary-if-let-scope.html> +note: value invokes this custom destructor + --> $DIR/drop-order-comparisons.rs:571:1 + | +LL | / impl<'b> Drop for LogDrop<'b> { +LL | | fn drop(&mut self) { +LL | | self.0.mark(self.1); +LL | | } +LL | | } + | |_^ help: the value is now dropped here in Edition 2024 --> $DIR/drop-order-comparisons.rs:365:35 | @@ -435,6 +507,15 @@ LL | if let Ok(_) = e.err(4) {} else { | = warning: this changes meaning in Rust 2024 = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/temporary-if-let-scope.html> +note: value invokes this custom destructor + --> $DIR/drop-order-comparisons.rs:571:1 + | +LL | / impl<'b> Drop for LogDrop<'b> { +LL | | fn drop(&mut self) { +LL | | self.0.mark(self.1); +LL | | } +LL | | } + | |_^ help: the value is now dropped here in Edition 2024 --> $DIR/drop-order-comparisons.rs:368:34 | @@ -459,6 +540,15 @@ LL | if let Ok(_) = e.err(4).as_ref() {} else { | = warning: this changes meaning in Rust 2024 = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/temporary-if-let-scope.html> +note: value invokes this custom destructor + --> $DIR/drop-order-comparisons.rs:571:1 + | +LL | / impl<'b> Drop for LogDrop<'b> { +LL | | fn drop(&mut self) { +LL | | self.0.mark(self.1); +LL | | } +LL | | } + | |_^ help: the value is now dropped here in Edition 2024 --> $DIR/drop-order-comparisons.rs:404:43 | diff --git a/tests/ui/drop/lint-if-let-rescope-false-positives.rs b/tests/ui/drop/lint-if-let-rescope-false-positives.rs new file mode 100644 index 00000000000..77b7df4bc3b --- /dev/null +++ b/tests/ui/drop/lint-if-let-rescope-false-positives.rs @@ -0,0 +1,33 @@ +//@ edition: 2021 +//@ check-pass + +#![deny(if_let_rescope)] + +struct Drop; +impl std::ops::Drop for Drop { + fn drop(&mut self) { + println!("drop") + } +} + +impl Drop { + fn as_ref(&self) -> Option<i32> { + Some(1) + } +} + +fn consume(_: impl Sized) -> Option<i32> { Some(1) } + +fn main() { + let drop = Drop; + + // Make sure we don't drop if we don't actually make a temporary. + if let None = drop.as_ref() {} else {} + + // Make sure we don't lint if we consume the droppy value. + if let None = consume(Drop) {} else {} + + // Make sure we don't lint on field exprs of place exprs. + let tup_place = (Drop, ()); + if let None = consume(tup_place.1) {} else {} +} diff --git a/tests/ui/drop/lint-if-let-rescope-gated.edition2021.stderr b/tests/ui/drop/lint-if-let-rescope-gated.edition2021.stderr index 546a5fe0fd0..070ba1c6a4c 100644 --- a/tests/ui/drop/lint-if-let-rescope-gated.edition2021.stderr +++ b/tests/ui/drop/lint-if-let-rescope-gated.edition2021.stderr @@ -8,6 +8,15 @@ LL | if let Some(_value) = Droppy.get() { | = warning: this changes meaning in Rust 2024 = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/temporary-if-let-scope.html> +note: value invokes this custom destructor + --> $DIR/lint-if-let-rescope-gated.rs:14:1 + | +LL | / impl Drop for Droppy { +LL | | fn drop(&mut self) { +LL | | println!("dropped"); +LL | | } +LL | | } + | |_^ help: the value is now dropped here in Edition 2024 --> $DIR/lint-if-let-rescope-gated.rs:30:5 | diff --git a/tests/ui/drop/lint-if-let-rescope-with-macro.stderr b/tests/ui/drop/lint-if-let-rescope-with-macro.stderr index 029d5c74929..f1ca0ba57de 100644 --- a/tests/ui/drop/lint-if-let-rescope-with-macro.stderr +++ b/tests/ui/drop/lint-if-let-rescope-with-macro.stderr @@ -15,6 +15,15 @@ LL | | }; | = warning: this changes meaning in Rust 2024 = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/temporary-if-let-scope.html> +note: value invokes this custom destructor + --> $DIR/lint-if-let-rescope-with-macro.rs:22:1 + | +LL | / impl Drop for Droppy { +LL | | fn drop(&mut self) { +LL | | println!("dropped"); +LL | | } +LL | | } + | |_^ help: the value is now dropped here in Edition 2024 --> $DIR/lint-if-let-rescope-with-macro.rs:12:38 | diff --git a/tests/ui/drop/lint-if-let-rescope.fixed b/tests/ui/drop/lint-if-let-rescope.fixed index 182190aa323..79858e6f225 100644 --- a/tests/ui/drop/lint-if-let-rescope.fixed +++ b/tests/ui/drop/lint-if-let-rescope.fixed @@ -94,6 +94,12 @@ fn main() { //~| HELP: a `match` with a single arm can preserve the drop order up to Edition 2021 } + match Some((droppy(), ()).1) { Some(_value) => {} _ => {}} + //~^ ERROR: `if let` assigns a shorter lifetime since Edition 2024 + //~| WARN: this changes meaning in Rust 2024 + //~| HELP: the value is now dropped here in Edition 2024 + //~| HELP: a `match` with a single arm can preserve the drop order up to Edition 2021 + // We want to keep the `if let`s below as direct descendents of match arms, // so the formatting is suppressed. #[rustfmt::skip] diff --git a/tests/ui/drop/lint-if-let-rescope.rs b/tests/ui/drop/lint-if-let-rescope.rs index e1b38be0a0f..9d873c65426 100644 --- a/tests/ui/drop/lint-if-let-rescope.rs +++ b/tests/ui/drop/lint-if-let-rescope.rs @@ -94,6 +94,12 @@ fn main() { //~| HELP: a `match` with a single arm can preserve the drop order up to Edition 2021 } + if let Some(_value) = Some((droppy(), ()).1) {} else {} + //~^ ERROR: `if let` assigns a shorter lifetime since Edition 2024 + //~| WARN: this changes meaning in Rust 2024 + //~| HELP: the value is now dropped here in Edition 2024 + //~| HELP: a `match` with a single arm can preserve the drop order up to Edition 2021 + // We want to keep the `if let`s below as direct descendents of match arms, // so the formatting is suppressed. #[rustfmt::skip] diff --git a/tests/ui/drop/lint-if-let-rescope.stderr b/tests/ui/drop/lint-if-let-rescope.stderr index 2b0fcb7a938..e95ec8fcea7 100644 --- a/tests/ui/drop/lint-if-let-rescope.stderr +++ b/tests/ui/drop/lint-if-let-rescope.stderr @@ -8,6 +8,15 @@ LL | if let Some(_value) = droppy().get() { | = warning: this changes meaning in Rust 2024 = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/temporary-if-let-scope.html> +note: value invokes this custom destructor + --> $DIR/lint-if-let-rescope.rs:11:1 + | +LL | / impl Drop for Droppy { +LL | | fn drop(&mut self) { +LL | | println!("dropped"); +LL | | } +LL | | } + | |_^ help: the value is now dropped here in Edition 2024 --> $DIR/lint-if-let-rescope.rs:32:5 | @@ -43,6 +52,24 @@ LL | } else if let Some(_value) = droppy().get() { | = warning: this changes meaning in Rust 2024 = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/temporary-if-let-scope.html> +note: value invokes this custom destructor + --> $DIR/lint-if-let-rescope.rs:11:1 + | +LL | / impl Drop for Droppy { +LL | | fn drop(&mut self) { +LL | | println!("dropped"); +LL | | } +LL | | } + | |_^ +note: value invokes this custom destructor + --> $DIR/lint-if-let-rescope.rs:11:1 + | +LL | / impl Drop for Droppy { +LL | | fn drop(&mut self) { +LL | | println!("dropped"); +LL | | } +LL | | } + | |_^ help: the value is now dropped here in Edition 2024 --> $DIR/lint-if-let-rescope.rs:42:5 | @@ -75,6 +102,15 @@ LL | } else if let Some(_value) = droppy().get() { | = warning: this changes meaning in Rust 2024 = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/temporary-if-let-scope.html> +note: value invokes this custom destructor + --> $DIR/lint-if-let-rescope.rs:11:1 + | +LL | / impl Drop for Droppy { +LL | | fn drop(&mut self) { +LL | | println!("dropped"); +LL | | } +LL | | } + | |_^ help: the value is now dropped here in Edition 2024 --> $DIR/lint-if-let-rescope.rs:54:5 | @@ -101,6 +137,15 @@ LL | if let Some(1) = { if let Some(_value) = Droppy.get() { Some(1) } else | = warning: this changes meaning in Rust 2024 = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/temporary-if-let-scope.html> +note: value invokes this custom destructor + --> $DIR/lint-if-let-rescope.rs:11:1 + | +LL | / impl Drop for Droppy { +LL | | fn drop(&mut self) { +LL | | println!("dropped"); +LL | | } +LL | | } + | |_^ help: the value is now dropped here in Edition 2024 --> $DIR/lint-if-let-rescope.rs:58:69 | @@ -122,6 +167,15 @@ LL | if (if let Some(_value) = droppy().get() { true } else { false }) { | = warning: this changes meaning in Rust 2024 = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/temporary-if-let-scope.html> +note: value invokes this custom destructor + --> $DIR/lint-if-let-rescope.rs:11:1 + | +LL | / impl Drop for Droppy { +LL | | fn drop(&mut self) { +LL | | println!("dropped"); +LL | | } +LL | | } + | |_^ help: the value is now dropped here in Edition 2024 --> $DIR/lint-if-let-rescope.rs:72:53 | @@ -143,6 +197,15 @@ LL | } else if (((if let Some(_value) = droppy().get() { true } else { false | = warning: this changes meaning in Rust 2024 = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/temporary-if-let-scope.html> +note: value invokes this custom destructor + --> $DIR/lint-if-let-rescope.rs:11:1 + | +LL | / impl Drop for Droppy { +LL | | fn drop(&mut self) { +LL | | println!("dropped"); +LL | | } +LL | | } + | |_^ help: the value is now dropped here in Edition 2024 --> $DIR/lint-if-let-rescope.rs:78:62 | @@ -164,6 +227,15 @@ LL | while (if let Some(_value) = droppy().get() { false } else { true }) { | = warning: this changes meaning in Rust 2024 = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/temporary-if-let-scope.html> +note: value invokes this custom destructor + --> $DIR/lint-if-let-rescope.rs:11:1 + | +LL | / impl Drop for Droppy { +LL | | fn drop(&mut self) { +LL | | println!("dropped"); +LL | | } +LL | | } + | |_^ help: the value is now dropped here in Edition 2024 --> $DIR/lint-if-let-rescope.rs:90:57 | @@ -175,5 +247,26 @@ LL - while (if let Some(_value) = droppy().get() { false } else { true }) { LL + while (match droppy().get() { Some(_value) => { false } _ => { true }}) { | -error: aborting due to 7 previous errors +error: `if let` assigns a shorter lifetime since Edition 2024 + --> $DIR/lint-if-let-rescope.rs:97:8 + | +LL | if let Some(_value) = Some((droppy(), ()).1) {} else {} + | ^^^^^^^^^^^^^^^^^^^^^^^^--------------^^^ + | | + | this value has a significant drop implementation which may observe a major change in drop order and requires your discretion + | + = warning: this changes meaning in Rust 2024 + = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/temporary-if-let-scope.html> +help: the value is now dropped here in Edition 2024 + --> $DIR/lint-if-let-rescope.rs:97:51 + | +LL | if let Some(_value) = Some((droppy(), ()).1) {} else {} + | ^ +help: a `match` with a single arm can preserve the drop order up to Edition 2021 + | +LL - if let Some(_value) = Some((droppy(), ()).1) {} else {} +LL + match Some((droppy(), ()).1) { Some(_value) => {} _ => {}} + | + +error: aborting due to 8 previous errors diff --git a/tests/ui/dropck/dropck-after-failed-type-lowering.rs b/tests/ui/dropck/dropck-after-failed-type-lowering.rs new file mode 100644 index 00000000000..2441e26fec9 --- /dev/null +++ b/tests/ui/dropck/dropck-after-failed-type-lowering.rs @@ -0,0 +1,14 @@ +// Regression test for #137329 + +trait B { + type C<'a>; + fn d<E>() -> F<E> { + todo!() + } +} +struct F<G> { + h: Option<<G as B>::C>, + //~^ ERROR missing generics for associated type `B::C` +} + +fn main() {} diff --git a/tests/ui/dropck/dropck-after-failed-type-lowering.stderr b/tests/ui/dropck/dropck-after-failed-type-lowering.stderr new file mode 100644 index 00000000000..56ea72de0c5 --- /dev/null +++ b/tests/ui/dropck/dropck-after-failed-type-lowering.stderr @@ -0,0 +1,19 @@ +error[E0107]: missing generics for associated type `B::C` + --> $DIR/dropck-after-failed-type-lowering.rs:10:25 + | +LL | h: Option<<G as B>::C>, + | ^ expected 1 lifetime argument + | +note: associated type defined here, with 1 lifetime parameter: `'a` + --> $DIR/dropck-after-failed-type-lowering.rs:4:10 + | +LL | type C<'a>; + | ^ -- +help: add missing lifetime argument + | +LL | h: Option<<G as B>::C<'a>>, + | ++++ + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0107`. diff --git a/tests/ui/dst/dst-bad-assign-3.rs b/tests/ui/dst/dst-bad-assign-3.rs index d199864d99c..f96ecf7762c 100644 --- a/tests/ui/dst/dst-bad-assign-3.rs +++ b/tests/ui/dst/dst-bad-assign-3.rs @@ -1,8 +1,6 @@ // Forbid assignment into a dynamically sized type. -#![feature(unsized_tuple_coercion)] - -type Fat<T> = (isize, &'static str, T); +struct Fat<T: ?Sized>(isize, &'static str, T); #[derive(PartialEq,Eq)] struct Bar; @@ -28,7 +26,7 @@ impl ToBar for Bar1 { pub fn main() { // Assignment. - let f5: &mut Fat<dyn ToBar> = &mut (5, "some str", Bar1 {f :42}); + let f5: &mut Fat<dyn ToBar> = &mut Fat(5, "some str", Bar1 {f :42}); let z: Box<dyn ToBar> = Box::new(Bar1 {f: 36}); f5.2 = Bar1 {f: 36}; //~^ ERROR mismatched types diff --git a/tests/ui/dst/dst-bad-assign-3.stderr b/tests/ui/dst/dst-bad-assign-3.stderr index 007f6b898be..4aa1677e751 100644 --- a/tests/ui/dst/dst-bad-assign-3.stderr +++ b/tests/ui/dst/dst-bad-assign-3.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/dst-bad-assign-3.rs:33:12 + --> $DIR/dst-bad-assign-3.rs:31:12 | LL | f5.2 = Bar1 {f: 36}; | ---- ^^^^^^^^^^^^ expected `dyn ToBar`, found `Bar1` @@ -11,7 +11,7 @@ LL | f5.2 = Bar1 {f: 36}; = help: `Bar1` implements `ToBar` so you could box the found value and coerce it to the trait object `Box<dyn ToBar>`, you will have to change the expected type as well error[E0277]: the size for values of type `dyn ToBar` cannot be known at compilation time - --> $DIR/dst-bad-assign-3.rs:33:5 + --> $DIR/dst-bad-assign-3.rs:31:5 | LL | f5.2 = Bar1 {f: 36}; | ^^^^ doesn't have a size known at compile-time diff --git a/tests/ui/dst/dst-bad-coerce1.rs b/tests/ui/dst/dst-bad-coerce1.rs index 7ef237e39e3..5ee0bfa9fbf 100644 --- a/tests/ui/dst/dst-bad-coerce1.rs +++ b/tests/ui/dst/dst-bad-coerce1.rs @@ -1,7 +1,5 @@ // Attempt to change the type as well as unsizing. -#![feature(unsized_tuple_coercion)] - struct Fat<T: ?Sized> { ptr: T } @@ -21,16 +19,4 @@ pub fn main() { let f2: &Fat<Foo> = &f1; let f3: &Fat<dyn Bar> = f2; //~^ ERROR `Foo: Bar` is not satisfied - - // Tuple with a vec of isize. - let f1 = ([1, 2, 3],); - let f2: &([isize; 3],) = &f1; - let f3: &([usize],) = f2; - //~^ ERROR mismatched types - - // Tuple with a trait. - let f1 = (Foo,); - let f2: &(Foo,) = &f1; - let f3: &(dyn Bar,) = f2; - //~^ ERROR `Foo: Bar` is not satisfied } diff --git a/tests/ui/dst/dst-bad-coerce1.stderr b/tests/ui/dst/dst-bad-coerce1.stderr index 455d15e935f..68456b8642c 100644 --- a/tests/ui/dst/dst-bad-coerce1.stderr +++ b/tests/ui/dst/dst-bad-coerce1.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/dst-bad-coerce1.rs:16:29 + --> $DIR/dst-bad-coerce1.rs:14:29 | LL | let f3: &Fat<[usize]> = f2; | ------------- ^^ expected `&Fat<[usize]>`, found `&Fat<[isize; 3]>` @@ -10,43 +10,19 @@ LL | let f3: &Fat<[usize]> = f2; found reference `&Fat<[isize; 3]>` error[E0277]: the trait bound `Foo: Bar` is not satisfied - --> $DIR/dst-bad-coerce1.rs:22:29 + --> $DIR/dst-bad-coerce1.rs:20:29 | LL | let f3: &Fat<dyn Bar> = f2; | ^^ the trait `Bar` is not implemented for `Foo` | help: this trait has no implementations, consider adding one - --> $DIR/dst-bad-coerce1.rs:10:1 + --> $DIR/dst-bad-coerce1.rs:8:1 | LL | trait Bar { fn bar(&self) {} } | ^^^^^^^^^ = note: required for the cast from `&Fat<Foo>` to `&Fat<dyn Bar>` -error[E0308]: mismatched types - --> $DIR/dst-bad-coerce1.rs:28:27 - | -LL | let f3: &([usize],) = f2; - | ----------- ^^ expected `&([usize],)`, found `&([isize; 3],)` - | | - | expected due to this - | - = note: expected reference `&([usize],)` - found reference `&([isize; 3],)` - -error[E0277]: the trait bound `Foo: Bar` is not satisfied - --> $DIR/dst-bad-coerce1.rs:34:27 - | -LL | let f3: &(dyn Bar,) = f2; - | ^^ the trait `Bar` is not implemented for `Foo` - | -help: this trait has no implementations, consider adding one - --> $DIR/dst-bad-coerce1.rs:10:1 - | -LL | trait Bar { fn bar(&self) {} } - | ^^^^^^^^^ - = note: required for the cast from `&(Foo,)` to `&(dyn Bar,)` - -error: aborting due to 4 previous errors +error: aborting due to 2 previous errors Some errors have detailed explanations: E0277, E0308. For more information about an error, try `rustc --explain E0277`. diff --git a/tests/ui/dst/dst-bad-coerce3.rs b/tests/ui/dst/dst-bad-coerce3.rs index fd5ee3b57bb..508f009c33e 100644 --- a/tests/ui/dst/dst-bad-coerce3.rs +++ b/tests/ui/dst/dst-bad-coerce3.rs @@ -1,7 +1,5 @@ // Attempt to extend the lifetime as well as unsizing. -#![feature(unsized_tuple_coercion)] - struct Fat<T: ?Sized> { ptr: T } @@ -20,16 +18,6 @@ fn baz<'a>() { let f1 = Fat { ptr: Foo }; let f2: &Fat<Foo> = &f1; //~ ERROR `f1` does not live long enough let f3: &'a Fat<dyn Bar> = f2; - - // Tuple with a vec of ints. - let f1 = ([1, 2, 3],); - let f2: &([isize; 3],) = &f1; //~ ERROR `f1` does not live long enough - let f3: &'a ([isize],) = f2; - - // Tuple with a trait. - let f1 = (Foo,); - let f2: &(Foo,) = &f1; //~ ERROR `f1` does not live long enough - let f3: &'a (dyn Bar,) = f2; } pub fn main() { diff --git a/tests/ui/dst/dst-bad-coerce3.stderr b/tests/ui/dst/dst-bad-coerce3.stderr index 1254250bcbd..177535b8c7c 100644 --- a/tests/ui/dst/dst-bad-coerce3.stderr +++ b/tests/ui/dst/dst-bad-coerce3.stderr @@ -1,5 +1,5 @@ error[E0597]: `f1` does not live long enough - --> $DIR/dst-bad-coerce3.rs:16:32 + --> $DIR/dst-bad-coerce3.rs:14:32 | LL | fn baz<'a>() { | -- lifetime `'a` defined here @@ -15,7 +15,7 @@ LL | } | - `f1` dropped here while still borrowed error[E0597]: `f1` does not live long enough - --> $DIR/dst-bad-coerce3.rs:21:25 + --> $DIR/dst-bad-coerce3.rs:19:25 | LL | fn baz<'a>() { | -- lifetime `'a` defined here @@ -26,41 +26,9 @@ LL | let f2: &Fat<Foo> = &f1; | ^^^ borrowed value does not live long enough LL | let f3: &'a Fat<dyn Bar> = f2; | ---------------- type annotation requires that `f1` is borrowed for `'a` -... -LL | } - | - `f1` dropped here while still borrowed - -error[E0597]: `f1` does not live long enough - --> $DIR/dst-bad-coerce3.rs:26:30 - | -LL | fn baz<'a>() { - | -- lifetime `'a` defined here -... -LL | let f1 = ([1, 2, 3],); - | -- binding `f1` declared here -LL | let f2: &([isize; 3],) = &f1; - | ^^^ borrowed value does not live long enough -LL | let f3: &'a ([isize],) = f2; - | -------------- type annotation requires that `f1` is borrowed for `'a` -... -LL | } - | - `f1` dropped here while still borrowed - -error[E0597]: `f1` does not live long enough - --> $DIR/dst-bad-coerce3.rs:31:23 - | -LL | fn baz<'a>() { - | -- lifetime `'a` defined here -... -LL | let f1 = (Foo,); - | -- binding `f1` declared here -LL | let f2: &(Foo,) = &f1; - | ^^^ borrowed value does not live long enough -LL | let f3: &'a (dyn Bar,) = f2; - | -------------- type annotation requires that `f1` is borrowed for `'a` LL | } | - `f1` dropped here while still borrowed -error: aborting due to 4 previous errors +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0597`. diff --git a/tests/ui/dst/dst-bad-coerce4.rs b/tests/ui/dst/dst-bad-coerce4.rs index 9f297915e58..25410aa4fac 100644 --- a/tests/ui/dst/dst-bad-coerce4.rs +++ b/tests/ui/dst/dst-bad-coerce4.rs @@ -1,7 +1,5 @@ // Attempt to coerce from unsized to sized. -#![feature(unsized_tuple_coercion)] - struct Fat<T: ?Sized> { ptr: T } @@ -14,12 +12,4 @@ pub fn main() { //~| expected `&Fat<[isize; 3]>`, found `&Fat<[isize]>` //~| expected reference `&Fat<[isize; 3]>` //~| found reference `&Fat<[isize]>` - - // Tuple with a vec of isizes. - let f1: &([isize],) = &([1, 2, 3],); - let f2: &([isize; 3],) = f1; - //~^ ERROR mismatched types - //~| expected `&([isize; 3],)`, found `&([isize],)` - //~| expected reference `&([isize; 3],)` - //~| found reference `&([isize],)` } diff --git a/tests/ui/dst/dst-bad-coerce4.stderr b/tests/ui/dst/dst-bad-coerce4.stderr index 46e7dba817c..5c14c0bfedd 100644 --- a/tests/ui/dst/dst-bad-coerce4.stderr +++ b/tests/ui/dst/dst-bad-coerce4.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/dst-bad-coerce4.rs:12:32 + --> $DIR/dst-bad-coerce4.rs:10:32 | LL | let f2: &Fat<[isize; 3]> = f1; | ---------------- ^^ expected `&Fat<[isize; 3]>`, found `&Fat<[isize]>` @@ -9,17 +9,6 @@ LL | let f2: &Fat<[isize; 3]> = f1; = note: expected reference `&Fat<[isize; 3]>` found reference `&Fat<[isize]>` -error[E0308]: mismatched types - --> $DIR/dst-bad-coerce4.rs:20:30 - | -LL | let f2: &([isize; 3],) = f1; - | -------------- ^^ expected `&([isize; 3],)`, found `&([isize],)` - | | - | expected due to this - | - = note: expected reference `&([isize; 3],)` - found reference `&([isize],)` - -error: aborting due to 2 previous errors +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/dst/dst-bad-deep-2.rs b/tests/ui/dst/dst-bad-deep-2.rs index e587399135d..76d35751369 100644 --- a/tests/ui/dst/dst-bad-deep-2.rs +++ b/tests/ui/dst/dst-bad-deep-2.rs @@ -3,11 +3,11 @@ // because it would require stack allocation of an unsized temporary (*g in the // test). -#![feature(unsized_tuple_coercion)] +struct Fat<T: ?Sized>(T); pub fn main() { - let f: ([isize; 3],) = ([5, 6, 7],); - let g: &([isize],) = &f; - let h: &(([isize],),) = &(*g,); + let f: Fat<[isize; 3]> = Fat([5, 6, 7]); + let g: &Fat<[isize]> = &f; + let h: &Fat<Fat<[isize]>> = &Fat(*g); //~^ ERROR the size for values of type } diff --git a/tests/ui/dst/dst-bad-deep-2.stderr b/tests/ui/dst/dst-bad-deep-2.stderr index c7e9854340f..de3f71d206f 100644 --- a/tests/ui/dst/dst-bad-deep-2.stderr +++ b/tests/ui/dst/dst-bad-deep-2.stderr @@ -1,13 +1,17 @@ error[E0277]: the size for values of type `[isize]` cannot be known at compilation time - --> $DIR/dst-bad-deep-2.rs:11:30 + --> $DIR/dst-bad-deep-2.rs:11:38 | -LL | let h: &(([isize],),) = &(*g,); - | ^^^^^ doesn't have a size known at compile-time +LL | let h: &Fat<Fat<[isize]>> = &Fat(*g); + | ^^ doesn't have a size known at compile-time | - = help: within `(([isize],),)`, the trait `Sized` is not implemented for `[isize]` - = note: required because it appears within the type `([isize],)` - = note: required because it appears within the type `(([isize],),)` - = note: tuples must have a statically known size to be initialized + = help: within `Fat<[isize]>`, the trait `Sized` is not implemented for `[isize]` +note: required because it appears within the type `Fat<[isize]>` + --> $DIR/dst-bad-deep-2.rs:6:8 + | +LL | struct Fat<T: ?Sized>(T); + | ^^^ + = note: all function arguments must have a statically known size + = help: unsized fn params are gated as an unstable feature error: aborting due to 1 previous error diff --git a/tests/ui/dyn-compatibility/associated-consts.dyn_compatible_for_dispatch.stderr b/tests/ui/dyn-compatibility/associated-consts.dyn_compatible_for_dispatch.stderr deleted file mode 100644 index 704d833f00b..00000000000 --- a/tests/ui/dyn-compatibility/associated-consts.dyn_compatible_for_dispatch.stderr +++ /dev/null @@ -1,20 +0,0 @@ -error[E0038]: the trait `Bar` is not dyn compatible - --> $DIR/associated-consts.rs:14:5 - | -LL | t - | ^ `Bar` is not dyn compatible - | -note: for a trait to be dyn compatible it needs to allow building a vtable - for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> - --> $DIR/associated-consts.rs:9:11 - | -LL | trait Bar { - | --- this trait is not dyn compatible... -LL | const X: usize; - | ^ ...because it contains this associated `const` - = help: consider moving `X` to another trait - = note: required for the cast from `&T` to `&dyn Bar` - -error: aborting due to 1 previous error - -For more information about this error, try `rustc --explain E0038`. diff --git a/tests/ui/dyn-compatibility/associated-consts.rs b/tests/ui/dyn-compatibility/associated-consts.rs index fc7b372b782..10d151d9a8b 100644 --- a/tests/ui/dyn-compatibility/associated-consts.rs +++ b/tests/ui/dyn-compatibility/associated-consts.rs @@ -1,16 +1,12 @@ // Check that we correctly prevent users from making trait objects // from traits with associated consts. -// -//@ revisions: curr dyn_compatible_for_dispatch - -#![cfg_attr(dyn_compatible_for_dispatch, feature(dyn_compatible_for_dispatch))] trait Bar { const X: usize; } fn make_bar<T:Bar>(t: &T) -> &dyn Bar { - //[curr]~^ ERROR E0038 + //~^ ERROR E0038 t //~^ ERROR E0038 } diff --git a/tests/ui/dyn-compatibility/generics.dyn_compatible_for_dispatch.stderr b/tests/ui/dyn-compatibility/associated-consts.stderr index b3565a766fe..beaf263af07 100644 --- a/tests/ui/dyn-compatibility/generics.dyn_compatible_for_dispatch.stderr +++ b/tests/ui/dyn-compatibility/associated-consts.stderr @@ -1,35 +1,34 @@ error[E0038]: the trait `Bar` is not dyn compatible - --> $DIR/generics.rs:20:5 + --> $DIR/associated-consts.rs:8:31 | -LL | t - | ^ `Bar` is not dyn compatible +LL | fn make_bar<T:Bar>(t: &T) -> &dyn Bar { + | ^^^^^^^ `Bar` is not dyn compatible | note: for a trait to be dyn compatible it needs to allow building a vtable for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> - --> $DIR/generics.rs:10:8 + --> $DIR/associated-consts.rs:5:11 | LL | trait Bar { | --- this trait is not dyn compatible... -LL | fn bar<T>(&self, t: T); - | ^^^ ...because method `bar` has generic type parameters - = help: consider moving `bar` to another trait - = note: required for the cast from `&T` to `&dyn Bar` +LL | const X: usize; + | ^ ...because it contains this associated `const` + = help: consider moving `X` to another trait error[E0038]: the trait `Bar` is not dyn compatible - --> $DIR/generics.rs:27:5 + --> $DIR/associated-consts.rs:10:5 | -LL | t as &dyn Bar +LL | t | ^ `Bar` is not dyn compatible | note: for a trait to be dyn compatible it needs to allow building a vtable for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> - --> $DIR/generics.rs:10:8 + --> $DIR/associated-consts.rs:5:11 | LL | trait Bar { | --- this trait is not dyn compatible... -LL | fn bar<T>(&self, t: T); - | ^^^ ...because method `bar` has generic type parameters - = help: consider moving `bar` to another trait +LL | const X: usize; + | ^ ...because it contains this associated `const` + = help: consider moving `X` to another trait = note: required for the cast from `&T` to `&dyn Bar` error: aborting due to 2 previous errors diff --git a/tests/ui/dyn-compatibility/generics.rs b/tests/ui/dyn-compatibility/generics.rs index b51555aa500..dcce17f925b 100644 --- a/tests/ui/dyn-compatibility/generics.rs +++ b/tests/ui/dyn-compatibility/generics.rs @@ -1,9 +1,6 @@ // Check that we correctly prevent users from making trait objects // from traits with generic methods, unless `where Self : Sized` is // present. -//@ revisions: curr dyn_compatible_for_dispatch - -#![cfg_attr(dyn_compatible_for_dispatch, feature(dyn_compatible_for_dispatch))] trait Bar { @@ -16,18 +13,16 @@ trait Quux { } fn make_bar<T:Bar>(t: &T) -> &dyn Bar { - //[curr]~^ ERROR E0038 + //~^ ERROR E0038 t - //[dyn_compatible_for_dispatch]~^ ERROR E0038 - //[curr]~^^ ERROR E0038 + //~^ ERROR E0038 } fn make_bar_explicit<T:Bar>(t: &T) -> &dyn Bar { - //[curr]~^ ERROR E0038 + //~^ ERROR E0038 t as &dyn Bar - //[dyn_compatible_for_dispatch]~^ ERROR E0038 - //[curr]~^^ ERROR E0038 - //[curr]~| ERROR E0038 + //~^ ERROR E0038 + //~| ERROR E0038 } fn make_quux<T:Quux>(t: &T) -> &dyn Quux { diff --git a/tests/ui/dyn-compatibility/generics.stderr b/tests/ui/dyn-compatibility/generics.stderr new file mode 100644 index 00000000000..c0193010541 --- /dev/null +++ b/tests/ui/dyn-compatibility/generics.stderr @@ -0,0 +1,85 @@ +error[E0038]: the trait `Bar` is not dyn compatible + --> $DIR/generics.rs:15:31 + | +LL | fn make_bar<T:Bar>(t: &T) -> &dyn Bar { + | ^^^^^^^ `Bar` is not dyn compatible + | +note: for a trait to be dyn compatible it needs to allow building a vtable + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> + --> $DIR/generics.rs:7:8 + | +LL | trait Bar { + | --- this trait is not dyn compatible... +LL | fn bar<T>(&self, t: T); + | ^^^ ...because method `bar` has generic type parameters + = help: consider moving `bar` to another trait + +error[E0038]: the trait `Bar` is not dyn compatible + --> $DIR/generics.rs:21:40 + | +LL | fn make_bar_explicit<T:Bar>(t: &T) -> &dyn Bar { + | ^^^^^^^ `Bar` is not dyn compatible + | +note: for a trait to be dyn compatible it needs to allow building a vtable + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> + --> $DIR/generics.rs:7:8 + | +LL | trait Bar { + | --- this trait is not dyn compatible... +LL | fn bar<T>(&self, t: T); + | ^^^ ...because method `bar` has generic type parameters + = help: consider moving `bar` to another trait + +error[E0038]: the trait `Bar` is not dyn compatible + --> $DIR/generics.rs:17:5 + | +LL | t + | ^ `Bar` is not dyn compatible + | +note: for a trait to be dyn compatible it needs to allow building a vtable + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> + --> $DIR/generics.rs:7:8 + | +LL | trait Bar { + | --- this trait is not dyn compatible... +LL | fn bar<T>(&self, t: T); + | ^^^ ...because method `bar` has generic type parameters + = help: consider moving `bar` to another trait + = note: required for the cast from `&T` to `&dyn Bar` + +error[E0038]: the trait `Bar` is not dyn compatible + --> $DIR/generics.rs:23:10 + | +LL | t as &dyn Bar + | ^^^^^^^^ `Bar` is not dyn compatible + | +note: for a trait to be dyn compatible it needs to allow building a vtable + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> + --> $DIR/generics.rs:7:8 + | +LL | trait Bar { + | --- this trait is not dyn compatible... +LL | fn bar<T>(&self, t: T); + | ^^^ ...because method `bar` has generic type parameters + = help: consider moving `bar` to another trait + +error[E0038]: the trait `Bar` is not dyn compatible + --> $DIR/generics.rs:23:5 + | +LL | t as &dyn Bar + | ^ `Bar` is not dyn compatible + | +note: for a trait to be dyn compatible it needs to allow building a vtable + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> + --> $DIR/generics.rs:7:8 + | +LL | trait Bar { + | --- this trait is not dyn compatible... +LL | fn bar<T>(&self, t: T); + | ^^^ ...because method `bar` has generic type parameters + = help: consider moving `bar` to another trait + = note: required for the cast from `&T` to `&dyn Bar` + +error: aborting due to 5 previous errors + +For more information about this error, try `rustc --explain E0038`. diff --git a/tests/ui/dyn-compatibility/mentions-Self.curr.stderr b/tests/ui/dyn-compatibility/mentions-Self.curr.stderr index 2d3fe5ce636..6d1ae90152e 100644 --- a/tests/ui/dyn-compatibility/mentions-Self.curr.stderr +++ b/tests/ui/dyn-compatibility/mentions-Self.curr.stderr @@ -1,12 +1,12 @@ error[E0038]: the trait `Bar` is not dyn compatible - --> $DIR/mentions-Self.rs:22:31 + --> $DIR/mentions-Self.rs:18:31 | LL | fn make_bar<T:Bar>(t: &T) -> &dyn Bar { | ^^^^^^^ `Bar` is not dyn compatible | note: for a trait to be dyn compatible it needs to allow building a vtable for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> - --> $DIR/mentions-Self.rs:11:22 + --> $DIR/mentions-Self.rs:7:22 | LL | trait Bar { | --- this trait is not dyn compatible... @@ -15,14 +15,14 @@ LL | fn bar(&self, x: &Self); = help: consider moving `bar` to another trait error[E0038]: the trait `Baz` is not dyn compatible - --> $DIR/mentions-Self.rs:28:31 + --> $DIR/mentions-Self.rs:24:31 | LL | fn make_baz<T:Baz>(t: &T) -> &dyn Baz { | ^^^^^^^ `Baz` is not dyn compatible | note: for a trait to be dyn compatible it needs to allow building a vtable for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> - --> $DIR/mentions-Self.rs:15:22 + --> $DIR/mentions-Self.rs:11:22 | LL | trait Baz { | --- this trait is not dyn compatible... @@ -31,14 +31,14 @@ LL | fn baz(&self) -> Self; = help: consider moving `baz` to another trait error[E0038]: the trait `Bar` is not dyn compatible - --> $DIR/mentions-Self.rs:24:5 + --> $DIR/mentions-Self.rs:20:5 | LL | t | ^ `Bar` is not dyn compatible | note: for a trait to be dyn compatible it needs to allow building a vtable for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> - --> $DIR/mentions-Self.rs:11:22 + --> $DIR/mentions-Self.rs:7:22 | LL | trait Bar { | --- this trait is not dyn compatible... @@ -48,14 +48,14 @@ LL | fn bar(&self, x: &Self); = note: required for the cast from `&T` to `&dyn Bar` error[E0038]: the trait `Baz` is not dyn compatible - --> $DIR/mentions-Self.rs:30:5 + --> $DIR/mentions-Self.rs:26:5 | LL | t | ^ `Baz` is not dyn compatible | note: for a trait to be dyn compatible it needs to allow building a vtable for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> - --> $DIR/mentions-Self.rs:15:22 + --> $DIR/mentions-Self.rs:11:22 | LL | trait Baz { | --- this trait is not dyn compatible... diff --git a/tests/ui/dyn-compatibility/mentions-Self.rs b/tests/ui/dyn-compatibility/mentions-Self.rs index 84c229e252d..ce210f4776f 100644 --- a/tests/ui/dyn-compatibility/mentions-Self.rs +++ b/tests/ui/dyn-compatibility/mentions-Self.rs @@ -1,10 +1,6 @@ // Check that we correctly prevent users from making trait objects // form traits that make use of `Self` in an argument or return // position, unless `where Self : Sized` is present.. -// -//@ revisions: curr dyn_compatible_for_dispatch - -#![cfg_attr(dyn_compatible_for_dispatch, feature(dyn_compatible_for_dispatch))] trait Bar { @@ -20,13 +16,13 @@ trait Quux { } fn make_bar<T:Bar>(t: &T) -> &dyn Bar { - //[curr]~^ ERROR E0038 + //~^ ERROR E0038 t //~^ ERROR E0038 } fn make_baz<T:Baz>(t: &T) -> &dyn Baz { - //[curr]~^ ERROR E0038 + //~^ ERROR E0038 t //~^ ERROR E0038 } diff --git a/tests/ui/dyn-compatibility/mentions-Self.stderr b/tests/ui/dyn-compatibility/mentions-Self.stderr new file mode 100644 index 00000000000..6d1ae90152e --- /dev/null +++ b/tests/ui/dyn-compatibility/mentions-Self.stderr @@ -0,0 +1,69 @@ +error[E0038]: the trait `Bar` is not dyn compatible + --> $DIR/mentions-Self.rs:18:31 + | +LL | fn make_bar<T:Bar>(t: &T) -> &dyn Bar { + | ^^^^^^^ `Bar` is not dyn compatible + | +note: for a trait to be dyn compatible it needs to allow building a vtable + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> + --> $DIR/mentions-Self.rs:7:22 + | +LL | trait Bar { + | --- this trait is not dyn compatible... +LL | fn bar(&self, x: &Self); + | ^^^^^ ...because method `bar` references the `Self` type in this parameter + = help: consider moving `bar` to another trait + +error[E0038]: the trait `Baz` is not dyn compatible + --> $DIR/mentions-Self.rs:24:31 + | +LL | fn make_baz<T:Baz>(t: &T) -> &dyn Baz { + | ^^^^^^^ `Baz` is not dyn compatible + | +note: for a trait to be dyn compatible it needs to allow building a vtable + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> + --> $DIR/mentions-Self.rs:11:22 + | +LL | trait Baz { + | --- this trait is not dyn compatible... +LL | fn baz(&self) -> Self; + | ^^^^ ...because method `baz` references the `Self` type in its return type + = help: consider moving `baz` to another trait + +error[E0038]: the trait `Bar` is not dyn compatible + --> $DIR/mentions-Self.rs:20:5 + | +LL | t + | ^ `Bar` is not dyn compatible + | +note: for a trait to be dyn compatible it needs to allow building a vtable + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> + --> $DIR/mentions-Self.rs:7:22 + | +LL | trait Bar { + | --- this trait is not dyn compatible... +LL | fn bar(&self, x: &Self); + | ^^^^^ ...because method `bar` references the `Self` type in this parameter + = help: consider moving `bar` to another trait + = note: required for the cast from `&T` to `&dyn Bar` + +error[E0038]: the trait `Baz` is not dyn compatible + --> $DIR/mentions-Self.rs:26:5 + | +LL | t + | ^ `Baz` is not dyn compatible + | +note: for a trait to be dyn compatible it needs to allow building a vtable + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> + --> $DIR/mentions-Self.rs:11:22 + | +LL | trait Baz { + | --- this trait is not dyn compatible... +LL | fn baz(&self) -> Self; + | ^^^^ ...because method `baz` references the `Self` type in its return type + = help: consider moving `baz` to another trait + = note: required for the cast from `&T` to `&dyn Baz` + +error: aborting due to 4 previous errors + +For more information about this error, try `rustc --explain E0038`. diff --git a/tests/ui/dyn-compatibility/no-static.dyn_compatible_for_dispatch.stderr b/tests/ui/dyn-compatibility/no-static.dyn_compatible_for_dispatch.stderr deleted file mode 100644 index d5ad4510334..00000000000 --- a/tests/ui/dyn-compatibility/no-static.dyn_compatible_for_dispatch.stderr +++ /dev/null @@ -1,28 +0,0 @@ -error[E0038]: the trait `Foo` is not dyn compatible - --> $DIR/no-static.rs:22:27 - | -LL | let b: Box<dyn Foo> = Box::new(Bar); - | ^^^^^^^^^^^^^ `Foo` is not dyn compatible - | -note: for a trait to be dyn compatible it needs to allow building a vtable - for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> - --> $DIR/no-static.rs:9:8 - | -LL | trait Foo { - | --- this trait is not dyn compatible... -LL | fn foo() {} - | ^^^ ...because associated function `foo` has no `self` parameter - = help: only type `Bar` implements `Foo`; consider using it directly instead. - = note: required for the cast from `Box<Bar>` to `Box<dyn Foo>` -help: consider turning `foo` into a method by giving it a `&self` argument - | -LL | fn foo(&self) {} - | +++++ -help: alternatively, consider constraining `foo` so it does not apply to trait objects - | -LL | fn foo() where Self: Sized {} - | +++++++++++++++++ - -error: aborting due to 1 previous error - -For more information about this error, try `rustc --explain E0038`. diff --git a/tests/ui/dyn-compatibility/no-static.rs b/tests/ui/dyn-compatibility/no-static.rs index 54af16fe18e..9bd87161972 100644 --- a/tests/ui/dyn-compatibility/no-static.rs +++ b/tests/ui/dyn-compatibility/no-static.rs @@ -1,16 +1,12 @@ // Check that we correctly prevent users from making trait objects // from traits with static methods. -// -//@ revisions: curr dyn_compatible_for_dispatch - -#![cfg_attr(dyn_compatible_for_dispatch, feature(dyn_compatible_for_dispatch))] trait Foo { fn foo() {} } fn diverges() -> Box<dyn Foo> { - //[curr]~^ ERROR E0038 + //~^ ERROR E0038 loop { } } @@ -21,5 +17,5 @@ impl Foo for Bar {} fn main() { let b: Box<dyn Foo> = Box::new(Bar); //~^ ERROR E0038 - //[curr]~| ERROR E0038 + //~| ERROR E0038 } diff --git a/tests/ui/dyn-compatibility/no-static.stderr b/tests/ui/dyn-compatibility/no-static.stderr new file mode 100644 index 00000000000..814ab0d53c3 --- /dev/null +++ b/tests/ui/dyn-compatibility/no-static.stderr @@ -0,0 +1,76 @@ +error[E0038]: the trait `Foo` is not dyn compatible + --> $DIR/no-static.rs:8:22 + | +LL | fn diverges() -> Box<dyn Foo> { + | ^^^^^^^ `Foo` is not dyn compatible + | +note: for a trait to be dyn compatible it needs to allow building a vtable + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> + --> $DIR/no-static.rs:5:8 + | +LL | trait Foo { + | --- this trait is not dyn compatible... +LL | fn foo() {} + | ^^^ ...because associated function `foo` has no `self` parameter + = help: only type `Bar` implements `Foo`; consider using it directly instead. +help: consider turning `foo` into a method by giving it a `&self` argument + | +LL | fn foo(&self) {} + | +++++ +help: alternatively, consider constraining `foo` so it does not apply to trait objects + | +LL | fn foo() where Self: Sized {} + | +++++++++++++++++ + +error[E0038]: the trait `Foo` is not dyn compatible + --> $DIR/no-static.rs:18:12 + | +LL | let b: Box<dyn Foo> = Box::new(Bar); + | ^^^^^^^^^^^^ `Foo` is not dyn compatible + | +note: for a trait to be dyn compatible it needs to allow building a vtable + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> + --> $DIR/no-static.rs:5:8 + | +LL | trait Foo { + | --- this trait is not dyn compatible... +LL | fn foo() {} + | ^^^ ...because associated function `foo` has no `self` parameter + = help: only type `Bar` implements `Foo`; consider using it directly instead. +help: consider turning `foo` into a method by giving it a `&self` argument + | +LL | fn foo(&self) {} + | +++++ +help: alternatively, consider constraining `foo` so it does not apply to trait objects + | +LL | fn foo() where Self: Sized {} + | +++++++++++++++++ + +error[E0038]: the trait `Foo` is not dyn compatible + --> $DIR/no-static.rs:18:27 + | +LL | let b: Box<dyn Foo> = Box::new(Bar); + | ^^^^^^^^^^^^^ `Foo` is not dyn compatible + | +note: for a trait to be dyn compatible it needs to allow building a vtable + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> + --> $DIR/no-static.rs:5:8 + | +LL | trait Foo { + | --- this trait is not dyn compatible... +LL | fn foo() {} + | ^^^ ...because associated function `foo` has no `self` parameter + = help: only type `Bar` implements `Foo`; consider using it directly instead. + = note: required for the cast from `Box<Bar>` to `Box<dyn Foo>` +help: consider turning `foo` into a method by giving it a `&self` argument + | +LL | fn foo(&self) {} + | +++++ +help: alternatively, consider constraining `foo` so it does not apply to trait objects + | +LL | fn foo() where Self: Sized {} + | +++++++++++++++++ + +error: aborting due to 3 previous errors + +For more information about this error, try `rustc --explain E0038`. diff --git a/tests/ui/dyn-compatibility/sized-2.dyn_compatible_for_dispatch.stderr b/tests/ui/dyn-compatibility/sized-2.dyn_compatible_for_dispatch.stderr deleted file mode 100644 index 1fbc10c0c3f..00000000000 --- a/tests/ui/dyn-compatibility/sized-2.dyn_compatible_for_dispatch.stderr +++ /dev/null @@ -1,19 +0,0 @@ -error[E0038]: the trait `Bar` is not dyn compatible - --> $DIR/sized-2.rs:16:5 - | -LL | t - | ^ `Bar` is not dyn compatible - | -note: for a trait to be dyn compatible it needs to allow building a vtable - for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> - --> $DIR/sized-2.rs:9:18 - | -LL | trait Bar - | --- this trait is not dyn compatible... -LL | where Self : Sized - | ^^^^^ ...because it requires `Self: Sized` - = note: required for the cast from `&T` to `&dyn Bar` - -error: aborting due to 1 previous error - -For more information about this error, try `rustc --explain E0038`. diff --git a/tests/ui/dyn-compatibility/sized-2.rs b/tests/ui/dyn-compatibility/sized-2.rs index f5edd287f24..f61d49ee8df 100644 --- a/tests/ui/dyn-compatibility/sized-2.rs +++ b/tests/ui/dyn-compatibility/sized-2.rs @@ -1,9 +1,5 @@ // Check that we correctly prevent users from making trait objects // from traits where `Self : Sized`. -// -//@ revisions: curr dyn_compatible_for_dispatch - -#![cfg_attr(dyn_compatible_for_dispatch, feature(dyn_compatible_for_dispatch))] trait Bar where Self : Sized @@ -12,7 +8,7 @@ trait Bar } fn make_bar<T:Bar>(t: &T) -> &dyn Bar { - //[curr]~^ ERROR E0038 + //~^ ERROR E0038 t //~^ ERROR E0038 } diff --git a/tests/ui/dyn-compatibility/mentions-Self.dyn_compatible_for_dispatch.stderr b/tests/ui/dyn-compatibility/sized-2.stderr index 91c26a86025..1834d906bb8 100644 --- a/tests/ui/dyn-compatibility/mentions-Self.dyn_compatible_for_dispatch.stderr +++ b/tests/ui/dyn-compatibility/sized-2.stderr @@ -1,36 +1,33 @@ error[E0038]: the trait `Bar` is not dyn compatible - --> $DIR/mentions-Self.rs:24:5 + --> $DIR/sized-2.rs:10:31 | -LL | t - | ^ `Bar` is not dyn compatible +LL | fn make_bar<T:Bar>(t: &T) -> &dyn Bar { + | ^^^^^^^ `Bar` is not dyn compatible | note: for a trait to be dyn compatible it needs to allow building a vtable for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> - --> $DIR/mentions-Self.rs:11:22 + --> $DIR/sized-2.rs:5:18 | -LL | trait Bar { +LL | trait Bar | --- this trait is not dyn compatible... -LL | fn bar(&self, x: &Self); - | ^^^^^ ...because method `bar` references the `Self` type in this parameter - = help: consider moving `bar` to another trait - = note: required for the cast from `&T` to `&dyn Bar` +LL | where Self : Sized + | ^^^^^ ...because it requires `Self: Sized` -error[E0038]: the trait `Baz` is not dyn compatible - --> $DIR/mentions-Self.rs:30:5 +error[E0038]: the trait `Bar` is not dyn compatible + --> $DIR/sized-2.rs:12:5 | LL | t - | ^ `Baz` is not dyn compatible + | ^ `Bar` is not dyn compatible | note: for a trait to be dyn compatible it needs to allow building a vtable for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> - --> $DIR/mentions-Self.rs:15:22 + --> $DIR/sized-2.rs:5:18 | -LL | trait Baz { +LL | trait Bar | --- this trait is not dyn compatible... -LL | fn baz(&self) -> Self; - | ^^^^ ...because method `baz` references the `Self` type in its return type - = help: consider moving `baz` to another trait - = note: required for the cast from `&T` to `&dyn Baz` +LL | where Self : Sized + | ^^^^^ ...because it requires `Self: Sized` + = note: required for the cast from `&T` to `&dyn Bar` error: aborting due to 2 previous errors diff --git a/tests/ui/dyn-compatibility/sized.dyn_compatible_for_dispatch.stderr b/tests/ui/dyn-compatibility/sized.dyn_compatible_for_dispatch.stderr deleted file mode 100644 index 350c8992c6f..00000000000 --- a/tests/ui/dyn-compatibility/sized.dyn_compatible_for_dispatch.stderr +++ /dev/null @@ -1,19 +0,0 @@ -error[E0038]: the trait `Bar` is not dyn compatible - --> $DIR/sized.rs:14:5 - | -LL | t - | ^ `Bar` is not dyn compatible - | -note: for a trait to be dyn compatible it needs to allow building a vtable - for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> - --> $DIR/sized.rs:8:12 - | -LL | trait Bar: Sized { - | --- ^^^^^ ...because it requires `Self: Sized` - | | - | this trait is not dyn compatible... - = note: required for the cast from `&T` to `&dyn Bar` - -error: aborting due to 1 previous error - -For more information about this error, try `rustc --explain E0038`. diff --git a/tests/ui/dyn-compatibility/sized.rs b/tests/ui/dyn-compatibility/sized.rs index 4c4fe3f8f25..eb5279c17e6 100644 --- a/tests/ui/dyn-compatibility/sized.rs +++ b/tests/ui/dyn-compatibility/sized.rs @@ -1,16 +1,12 @@ // Check that we correctly prevent users from making trait objects // from traits where `Self : Sized`. -// -//@ revisions: curr dyn_compatible_for_dispatch - -#![cfg_attr(dyn_compatible_for_dispatch, feature(dyn_compatible_for_dispatch))] trait Bar: Sized { fn bar<T>(&self, t: T); } fn make_bar<T: Bar>(t: &T) -> &dyn Bar { - //[curr]~^ ERROR E0038 + //~^ ERROR E0038 t //~^ ERROR E0038 } diff --git a/tests/ui/dyn-compatibility/sized.stderr b/tests/ui/dyn-compatibility/sized.stderr new file mode 100644 index 00000000000..c66e299cf6f --- /dev/null +++ b/tests/ui/dyn-compatibility/sized.stderr @@ -0,0 +1,34 @@ +error[E0038]: the trait `Bar` is not dyn compatible + --> $DIR/sized.rs:8:32 + | +LL | fn make_bar<T: Bar>(t: &T) -> &dyn Bar { + | ^^^^^^^ `Bar` is not dyn compatible + | +note: for a trait to be dyn compatible it needs to allow building a vtable + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> + --> $DIR/sized.rs:4:12 + | +LL | trait Bar: Sized { + | --- ^^^^^ ...because it requires `Self: Sized` + | | + | this trait is not dyn compatible... + +error[E0038]: the trait `Bar` is not dyn compatible + --> $DIR/sized.rs:10:5 + | +LL | t + | ^ `Bar` is not dyn compatible + | +note: for a trait to be dyn compatible it needs to allow building a vtable + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> + --> $DIR/sized.rs:4:12 + | +LL | trait Bar: Sized { + | --- ^^^^^ ...because it requires `Self: Sized` + | | + | this trait is not dyn compatible... + = note: required for the cast from `&T` to `&dyn Bar` + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0038`. diff --git a/tests/ui/dyn-compatibility/taint-const-eval.dyn_compatible_for_dispatch.stderr b/tests/ui/dyn-compatibility/taint-const-eval.dyn_compatible_for_dispatch.stderr deleted file mode 100644 index 0bc7d0b14d3..00000000000 --- a/tests/ui/dyn-compatibility/taint-const-eval.dyn_compatible_for_dispatch.stderr +++ /dev/null @@ -1,27 +0,0 @@ -error[E0038]: the trait `Qux` is not dyn compatible - --> $DIR/taint-const-eval.rs:11:33 - | -LL | static FOO: &(dyn Qux + Sync) = "desc"; - | ^^^^^^ `Qux` is not dyn compatible - | -note: for a trait to be dyn compatible it needs to allow building a vtable - for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> - --> $DIR/taint-const-eval.rs:8:8 - | -LL | trait Qux { - | --- this trait is not dyn compatible... -LL | fn bar(); - | ^^^ ...because associated function `bar` has no `self` parameter - = note: required for the cast from `&'static str` to `&'static (dyn Qux + Sync + 'static)` -help: consider turning `bar` into a method by giving it a `&self` argument - | -LL | fn bar(&self); - | +++++ -help: alternatively, consider constraining `bar` so it does not apply to trait objects - | -LL | fn bar() where Self: Sized; - | +++++++++++++++++ - -error: aborting due to 1 previous error - -For more information about this error, try `rustc --explain E0038`. diff --git a/tests/ui/dyn-compatibility/taint-const-eval.rs b/tests/ui/dyn-compatibility/taint-const-eval.rs index 2feae58080b..7ea763e1846 100644 --- a/tests/ui/dyn-compatibility/taint-const-eval.rs +++ b/tests/ui/dyn-compatibility/taint-const-eval.rs @@ -1,16 +1,12 @@ // Test that we do not attempt to create dyn-incompatible trait objects in const eval. -//@ revisions: curr dyn_compatible_for_dispatch - -#![cfg_attr(dyn_compatible_for_dispatch, feature(dyn_compatible_for_dispatch))] - trait Qux { fn bar(); } static FOO: &(dyn Qux + Sync) = "desc"; //~^ the trait `Qux` is not dyn compatible -//[curr]~| the trait `Qux` is not dyn compatible -//[curr]~| the trait `Qux` is not dyn compatible +//~| the trait `Qux` is not dyn compatible +//~| the trait `Qux` is not dyn compatible fn main() {} diff --git a/tests/ui/dyn-compatibility/taint-const-eval.stderr b/tests/ui/dyn-compatibility/taint-const-eval.stderr new file mode 100644 index 00000000000..942c20db6ce --- /dev/null +++ b/tests/ui/dyn-compatibility/taint-const-eval.stderr @@ -0,0 +1,74 @@ +error[E0038]: the trait `Qux` is not dyn compatible + --> $DIR/taint-const-eval.rs:7:15 + | +LL | static FOO: &(dyn Qux + Sync) = "desc"; + | ^^^^^^^^^^^^^^ `Qux` is not dyn compatible + | +note: for a trait to be dyn compatible it needs to allow building a vtable + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> + --> $DIR/taint-const-eval.rs:4:8 + | +LL | trait Qux { + | --- this trait is not dyn compatible... +LL | fn bar(); + | ^^^ ...because associated function `bar` has no `self` parameter +help: consider turning `bar` into a method by giving it a `&self` argument + | +LL | fn bar(&self); + | +++++ +help: alternatively, consider constraining `bar` so it does not apply to trait objects + | +LL | fn bar() where Self: Sized; + | +++++++++++++++++ + +error[E0038]: the trait `Qux` is not dyn compatible + --> $DIR/taint-const-eval.rs:7:33 + | +LL | static FOO: &(dyn Qux + Sync) = "desc"; + | ^^^^^^ `Qux` is not dyn compatible + | +note: for a trait to be dyn compatible it needs to allow building a vtable + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> + --> $DIR/taint-const-eval.rs:4:8 + | +LL | trait Qux { + | --- this trait is not dyn compatible... +LL | fn bar(); + | ^^^ ...because associated function `bar` has no `self` parameter + = note: required for the cast from `&'static str` to `&'static (dyn Qux + Sync + 'static)` +help: consider turning `bar` into a method by giving it a `&self` argument + | +LL | fn bar(&self); + | +++++ +help: alternatively, consider constraining `bar` so it does not apply to trait objects + | +LL | fn bar() where Self: Sized; + | +++++++++++++++++ + +error[E0038]: the trait `Qux` is not dyn compatible + --> $DIR/taint-const-eval.rs:7:15 + | +LL | static FOO: &(dyn Qux + Sync) = "desc"; + | ^^^^^^^^^^^^^^ `Qux` is not dyn compatible + | +note: for a trait to be dyn compatible it needs to allow building a vtable + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> + --> $DIR/taint-const-eval.rs:4:8 + | +LL | trait Qux { + | --- this trait is not dyn compatible... +LL | fn bar(); + | ^^^ ...because associated function `bar` has no `self` parameter + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` +help: consider turning `bar` into a method by giving it a `&self` argument + | +LL | fn bar(&self); + | +++++ +help: alternatively, consider constraining `bar` so it does not apply to trait objects + | +LL | fn bar() where Self: Sized; + | +++++++++++++++++ + +error: aborting due to 3 previous errors + +For more information about this error, try `rustc --explain E0038`. diff --git a/tests/ui/dynamically-sized-types/dst-irrefutable-bind.rs b/tests/ui/dynamically-sized-types/dst-irrefutable-bind.rs index 5e352e930d8..f4576229864 100644 --- a/tests/ui/dynamically-sized-types/dst-irrefutable-bind.rs +++ b/tests/ui/dynamically-sized-types/dst-irrefutable-bind.rs @@ -1,5 +1,4 @@ //@ run-pass -#![feature(unsized_tuple_coercion)] struct Test<T: ?Sized>(T); @@ -14,14 +13,4 @@ fn main() { let slice = &[1,2,3]; let x = Test(&slice); let Test(&_slice) = x; - - - let x = (10, [1,2,3]); - let x : &(i32, [i32]) = &x; - - let & ref _y = x; - - let slice = &[1,2,3]; - let x = (10, &slice); - let (_, &_slice) = x; } diff --git a/tests/ui/dynamically-sized-types/dst-raw.rs b/tests/ui/dynamically-sized-types/dst-raw.rs index c32ee67dab9..111848c5a7f 100644 --- a/tests/ui/dynamically-sized-types/dst-raw.rs +++ b/tests/ui/dynamically-sized-types/dst-raw.rs @@ -1,9 +1,6 @@ //@ run-pass // Test DST raw pointers - -#![feature(unsized_tuple_coercion)] - trait Trait { fn foo(&self) -> isize; } @@ -38,14 +35,6 @@ pub fn main() { }; assert_eq!(r, 42); - // raw DST tuple - let p = (A { f: 42 },); - let o: *const (dyn Trait,) = &p; - let r = unsafe { - (&*o).0.foo() - }; - assert_eq!(r, 42); - // raw slice let a: *const [_] = &[1, 2, 3]; unsafe { @@ -73,15 +62,6 @@ pub fn main() { assert_eq!(len, 3); } - // raw DST tuple with slice - let c: *const ([_],) = &([1, 2, 3],); - unsafe { - let b = (&*c).0[0]; - assert_eq!(b, 1); - let len = (&*c).0.len(); - assert_eq!(len, 3); - } - // all of the above with *mut let mut x = A { f: 42 }; let z: *mut dyn Trait = &mut x; @@ -97,13 +77,6 @@ pub fn main() { }; assert_eq!(r, 42); - let mut p = (A { f: 42 },); - let o: *mut (dyn Trait,) = &mut p; - let r = unsafe { - (&*o).0.foo() - }; - assert_eq!(r, 42); - let a: *mut [_] = &mut [1, 2, 3]; unsafe { let b = (*a)[2]; @@ -127,12 +100,4 @@ pub fn main() { let len = (&*c).f.len(); assert_eq!(len, 3); } - - let c: *mut ([_],) = &mut ([1, 2, 3],); - unsafe { - let b = (&*c).0[0]; - assert_eq!(b, 1); - let len = (&*c).0.len(); - assert_eq!(len, 3); - } } diff --git a/tests/ui/dynamically-sized-types/dst-trait-tuple.rs b/tests/ui/dynamically-sized-types/dst-trait-tuple.rs deleted file mode 100644 index 6ab8829859b..00000000000 --- a/tests/ui/dynamically-sized-types/dst-trait-tuple.rs +++ /dev/null @@ -1,102 +0,0 @@ -//@ run-pass -#![allow(type_alias_bounds)] - -#![allow(unused_features)] -#![feature(unsized_tuple_coercion)] - -type Fat<T: ?Sized> = (isize, &'static str, T); - -#[derive(Copy, Clone, PartialEq, Eq, Debug)] -struct Bar; - -#[derive(Copy, Clone, PartialEq, Eq)] -struct Bar1 { - f: isize -} - -trait ToBar { - fn to_bar(&self) -> Bar; - fn to_val(&self) -> isize; -} - -impl ToBar for Bar { - fn to_bar(&self) -> Bar { - *self - } - fn to_val(&self) -> isize { - 0 - } -} -impl ToBar for Bar1 { - fn to_bar(&self) -> Bar { - Bar - } - fn to_val(&self) -> isize { - self.f - } -} - -// x is a fat pointer -fn foo(x: &Fat<dyn ToBar>) { - assert_eq!(x.0, 5); - assert_eq!(x.1, "some str"); - assert_eq!(x.2.to_bar(), Bar); - assert_eq!(x.2.to_val(), 42); - - let y = &x.2; - assert_eq!(y.to_bar(), Bar); - assert_eq!(y.to_val(), 42); -} - -fn bar(x: &dyn ToBar) { - assert_eq!(x.to_bar(), Bar); - assert_eq!(x.to_val(), 42); -} - -fn baz(x: &Fat<Fat<dyn ToBar>>) { - assert_eq!(x.0, 5); - assert_eq!(x.1, "some str"); - assert_eq!((x.2).0, 8); - assert_eq!((x.2).1, "deep str"); - assert_eq!((x.2).2.to_bar(), Bar); - assert_eq!((x.2).2.to_val(), 42); - - let y = &(x.2).2; - assert_eq!(y.to_bar(), Bar); - assert_eq!(y.to_val(), 42); - -} - -pub fn main() { - let f1 = (5, "some str", Bar1 {f :42}); - foo(&f1); - let f2 = &f1; - foo(f2); - let f3: &Fat<dyn ToBar> = f2; - foo(f3); - let f4: &Fat<dyn ToBar> = &f1; - foo(f4); - let f5: &Fat<dyn ToBar> = &(5, "some str", Bar1 {f :42}); - foo(f5); - - // Zero size object. - let f6: &Fat<dyn ToBar> = &(5, "some str", Bar); - assert_eq!(f6.2.to_bar(), Bar); - - // &* - // - let f7: Box<dyn ToBar> = Box::new(Bar1 {f :42}); - bar(&*f7); - - // Deep nesting - let f1 = (5, "some str", (8, "deep str", Bar1 {f :42})); - baz(&f1); - let f2 = &f1; - baz(f2); - let f3: &Fat<Fat<dyn ToBar>> = f2; - baz(f3); - let f4: &Fat<Fat<dyn ToBar>> = &f1; - baz(f4); - let f5: &Fat<Fat<dyn ToBar>> = &(5, "some str", (8, "deep str", Bar1 {f :42})); - baz(f5); -} diff --git a/tests/ui/dynamically-sized-types/dst-tuple-no-reorder.rs b/tests/ui/dynamically-sized-types/dst-tuple-no-reorder.rs deleted file mode 100644 index ad48d88e480..00000000000 --- a/tests/ui/dynamically-sized-types/dst-tuple-no-reorder.rs +++ /dev/null @@ -1,26 +0,0 @@ -//@ run-pass - -#![feature(unsized_tuple_coercion)] - -// Ensure that unsizable fields that might be accessed don't get reordered - -fn nonzero_size() { - let sized: (u8, [u32; 2]) = (123, [456, 789]); - let unsize: &(u8, [u32]) = &sized; - assert_eq!(unsize.0, 123); - assert_eq!(unsize.1.len(), 2); - assert_eq!(unsize.1[0], 456); - assert_eq!(unsize.1[1], 789); -} - -fn zst() { - let sized: (u8, [u32; 0]) = (123, []); - let unsize: &(u8, [u32]) = &sized; - assert_eq!(unsize.0, 123); - assert_eq!(unsize.1.len(), 0); -} - -pub fn main() { - nonzero_size(); - zst(); -} diff --git a/tests/ui/dynamically-sized-types/dst-tuple-sole.rs b/tests/ui/dynamically-sized-types/dst-tuple-sole.rs deleted file mode 100644 index dc3363b9bde..00000000000 --- a/tests/ui/dynamically-sized-types/dst-tuple-sole.rs +++ /dev/null @@ -1,79 +0,0 @@ -//@ run-pass -#![allow(stable_features)] -#![allow(type_alias_bounds)] - -// As dst-tuple.rs, but the unsized field is the only field in the tuple. - - -#![feature(unsized_tuple_coercion)] - -type Fat<T: ?Sized> = (T,); - -// x is a fat pointer -fn foo(x: &Fat<[isize]>) { - let y = &x.0; - assert_eq!(x.0.len(), 3); - assert_eq!(y[0], 1); - assert_eq!(x.0[1], 2); -} - -fn foo2<T:ToBar>(x: &Fat<[T]>) { - let y = &x.0; - let bar = Bar; - assert_eq!(x.0.len(), 3); - assert_eq!(y[0].to_bar(), bar); - assert_eq!(x.0[1].to_bar(), bar); -} - -#[derive(Copy, Clone, PartialEq, Eq, Debug)] -struct Bar; - -trait ToBar { - fn to_bar(&self) -> Bar; -} - -impl ToBar for Bar { - fn to_bar(&self) -> Bar { - *self - } -} - -pub fn main() { - // With a vec of ints. - let f1 = ([1, 2, 3],); - foo(&f1); - let f2 = &f1; - foo(f2); - let f3: &Fat<[isize]> = f2; - foo(f3); - let f4: &Fat<[isize]> = &f1; - foo(f4); - let f5: &Fat<[isize]> = &([1, 2, 3],); - foo(f5); - - // With a vec of Bars. - let bar = Bar; - let f1 = ([bar, bar, bar],); - foo2(&f1); - let f2 = &f1; - foo2(f2); - let f3: &Fat<[Bar]> = f2; - foo2(f3); - let f4: &Fat<[Bar]> = &f1; - foo2(f4); - let f5: &Fat<[Bar]> = &([bar, bar, bar],); - foo2(f5); - - // Assignment. - let f5: &mut Fat<[isize]> = &mut ([1, 2, 3],); - f5.0[1] = 34; - assert_eq!(f5.0[0], 1); - assert_eq!(f5.0[1], 34); - assert_eq!(f5.0[2], 3); - - // Zero size vec. - let f5: &Fat<[isize]> = &([],); - assert!(f5.0.is_empty()); - let f5: &Fat<[Bar]> = &([],); - assert!(f5.0.is_empty()); -} diff --git a/tests/ui/dynamically-sized-types/dst-tuple-zst-offsets.rs b/tests/ui/dynamically-sized-types/dst-tuple-zst-offsets.rs deleted file mode 100644 index b4ee0fb4070..00000000000 --- a/tests/ui/dynamically-sized-types/dst-tuple-zst-offsets.rs +++ /dev/null @@ -1,22 +0,0 @@ -//@ run-pass - -#![feature(unsized_tuple_coercion)] - -// Check that we do not change the offsets of ZST fields when unsizing - -fn scalar_layout() { - let sized: &(u8, [(); 13]) = &(123, [(); 13]); - let unsize: &(u8, [()]) = sized; - assert_eq!(sized.1.as_ptr(), unsize.1.as_ptr()); -} - -fn scalarpair_layout() { - let sized: &(u8, u16, [(); 13]) = &(123, 456, [(); 13]); - let unsize: &(u8, u16, [()]) = sized; - assert_eq!(sized.2.as_ptr(), unsize.2.as_ptr()); -} - -pub fn main() { - scalar_layout(); - scalarpair_layout(); -} diff --git a/tests/ui/dynamically-sized-types/dst-tuple.rs b/tests/ui/dynamically-sized-types/dst-tuple.rs deleted file mode 100644 index 52fc69f7809..00000000000 --- a/tests/ui/dynamically-sized-types/dst-tuple.rs +++ /dev/null @@ -1,119 +0,0 @@ -//@ run-pass -#![allow(type_alias_bounds)] - -#![feature(unsized_tuple_coercion)] - -type Fat<T: ?Sized> = (isize, &'static str, T); - -// x is a fat pointer -fn foo(x: &Fat<[isize]>) { - let y = &x.2; - assert_eq!(x.2.len(), 3); - assert_eq!(y[0], 1); - assert_eq!(x.2[1], 2); - assert_eq!(x.0, 5); - assert_eq!(x.1, "some str"); -} - -fn foo2<T:ToBar>(x: &Fat<[T]>) { - let y = &x.2; - let bar = Bar; - assert_eq!(x.2.len(), 3); - assert_eq!(y[0].to_bar(), bar); - assert_eq!(x.2[1].to_bar(), bar); - assert_eq!(x.0, 5); - assert_eq!(x.1, "some str"); -} - -fn foo3(x: &Fat<Fat<[isize]>>) { - let y = &(x.2).2; - assert_eq!(x.0, 5); - assert_eq!(x.1, "some str"); - assert_eq!((x.2).0, 8); - assert_eq!((x.2).1, "deep str"); - assert_eq!((x.2).2.len(), 3); - assert_eq!(y[0], 1); - assert_eq!((x.2).2[1], 2); -} - - -#[derive(Copy, Clone, PartialEq, Eq, Debug)] -struct Bar; - -trait ToBar { - fn to_bar(&self) -> Bar; -} - -impl ToBar for Bar { - fn to_bar(&self) -> Bar { - *self - } -} - -pub fn main() { - // With a vec of ints. - let f1 = (5, "some str", [1, 2, 3]); - foo(&f1); - let f2 = &f1; - foo(f2); - let f3: &Fat<[isize]> = f2; - foo(f3); - let f4: &Fat<[isize]> = &f1; - foo(f4); - let f5: &Fat<[isize]> = &(5, "some str", [1, 2, 3]); - foo(f5); - - // With a vec of Bars. - let bar = Bar; - let f1 = (5, "some str", [bar, bar, bar]); - foo2(&f1); - let f2 = &f1; - foo2(f2); - let f3: &Fat<[Bar]> = f2; - foo2(f3); - let f4: &Fat<[Bar]> = &f1; - foo2(f4); - let f5: &Fat<[Bar]> = &(5, "some str", [bar, bar, bar]); - foo2(f5); - - // Assignment. - let f5: &mut Fat<[isize]> = &mut (5, "some str", [1, 2, 3]); - f5.2[1] = 34; - assert_eq!(f5.2[0], 1); - assert_eq!(f5.2[1], 34); - assert_eq!(f5.2[2], 3); - - // Zero size vec. - let f5: &Fat<[isize]> = &(5, "some str", []); - assert!(f5.2.is_empty()); - let f5: &Fat<[Bar]> = &(5, "some str", []); - assert!(f5.2.is_empty()); - - // Deeply nested. - let f1 = (5, "some str", (8, "deep str", [1, 2, 3])); - foo3(&f1); - let f2 = &f1; - foo3(f2); - let f3: &Fat<Fat<[isize]>> = f2; - foo3(f3); - let f4: &Fat<Fat<[isize]>> = &f1; - foo3(f4); - let f5: &Fat<Fat<[isize]>> = &(5, "some str", (8, "deep str", [1, 2, 3])); - foo3(f5); - - // Box. - let f1 = Box::new([1, 2, 3]); - assert_eq!((*f1)[1], 2); - let f2: Box<[isize]> = f1; - assert_eq!((*f2)[1], 2); - - // Nested Box. - let f1 : Box<Fat<[isize; 3]>> = Box::new((5, "some str", [1, 2, 3])); - foo(&*f1); - let f2 : Box<Fat<[isize]>> = f1; - foo(&*f2); - - let f3 : Box<Fat<[isize]>> = - Box::<Fat<[_; 3]>>::new((5, "some str", [1, 2, 3])); - foo(&*f3); -} diff --git a/tests/ui/editions/edition-keywords-2018-2015-parsing.stderr b/tests/ui/editions/edition-keywords-2018-2015-parsing.stderr index 905e1249d97..152a6f3a41e 100644 --- a/tests/ui/editions/edition-keywords-2018-2015-parsing.stderr +++ b/tests/ui/editions/edition-keywords-2018-2015-parsing.stderr @@ -44,22 +44,22 @@ note: while trying to match `r#async` LL | (r#async) => (1) | ^^^^^^^ -error: macro expansion ends with an incomplete expression: expected one of `move`, `|`, or `||` +error: macro expansion ends with an incomplete expression: expected one of `move`, `use`, `|`, or `||` --> $DIR/auxiliary/edition-kw-macro-2015.rs:27:23 | LL | ($i: ident) => ($i) - | ^ expected one of `move`, `|`, or `||` + | ^ expected one of `move`, `use`, `|`, or `||` | ::: $DIR/edition-keywords-2018-2015-parsing.rs:22:8 | LL | if passes_ident!(async) == 1 {} // FIXME: Edition hygiene bug, async here is 2018 and reserved | -------------------- in this macro invocation -error: macro expansion ends with an incomplete expression: expected one of `move`, `|`, or `||` +error: macro expansion ends with an incomplete expression: expected one of `move`, `use`, `|`, or `||` --> $DIR/edition-keywords-2018-2015-parsing.rs:24:24 | LL | if passes_tt!(async) == 1 {} - | ^ expected one of `move`, `|`, or `||` + | ^ expected one of `move`, `use`, `|`, or `||` error[E0308]: mismatched types --> $DIR/edition-keywords-2018-2015-parsing.rs:29:33 diff --git a/tests/ui/editions/edition-keywords-2018-2018-parsing.stderr b/tests/ui/editions/edition-keywords-2018-2018-parsing.stderr index af5cc515bb2..53f1b827f9c 100644 --- a/tests/ui/editions/edition-keywords-2018-2018-parsing.stderr +++ b/tests/ui/editions/edition-keywords-2018-2018-parsing.stderr @@ -44,34 +44,34 @@ note: while trying to match `r#async` LL | (r#async) => (1) | ^^^^^^^ -error: macro expansion ends with an incomplete expression: expected one of `move`, `|`, or `||` +error: macro expansion ends with an incomplete expression: expected one of `move`, `use`, `|`, or `||` --> $DIR/auxiliary/edition-kw-macro-2018.rs:27:23 | LL | ($i: ident) => ($i) - | ^ expected one of `move`, `|`, or `||` + | ^ expected one of `move`, `use`, `|`, or `||` | ::: $DIR/edition-keywords-2018-2018-parsing.rs:29:8 | LL | if passes_ident!(async) == 1 {} // FIXME: Edition hygiene bug, async here is 2018 and reserved | -------------------- in this macro invocation -error: macro expansion ends with an incomplete expression: expected one of `move`, `|`, or `||` +error: macro expansion ends with an incomplete expression: expected one of `move`, `use`, `|`, or `||` --> $DIR/edition-keywords-2018-2018-parsing.rs:31:24 | LL | if passes_tt!(async) == 1 {} - | ^ expected one of `move`, `|`, or `||` + | ^ expected one of `move`, `use`, `|`, or `||` -error: macro expansion ends with an incomplete expression: expected one of `move`, `|`, or `||` +error: macro expansion ends with an incomplete expression: expected one of `move`, `use`, `|`, or `||` --> $DIR/edition-keywords-2018-2018-parsing.rs:14:23 | LL | ($i: ident) => ($i) - | ^ expected one of `move`, `|`, or `||` + | ^ expected one of `move`, `use`, `|`, or `||` -error: macro expansion ends with an incomplete expression: expected one of `move`, `|`, or `||` +error: macro expansion ends with an incomplete expression: expected one of `move`, `use`, `|`, or `||` --> $DIR/edition-keywords-2018-2018-parsing.rs:35:30 | LL | if local_passes_tt!(async) == 1 {} - | ^ expected one of `move`, `|`, or `||` + | ^ expected one of `move`, `use`, `|`, or `||` error[E0308]: mismatched types --> $DIR/edition-keywords-2018-2018-parsing.rs:40:33 diff --git a/tests/ui/ergonomic-clones/async/basic.rs b/tests/ui/ergonomic-clones/async/basic.rs new file mode 100644 index 00000000000..ad2bfd97cd1 --- /dev/null +++ b/tests/ui/ergonomic-clones/async/basic.rs @@ -0,0 +1,17 @@ +//@ check-pass +//@ edition:2018 + +#![feature(ergonomic_clones)] +#![allow(incomplete_features)] + +use std::future::Future; + +fn ergonomic_clone_async_closures() -> impl Future<Output = String> { + let s = String::from("hi"); + + async use { + s + } +} + +fn main() {} diff --git a/tests/ui/ergonomic-clones/async/edition-2015.rs b/tests/ui/ergonomic-clones/async/edition-2015.rs new file mode 100644 index 00000000000..d3b2071b9f9 --- /dev/null +++ b/tests/ui/ergonomic-clones/async/edition-2015.rs @@ -0,0 +1,7 @@ +#![feature(ergonomic_clones)] +#![allow(incomplete_features)] + +fn main() { + async use {}; + //~^ ERROR `async use` blocks are only allowed in Rust 2018 or later +} diff --git a/tests/ui/ergonomic-clones/async/edition-2015.stderr b/tests/ui/ergonomic-clones/async/edition-2015.stderr new file mode 100644 index 00000000000..b218e6b242e --- /dev/null +++ b/tests/ui/ergonomic-clones/async/edition-2015.stderr @@ -0,0 +1,8 @@ +error: `async use` blocks are only allowed in Rust 2018 or later + --> $DIR/edition-2015.rs:5:5 + | +LL | async use {}; + | ^^^^^^^^^ + +error: aborting due to 1 previous error + diff --git a/tests/ui/ergonomic-clones/async/local-type.rs b/tests/ui/ergonomic-clones/async/local-type.rs new file mode 100644 index 00000000000..e891686b550 --- /dev/null +++ b/tests/ui/ergonomic-clones/async/local-type.rs @@ -0,0 +1,10 @@ +// Check that using the parameter name in its type does not ICE. +//@ edition:2018 + +#![feature(ergonomic_clones)] +#![allow(incomplete_features)] + +fn main() { + let _ = async use |x: x| x; //~ ERROR expected type + let _ = async use |x: bool| -> x { x }; //~ ERROR expected type +} diff --git a/tests/ui/ergonomic-clones/async/local-type.stderr b/tests/ui/ergonomic-clones/async/local-type.stderr new file mode 100644 index 00000000000..fd832fbc8d2 --- /dev/null +++ b/tests/ui/ergonomic-clones/async/local-type.stderr @@ -0,0 +1,15 @@ +error[E0573]: expected type, found local variable `x` + --> $DIR/local-type.rs:8:27 + | +LL | let _ = async use |x: x| x; + | ^ not a type + +error[E0573]: expected type, found local variable `x` + --> $DIR/local-type.rs:9:36 + | +LL | let _ = async use |x: bool| -> x { x }; + | ^ not a type + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0573`. diff --git a/tests/ui/ergonomic-clones/closure/basic.rs b/tests/ui/ergonomic-clones/closure/basic.rs new file mode 100644 index 00000000000..01d3b08ffa2 --- /dev/null +++ b/tests/ui/ergonomic-clones/closure/basic.rs @@ -0,0 +1,58 @@ +//@ check-pass + +#![feature(ergonomic_clones)] +#![allow(incomplete_features)] + +use std::clone::UseCloned; +use std::future::Future; + +fn ergonomic_clone_closure_no_captures() -> i32 { + let cl = use || { + 1 + }; + cl() +} + +fn ergonomic_clone_closure_move() -> String { + let s = String::from("hi"); + + let cl = use || { + s + }; + cl() +} + +#[derive(Clone)] +struct Foo; + +impl UseCloned for Foo {} + +fn ergonomic_clone_closure_use_cloned() -> Foo { + let f = Foo; + + let f1 = use || { + f + }; + + let f2 = use || { + f + }; + + f +} + +fn ergonomic_clone_closure_copy() -> i32 { + let i = 1; + + let i1 = use || { + i + }; + + let i2 = use || { + i + }; + + i +} + +fn main() {} diff --git a/tests/ui/ergonomic-clones/closure/const-closure.rs b/tests/ui/ergonomic-clones/closure/const-closure.rs new file mode 100644 index 00000000000..6b4de824df9 --- /dev/null +++ b/tests/ui/ergonomic-clones/closure/const-closure.rs @@ -0,0 +1,11 @@ +//@ check-pass + +#![feature(const_closures)] +#![feature(ergonomic_clones)] +#![allow(incomplete_features)] + +const fn foo() { + let cl = const use || {}; +} + +fn main() {} diff --git a/tests/ui/ergonomic-clones/closure/expect-region.rs b/tests/ui/ergonomic-clones/closure/expect-region.rs new file mode 100644 index 00000000000..cbb13e56a18 --- /dev/null +++ b/tests/ui/ergonomic-clones/closure/expect-region.rs @@ -0,0 +1,25 @@ +#![feature(ergonomic_clones)] +#![allow(warnings)] + +fn closure_expecting_bound<F>(_: F) +where + F: FnOnce(&u32), +{ +} + +fn expect_bound_supply_named<'x>() { + let mut f: Option<&u32> = None; + + // Here we give a type annotation that `x` should be free. We get + // an error because of that. + closure_expecting_bound(use |x: &'x u32| { + //~^ ERROR lifetime may not live long enough + //~| ERROR lifetime may not live long enough + + // Borrowck doesn't get a chance to run, but if it did it should error + // here. + f = Some(x); + }); +} + +fn main() {} diff --git a/tests/ui/ergonomic-clones/closure/expect-region.stderr b/tests/ui/ergonomic-clones/closure/expect-region.stderr new file mode 100644 index 00000000000..4df1df1378b --- /dev/null +++ b/tests/ui/ergonomic-clones/closure/expect-region.stderr @@ -0,0 +1,22 @@ +error: lifetime may not live long enough + --> $DIR/expect-region.rs:15:34 + | +LL | fn expect_bound_supply_named<'x>() { + | -- lifetime `'x` defined here +... +LL | closure_expecting_bound(use |x: &'x u32| { + | ^ - let's call the lifetime of this reference `'1` + | | + | requires that `'1` must outlive `'x` + +error: lifetime may not live long enough + --> $DIR/expect-region.rs:15:34 + | +LL | fn expect_bound_supply_named<'x>() { + | -- lifetime `'x` defined here +... +LL | closure_expecting_bound(use |x: &'x u32| { + | ^ requires that `'x` must outlive `'static` + +error: aborting due to 2 previous errors + diff --git a/tests/ui/ergonomic-clones/closure/fn-once.rs b/tests/ui/ergonomic-clones/closure/fn-once.rs new file mode 100644 index 00000000000..24060f3ed3b --- /dev/null +++ b/tests/ui/ergonomic-clones/closure/fn-once.rs @@ -0,0 +1,14 @@ +#![feature(ergonomic_clones)] +#![allow(incomplete_features)] + +fn get_closure() -> Box<dyn Fn() -> Vec<u8>> { + let vec = vec![1u8, 2u8]; + + let closure = use || { //~ ERROR expected a closure + vec + }; + + Box::new(closure) +} + +fn main() {} diff --git a/tests/ui/ergonomic-clones/closure/fn-once.stderr b/tests/ui/ergonomic-clones/closure/fn-once.stderr new file mode 100644 index 00000000000..40f1200695c --- /dev/null +++ b/tests/ui/ergonomic-clones/closure/fn-once.stderr @@ -0,0 +1,16 @@ +error[E0525]: expected a closure that implements the `Fn` trait, but this closure only implements `FnOnce` + --> $DIR/fn-once.rs:7:19 + | +LL | let closure = use || { + | ^^^^^^ this closure implements `FnOnce`, not `Fn` +LL | vec + | --- closure is `FnOnce` because it moves the variable `vec` out of its environment +... +LL | Box::new(closure) + | ----------------- the requirement to implement `Fn` derives from here + | + = note: required for the cast from `Box<{closure@$DIR/fn-once.rs:7:19: 7:25}>` to `Box<(dyn Fn() -> Vec<u8> + 'static)>` + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0525`. diff --git a/tests/ui/ergonomic-clones/closure/immutable-outer-variable.fixed b/tests/ui/ergonomic-clones/closure/immutable-outer-variable.fixed new file mode 100644 index 00000000000..1e570632452 --- /dev/null +++ b/tests/ui/ergonomic-clones/closure/immutable-outer-variable.fixed @@ -0,0 +1,16 @@ +//@ run-rustfix + +// Point at the captured immutable outer variable + +#![feature(ergonomic_clones)] +#![allow(incomplete_features)] + +fn foo(mut f: Box<dyn FnMut()>) { + f(); +} + +fn main() { + let mut y = true; + foo(Box::new(use || y = !y) as Box<_>); + //~^ ERROR cannot assign to `y`, as it is not declared as mutable +} diff --git a/tests/ui/ergonomic-clones/closure/immutable-outer-variable.rs b/tests/ui/ergonomic-clones/closure/immutable-outer-variable.rs new file mode 100644 index 00000000000..59aa61f581d --- /dev/null +++ b/tests/ui/ergonomic-clones/closure/immutable-outer-variable.rs @@ -0,0 +1,16 @@ +//@ run-rustfix + +// Point at the captured immutable outer variable + +#![feature(ergonomic_clones)] +#![allow(incomplete_features)] + +fn foo(mut f: Box<dyn FnMut()>) { + f(); +} + +fn main() { + let y = true; + foo(Box::new(use || y = !y) as Box<_>); + //~^ ERROR cannot assign to `y`, as it is not declared as mutable +} diff --git a/tests/ui/ergonomic-clones/closure/immutable-outer-variable.stderr b/tests/ui/ergonomic-clones/closure/immutable-outer-variable.stderr new file mode 100644 index 00000000000..f7c742d33fd --- /dev/null +++ b/tests/ui/ergonomic-clones/closure/immutable-outer-variable.stderr @@ -0,0 +1,14 @@ +error[E0594]: cannot assign to `y`, as it is not declared as mutable + --> $DIR/immutable-outer-variable.rs:14:25 + | +LL | foo(Box::new(use || y = !y) as Box<_>); + | ^^^^^^ cannot assign + | +help: consider changing this to be mutable + | +LL | let mut y = true; + | +++ + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0594`. diff --git a/tests/ui/ergonomic-clones/closure/local-type.rs b/tests/ui/ergonomic-clones/closure/local-type.rs new file mode 100644 index 00000000000..b2f99efa1e6 --- /dev/null +++ b/tests/ui/ergonomic-clones/closure/local-type.rs @@ -0,0 +1,9 @@ +// Check that using the parameter name in its type does not ICE. + +#![feature(ergonomic_clones)] +#![allow(incomplete_features)] + +fn main() { + let _ = use |x: x| x; //~ ERROR expected type + let _ = use |x: bool| -> x { x }; //~ ERROR expected type +} diff --git a/tests/ui/ergonomic-clones/closure/local-type.stderr b/tests/ui/ergonomic-clones/closure/local-type.stderr new file mode 100644 index 00000000000..5a42ae63afa --- /dev/null +++ b/tests/ui/ergonomic-clones/closure/local-type.stderr @@ -0,0 +1,15 @@ +error[E0573]: expected type, found local variable `x` + --> $DIR/local-type.rs:7:21 + | +LL | let _ = use |x: x| x; + | ^ not a type + +error[E0573]: expected type, found local variable `x` + --> $DIR/local-type.rs:8:30 + | +LL | let _ = use |x: bool| -> x { x }; + | ^ not a type + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0573`. diff --git a/tests/ui/ergonomic-clones/closure/mutation.rs b/tests/ui/ergonomic-clones/closure/mutation.rs new file mode 100644 index 00000000000..ef05fffd479 --- /dev/null +++ b/tests/ui/ergonomic-clones/closure/mutation.rs @@ -0,0 +1,12 @@ +//@ check-pass + +#![feature(ergonomic_clones)] +#![allow(incomplete_features)] + +fn main() { + let mut my_var = false; + let mut callback = use || { + my_var = true; + }; + callback(); +} diff --git a/tests/ui/ergonomic-clones/closure/mutation2.rs b/tests/ui/ergonomic-clones/closure/mutation2.rs new file mode 100644 index 00000000000..1cb5b8a7ec3 --- /dev/null +++ b/tests/ui/ergonomic-clones/closure/mutation2.rs @@ -0,0 +1,11 @@ +#![feature(ergonomic_clones)] +#![allow(incomplete_features)] + +fn main() { + let mut my_var = false; + let callback = use || { + my_var = true; + }; + callback(); + //~^ ERROR cannot borrow `callback` as mutable, as it is not declared as mutable [E0596] +} diff --git a/tests/ui/ergonomic-clones/closure/mutation2.stderr b/tests/ui/ergonomic-clones/closure/mutation2.stderr new file mode 100644 index 00000000000..3ff33cf7017 --- /dev/null +++ b/tests/ui/ergonomic-clones/closure/mutation2.stderr @@ -0,0 +1,17 @@ +error[E0596]: cannot borrow `callback` as mutable, as it is not declared as mutable + --> $DIR/mutation2.rs:9:5 + | +LL | my_var = true; + | ------ calling `callback` requires mutable binding due to possible mutation of `my_var` +LL | }; +LL | callback(); + | ^^^^^^^^ cannot borrow as mutable + | +help: consider changing this to be mutable + | +LL | let mut callback = use || { + | +++ + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0596`. diff --git a/tests/ui/ergonomic-clones/closure/nested.rs b/tests/ui/ergonomic-clones/closure/nested.rs new file mode 100644 index 00000000000..fc364fb594b --- /dev/null +++ b/tests/ui/ergonomic-clones/closure/nested.rs @@ -0,0 +1,21 @@ +//@ run-pass + +#![feature(ergonomic_clones)] +#![allow(incomplete_features)] + +use std::clone::UseCloned; + +#[derive(Clone)] +struct Foo; + +impl UseCloned for Foo {} + +fn work(_: Box<Foo>) {} +fn foo<F:FnOnce()>(_: F) {} + +pub fn main() { + let a = Box::new(Foo); + foo(use || { foo(use || { work(a) }) }); + let x = use || { use || { Foo } }; + let _y = x(); +} diff --git a/tests/ui/ergonomic-clones/closure/once-move-out-on-heap.rs b/tests/ui/ergonomic-clones/closure/once-move-out-on-heap.rs new file mode 100644 index 00000000000..a8267ac5359 --- /dev/null +++ b/tests/ui/ergonomic-clones/closure/once-move-out-on-heap.rs @@ -0,0 +1,19 @@ +//@ run-pass +// Testing guarantees provided by once functions. + +#![feature(ergonomic_clones)] +#![allow(incomplete_features)] + +use std::sync::Arc; + +fn foo<F: FnOnce()>(blk: F) { + blk(); +} + +pub fn main() { + let x = Arc::new(true); + foo(use || { + assert!(*x); + drop(x); + }); +} diff --git a/tests/ui/ergonomic-clones/closure/parse.rs b/tests/ui/ergonomic-clones/closure/parse.rs new file mode 100644 index 00000000000..0b3bfae0608 --- /dev/null +++ b/tests/ui/ergonomic-clones/closure/parse.rs @@ -0,0 +1,22 @@ +#![feature(ergonomic_clones)] +#![allow(incomplete_features)] + +fn parse1() { + || use { + //~^ ERROR expected one of `async`, `|`, or `||`, found `{` + }; +} + +fn parse2() { + move use || { + //~^ ERROR expected one of `async`, `|`, or `||`, found keyword `use` + }; +} + +fn parse3() { + use move || { + //~^ ERROR expected one of `async`, `|`, or `||`, found keyword `move` + }; +} + +fn main() {} diff --git a/tests/ui/ergonomic-clones/closure/parse.stderr b/tests/ui/ergonomic-clones/closure/parse.stderr new file mode 100644 index 00000000000..c37cb71394b --- /dev/null +++ b/tests/ui/ergonomic-clones/closure/parse.stderr @@ -0,0 +1,28 @@ +error: expected one of `async`, `|`, or `||`, found `{` + --> $DIR/parse.rs:5:12 + | +LL | || use { + | -- ^ expected one of `async`, `|`, or `||` + | | + | while parsing the body of this closure + | +help: you might have meant to open the body of the closure, instead of enclosing the closure in a block + | +LL ~ fn parse1() +LL ~ || { use { + | + +error: expected one of `async`, `|`, or `||`, found keyword `use` + --> $DIR/parse.rs:11:10 + | +LL | move use || { + | ^^^ expected one of `async`, `|`, or `||` + +error: expected one of `async`, `|`, or `||`, found keyword `move` + --> $DIR/parse.rs:17:9 + | +LL | use move || { + | ^^^^ expected one of `async`, `|`, or `||` + +error: aborting due to 3 previous errors + diff --git a/tests/ui/ergonomic-clones/closure/print-verbose.rs b/tests/ui/ergonomic-clones/closure/print-verbose.rs new file mode 100644 index 00000000000..e80d0d4b649 --- /dev/null +++ b/tests/ui/ergonomic-clones/closure/print-verbose.rs @@ -0,0 +1,28 @@ +//@ compile-flags: -Zverbose-internals + +#![feature(ergonomic_clones)] +#![allow(incomplete_features)] + +fn to_fn_once<F: FnOnce()>(f: F) -> F { + f +} + +fn f<T: std::fmt::Display>(y: T) { + struct Foo<U: std::fmt::Display> { + x: U, + }; + + let foo = Foo { x: "x" }; + + let c = to_fn_once(use || { + println!("{} {}", foo.x, y); + }); + + c(); + c(); + //~^ ERROR use of moved value +} + +fn main() { + f("S"); +} diff --git a/tests/ui/ergonomic-clones/closure/print-verbose.stderr b/tests/ui/ergonomic-clones/closure/print-verbose.stderr new file mode 100644 index 00000000000..283405c79d6 --- /dev/null +++ b/tests/ui/ergonomic-clones/closure/print-verbose.stderr @@ -0,0 +1,20 @@ +error[E0382]: use of moved value: `c` + --> $DIR/print-verbose.rs:22:5 + | +LL | let c = to_fn_once(use || { + | - move occurs because `c` has type `{f<T>::{closure#0} closure_kind_ty=i32 closure_sig_as_fn_ptr_ty=extern "rust-call" fn(()) upvar_tys=(Foo<&'?9 str>, T)}`, which does not implement the `Copy` trait +... +LL | c(); + | --- `c` moved due to this call +LL | c(); + | ^ value used here after move + | +note: this value implements `FnOnce`, which causes it to be moved when called + --> $DIR/print-verbose.rs:21:5 + | +LL | c(); + | ^ + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0382`. diff --git a/tests/ui/ergonomic-clones/closure/print.rs b/tests/ui/ergonomic-clones/closure/print.rs new file mode 100644 index 00000000000..c24a4cc5094 --- /dev/null +++ b/tests/ui/ergonomic-clones/closure/print.rs @@ -0,0 +1,26 @@ +#![feature(ergonomic_clones)] +#![allow(incomplete_features)] + +fn to_fn_once<F: FnOnce()>(f: F) -> F { + f +} + +fn f<T: std::fmt::Display>(y: T) { + struct Foo<U: std::fmt::Display> { + x: U, + }; + + let foo = Foo { x: "x" }; + + let c = to_fn_once(use || { + println!("{} {}", foo.x, y); + }); + + c(); + c(); + //~^ ERROR use of moved value +} + +fn main() { + f("S"); +} diff --git a/tests/ui/ergonomic-clones/closure/print.stderr b/tests/ui/ergonomic-clones/closure/print.stderr new file mode 100644 index 00000000000..5f48059ebff --- /dev/null +++ b/tests/ui/ergonomic-clones/closure/print.stderr @@ -0,0 +1,20 @@ +error[E0382]: use of moved value: `c` + --> $DIR/print.rs:20:5 + | +LL | let c = to_fn_once(use || { + | - move occurs because `c` has type `{closure@$DIR/print.rs:15:24: 15:30}`, which does not implement the `Copy` trait +... +LL | c(); + | --- `c` moved due to this call +LL | c(); + | ^ value used here after move + | +note: this value implements `FnOnce`, which causes it to be moved when called + --> $DIR/print.rs:19:5 + | +LL | c(); + | ^ + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0382`. diff --git a/tests/ui/ergonomic-clones/closure/with-binders.rs b/tests/ui/ergonomic-clones/closure/with-binders.rs new file mode 100644 index 00000000000..4260c252d9d --- /dev/null +++ b/tests/ui/ergonomic-clones/closure/with-binders.rs @@ -0,0 +1,10 @@ +//@ edition:2021 +//@ check-pass + +#![feature(closure_lifetime_binder)] +#![feature(ergonomic_clones)] +#![allow(incomplete_features)] + +fn main() { + for<'a> use || -> () {}; +} diff --git a/tests/ui/ergonomic-clones/dotuse/basic.rs b/tests/ui/ergonomic-clones/dotuse/basic.rs new file mode 100644 index 00000000000..8f962f079df --- /dev/null +++ b/tests/ui/ergonomic-clones/dotuse/basic.rs @@ -0,0 +1,22 @@ +//@ check-pass + +#![feature(ergonomic_clones)] +#![allow(incomplete_features)] + +use std::clone::UseCloned; + +fn basic_test(x: i32) -> i32 { + x.use.use.abs() +} + +#[derive(Clone)] +struct Foo; + +impl UseCloned for Foo {} + +fn do_not_move_test(x: Foo) -> Foo { + let s = x.use; + x +} + +fn main() {} diff --git a/tests/ui/ergonomic-clones/dotuse/parse.rs b/tests/ui/ergonomic-clones/dotuse/parse.rs new file mode 100644 index 00000000000..37ef5c37029 --- /dev/null +++ b/tests/ui/ergonomic-clones/dotuse/parse.rs @@ -0,0 +1,39 @@ +#![feature(ergonomic_clones)] +#![allow(incomplete_features)] + +fn parse1() { + 1.use!; + //~^ ERROR: expected one of `.`, `;`, `?`, `}`, or an operator, found `!` + } + +fn parse2() { + 1.use!(2); + //~^ ERROR: expected one of `.`, `;`, `?`, `}`, or an operator, found `!` + } + +fn parse3() { + 1.use 2; + //~^ ERROR: expected one of `.`, `;`, `?`, `}`, or an operator, found `2` + } + +fn parse4() { + 1.use? 2; + //~^ ERROR: expected one of `.`, `;`, `?`, `}`, or an operator, found `2` + } + +fn parse5() { + 1.use(); + //~^ ERROR: incorrect use of `use` +} + +fn parse6() { + 1.use(2); + //~^ ERROR: expected function, found `{integer}` [E0618] +} + +fn parse7() { + 1.use { 2 }; + //~^ ERROR: expected one of `.`, `;`, `?`, `}`, or an operator, found `{` +} + +fn main() {} diff --git a/tests/ui/ergonomic-clones/dotuse/parse.stderr b/tests/ui/ergonomic-clones/dotuse/parse.stderr new file mode 100644 index 00000000000..4b7a92534ed --- /dev/null +++ b/tests/ui/ergonomic-clones/dotuse/parse.stderr @@ -0,0 +1,53 @@ +error: expected one of `.`, `;`, `?`, `}`, or an operator, found `!` + --> $DIR/parse.rs:5:10 + | +LL | 1.use!; + | ^ expected one of `.`, `;`, `?`, `}`, or an operator + +error: expected one of `.`, `;`, `?`, `}`, or an operator, found `!` + --> $DIR/parse.rs:10:10 + | +LL | 1.use!(2); + | ^ expected one of `.`, `;`, `?`, `}`, or an operator + +error: expected one of `.`, `;`, `?`, `}`, or an operator, found `2` + --> $DIR/parse.rs:15:11 + | +LL | 1.use 2; + | ^ expected one of `.`, `;`, `?`, `}`, or an operator + +error: expected one of `.`, `;`, `?`, `}`, or an operator, found `2` + --> $DIR/parse.rs:20:12 + | +LL | 1.use? 2; + | ^ expected one of `.`, `;`, `?`, `}`, or an operator + +error: incorrect use of `use` + --> $DIR/parse.rs:25:10 + | +LL | 1.use(); + | ^^ + | +help: `use` is not a method call, try removing the parentheses + | +LL - 1.use(); +LL + 1.use; + | + +error: expected one of `.`, `;`, `?`, `}`, or an operator, found `{` + --> $DIR/parse.rs:35:11 + | +LL | 1.use { 2 }; + | ^ expected one of `.`, `;`, `?`, `}`, or an operator + +error[E0618]: expected function, found `{integer}` + --> $DIR/parse.rs:30:5 + | +LL | 1.use(2); + | ^^^^^--- + | | + | call expression requires function + +error: aborting due to 7 previous errors + +For more information about this error, try `rustc --explain E0618`. diff --git a/tests/ui/error-codes/E0084.stderr b/tests/ui/error-codes/E0084.stderr index f1fbe6c2532..3df2e4a322b 100644 --- a/tests/ui/error-codes/E0084.stderr +++ b/tests/ui/error-codes/E0084.stderr @@ -1,8 +1,8 @@ error[E0084]: unsupported representation for zero-variant enum - --> $DIR/E0084.rs:1:1 + --> $DIR/E0084.rs:1:8 | LL | #[repr(i32)] - | ^^^^^^^^^^^^ + | ^^^ LL | enum Foo {} | -------- zero-variant enum diff --git a/tests/ui/error-codes/E0094.rs b/tests/ui/error-codes/E0094.rs index da59d3decac..2067179b26a 100644 --- a/tests/ui/error-codes/E0094.rs +++ b/tests/ui/error-codes/E0094.rs @@ -1,10 +1,7 @@ #![feature(intrinsics)] #[rustc_intrinsic] -#[rustc_intrinsic_must_be_overridden] -fn size_of<T, U>() -> usize { - //~^ ERROR E0094 - loop {} -} +fn size_of<T, U>() -> usize; +//~^ ERROR E0094 fn main() {} diff --git a/tests/ui/error-codes/E0094.stderr b/tests/ui/error-codes/E0094.stderr index e45cc0ea063..da29987f8b1 100644 --- a/tests/ui/error-codes/E0094.stderr +++ b/tests/ui/error-codes/E0094.stderr @@ -1,7 +1,7 @@ error[E0094]: intrinsic has wrong number of type parameters: found 2, expected 1 - --> $DIR/E0094.rs:5:11 + --> $DIR/E0094.rs:4:11 | -LL | fn size_of<T, U>() -> usize { +LL | fn size_of<T, U>() -> usize; | ^^^^^^ expected 1 type parameter error: aborting due to 1 previous error diff --git a/tests/ui/error-codes/E0275.rs b/tests/ui/error-codes/E0275.rs index df7b606155e..28a9676f03e 100644 --- a/tests/ui/error-codes/E0275.rs +++ b/tests/ui/error-codes/E0275.rs @@ -1,4 +1,3 @@ -//@ normalize-stderr: "long-type-\d+" -> "long-type-hash" trait Foo {} struct Bar<T>(T); diff --git a/tests/ui/error-codes/E0275.stderr b/tests/ui/error-codes/E0275.stderr index b5075408340..3b31c87320a 100644 --- a/tests/ui/error-codes/E0275.stderr +++ b/tests/ui/error-codes/E0275.stderr @@ -1,12 +1,12 @@ error[E0275]: overflow evaluating the requirement `Bar<Bar<Bar<Bar<Bar<Bar<Bar<...>>>>>>>: Foo` - --> $DIR/E0275.rs:6:33 + --> $DIR/E0275.rs:5:33 | LL | impl<T> Foo for T where Bar<T>: Foo {} | ^^^ | = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`E0275`) note: required for `Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<T>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>` to implement `Foo` - --> $DIR/E0275.rs:6:9 + --> $DIR/E0275.rs:5:9 | LL | impl<T> Foo for T where Bar<T>: Foo {} | ^^^ ^ --- unsatisfied trait bound introduced here diff --git a/tests/ui/error-codes/E0308.rs b/tests/ui/error-codes/E0308.rs index f8f93d49a8e..c27d4245471 100644 --- a/tests/ui/error-codes/E0308.rs +++ b/tests/ui/error-codes/E0308.rs @@ -2,10 +2,7 @@ #![feature(rustc_attrs)] #[rustc_intrinsic] -#[rustc_intrinsic_must_be_overridden] -fn size_of<T>() { - //~^ ERROR E0308 - loop {} -} +fn size_of<T>(); +//~^ ERROR E0308 fn main() {} diff --git a/tests/ui/error-codes/E0308.stderr b/tests/ui/error-codes/E0308.stderr index 77e5c06e06a..a1077481a81 100644 --- a/tests/ui/error-codes/E0308.stderr +++ b/tests/ui/error-codes/E0308.stderr @@ -1,7 +1,7 @@ error[E0308]: intrinsic has wrong type - --> $DIR/E0308.rs:6:16 + --> $DIR/E0308.rs:5:16 | -LL | fn size_of<T>() { +LL | fn size_of<T>(); | ^ expected `usize`, found `()` | = note: expected signature `fn() -> usize` diff --git a/tests/ui/error-codes/E0374.stderr b/tests/ui/error-codes/E0374.stderr index 71eec4c16fd..95e6b95e0d5 100644 --- a/tests/ui/error-codes/E0374.stderr +++ b/tests/ui/error-codes/E0374.stderr @@ -6,7 +6,7 @@ LL | struct Foo<T: ?Sized> { | = help: consider removing `T`, referring to it in a field, or using a marker such as `PhantomData` -error[E0374]: the trait `CoerceUnsized` may only be implemented for a coercion between structures +error[E0374]: implementing `CoerceUnsized` requires a field to be coerced --> $DIR/E0374.rs:8:1 | LL | / impl<T, U> CoerceUnsized<Foo<U>> for Foo<T> diff --git a/tests/ui/error-codes/E0375.stderr b/tests/ui/error-codes/E0375.stderr index af720bd40e7..a797ba9d461 100644 --- a/tests/ui/error-codes/E0375.stderr +++ b/tests/ui/error-codes/E0375.stderr @@ -23,14 +23,19 @@ help: the `Box` type always has a statically known size and allocates its conten LL | b: Box<T>, | ++++ + -error[E0375]: implementing the trait `CoerceUnsized` requires multiple coercions +error[E0375]: implementing `CoerceUnsized` does not allow multiple fields to be coerced --> $DIR/E0375.rs:10:12 | LL | impl<T, U> CoerceUnsized<Foo<U, T>> for Foo<T, U> {} - | ^^^^^^^^^^^^^^^^^^^^^^^^ requires multiple coercions + | ^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: `CoerceUnsized` may only be implemented for a coercion between structures with one field being coerced - = note: currently, 2 fields need coercions: `b` (`T` to `U`), `c` (`U` to `T`) +note: the trait `CoerceUnsized` may only be implemented when a single field is being coerced + --> $DIR/E0375.rs:6:5 + | +LL | b: T, + | ^^^^ +LL | c: U, + | ^^^^ error: aborting due to 2 previous errors diff --git a/tests/ui/error-codes/E0376.rs b/tests/ui/error-codes/E0376.rs deleted file mode 100644 index f092eb02c2b..00000000000 --- a/tests/ui/error-codes/E0376.rs +++ /dev/null @@ -1,10 +0,0 @@ -#![feature(coerce_unsized)] -use std::ops::CoerceUnsized; - -struct Foo<T: ?Sized> { - a: T, -} - -impl<T, U> CoerceUnsized<U> for Foo<T> {} //~ ERROR E0376 - -fn main() {} diff --git a/tests/ui/error-codes/E0376.stderr b/tests/ui/error-codes/E0376.stderr deleted file mode 100644 index 46668e05a42..00000000000 --- a/tests/ui/error-codes/E0376.stderr +++ /dev/null @@ -1,9 +0,0 @@ -error[E0376]: the trait `CoerceUnsized` may only be implemented for a coercion between structures - --> $DIR/E0376.rs:8:1 - | -LL | impl<T, U> CoerceUnsized<U> for Foo<T> {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -error: aborting due to 1 previous error - -For more information about this error, try `rustc --explain E0376`. diff --git a/tests/ui/error-codes/E0462.stderr b/tests/ui/error-codes/E0462.stderr index 18f20d79385..be32001fad4 100644 --- a/tests/ui/error-codes/E0462.stderr +++ b/tests/ui/error-codes/E0462.stderr @@ -5,7 +5,7 @@ LL | extern crate found_staticlib; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: the following crate versions were found: - crate `found_staticlib`: $TEST_BUILD_DIR/error-codes/E0462/auxiliary/libfound_staticlib.somelib + crate `found_staticlib`: $TEST_BUILD_DIR/auxiliary/libfound_staticlib.somelib = help: please recompile that crate using --crate-type lib error: aborting due to 1 previous error diff --git a/tests/ui/error-codes/E0464.stderr b/tests/ui/error-codes/E0464.stderr index edb0b1cf41e..ec18978a59a 100644 --- a/tests/ui/error-codes/E0464.stderr +++ b/tests/ui/error-codes/E0464.stderr @@ -4,9 +4,9 @@ error[E0464]: multiple candidates for `rlib` dependency `crateresolve1` found LL | extern crate crateresolve1; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: candidate #1: $TEST_BUILD_DIR/error-codes/E0464/auxiliary/libcrateresolve1-1.somelib - = note: candidate #2: $TEST_BUILD_DIR/error-codes/E0464/auxiliary/libcrateresolve1-2.somelib - = note: candidate #3: $TEST_BUILD_DIR/error-codes/E0464/auxiliary/libcrateresolve1-3.somelib + = note: candidate #1: $TEST_BUILD_DIR/auxiliary/libcrateresolve1-1.somelib + = note: candidate #2: $TEST_BUILD_DIR/auxiliary/libcrateresolve1-2.somelib + = note: candidate #3: $TEST_BUILD_DIR/auxiliary/libcrateresolve1-3.somelib error: aborting due to 1 previous error diff --git a/tests/ui/error-codes/E0511.rs b/tests/ui/error-codes/E0511.rs index 81656c71088..c7e59c5c6c9 100644 --- a/tests/ui/error-codes/E0511.rs +++ b/tests/ui/error-codes/E0511.rs @@ -1,11 +1,11 @@ //@ build-fail -#![feature(intrinsics)] +#![feature(core_intrinsics)] -extern "rust-intrinsic" { - fn simd_add<T>(a: T, b: T) -> T; -} +use std::intrinsics::simd::simd_add; fn main() { - unsafe { simd_add(0, 1); } //~ ERROR E0511 + unsafe { + simd_add(0, 1) //~ ERROR E0511 + }; } diff --git a/tests/ui/error-codes/E0511.stderr b/tests/ui/error-codes/E0511.stderr index 59eb19d2ee5..45f5b8d238d 100644 --- a/tests/ui/error-codes/E0511.stderr +++ b/tests/ui/error-codes/E0511.stderr @@ -1,8 +1,8 @@ error[E0511]: invalid monomorphization of `simd_add` intrinsic: expected SIMD input type, found non-SIMD `i32` - --> $DIR/E0511.rs:10:14 + --> $DIR/E0511.rs:9:9 | -LL | unsafe { simd_add(0, 1); } - | ^^^^^^^^^^^^^^ +LL | simd_add(0, 1) + | ^^^^^^^^^^^^^^ error: aborting due to 1 previous error diff --git a/tests/ui/error-codes/E0523.stderr b/tests/ui/error-codes/E0523.stderr index c6e65b55e2b..f4072d69104 100644 --- a/tests/ui/error-codes/E0523.stderr +++ b/tests/ui/error-codes/E0523.stderr @@ -4,9 +4,9 @@ error[E0464]: multiple candidates for `rlib` dependency `crateresolve1` found LL | extern crate crateresolve1; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: candidate #1: $TEST_BUILD_DIR/error-codes/E0523/auxiliary/libcrateresolve1-1.somelib - = note: candidate #2: $TEST_BUILD_DIR/error-codes/E0523/auxiliary/libcrateresolve1-2.somelib - = note: candidate #3: $TEST_BUILD_DIR/error-codes/E0523/auxiliary/libcrateresolve1-3.somelib + = note: candidate #1: $TEST_BUILD_DIR/auxiliary/libcrateresolve1-1.somelib + = note: candidate #2: $TEST_BUILD_DIR/auxiliary/libcrateresolve1-2.somelib + = note: candidate #3: $TEST_BUILD_DIR/auxiliary/libcrateresolve1-3.somelib error: aborting due to 1 previous error diff --git a/tests/ui/error-codes/E0565.stderr b/tests/ui/error-codes/E0565.stderr index 68f4a37dcff..6e56600133d 100644 --- a/tests/ui/error-codes/E0565.stderr +++ b/tests/ui/error-codes/E0565.stderr @@ -1,8 +1,8 @@ error[E0565]: meta item in `repr` must be an identifier - --> $DIR/E0565.rs:2:8 + --> $DIR/E0565.rs:2:1 | LL | #[repr("C")] - | ^^^ + | ^^^^^^^^^^^^ error: aborting due to 1 previous error diff --git a/tests/ui/error-codes/E0582.stderr b/tests/ui/error-codes/E0582.stderr index 64b527cdcc2..ac97a6ff00a 100644 --- a/tests/ui/error-codes/E0582.stderr +++ b/tests/ui/error-codes/E0582.stderr @@ -14,7 +14,7 @@ error[E0308]: mismatched types --> $DIR/E0582.rs:22:5 | LL | bar(mk_unexpected_char_err) - | ^^^ one type is more general than the other + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ one type is more general than the other | = note: expected enum `Option<&_>` found enum `Option<&'a _>` diff --git a/tests/ui/error-codes/E0614.stderr b/tests/ui/error-codes/E0614.stderr index ae7c2ce9a13..0bba0753980 100644 --- a/tests/ui/error-codes/E0614.stderr +++ b/tests/ui/error-codes/E0614.stderr @@ -2,7 +2,7 @@ error[E0614]: type `u32` cannot be dereferenced --> $DIR/E0614.rs:3:5 | LL | *y; - | ^^ + | ^^ can't be dereferenced error: aborting due to 1 previous error diff --git a/tests/ui/error-codes/E0771.stderr b/tests/ui/error-codes/E0771.stderr index 5e829e6f6d2..dfeaa347941 100644 --- a/tests/ui/error-codes/E0771.stderr +++ b/tests/ui/error-codes/E0771.stderr @@ -3,8 +3,6 @@ error[E0770]: the type of const parameters must not depend on other generic para | LL | fn function_with_str<'a, const STRING: &'a str>() {} | ^^ the type must not depend on the parameter `'a` - | - = note: lifetime parameters may not be used in the type of const parameters warning: the feature `unsized_const_params` is incomplete and may not be safe to use and/or cause compiler crashes --> $DIR/E0771.rs:1:30 diff --git a/tests/ui/error-codes/E0789.rs b/tests/ui/error-codes/E0789.rs index 08471e1b3f3..4a55e174315 100644 --- a/tests/ui/error-codes/E0789.rs +++ b/tests/ui/error-codes/E0789.rs @@ -8,5 +8,3 @@ // #[stable(feature = "foo", since = "1.0")] struct Foo; //~^ ERROR `rustc_allowed_through_unstable_modules` attribute must be paired with a `stable` attribute -//~^^ ERROR `rustc_allowed_through_unstable_modules` attribute must be paired with a `stable` attribute -// FIXME: we shouldn't have two errors here, only occurs when using `-Zdeduplicate-diagnostics=no` diff --git a/tests/ui/error-codes/E0789.stderr b/tests/ui/error-codes/E0789.stderr index 6df9daafec7..23631ee1b03 100644 --- a/tests/ui/error-codes/E0789.stderr +++ b/tests/ui/error-codes/E0789.stderr @@ -4,14 +4,6 @@ error[E0789]: `rustc_allowed_through_unstable_modules` attribute must be paired LL | struct Foo; | ^^^^^^^^^^^ -error[E0789]: `rustc_allowed_through_unstable_modules` attribute must be paired with a `stable` attribute - --> $DIR/E0789.rs:9:1 - | -LL | struct Foo; - | ^^^^^^^^^^^ - | - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` - -error: aborting due to 2 previous errors +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0789`. diff --git a/tests/ui/explicit-tail-calls/ctfe-id-unlimited.return.stderr b/tests/ui/explicit-tail-calls/ctfe-id-unlimited.return.stderr index 46769cdea8a..8fb51f5b637 100644 --- a/tests/ui/explicit-tail-calls/ctfe-id-unlimited.return.stderr +++ b/tests/ui/explicit-tail-calls/ctfe-id-unlimited.return.stderr @@ -1,29 +1,24 @@ error[E0080]: evaluation of constant value failed - --> $DIR/ctfe-id-unlimited.rs:17:42 + --> $DIR/ctfe-id-unlimited.rs:28:20 | -LL | #[cfg(r#return)] _ => return inner(acc + 1, n - 1), - | ^^^^^^^^^^^^^^^^^^^^^ reached the configured maximum number of stack frames +LL | const ID_ED: u32 = rec_id(ORIGINAL); + | ^^^^^^^^^^^^^^^^ reached the configured maximum number of stack frames | -note: inside `inner` - --> $DIR/ctfe-id-unlimited.rs:17:42 +note: inside `rec_id` + --> $DIR/ctfe-id-unlimited.rs:21:5 | -LL | #[cfg(r#return)] _ => return inner(acc + 1, n - 1), - | ^^^^^^^^^^^^^^^^^^^^^ +LL | inner(0, n) + | ^^^^^^^^^^^ note: [... 125 additional calls inside `inner` ...] --> $DIR/ctfe-id-unlimited.rs:17:42 | LL | #[cfg(r#return)] _ => return inner(acc + 1, n - 1), | ^^^^^^^^^^^^^^^^^^^^^ -note: inside `rec_id` - --> $DIR/ctfe-id-unlimited.rs:22:5 - | -LL | inner(0, n) - | ^^^^^^^^^^^ -note: inside `ID_ED` - --> $DIR/ctfe-id-unlimited.rs:29:20 +note: inside `inner` + --> $DIR/ctfe-id-unlimited.rs:17:42 | -LL | const ID_ED: u32 = rec_id(ORIGINAL); - | ^^^^^^^^^^^^^^^^ +LL | #[cfg(r#return)] _ => return inner(acc + 1, n - 1), + | ^^^^^^^^^^^^^^^^^^^^^ the failure occurred here error: aborting due to 1 previous error diff --git a/tests/ui/explicit-tail-calls/ctfe-id-unlimited.rs b/tests/ui/explicit-tail-calls/ctfe-id-unlimited.rs index 2a04d4893e6..9e89f4066bb 100644 --- a/tests/ui/explicit-tail-calls/ctfe-id-unlimited.rs +++ b/tests/ui/explicit-tail-calls/ctfe-id-unlimited.rs @@ -15,7 +15,6 @@ const fn rec_id(n: u32) -> u32 { 0 => acc, #[cfg(r#become)] _ => become inner(acc + 1, n - 1), #[cfg(r#return)] _ => return inner(acc + 1, n - 1), - //[return]~^ error: evaluation of constant value failed } } @@ -26,7 +25,7 @@ const fn rec_id(n: u32) -> u32 { const ORIGINAL: u32 = 12345; // Original number, but with identity function applied // (this is the same, but requires execution of the recursion) -const ID_ED: u32 = rec_id(ORIGINAL); +const ID_ED: u32 = rec_id(ORIGINAL); //[return]~ error: evaluation of constant value failed // Assert to make absolutely sure the computation actually happens const ASSERT: () = assert!(ORIGINAL == ID_ED); diff --git a/tests/ui/explicit-tail-calls/ctfe-tail-call-panic.rs b/tests/ui/explicit-tail-calls/ctfe-tail-call-panic.rs index fba4a2692af..e7038a01d2d 100644 --- a/tests/ui/explicit-tail-calls/ctfe-tail-call-panic.rs +++ b/tests/ui/explicit-tail-calls/ctfe-tail-call-panic.rs @@ -6,14 +6,11 @@ pub const fn f() { } const fn g() { - panic!() - //~^ error: evaluation of constant value failed - //~| note: in this expansion of panic! - //~| note: inside `g` - //~| note: in this expansion of panic! + panic!() //~ NOTE inside `g` + //~^ NOTE in this expansion of panic! } -const _: () = f(); -//~^ note: inside `_` +const _: () = f(); //~ ERROR evaluation of constant value failed +//~^ NOTE explicit panic fn main() {} diff --git a/tests/ui/explicit-tail-calls/ctfe-tail-call-panic.stderr b/tests/ui/explicit-tail-calls/ctfe-tail-call-panic.stderr index 8c070512105..ef71722a0ab 100644 --- a/tests/ui/explicit-tail-calls/ctfe-tail-call-panic.stderr +++ b/tests/ui/explicit-tail-calls/ctfe-tail-call-panic.stderr @@ -1,19 +1,14 @@ error[E0080]: evaluation of constant value failed - --> $DIR/ctfe-tail-call-panic.rs:9:5 + --> $DIR/ctfe-tail-call-panic.rs:13:15 | -LL | panic!() - | ^^^^^^^^ the evaluated program panicked at 'explicit panic', $DIR/ctfe-tail-call-panic.rs:9:5 +LL | const _: () = f(); + | ^^^ evaluation panicked: explicit panic | note: inside `g` --> $DIR/ctfe-tail-call-panic.rs:9:5 | LL | panic!() - | ^^^^^^^^ -note: inside `_` - --> $DIR/ctfe-tail-call-panic.rs:16:15 - | -LL | const _: () = f(); - | ^^^ + | ^^^^^^^^ the failure occurred here = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 1 previous error diff --git a/tests/ui/extern/issue-36122-accessing-externed-dst.stderr b/tests/ui/extern/issue-36122-accessing-externed-dst.stderr index 64178e6f843..6f805aec1df 100644 --- a/tests/ui/extern/issue-36122-accessing-externed-dst.stderr +++ b/tests/ui/extern/issue-36122-accessing-externed-dst.stderr @@ -5,6 +5,7 @@ LL | static symbol: [usize]; | ^^^^^^^ doesn't have a size known at compile-time | = help: the trait `Sized` is not implemented for `[usize]` + = note: statics and constants must have a statically known size error[E0133]: use of extern static is unsafe and requires unsafe function or block --> $DIR/issue-36122-accessing-externed-dst.rs:5:20 diff --git a/tests/ui/feature-gates/feature-gate-abi-avr-interrupt.rs b/tests/ui/feature-gates/feature-gate-abi-avr-interrupt.rs index ce3d3fc645d..6901a2ab9f1 100644 --- a/tests/ui/feature-gates/feature-gate-abi-avr-interrupt.rs +++ b/tests/ui/feature-gates/feature-gate-abi-avr-interrupt.rs @@ -1,9 +1,11 @@ +//@ add-core-stubs //@ needs-llvm-components: avr //@ compile-flags: --target=avr-none -C target-cpu=atmega328p --crate-type=rlib #![no_core] #![feature(no_core, lang_items)] -#[lang="sized"] -trait Sized { } + +extern crate minicore; +use minicore::*; // Test that the AVR interrupt ABI cannot be used when avr_interrupt // feature gate is not used. diff --git a/tests/ui/feature-gates/feature-gate-abi-avr-interrupt.stderr b/tests/ui/feature-gates/feature-gate-abi-avr-interrupt.stderr index d9f3c3adc7f..768209eec63 100644 --- a/tests/ui/feature-gates/feature-gate-abi-avr-interrupt.stderr +++ b/tests/ui/feature-gates/feature-gate-abi-avr-interrupt.stderr @@ -1,5 +1,5 @@ error[E0658]: the extern "avr-non-blocking-interrupt" ABI is experimental and subject to change - --> $DIR/feature-gate-abi-avr-interrupt.rs:11:8 + --> $DIR/feature-gate-abi-avr-interrupt.rs:13:8 | LL | extern "avr-non-blocking-interrupt" fn fu() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -9,7 +9,7 @@ LL | extern "avr-non-blocking-interrupt" fn fu() {} = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: the extern "avr-interrupt" ABI is experimental and subject to change - --> $DIR/feature-gate-abi-avr-interrupt.rs:13:8 + --> $DIR/feature-gate-abi-avr-interrupt.rs:15:8 | LL | extern "avr-interrupt" fn f() {} | ^^^^^^^^^^^^^^^ @@ -19,7 +19,7 @@ LL | extern "avr-interrupt" fn f() {} = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: the extern "avr-interrupt" ABI is experimental and subject to change - --> $DIR/feature-gate-abi-avr-interrupt.rs:17:12 + --> $DIR/feature-gate-abi-avr-interrupt.rs:19:12 | LL | extern "avr-interrupt" fn m(); | ^^^^^^^^^^^^^^^ @@ -29,7 +29,7 @@ LL | extern "avr-interrupt" fn m(); = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: the extern "avr-non-blocking-interrupt" ABI is experimental and subject to change - --> $DIR/feature-gate-abi-avr-interrupt.rs:19:12 + --> $DIR/feature-gate-abi-avr-interrupt.rs:21:12 | LL | extern "avr-non-blocking-interrupt" fn mu(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -39,7 +39,7 @@ LL | extern "avr-non-blocking-interrupt" fn mu(); = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: the extern "avr-interrupt" ABI is experimental and subject to change - --> $DIR/feature-gate-abi-avr-interrupt.rs:22:12 + --> $DIR/feature-gate-abi-avr-interrupt.rs:24:12 | LL | extern "avr-interrupt" fn dm() {} | ^^^^^^^^^^^^^^^ @@ -49,7 +49,7 @@ LL | extern "avr-interrupt" fn dm() {} = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: the extern "avr-non-blocking-interrupt" ABI is experimental and subject to change - --> $DIR/feature-gate-abi-avr-interrupt.rs:24:12 + --> $DIR/feature-gate-abi-avr-interrupt.rs:26:12 | LL | extern "avr-non-blocking-interrupt" fn dmu() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -59,7 +59,7 @@ LL | extern "avr-non-blocking-interrupt" fn dmu() {} = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: the extern "avr-interrupt" ABI is experimental and subject to change - --> $DIR/feature-gate-abi-avr-interrupt.rs:30:12 + --> $DIR/feature-gate-abi-avr-interrupt.rs:32:12 | LL | extern "avr-interrupt" fn m() {} | ^^^^^^^^^^^^^^^ @@ -69,7 +69,7 @@ LL | extern "avr-interrupt" fn m() {} = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: the extern "avr-non-blocking-interrupt" ABI is experimental and subject to change - --> $DIR/feature-gate-abi-avr-interrupt.rs:32:12 + --> $DIR/feature-gate-abi-avr-interrupt.rs:34:12 | LL | extern "avr-non-blocking-interrupt" fn mu() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -79,7 +79,7 @@ LL | extern "avr-non-blocking-interrupt" fn mu() {} = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: the extern "avr-interrupt" ABI is experimental and subject to change - --> $DIR/feature-gate-abi-avr-interrupt.rs:37:12 + --> $DIR/feature-gate-abi-avr-interrupt.rs:39:12 | LL | extern "avr-interrupt" fn im() {} | ^^^^^^^^^^^^^^^ @@ -89,7 +89,7 @@ LL | extern "avr-interrupt" fn im() {} = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: the extern "avr-non-blocking-interrupt" ABI is experimental and subject to change - --> $DIR/feature-gate-abi-avr-interrupt.rs:39:12 + --> $DIR/feature-gate-abi-avr-interrupt.rs:41:12 | LL | extern "avr-non-blocking-interrupt" fn imu() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -99,7 +99,7 @@ LL | extern "avr-non-blocking-interrupt" fn imu() {} = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: the extern "avr-interrupt" ABI is experimental and subject to change - --> $DIR/feature-gate-abi-avr-interrupt.rs:43:18 + --> $DIR/feature-gate-abi-avr-interrupt.rs:45:18 | LL | type TA = extern "avr-interrupt" fn(); | ^^^^^^^^^^^^^^^ @@ -109,7 +109,7 @@ LL | type TA = extern "avr-interrupt" fn(); = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: the extern "avr-non-blocking-interrupt" ABI is experimental and subject to change - --> $DIR/feature-gate-abi-avr-interrupt.rs:45:19 + --> $DIR/feature-gate-abi-avr-interrupt.rs:47:19 | LL | type TAU = extern "avr-non-blocking-interrupt" fn(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -119,7 +119,7 @@ LL | type TAU = extern "avr-non-blocking-interrupt" fn(); = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: the extern "avr-interrupt" ABI is experimental and subject to change - --> $DIR/feature-gate-abi-avr-interrupt.rs:48:8 + --> $DIR/feature-gate-abi-avr-interrupt.rs:50:8 | LL | extern "avr-interrupt" {} | ^^^^^^^^^^^^^^^ @@ -129,7 +129,7 @@ LL | extern "avr-interrupt" {} = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: the extern "avr-non-blocking-interrupt" ABI is experimental and subject to change - --> $DIR/feature-gate-abi-avr-interrupt.rs:50:8 + --> $DIR/feature-gate-abi-avr-interrupt.rs:52:8 | LL | extern "avr-non-blocking-interrupt" {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/feature-gates/feature-gate-abi-msp430-interrupt.rs b/tests/ui/feature-gates/feature-gate-abi-msp430-interrupt.rs index bb69a638cee..60bf69f597c 100644 --- a/tests/ui/feature-gates/feature-gate-abi-msp430-interrupt.rs +++ b/tests/ui/feature-gates/feature-gate-abi-msp430-interrupt.rs @@ -1,9 +1,11 @@ +//@ add-core-stubs //@ needs-llvm-components: msp430 //@ compile-flags: --target=msp430-none-elf --crate-type=rlib #![no_core] #![feature(no_core, lang_items)] -#[lang="sized"] -trait Sized { } + +extern crate minicore; +use minicore::*; extern "msp430-interrupt" fn f() {} //~^ ERROR "msp430-interrupt" ABI is experimental diff --git a/tests/ui/feature-gates/feature-gate-abi-msp430-interrupt.stderr b/tests/ui/feature-gates/feature-gate-abi-msp430-interrupt.stderr index 21ddbf7a86d..4a995b4efa6 100644 --- a/tests/ui/feature-gates/feature-gate-abi-msp430-interrupt.stderr +++ b/tests/ui/feature-gates/feature-gate-abi-msp430-interrupt.stderr @@ -1,5 +1,5 @@ error[E0658]: the extern "msp430-interrupt" ABI is experimental and subject to change - --> $DIR/feature-gate-abi-msp430-interrupt.rs:8:8 + --> $DIR/feature-gate-abi-msp430-interrupt.rs:10:8 | LL | extern "msp430-interrupt" fn f() {} | ^^^^^^^^^^^^^^^^^^ @@ -9,7 +9,7 @@ LL | extern "msp430-interrupt" fn f() {} = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: the extern "msp430-interrupt" ABI is experimental and subject to change - --> $DIR/feature-gate-abi-msp430-interrupt.rs:12:12 + --> $DIR/feature-gate-abi-msp430-interrupt.rs:14:12 | LL | extern "msp430-interrupt" fn m(); | ^^^^^^^^^^^^^^^^^^ @@ -19,7 +19,7 @@ LL | extern "msp430-interrupt" fn m(); = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: the extern "msp430-interrupt" ABI is experimental and subject to change - --> $DIR/feature-gate-abi-msp430-interrupt.rs:15:12 + --> $DIR/feature-gate-abi-msp430-interrupt.rs:17:12 | LL | extern "msp430-interrupt" fn dm() {} | ^^^^^^^^^^^^^^^^^^ @@ -29,7 +29,7 @@ LL | extern "msp430-interrupt" fn dm() {} = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: the extern "msp430-interrupt" ABI is experimental and subject to change - --> $DIR/feature-gate-abi-msp430-interrupt.rs:21:12 + --> $DIR/feature-gate-abi-msp430-interrupt.rs:23:12 | LL | extern "msp430-interrupt" fn m() {} | ^^^^^^^^^^^^^^^^^^ @@ -39,7 +39,7 @@ LL | extern "msp430-interrupt" fn m() {} = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: the extern "msp430-interrupt" ABI is experimental and subject to change - --> $DIR/feature-gate-abi-msp430-interrupt.rs:26:12 + --> $DIR/feature-gate-abi-msp430-interrupt.rs:28:12 | LL | extern "msp430-interrupt" fn im() {} | ^^^^^^^^^^^^^^^^^^ @@ -49,7 +49,7 @@ LL | extern "msp430-interrupt" fn im() {} = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: the extern "msp430-interrupt" ABI is experimental and subject to change - --> $DIR/feature-gate-abi-msp430-interrupt.rs:30:18 + --> $DIR/feature-gate-abi-msp430-interrupt.rs:32:18 | LL | type TA = extern "msp430-interrupt" fn(); | ^^^^^^^^^^^^^^^^^^ @@ -59,7 +59,7 @@ LL | type TA = extern "msp430-interrupt" fn(); = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: the extern "msp430-interrupt" ABI is experimental and subject to change - --> $DIR/feature-gate-abi-msp430-interrupt.rs:33:8 + --> $DIR/feature-gate-abi-msp430-interrupt.rs:35:8 | LL | extern "msp430-interrupt" {} | ^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/feature-gates/feature-gate-abi-riscv-interrupt.rs b/tests/ui/feature-gates/feature-gate-abi-riscv-interrupt.rs index 6f4989fbd9f..006d01c5589 100644 --- a/tests/ui/feature-gates/feature-gate-abi-riscv-interrupt.rs +++ b/tests/ui/feature-gates/feature-gate-abi-riscv-interrupt.rs @@ -1,9 +1,11 @@ +//@ add-core-stubs //@ needs-llvm-components: riscv //@ compile-flags: --target=riscv32imc-unknown-none-elf --crate-type=rlib #![no_core] #![feature(no_core, lang_items)] -#[lang = "sized"] -trait Sized {} + +extern crate minicore; +use minicore::*; // Test that the riscv interrupt ABIs cannot be used when riscv_interrupt // feature gate is not used. diff --git a/tests/ui/feature-gates/feature-gate-abi-riscv-interrupt.stderr b/tests/ui/feature-gates/feature-gate-abi-riscv-interrupt.stderr index 3c9e99aa1b9..af956c35da6 100644 --- a/tests/ui/feature-gates/feature-gate-abi-riscv-interrupt.stderr +++ b/tests/ui/feature-gates/feature-gate-abi-riscv-interrupt.stderr @@ -1,5 +1,5 @@ error[E0658]: the extern "riscv-interrupt-m" ABI is experimental and subject to change - --> $DIR/feature-gate-abi-riscv-interrupt.rs:11:8 + --> $DIR/feature-gate-abi-riscv-interrupt.rs:13:8 | LL | extern "riscv-interrupt-m" fn f() {} | ^^^^^^^^^^^^^^^^^^^ @@ -9,7 +9,7 @@ LL | extern "riscv-interrupt-m" fn f() {} = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: the extern "riscv-interrupt-s" ABI is experimental and subject to change - --> $DIR/feature-gate-abi-riscv-interrupt.rs:13:8 + --> $DIR/feature-gate-abi-riscv-interrupt.rs:15:8 | LL | extern "riscv-interrupt-s" fn f_s() {} | ^^^^^^^^^^^^^^^^^^^ @@ -19,7 +19,7 @@ LL | extern "riscv-interrupt-s" fn f_s() {} = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: the extern "riscv-interrupt-m" ABI is experimental and subject to change - --> $DIR/feature-gate-abi-riscv-interrupt.rs:17:12 + --> $DIR/feature-gate-abi-riscv-interrupt.rs:19:12 | LL | extern "riscv-interrupt-m" fn m(); | ^^^^^^^^^^^^^^^^^^^ @@ -29,7 +29,7 @@ LL | extern "riscv-interrupt-m" fn m(); = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: the extern "riscv-interrupt-m" ABI is experimental and subject to change - --> $DIR/feature-gate-abi-riscv-interrupt.rs:23:12 + --> $DIR/feature-gate-abi-riscv-interrupt.rs:25:12 | LL | extern "riscv-interrupt-m" fn m() {} | ^^^^^^^^^^^^^^^^^^^ @@ -39,7 +39,7 @@ LL | extern "riscv-interrupt-m" fn m() {} = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: the extern "riscv-interrupt-m" ABI is experimental and subject to change - --> $DIR/feature-gate-abi-riscv-interrupt.rs:28:12 + --> $DIR/feature-gate-abi-riscv-interrupt.rs:30:12 | LL | extern "riscv-interrupt-m" fn im() {} | ^^^^^^^^^^^^^^^^^^^ @@ -49,7 +49,7 @@ LL | extern "riscv-interrupt-m" fn im() {} = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: the extern "riscv-interrupt-m" ABI is experimental and subject to change - --> $DIR/feature-gate-abi-riscv-interrupt.rs:32:18 + --> $DIR/feature-gate-abi-riscv-interrupt.rs:34:18 | LL | type TA = extern "riscv-interrupt-m" fn(); | ^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/feature-gates/feature-gate-abi-x86-interrupt.rs b/tests/ui/feature-gates/feature-gate-abi-x86-interrupt.rs index 93c59364f10..c4fdb5f427c 100644 --- a/tests/ui/feature-gates/feature-gate-abi-x86-interrupt.rs +++ b/tests/ui/feature-gates/feature-gate-abi-x86-interrupt.rs @@ -1,9 +1,11 @@ +//@ add-core-stubs //@ needs-llvm-components: x86 //@ compile-flags: --target=x86_64-unknown-linux-gnu --crate-type=rlib #![no_core] #![feature(no_core, lang_items)] -#[lang="sized"] -trait Sized { } + +extern crate minicore; +use minicore::*; extern "x86-interrupt" fn f7() {} //~ ERROR "x86-interrupt" ABI is experimental trait Tr { diff --git a/tests/ui/feature-gates/feature-gate-abi-x86-interrupt.stderr b/tests/ui/feature-gates/feature-gate-abi-x86-interrupt.stderr index 231cf207c86..67211d402c6 100644 --- a/tests/ui/feature-gates/feature-gate-abi-x86-interrupt.stderr +++ b/tests/ui/feature-gates/feature-gate-abi-x86-interrupt.stderr @@ -1,5 +1,5 @@ error[E0658]: the extern "x86-interrupt" ABI is experimental and subject to change - --> $DIR/feature-gate-abi-x86-interrupt.rs:8:8 + --> $DIR/feature-gate-abi-x86-interrupt.rs:10:8 | LL | extern "x86-interrupt" fn f7() {} | ^^^^^^^^^^^^^^^ @@ -9,7 +9,7 @@ LL | extern "x86-interrupt" fn f7() {} = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: the extern "x86-interrupt" ABI is experimental and subject to change - --> $DIR/feature-gate-abi-x86-interrupt.rs:10:12 + --> $DIR/feature-gate-abi-x86-interrupt.rs:12:12 | LL | extern "x86-interrupt" fn m7(); | ^^^^^^^^^^^^^^^ @@ -19,7 +19,7 @@ LL | extern "x86-interrupt" fn m7(); = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: the extern "x86-interrupt" ABI is experimental and subject to change - --> $DIR/feature-gate-abi-x86-interrupt.rs:11:12 + --> $DIR/feature-gate-abi-x86-interrupt.rs:13:12 | LL | extern "x86-interrupt" fn dm7() {} | ^^^^^^^^^^^^^^^ @@ -29,7 +29,7 @@ LL | extern "x86-interrupt" fn dm7() {} = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: the extern "x86-interrupt" ABI is experimental and subject to change - --> $DIR/feature-gate-abi-x86-interrupt.rs:18:12 + --> $DIR/feature-gate-abi-x86-interrupt.rs:20:12 | LL | extern "x86-interrupt" fn m7() {} | ^^^^^^^^^^^^^^^ @@ -39,7 +39,7 @@ LL | extern "x86-interrupt" fn m7() {} = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: the extern "x86-interrupt" ABI is experimental and subject to change - --> $DIR/feature-gate-abi-x86-interrupt.rs:23:12 + --> $DIR/feature-gate-abi-x86-interrupt.rs:25:12 | LL | extern "x86-interrupt" fn im7() {} | ^^^^^^^^^^^^^^^ @@ -49,7 +49,7 @@ LL | extern "x86-interrupt" fn im7() {} = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: the extern "x86-interrupt" ABI is experimental and subject to change - --> $DIR/feature-gate-abi-x86-interrupt.rs:26:18 + --> $DIR/feature-gate-abi-x86-interrupt.rs:28:18 | LL | type A7 = extern "x86-interrupt" fn(); | ^^^^^^^^^^^^^^^ @@ -59,7 +59,7 @@ LL | type A7 = extern "x86-interrupt" fn(); = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: the extern "x86-interrupt" ABI is experimental and subject to change - --> $DIR/feature-gate-abi-x86-interrupt.rs:28:8 + --> $DIR/feature-gate-abi-x86-interrupt.rs:30:8 | LL | extern "x86-interrupt" {} | ^^^^^^^^^^^^^^^ diff --git a/tests/ui/feature-gates/feature-gate-abi.rs b/tests/ui/feature-gates/feature-gate-abi.rs index 7ab05889c20..2af623734ee 100644 --- a/tests/ui/feature-gates/feature-gate-abi.rs +++ b/tests/ui/feature-gates/feature-gate-abi.rs @@ -1,14 +1,12 @@ // gate-test-intrinsics +//@ add-core-stubs //@ compile-flags: --crate-type=rlib #![feature(no_core, lang_items)] #![no_core] -#[lang="sized"] -trait Sized { } - -#[lang="tuple_trait"] -trait Tuple { } +extern crate minicore; +use minicore::*; // Functions extern "rust-intrinsic" fn f1() {} //~ ERROR extern "rust-intrinsic" ABI is an implementation detail diff --git a/tests/ui/feature-gates/feature-gate-abi.stderr b/tests/ui/feature-gates/feature-gate-abi.stderr index 70ec64e5135..a974c0099cb 100644 --- a/tests/ui/feature-gates/feature-gate-abi.stderr +++ b/tests/ui/feature-gates/feature-gate-abi.stderr @@ -1,5 +1,5 @@ error[E0658]: the extern "rust-intrinsic" ABI is an implementation detail and perma-unstable - --> $DIR/feature-gate-abi.rs:14:8 + --> $DIR/feature-gate-abi.rs:12:8 | LL | extern "rust-intrinsic" fn f1() {} | ^^^^^^^^^^^^^^^^ @@ -8,7 +8,7 @@ LL | extern "rust-intrinsic" fn f1() {} = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: the extern "rust-intrinsic" ABI is an implementation detail and perma-unstable - --> $DIR/feature-gate-abi.rs:16:8 + --> $DIR/feature-gate-abi.rs:14:8 | LL | extern "rust-intrinsic" fn f2() {} | ^^^^^^^^^^^^^^^^ @@ -17,7 +17,7 @@ LL | extern "rust-intrinsic" fn f2() {} = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: the extern "rust-call" ABI is experimental and subject to change - --> $DIR/feature-gate-abi.rs:18:8 + --> $DIR/feature-gate-abi.rs:16:8 | LL | extern "rust-call" fn f4(_: ()) {} | ^^^^^^^^^^^ @@ -27,7 +27,7 @@ LL | extern "rust-call" fn f4(_: ()) {} = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: the extern "rust-intrinsic" ABI is an implementation detail and perma-unstable - --> $DIR/feature-gate-abi.rs:22:12 + --> $DIR/feature-gate-abi.rs:20:12 | LL | extern "rust-intrinsic" fn m1(); | ^^^^^^^^^^^^^^^^ @@ -36,7 +36,7 @@ LL | extern "rust-intrinsic" fn m1(); = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: the extern "rust-intrinsic" ABI is an implementation detail and perma-unstable - --> $DIR/feature-gate-abi.rs:24:12 + --> $DIR/feature-gate-abi.rs:22:12 | LL | extern "rust-intrinsic" fn m2(); | ^^^^^^^^^^^^^^^^ @@ -45,7 +45,7 @@ LL | extern "rust-intrinsic" fn m2(); = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: the extern "rust-call" ABI is experimental and subject to change - --> $DIR/feature-gate-abi.rs:26:12 + --> $DIR/feature-gate-abi.rs:24:12 | LL | extern "rust-call" fn m4(_: ()); | ^^^^^^^^^^^ @@ -55,7 +55,7 @@ LL | extern "rust-call" fn m4(_: ()); = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: the extern "rust-call" ABI is experimental and subject to change - --> $DIR/feature-gate-abi.rs:28:12 + --> $DIR/feature-gate-abi.rs:26:12 | LL | extern "rust-call" fn dm4(_: ()) {} | ^^^^^^^^^^^ @@ -65,7 +65,7 @@ LL | extern "rust-call" fn dm4(_: ()) {} = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: the extern "rust-intrinsic" ABI is an implementation detail and perma-unstable - --> $DIR/feature-gate-abi.rs:35:12 + --> $DIR/feature-gate-abi.rs:33:12 | LL | extern "rust-intrinsic" fn m1() {} | ^^^^^^^^^^^^^^^^ @@ -74,7 +74,7 @@ LL | extern "rust-intrinsic" fn m1() {} = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: the extern "rust-intrinsic" ABI is an implementation detail and perma-unstable - --> $DIR/feature-gate-abi.rs:37:12 + --> $DIR/feature-gate-abi.rs:35:12 | LL | extern "rust-intrinsic" fn m2() {} | ^^^^^^^^^^^^^^^^ @@ -83,7 +83,7 @@ LL | extern "rust-intrinsic" fn m2() {} = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: the extern "rust-call" ABI is experimental and subject to change - --> $DIR/feature-gate-abi.rs:39:12 + --> $DIR/feature-gate-abi.rs:37:12 | LL | extern "rust-call" fn m4(_: ()) {} | ^^^^^^^^^^^ @@ -93,7 +93,7 @@ LL | extern "rust-call" fn m4(_: ()) {} = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: the extern "rust-intrinsic" ABI is an implementation detail and perma-unstable - --> $DIR/feature-gate-abi.rs:44:12 + --> $DIR/feature-gate-abi.rs:42:12 | LL | extern "rust-intrinsic" fn im1() {} | ^^^^^^^^^^^^^^^^ @@ -102,7 +102,7 @@ LL | extern "rust-intrinsic" fn im1() {} = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: the extern "rust-intrinsic" ABI is an implementation detail and perma-unstable - --> $DIR/feature-gate-abi.rs:46:12 + --> $DIR/feature-gate-abi.rs:44:12 | LL | extern "rust-intrinsic" fn im2() {} | ^^^^^^^^^^^^^^^^ @@ -111,7 +111,7 @@ LL | extern "rust-intrinsic" fn im2() {} = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: the extern "rust-call" ABI is experimental and subject to change - --> $DIR/feature-gate-abi.rs:48:12 + --> $DIR/feature-gate-abi.rs:46:12 | LL | extern "rust-call" fn im4(_: ()) {} | ^^^^^^^^^^^ @@ -121,7 +121,7 @@ LL | extern "rust-call" fn im4(_: ()) {} = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: the extern "rust-intrinsic" ABI is an implementation detail and perma-unstable - --> $DIR/feature-gate-abi.rs:52:18 + --> $DIR/feature-gate-abi.rs:50:18 | LL | type A1 = extern "rust-intrinsic" fn(); | ^^^^^^^^^^^^^^^^ @@ -130,7 +130,7 @@ LL | type A1 = extern "rust-intrinsic" fn(); = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: the extern "rust-intrinsic" ABI is an implementation detail and perma-unstable - --> $DIR/feature-gate-abi.rs:53:18 + --> $DIR/feature-gate-abi.rs:51:18 | LL | type A2 = extern "rust-intrinsic" fn(); | ^^^^^^^^^^^^^^^^ @@ -139,7 +139,7 @@ LL | type A2 = extern "rust-intrinsic" fn(); = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: the extern "rust-call" ABI is experimental and subject to change - --> $DIR/feature-gate-abi.rs:54:18 + --> $DIR/feature-gate-abi.rs:52:18 | LL | type A4 = extern "rust-call" fn(_: ()); | ^^^^^^^^^^^ @@ -149,7 +149,7 @@ LL | type A4 = extern "rust-call" fn(_: ()); = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: the extern "rust-intrinsic" ABI is an implementation detail and perma-unstable - --> $DIR/feature-gate-abi.rs:57:8 + --> $DIR/feature-gate-abi.rs:55:8 | LL | extern "rust-intrinsic" {} | ^^^^^^^^^^^^^^^^ @@ -158,7 +158,7 @@ LL | extern "rust-intrinsic" {} = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: the extern "rust-intrinsic" ABI is an implementation detail and perma-unstable - --> $DIR/feature-gate-abi.rs:58:8 + --> $DIR/feature-gate-abi.rs:56:8 | LL | extern "rust-intrinsic" {} | ^^^^^^^^^^^^^^^^ @@ -167,7 +167,7 @@ LL | extern "rust-intrinsic" {} = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: the extern "rust-call" ABI is experimental and subject to change - --> $DIR/feature-gate-abi.rs:59:8 + --> $DIR/feature-gate-abi.rs:57:8 | LL | extern "rust-call" {} | ^^^^^^^^^^^ @@ -177,49 +177,49 @@ LL | extern "rust-call" {} = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error: intrinsic must be in `extern "rust-intrinsic" { ... }` block - --> $DIR/feature-gate-abi.rs:22:32 + --> $DIR/feature-gate-abi.rs:20:32 | LL | extern "rust-intrinsic" fn m1(); | ^^ error: intrinsic must be in `extern "rust-intrinsic" { ... }` block - --> $DIR/feature-gate-abi.rs:24:32 + --> $DIR/feature-gate-abi.rs:22:32 | LL | extern "rust-intrinsic" fn m2(); | ^^ error: intrinsic must be in `extern "rust-intrinsic" { ... }` block - --> $DIR/feature-gate-abi.rs:14:33 + --> $DIR/feature-gate-abi.rs:12:33 | LL | extern "rust-intrinsic" fn f1() {} | ^^ error: intrinsic must be in `extern "rust-intrinsic" { ... }` block - --> $DIR/feature-gate-abi.rs:16:33 + --> $DIR/feature-gate-abi.rs:14:33 | LL | extern "rust-intrinsic" fn f2() {} | ^^ error: intrinsic must be in `extern "rust-intrinsic" { ... }` block - --> $DIR/feature-gate-abi.rs:35:37 + --> $DIR/feature-gate-abi.rs:33:37 | LL | extern "rust-intrinsic" fn m1() {} | ^^ error: intrinsic must be in `extern "rust-intrinsic" { ... }` block - --> $DIR/feature-gate-abi.rs:37:37 + --> $DIR/feature-gate-abi.rs:35:37 | LL | extern "rust-intrinsic" fn m2() {} | ^^ error: intrinsic must be in `extern "rust-intrinsic" { ... }` block - --> $DIR/feature-gate-abi.rs:44:38 + --> $DIR/feature-gate-abi.rs:42:38 | LL | extern "rust-intrinsic" fn im1() {} | ^^ error: intrinsic must be in `extern "rust-intrinsic" { ... }` block - --> $DIR/feature-gate-abi.rs:46:38 + --> $DIR/feature-gate-abi.rs:44:38 | LL | extern "rust-intrinsic" fn im2() {} | ^^ diff --git a/tests/ui/feature-gates/feature-gate-abi_gpu_kernel.rs b/tests/ui/feature-gates/feature-gate-abi_gpu_kernel.rs index fb04906dafe..d9027b417b4 100644 --- a/tests/ui/feature-gates/feature-gate-abi_gpu_kernel.rs +++ b/tests/ui/feature-gates/feature-gate-abi_gpu_kernel.rs @@ -1,13 +1,11 @@ +//@ add-core-stubs //@ compile-flags: --crate-type=rlib #![feature(no_core, lang_items)] #![no_core] -#[lang="sized"] -trait Sized { } - -#[lang="tuple_trait"] -trait Tuple { } +extern crate minicore; +use minicore::*; // Functions extern "gpu-kernel" fn f1(_: ()) {} //~ ERROR "gpu-kernel" ABI is experimental and subject to change diff --git a/tests/ui/feature-gates/feature-gate-abi_gpu_kernel.stderr b/tests/ui/feature-gates/feature-gate-abi_gpu_kernel.stderr index b05c16e3d9e..aa9c67f0151 100644 --- a/tests/ui/feature-gates/feature-gate-abi_gpu_kernel.stderr +++ b/tests/ui/feature-gates/feature-gate-abi_gpu_kernel.stderr @@ -1,5 +1,5 @@ error[E0658]: the extern "gpu-kernel" ABI is experimental and subject to change - --> $DIR/feature-gate-abi_gpu_kernel.rs:13:8 + --> $DIR/feature-gate-abi_gpu_kernel.rs:11:8 | LL | extern "gpu-kernel" fn f1(_: ()) {} | ^^^^^^^^^^^^ @@ -9,7 +9,7 @@ LL | extern "gpu-kernel" fn f1(_: ()) {} = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: the extern "gpu-kernel" ABI is experimental and subject to change - --> $DIR/feature-gate-abi_gpu_kernel.rs:18:12 + --> $DIR/feature-gate-abi_gpu_kernel.rs:16:12 | LL | extern "gpu-kernel" fn m1(_: ()); | ^^^^^^^^^^^^ @@ -19,7 +19,7 @@ LL | extern "gpu-kernel" fn m1(_: ()); = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: the extern "gpu-kernel" ABI is experimental and subject to change - --> $DIR/feature-gate-abi_gpu_kernel.rs:20:12 + --> $DIR/feature-gate-abi_gpu_kernel.rs:18:12 | LL | extern "gpu-kernel" fn dm1(_: ()) {} | ^^^^^^^^^^^^ @@ -29,7 +29,7 @@ LL | extern "gpu-kernel" fn dm1(_: ()) {} = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: the extern "gpu-kernel" ABI is experimental and subject to change - --> $DIR/feature-gate-abi_gpu_kernel.rs:28:12 + --> $DIR/feature-gate-abi_gpu_kernel.rs:26:12 | LL | extern "gpu-kernel" fn m1(_: ()) {} | ^^^^^^^^^^^^ @@ -39,7 +39,7 @@ LL | extern "gpu-kernel" fn m1(_: ()) {} = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: the extern "gpu-kernel" ABI is experimental and subject to change - --> $DIR/feature-gate-abi_gpu_kernel.rs:34:12 + --> $DIR/feature-gate-abi_gpu_kernel.rs:32:12 | LL | extern "gpu-kernel" fn im1(_: ()) {} | ^^^^^^^^^^^^ @@ -49,7 +49,7 @@ LL | extern "gpu-kernel" fn im1(_: ()) {} = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: the extern "gpu-kernel" ABI is experimental and subject to change - --> $DIR/feature-gate-abi_gpu_kernel.rs:39:18 + --> $DIR/feature-gate-abi_gpu_kernel.rs:37:18 | LL | type A1 = extern "gpu-kernel" fn(_: ()); | ^^^^^^^^^^^^ @@ -59,7 +59,7 @@ LL | type A1 = extern "gpu-kernel" fn(_: ()); = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: the extern "gpu-kernel" ABI is experimental and subject to change - --> $DIR/feature-gate-abi_gpu_kernel.rs:44:8 + --> $DIR/feature-gate-abi_gpu_kernel.rs:42:8 | LL | extern "gpu-kernel" {} | ^^^^^^^^^^^^ @@ -69,7 +69,7 @@ LL | extern "gpu-kernel" {} = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date warning: the calling convention "gpu-kernel" is not supported on this target - --> $DIR/feature-gate-abi_gpu_kernel.rs:39:11 + --> $DIR/feature-gate-abi_gpu_kernel.rs:37:11 | LL | type A1 = extern "gpu-kernel" fn(_: ()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -79,31 +79,31 @@ LL | type A1 = extern "gpu-kernel" fn(_: ()); = note: `#[warn(unsupported_fn_ptr_calling_conventions)]` on by default error[E0570]: `"gpu-kernel"` is not a supported ABI for the current target - --> $DIR/feature-gate-abi_gpu_kernel.rs:44:1 + --> $DIR/feature-gate-abi_gpu_kernel.rs:42:1 | LL | extern "gpu-kernel" {} | ^^^^^^^^^^^^^^^^^^^^^^ error[E0570]: `"gpu-kernel"` is not a supported ABI for the current target - --> $DIR/feature-gate-abi_gpu_kernel.rs:13:1 + --> $DIR/feature-gate-abi_gpu_kernel.rs:11:1 | LL | extern "gpu-kernel" fn f1(_: ()) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0570]: `"gpu-kernel"` is not a supported ABI for the current target - --> $DIR/feature-gate-abi_gpu_kernel.rs:20:5 + --> $DIR/feature-gate-abi_gpu_kernel.rs:18:5 | LL | extern "gpu-kernel" fn dm1(_: ()) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0570]: `"gpu-kernel"` is not a supported ABI for the current target - --> $DIR/feature-gate-abi_gpu_kernel.rs:28:5 + --> $DIR/feature-gate-abi_gpu_kernel.rs:26:5 | LL | extern "gpu-kernel" fn m1(_: ()) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0570]: `"gpu-kernel"` is not a supported ABI for the current target - --> $DIR/feature-gate-abi_gpu_kernel.rs:34:5 + --> $DIR/feature-gate-abi_gpu_kernel.rs:32:5 | LL | extern "gpu-kernel" fn im1(_: ()) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -112,3 +112,14 @@ error: aborting due to 12 previous errors; 1 warning emitted Some errors have detailed explanations: E0570, E0658. For more information about an error, try `rustc --explain E0570`. +Future incompatibility report: Future breakage diagnostic: +warning: the calling convention "gpu-kernel" is not supported on this target + --> $DIR/feature-gate-abi_gpu_kernel.rs:37:11 + | +LL | type A1 = extern "gpu-kernel" fn(_: ()); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #130260 <https://github.com/rust-lang/rust/issues/130260> + = note: `#[warn(unsupported_fn_ptr_calling_conventions)]` on by default + diff --git a/tests/ui/feature-gates/feature-gate-abi_ptx.rs b/tests/ui/feature-gates/feature-gate-abi_ptx.rs index e742492303a..3cc2b786192 100644 --- a/tests/ui/feature-gates/feature-gate-abi_ptx.rs +++ b/tests/ui/feature-gates/feature-gate-abi_ptx.rs @@ -1,9 +1,11 @@ +//@ add-core-stubs //@ needs-llvm-components: nvptx //@ compile-flags: --target=nvptx64-nvidia-cuda --crate-type=rlib #![no_core] #![feature(no_core, lang_items)] -#[lang="sized"] -trait Sized { } + +extern crate minicore; +use minicore::*; extern "ptx-kernel" fn fu() {} //~ ERROR extern "ptx-kernel" ABI is experimental diff --git a/tests/ui/feature-gates/feature-gate-abi_ptx.stderr b/tests/ui/feature-gates/feature-gate-abi_ptx.stderr index d128075919b..cbe9fd8d834 100644 --- a/tests/ui/feature-gates/feature-gate-abi_ptx.stderr +++ b/tests/ui/feature-gates/feature-gate-abi_ptx.stderr @@ -1,5 +1,5 @@ error[E0658]: the extern "ptx-kernel" ABI is experimental and subject to change - --> $DIR/feature-gate-abi_ptx.rs:8:8 + --> $DIR/feature-gate-abi_ptx.rs:10:8 | LL | extern "ptx-kernel" fn fu() {} | ^^^^^^^^^^^^ @@ -9,7 +9,7 @@ LL | extern "ptx-kernel" fn fu() {} = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: the extern "ptx-kernel" ABI is experimental and subject to change - --> $DIR/feature-gate-abi_ptx.rs:11:12 + --> $DIR/feature-gate-abi_ptx.rs:13:12 | LL | extern "ptx-kernel" fn mu(); | ^^^^^^^^^^^^ @@ -19,7 +19,7 @@ LL | extern "ptx-kernel" fn mu(); = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: the extern "ptx-kernel" ABI is experimental and subject to change - --> $DIR/feature-gate-abi_ptx.rs:12:12 + --> $DIR/feature-gate-abi_ptx.rs:14:12 | LL | extern "ptx-kernel" fn dmu() {} | ^^^^^^^^^^^^ @@ -29,7 +29,7 @@ LL | extern "ptx-kernel" fn dmu() {} = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: the extern "ptx-kernel" ABI is experimental and subject to change - --> $DIR/feature-gate-abi_ptx.rs:17:12 + --> $DIR/feature-gate-abi_ptx.rs:19:12 | LL | extern "ptx-kernel" fn mu() {} | ^^^^^^^^^^^^ @@ -39,7 +39,7 @@ LL | extern "ptx-kernel" fn mu() {} = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: the extern "ptx-kernel" ABI is experimental and subject to change - --> $DIR/feature-gate-abi_ptx.rs:21:12 + --> $DIR/feature-gate-abi_ptx.rs:23:12 | LL | extern "ptx-kernel" fn imu() {} | ^^^^^^^^^^^^ @@ -49,7 +49,7 @@ LL | extern "ptx-kernel" fn imu() {} = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: the extern "ptx-kernel" ABI is experimental and subject to change - --> $DIR/feature-gate-abi_ptx.rs:24:19 + --> $DIR/feature-gate-abi_ptx.rs:26:19 | LL | type TAU = extern "ptx-kernel" fn(); | ^^^^^^^^^^^^ @@ -59,7 +59,7 @@ LL | type TAU = extern "ptx-kernel" fn(); = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: the extern "ptx-kernel" ABI is experimental and subject to change - --> $DIR/feature-gate-abi_ptx.rs:26:8 + --> $DIR/feature-gate-abi_ptx.rs:28:8 | LL | extern "ptx-kernel" {} | ^^^^^^^^^^^^ diff --git a/tests/ui/feature-gates/feature-gate-allow-internal-unstable-struct.rs b/tests/ui/feature-gates/feature-gate-allow-internal-unstable-struct.rs index 8b13f1bf278..81b7fe3db2b 100644 --- a/tests/ui/feature-gates/feature-gate-allow-internal-unstable-struct.rs +++ b/tests/ui/feature-gates/feature-gate-allow-internal-unstable-struct.rs @@ -1,7 +1,9 @@ // checks that this attribute is caught on non-macro items. // this needs a different test since this is done after expansion -#[allow_internal_unstable()] //~ ERROR allow_internal_unstable side-steps +// FIXME(jdonszelmann): empty attributes are currently ignored, since when its empty no actual +// change is applied. This should be fixed when later moving this check to attribute parsing. +#[allow_internal_unstable(something)] //~ ERROR allow_internal_unstable side-steps //~| ERROR attribute should struct S; diff --git a/tests/ui/feature-gates/feature-gate-allow-internal-unstable-struct.stderr b/tests/ui/feature-gates/feature-gate-allow-internal-unstable-struct.stderr index 28f1a0d6ed5..076f2df28e3 100644 --- a/tests/ui/feature-gates/feature-gate-allow-internal-unstable-struct.stderr +++ b/tests/ui/feature-gates/feature-gate-allow-internal-unstable-struct.stderr @@ -1,17 +1,17 @@ error[E0658]: allow_internal_unstable side-steps feature gating and stability checks - --> $DIR/feature-gate-allow-internal-unstable-struct.rs:4:1 + --> $DIR/feature-gate-allow-internal-unstable-struct.rs:6:1 | -LL | #[allow_internal_unstable()] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | #[allow_internal_unstable(something)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add `#![feature(allow_internal_unstable)]` 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: attribute should be applied to a macro - --> $DIR/feature-gate-allow-internal-unstable-struct.rs:4:1 + --> $DIR/feature-gate-allow-internal-unstable-struct.rs:6:1 | -LL | #[allow_internal_unstable()] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | #[allow_internal_unstable(something)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ LL | LL | struct S; | --------- not a macro diff --git a/tests/ui/feature-gates/feature-gate-asm_experimental_arch.rs b/tests/ui/feature-gates/feature-gate-asm_experimental_arch.rs index a52fbbe4075..a3b41e07195 100644 --- a/tests/ui/feature-gates/feature-gate-asm_experimental_arch.rs +++ b/tests/ui/feature-gates/feature-gate-asm_experimental_arch.rs @@ -1,3 +1,4 @@ +//@ add-core-stubs //@ compile-flags: --target mips-unknown-linux-gnu //@ needs-llvm-components: mips @@ -5,15 +6,8 @@ #![crate_type = "rlib"] #![no_core] -#[rustc_builtin_macro] -macro_rules! asm { - () => {}; -} - -#[lang = "sized"] -trait Sized {} -#[lang = "copy"] -trait Copy {} +extern crate minicore; +use minicore::*; unsafe fn main() { asm!(""); diff --git a/tests/ui/feature-gates/feature-gate-asm_experimental_arch.stderr b/tests/ui/feature-gates/feature-gate-asm_experimental_arch.stderr index d930429779c..e59a10c11c3 100644 --- a/tests/ui/feature-gates/feature-gate-asm_experimental_arch.stderr +++ b/tests/ui/feature-gates/feature-gate-asm_experimental_arch.stderr @@ -1,5 +1,5 @@ error[E0658]: inline assembly is not stable yet on this architecture - --> $DIR/feature-gate-asm_experimental_arch.rs:19:5 + --> $DIR/feature-gate-asm_experimental_arch.rs:13:5 | LL | asm!(""); | ^^^^^^^^ diff --git a/tests/ui/feature-gates/feature-gate-asm_experimental_reg.rs b/tests/ui/feature-gates/feature-gate-asm_experimental_reg.rs index 7aec7455b2e..6c53c2213a5 100644 --- a/tests/ui/feature-gates/feature-gate-asm_experimental_reg.rs +++ b/tests/ui/feature-gates/feature-gate-asm_experimental_reg.rs @@ -1,3 +1,4 @@ +//@ add-core-stubs //@ needs-asm-support //@ compile-flags: --target s390x-unknown-linux-gnu //@ needs-llvm-components: systemz @@ -6,15 +7,8 @@ #![crate_type = "rlib"] #![no_core] -#[rustc_builtin_macro] -macro_rules! asm { - () => {}; -} - -#[lang = "sized"] -trait Sized {} -#[lang = "copy"] -trait Copy {} +extern crate minicore; +use minicore::*; unsafe fn main() { asm!("", in("v0") 0); diff --git a/tests/ui/feature-gates/feature-gate-asm_experimental_reg.stderr b/tests/ui/feature-gates/feature-gate-asm_experimental_reg.stderr index 0791ce4543c..6f2ea0ddaec 100644 --- a/tests/ui/feature-gates/feature-gate-asm_experimental_reg.stderr +++ b/tests/ui/feature-gates/feature-gate-asm_experimental_reg.stderr @@ -1,5 +1,5 @@ error[E0658]: register class `vreg` can only be used as a clobber in stable - --> $DIR/feature-gate-asm_experimental_reg.rs:20:14 + --> $DIR/feature-gate-asm_experimental_reg.rs:14:14 | LL | asm!("", in("v0") 0); | ^^^^^^^^^^ @@ -9,7 +9,7 @@ LL | asm!("", in("v0") 0); = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: type `i32` cannot be used with this register class in stable - --> $DIR/feature-gate-asm_experimental_reg.rs:20:23 + --> $DIR/feature-gate-asm_experimental_reg.rs:14:23 | LL | asm!("", in("v0") 0); | ^ diff --git a/tests/ui/feature-gates/feature-gate-coroutines.e2024.stderr b/tests/ui/feature-gates/feature-gate-coroutines.e2024.stderr index 032d7adf77a..381e7a210be 100644 --- a/tests/ui/feature-gates/feature-gate-coroutines.e2024.stderr +++ b/tests/ui/feature-gates/feature-gate-coroutines.e2024.stderr @@ -45,7 +45,7 @@ LL | yield true; | ^^^^^^^^^^ | = note: see issue #43122 <https://github.com/rust-lang/rust/issues/43122> for more information - = help: add `#![feature(coroutines)]` to the crate attributes to enable + = help: add `#![feature(yield_expr)]` 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: `yield` can only be used in `#[coroutine]` closures, or `gen` blocks @@ -66,7 +66,7 @@ LL | let _ = || yield true; | ^^^^^^^^^^ | = note: see issue #43122 <https://github.com/rust-lang/rust/issues/43122> for more information - = help: add `#![feature(coroutines)]` to the crate attributes to enable + = help: add `#![feature(yield_expr)]` 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: `yield` can only be used in `#[coroutine]` closures, or `gen` blocks diff --git a/tests/ui/feature-gates/feature-gate-coroutines.none.stderr b/tests/ui/feature-gates/feature-gate-coroutines.none.stderr index 032d7adf77a..381e7a210be 100644 --- a/tests/ui/feature-gates/feature-gate-coroutines.none.stderr +++ b/tests/ui/feature-gates/feature-gate-coroutines.none.stderr @@ -45,7 +45,7 @@ LL | yield true; | ^^^^^^^^^^ | = note: see issue #43122 <https://github.com/rust-lang/rust/issues/43122> for more information - = help: add `#![feature(coroutines)]` to the crate attributes to enable + = help: add `#![feature(yield_expr)]` 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: `yield` can only be used in `#[coroutine]` closures, or `gen` blocks @@ -66,7 +66,7 @@ LL | let _ = || yield true; | ^^^^^^^^^^ | = note: see issue #43122 <https://github.com/rust-lang/rust/issues/43122> for more information - = help: add `#![feature(coroutines)]` to the crate attributes to enable + = help: add `#![feature(yield_expr)]` 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: `yield` can only be used in `#[coroutine]` closures, or `gen` blocks diff --git a/tests/ui/feature-gates/feature-gate-dyn_compatible_for_dispatch.rs b/tests/ui/feature-gates/feature-gate-dyn_compatible_for_dispatch.rs deleted file mode 100644 index e38ab66dbe5..00000000000 --- a/tests/ui/feature-gates/feature-gate-dyn_compatible_for_dispatch.rs +++ /dev/null @@ -1,41 +0,0 @@ -// Test that the use of the dyn-incompatible trait objects -// are gated by the `dyn_compatible_for_dispatch` feature gate. - -trait DynIncompatible1: Sized {} - -trait DynIncompatible2 { - fn static_fn() {} -} - -trait DynIncompatible3 { - fn foo<T>(&self); -} - -trait DynIncompatible4 { - fn foo(&self, s: &Self); -} - -fn takes_dyn_incompatible_ref<T>(obj: &dyn DynIncompatible1) { - //~^ ERROR E0038 -} - -fn return_dyn_incompatible_ref() -> &'static dyn DynIncompatible2 { - //~^ ERROR E0038 - loop {} -} - -fn takes_dyn_incompatible_box(obj: Box<dyn DynIncompatible3>) { - //~^ ERROR E0038 -} - -fn return_dyn_incompatible_rc() -> std::rc::Rc<dyn DynIncompatible4> { - //~^ ERROR E0038 - loop {} -} - -trait Trait {} - -impl Trait for dyn DynIncompatible1 {} -//~^ ERROR E0038 - -fn main() {} diff --git a/tests/ui/feature-gates/feature-gate-dyn_compatible_for_dispatch.stderr b/tests/ui/feature-gates/feature-gate-dyn_compatible_for_dispatch.stderr deleted file mode 100644 index 2c3edd6e6a5..00000000000 --- a/tests/ui/feature-gates/feature-gate-dyn_compatible_for_dispatch.stderr +++ /dev/null @@ -1,88 +0,0 @@ -error[E0038]: the trait `DynIncompatible1` is not dyn compatible - --> $DIR/feature-gate-dyn_compatible_for_dispatch.rs:18:40 - | -LL | fn takes_dyn_incompatible_ref<T>(obj: &dyn DynIncompatible1) { - | ^^^^^^^^^^^^^^^^^^^^ `DynIncompatible1` is not dyn compatible - | -note: for a trait to be dyn compatible it needs to allow building a vtable - for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> - --> $DIR/feature-gate-dyn_compatible_for_dispatch.rs:4:25 - | -LL | trait DynIncompatible1: Sized {} - | ---------------- ^^^^^ ...because it requires `Self: Sized` - | | - | this trait is not dyn compatible... - -error[E0038]: the trait `DynIncompatible2` is not dyn compatible - --> $DIR/feature-gate-dyn_compatible_for_dispatch.rs:22:46 - | -LL | fn return_dyn_incompatible_ref() -> &'static dyn DynIncompatible2 { - | ^^^^^^^^^^^^^^^^^^^^ `DynIncompatible2` is not dyn compatible - | -note: for a trait to be dyn compatible it needs to allow building a vtable - for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> - --> $DIR/feature-gate-dyn_compatible_for_dispatch.rs:7:8 - | -LL | trait DynIncompatible2 { - | ---------------- this trait is not dyn compatible... -LL | fn static_fn() {} - | ^^^^^^^^^ ...because associated function `static_fn` has no `self` parameter -help: consider turning `static_fn` into a method by giving it a `&self` argument - | -LL | fn static_fn(&self) {} - | +++++ -help: alternatively, consider constraining `static_fn` so it does not apply to trait objects - | -LL | fn static_fn() where Self: Sized {} - | +++++++++++++++++ - -error[E0038]: the trait `DynIncompatible3` is not dyn compatible - --> $DIR/feature-gate-dyn_compatible_for_dispatch.rs:27:40 - | -LL | fn takes_dyn_incompatible_box(obj: Box<dyn DynIncompatible3>) { - | ^^^^^^^^^^^^^^^^^^^^ `DynIncompatible3` is not dyn compatible - | -note: for a trait to be dyn compatible it needs to allow building a vtable - for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> - --> $DIR/feature-gate-dyn_compatible_for_dispatch.rs:11:8 - | -LL | trait DynIncompatible3 { - | ---------------- this trait is not dyn compatible... -LL | fn foo<T>(&self); - | ^^^ ...because method `foo` has generic type parameters - = help: consider moving `foo` to another trait - -error[E0038]: the trait `DynIncompatible4` is not dyn compatible - --> $DIR/feature-gate-dyn_compatible_for_dispatch.rs:31:48 - | -LL | fn return_dyn_incompatible_rc() -> std::rc::Rc<dyn DynIncompatible4> { - | ^^^^^^^^^^^^^^^^^^^^ `DynIncompatible4` is not dyn compatible - | -note: for a trait to be dyn compatible it needs to allow building a vtable - for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> - --> $DIR/feature-gate-dyn_compatible_for_dispatch.rs:15:22 - | -LL | trait DynIncompatible4 { - | ---------------- this trait is not dyn compatible... -LL | fn foo(&self, s: &Self); - | ^^^^^ ...because method `foo` references the `Self` type in this parameter - = help: consider moving `foo` to another trait - -error[E0038]: the trait `DynIncompatible1` is not dyn compatible - --> $DIR/feature-gate-dyn_compatible_for_dispatch.rs:38:16 - | -LL | impl Trait for dyn DynIncompatible1 {} - | ^^^^^^^^^^^^^^^^^^^^ `DynIncompatible1` is not dyn compatible - | -note: for a trait to be dyn compatible it needs to allow building a vtable - for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> - --> $DIR/feature-gate-dyn_compatible_for_dispatch.rs:4:25 - | -LL | trait DynIncompatible1: Sized {} - | ---------------- ^^^^^ ...because it requires `Self: Sized` - | | - | this trait is not dyn compatible... - -error: aborting due to 5 previous errors - -For more information about this error, try `rustc --explain E0038`. diff --git a/tests/ui/feature-gates/feature-gate-ergonomic-clones.rs b/tests/ui/feature-gates/feature-gate-ergonomic-clones.rs new file mode 100644 index 00000000000..c2e44064cfa --- /dev/null +++ b/tests/ui/feature-gates/feature-gate-ergonomic-clones.rs @@ -0,0 +1,32 @@ +use std::clone::UseCloned; +//~^ ERROR use of unstable library feature `ergonomic_clones` [E0658] + +fn ergonomic_clone(x: i32) -> i32 { + x.use + //~^ ERROR ergonomic clones are experimental [E0658] +} + +#[derive(Clone)] +struct Foo; + +fn foo<T: UseCloned>() {} +//~^ ERROR use of unstable library feature `ergonomic_clones` [E0658] + +impl UseCloned for Foo {} +//~^ ERROR use of unstable library feature `ergonomic_clones` [E0658] + +fn ergonomic_closure_clone() { + let f1 = Foo; + + let f2 = use || { + //~^ ERROR ergonomic clones are experimental [E0658] + f1 + }; + + let f3 = use || { + //~^ ERROR ergonomic clones are experimental [E0658] + f1 + }; +} + +fn main() {} diff --git a/tests/ui/feature-gates/feature-gate-ergonomic-clones.stderr b/tests/ui/feature-gates/feature-gate-ergonomic-clones.stderr new file mode 100644 index 00000000000..cf92f2f28df --- /dev/null +++ b/tests/ui/feature-gates/feature-gate-ergonomic-clones.stderr @@ -0,0 +1,63 @@ +error[E0658]: ergonomic clones are experimental + --> $DIR/feature-gate-ergonomic-clones.rs:5:7 + | +LL | x.use + | ^^^ + | + = note: see issue #132290 <https://github.com/rust-lang/rust/issues/132290> for more information + = help: add `#![feature(ergonomic_clones)]` 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[E0658]: ergonomic clones are experimental + --> $DIR/feature-gate-ergonomic-clones.rs:21:14 + | +LL | let f2 = use || { + | ^^^ + | + = note: see issue #132290 <https://github.com/rust-lang/rust/issues/132290> for more information + = help: add `#![feature(ergonomic_clones)]` 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[E0658]: ergonomic clones are experimental + --> $DIR/feature-gate-ergonomic-clones.rs:26:14 + | +LL | let f3 = use || { + | ^^^ + | + = note: see issue #132290 <https://github.com/rust-lang/rust/issues/132290> for more information + = help: add `#![feature(ergonomic_clones)]` 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[E0658]: use of unstable library feature `ergonomic_clones` + --> $DIR/feature-gate-ergonomic-clones.rs:1:5 + | +LL | use std::clone::UseCloned; + | ^^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #132290 <https://github.com/rust-lang/rust/issues/132290> for more information + = help: add `#![feature(ergonomic_clones)]` 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[E0658]: use of unstable library feature `ergonomic_clones` + --> $DIR/feature-gate-ergonomic-clones.rs:12:11 + | +LL | fn foo<T: UseCloned>() {} + | ^^^^^^^^^ + | + = note: see issue #132290 <https://github.com/rust-lang/rust/issues/132290> for more information + = help: add `#![feature(ergonomic_clones)]` 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[E0658]: use of unstable library feature `ergonomic_clones` + --> $DIR/feature-gate-ergonomic-clones.rs:15:6 + | +LL | impl UseCloned for Foo {} + | ^^^^^^^^^ + | + = note: see issue #132290 <https://github.com/rust-lang/rust/issues/132290> for more information + = help: add `#![feature(ergonomic_clones)]` 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 6 previous errors + +For more information about this error, try `rustc --explain E0658`. diff --git a/tests/ui/feature-gates/feature-gate-fn_align.rs b/tests/ui/feature-gates/feature-gate-fn_align.rs index 06784a45d76..744877704dd 100644 --- a/tests/ui/feature-gates/feature-gate-fn_align.rs +++ b/tests/ui/feature-gates/feature-gate-fn_align.rs @@ -4,6 +4,6 @@ fn requires_alignment() {} trait MyTrait { - #[repr(align)] //~ ERROR `repr(align)` attributes on functions are unstable + #[repr(align)] //~ ERROR invalid `repr(align)` attribute: `align` needs an argument 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 cd9900c6051..ff17c29fe02 100644 --- a/tests/ui/feature-gates/feature-gate-fn_align.stderr +++ b/tests/ui/feature-gates/feature-gate-fn_align.stderr @@ -1,3 +1,9 @@ +error[E0589]: invalid `repr(align)` attribute: `align` needs an argument + --> $DIR/feature-gate-fn_align.rs:7:12 + | +LL | #[repr(align)] + | ^^^^^ help: supply an argument here: `align(...)` + error[E0658]: `repr(align)` attributes on functions are unstable --> $DIR/feature-gate-fn_align.rs:3:8 | @@ -8,16 +14,7 @@ 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[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`. +Some errors have detailed explanations: E0589, E0658. +For more information about an error, try `rustc --explain E0589`. diff --git a/tests/ui/feature-gates/feature-gate-generic-const-parameter-types.normal.stderr b/tests/ui/feature-gates/feature-gate-generic-const-parameter-types.normal.stderr new file mode 100644 index 00000000000..1377f845d16 --- /dev/null +++ b/tests/ui/feature-gates/feature-gate-generic-const-parameter-types.normal.stderr @@ -0,0 +1,21 @@ +error[E0770]: the type of const parameters must not depend on other generic parameters + --> $DIR/feature-gate-generic-const-parameter-types.rs:7:50 + | +LL | struct MyADT<const LEN: usize, const ARRAY: [u8; LEN]>; + | ^^^ the type must not depend on the parameter `LEN` + +error: `[u8; LEN]` is forbidden as the type of a const generic parameter + --> $DIR/feature-gate-generic-const-parameter-types.rs:7:45 + | +LL | struct MyADT<const LEN: usize, const ARRAY: [u8; LEN]>; + | ^^^^^^^^^ + | + = note: the only supported types are integers, `bool`, and `char` +help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types + | +LL + #![feature(adt_const_params)] + | + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0770`. diff --git a/tests/ui/feature-gates/feature-gate-generic-const-parameter-types.rs b/tests/ui/feature-gates/feature-gate-generic-const-parameter-types.rs new file mode 100644 index 00000000000..cc374ea3eb2 --- /dev/null +++ b/tests/ui/feature-gates/feature-gate-generic-const-parameter-types.rs @@ -0,0 +1,11 @@ +//@ [feature] check-pass +//@ revisions: normal feature + +#![cfg_attr(feature, feature(adt_const_params, generic_const_parameter_types))] +#![cfg_attr(feature, expect(incomplete_features))] + +struct MyADT<const LEN: usize, const ARRAY: [u8; LEN]>; +//[normal]~^ ERROR: the type of const parameters must not depend on other generic parameters +//[normal]~| ERROR: `[u8; LEN]` is forbidden as the type of a const generic parameter + +fn main() {} diff --git a/tests/ui/feature-gates/feature-gate-min-generic-const-args.rs b/tests/ui/feature-gates/feature-gate-min-generic-const-args.rs index 171509876d1..1cf755b2c56 100644 --- a/tests/ui/feature-gates/feature-gate-min-generic-const-args.rs +++ b/tests/ui/feature-gates/feature-gate-min-generic-const-args.rs @@ -1,8 +1,10 @@ trait Trait { + #[type_const] + //~^ ERROR experimental const ASSOC: usize; } -// FIXME(min_generic_const_args): implement support for this, behind the feature gate +// FIXME(mgca): add suggestion for mgca to this error fn foo<T: Trait>() -> [u8; <T as Trait>::ASSOC] { //~^ ERROR generic parameters may not be used in const operations loop {} diff --git a/tests/ui/feature-gates/feature-gate-min-generic-const-args.stderr b/tests/ui/feature-gates/feature-gate-min-generic-const-args.stderr index 04d96b4c11e..af528a3c1b7 100644 --- a/tests/ui/feature-gates/feature-gate-min-generic-const-args.stderr +++ b/tests/ui/feature-gates/feature-gate-min-generic-const-args.stderr @@ -1,5 +1,5 @@ error: generic parameters may not be used in const operations - --> $DIR/feature-gate-min-generic-const-args.rs:6:29 + --> $DIR/feature-gate-min-generic-const-args.rs:8:29 | LL | fn foo<T: Trait>() -> [u8; <T as Trait>::ASSOC] { | ^ cannot perform const operation using `T` @@ -7,5 +7,16 @@ LL | fn foo<T: Trait>() -> [u8; <T as Trait>::ASSOC] { = note: type parameters may not be used in const expressions = help: add `#![feature(generic_const_exprs)]` to allow generic const expressions -error: aborting due to 1 previous error +error[E0658]: the `#[type_const]` attribute is an experimental feature + --> $DIR/feature-gate-min-generic-const-args.rs:2:5 + | +LL | #[type_const] + | ^^^^^^^^^^^^^ + | + = note: see issue #132980 <https://github.com/rust-lang/rust/issues/132980> for more information + = help: add `#![feature(min_generic_const_args)]` 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/feature-gates/feature-gate-pin_ergonomics.rs b/tests/ui/feature-gates/feature-gate-pin_ergonomics.rs index 4624faf1e53..663a83a665c 100644 --- a/tests/ui/feature-gates/feature-gate-pin_ergonomics.rs +++ b/tests/ui/feature-gates/feature-gate-pin_ergonomics.rs @@ -7,9 +7,13 @@ struct Foo; impl Foo { fn foo(self: Pin<&mut Self>) { } + fn foo_sugar(&pin mut self) {} //~ ERROR pinned reference syntax is experimental + fn foo_sugar_const(&pin const self) {} //~ ERROR pinned reference syntax is experimental } -fn foo(x: Pin<&mut Foo>) { +fn foo(mut x: Pin<&mut Foo>) { + Foo::foo_sugar(x.as_mut()); + Foo::foo_sugar_const(x.as_ref()); let _y: &pin mut Foo = x; //~ ERROR pinned reference syntax is experimental } @@ -27,4 +31,38 @@ fn baz(mut x: Pin<&mut Foo>) { fn baz_sugar(_: &pin const Foo) {} //~ ERROR pinned reference syntax is experimental +#[cfg(any())] +mod not_compiled { + use std::pin::Pin; + + struct Foo; + + impl Foo { + fn foo(self: Pin<&mut Self>) { + } + fn foo_sugar(&pin mut self) {} //~ ERROR pinned reference syntax is experimental + fn foo_sugar_const(&pin const self) {} //~ ERROR pinned reference syntax is experimental + } + + fn foo(mut x: Pin<&mut Foo>) { + Foo::foo_sugar(x.as_mut()); + Foo::foo_sugar_const(x.as_ref()); + let _y: &pin mut Foo = x; //~ ERROR pinned reference syntax is experimental + } + + fn foo_sugar(_: &pin mut Foo) {} //~ ERROR pinned reference syntax is experimental + + fn bar(x: Pin<&mut Foo>) { + foo(x); + foo(x); + } + + fn baz(mut x: Pin<&mut Foo>) { + x.foo(); + x.foo(); + } + + fn baz_sugar(_: &pin const Foo) {} //~ ERROR pinned reference syntax is experimental +} + fn main() {} diff --git a/tests/ui/feature-gates/feature-gate-pin_ergonomics.stderr b/tests/ui/feature-gates/feature-gate-pin_ergonomics.stderr index dd93a7be1ad..8ed7543d86e 100644 --- a/tests/ui/feature-gates/feature-gate-pin_ergonomics.stderr +++ b/tests/ui/feature-gates/feature-gate-pin_ergonomics.stderr @@ -1,5 +1,25 @@ error[E0658]: pinned reference syntax is experimental - --> $DIR/feature-gate-pin_ergonomics.rs:13:14 + --> $DIR/feature-gate-pin_ergonomics.rs:10:19 + | +LL | fn foo_sugar(&pin mut self) {} + | ^^^ + | + = note: see issue #130494 <https://github.com/rust-lang/rust/issues/130494> for more information + = help: add `#![feature(pin_ergonomics)]` 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[E0658]: pinned reference syntax is experimental + --> $DIR/feature-gate-pin_ergonomics.rs:11:25 + | +LL | fn foo_sugar_const(&pin const self) {} + | ^^^ + | + = note: see issue #130494 <https://github.com/rust-lang/rust/issues/130494> for more information + = help: add `#![feature(pin_ergonomics)]` 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[E0658]: pinned reference syntax is experimental + --> $DIR/feature-gate-pin_ergonomics.rs:17:14 | LL | let _y: &pin mut Foo = x; | ^^^ @@ -9,7 +29,7 @@ LL | let _y: &pin mut Foo = x; = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: pinned reference syntax is experimental - --> $DIR/feature-gate-pin_ergonomics.rs:16:18 + --> $DIR/feature-gate-pin_ergonomics.rs:20:18 | LL | fn foo_sugar(_: &pin mut Foo) {} | ^^^ @@ -19,7 +39,7 @@ LL | fn foo_sugar(_: &pin mut Foo) {} = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: pinned reference syntax is experimental - --> $DIR/feature-gate-pin_ergonomics.rs:28:18 + --> $DIR/feature-gate-pin_ergonomics.rs:32:18 | LL | fn baz_sugar(_: &pin const Foo) {} | ^^^ @@ -28,8 +48,58 @@ LL | fn baz_sugar(_: &pin const Foo) {} = help: add `#![feature(pin_ergonomics)]` 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[E0658]: pinned reference syntax is experimental + --> $DIR/feature-gate-pin_ergonomics.rs:43:23 + | +LL | fn foo_sugar(&pin mut self) {} + | ^^^ + | + = note: see issue #130494 <https://github.com/rust-lang/rust/issues/130494> for more information + = help: add `#![feature(pin_ergonomics)]` 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[E0658]: pinned reference syntax is experimental + --> $DIR/feature-gate-pin_ergonomics.rs:44:29 + | +LL | fn foo_sugar_const(&pin const self) {} + | ^^^ + | + = note: see issue #130494 <https://github.com/rust-lang/rust/issues/130494> for more information + = help: add `#![feature(pin_ergonomics)]` 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[E0658]: pinned reference syntax is experimental + --> $DIR/feature-gate-pin_ergonomics.rs:50:18 + | +LL | let _y: &pin mut Foo = x; + | ^^^ + | + = note: see issue #130494 <https://github.com/rust-lang/rust/issues/130494> for more information + = help: add `#![feature(pin_ergonomics)]` 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[E0658]: pinned reference syntax is experimental + --> $DIR/feature-gate-pin_ergonomics.rs:53:22 + | +LL | fn foo_sugar(_: &pin mut Foo) {} + | ^^^ + | + = note: see issue #130494 <https://github.com/rust-lang/rust/issues/130494> for more information + = help: add `#![feature(pin_ergonomics)]` 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[E0658]: pinned reference syntax is experimental + --> $DIR/feature-gate-pin_ergonomics.rs:65:22 + | +LL | fn baz_sugar(_: &pin const Foo) {} + | ^^^ + | + = note: see issue #130494 <https://github.com/rust-lang/rust/issues/130494> for more information + = help: add `#![feature(pin_ergonomics)]` 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[E0382]: use of moved value: `x` - --> $DIR/feature-gate-pin_ergonomics.rs:20:9 + --> $DIR/feature-gate-pin_ergonomics.rs:24:9 | LL | fn bar(x: Pin<&mut Foo>) { | - move occurs because `x` has type `Pin<&mut Foo>`, which does not implement the `Copy` trait @@ -39,15 +109,15 @@ LL | foo(x); | ^ value used here after move | note: consider changing this parameter type in function `foo` to borrow instead if owning the value isn't necessary - --> $DIR/feature-gate-pin_ergonomics.rs:12:11 + --> $DIR/feature-gate-pin_ergonomics.rs:14:15 | -LL | fn foo(x: Pin<&mut Foo>) { - | --- ^^^^^^^^^^^^^ this parameter takes ownership of the value +LL | fn foo(mut x: Pin<&mut Foo>) { + | --- ^^^^^^^^^^^^^ this parameter takes ownership of the value | | | in this function error[E0382]: use of moved value: `x` - --> $DIR/feature-gate-pin_ergonomics.rs:25:5 + --> $DIR/feature-gate-pin_ergonomics.rs:29:5 | LL | fn baz(mut x: Pin<&mut Foo>) { | ----- move occurs because `x` has type `Pin<&mut Foo>`, which does not implement the `Copy` trait @@ -66,7 +136,7 @@ help: consider reborrowing the `Pin` instead of moving it LL | x.as_mut().foo(); | +++++++++ -error: aborting due to 5 previous errors +error: aborting due to 12 previous errors Some errors have detailed explanations: E0382, E0658. For more information about an error, try `rustc --explain E0382`. diff --git a/tests/ui/feature-gates/feature-gate-raw-dylib-elf.rs b/tests/ui/feature-gates/feature-gate-raw-dylib-elf.rs new file mode 100644 index 00000000000..ec49e53d9b4 --- /dev/null +++ b/tests/ui/feature-gates/feature-gate-raw-dylib-elf.rs @@ -0,0 +1,9 @@ +//@ only-elf +//@ needs-dynamic-linking + +#[link(name = "meow", kind = "raw-dylib")] //~ ERROR: link kind `raw-dylib` is unstable on ELF platforms +unsafe extern "C" { + safe fn meowmeow(); +} + +fn main() {} diff --git a/tests/ui/feature-gates/feature-gate-raw-dylib-elf.stderr b/tests/ui/feature-gates/feature-gate-raw-dylib-elf.stderr new file mode 100644 index 00000000000..dfbf39f5a18 --- /dev/null +++ b/tests/ui/feature-gates/feature-gate-raw-dylib-elf.stderr @@ -0,0 +1,13 @@ +error[E0658]: link kind `raw-dylib` is unstable on ELF platforms + --> $DIR/feature-gate-raw-dylib-elf.rs:4:30 + | +LL | #[link(name = "meow", kind = "raw-dylib")] + | ^^^^^^^^^^^ + | + = note: see issue #135694 <https://github.com/rust-lang/rust/issues/135694> for more information + = help: add `#![feature(raw_dylib_elf)]` 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 + +For more information about this error, try `rustc --explain E0658`. diff --git a/tests/ui/feature-gates/feature-gate-unsized_tuple_coercion.rs b/tests/ui/feature-gates/feature-gate-unsized_tuple_coercion.rs index c3d62a231e5..b5fbcc9ccf8 100644 --- a/tests/ui/feature-gates/feature-gate-unsized_tuple_coercion.rs +++ b/tests/ui/feature-gates/feature-gate-unsized_tuple_coercion.rs @@ -1,4 +1,4 @@ fn main() { let _ : &(dyn Send,) = &((),); - //~^ ERROR unsized tuple coercion is not stable enough + //~^ ERROR 2:28: 2:34: mismatched types [E0308] } diff --git a/tests/ui/feature-gates/feature-gate-unsized_tuple_coercion.stderr b/tests/ui/feature-gates/feature-gate-unsized_tuple_coercion.stderr index 251928658df..12847bd3c0d 100644 --- a/tests/ui/feature-gates/feature-gate-unsized_tuple_coercion.stderr +++ b/tests/ui/feature-gates/feature-gate-unsized_tuple_coercion.stderr @@ -1,13 +1,14 @@ -error[E0658]: unsized tuple coercion is not stable enough for use and is subject to change +error[E0308]: mismatched types --> $DIR/feature-gate-unsized_tuple_coercion.rs:2:28 | LL | let _ : &(dyn Send,) = &((),); - | ^^^^^^ + | ------------ ^^^^^^ expected `&(dyn Send,)`, found `&((),)` + | | + | expected due to this | - = note: see issue #42877 <https://github.com/rust-lang/rust/issues/42877> for more information - = help: add `#![feature(unsized_tuple_coercion)]` to the crate attributes to enable - = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date + = note: expected reference `&(dyn Send,)` + found reference `&((),)` error: aborting due to 1 previous error -For more information about this error, try `rustc --explain E0658`. +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/feature-gates/feature-gate-vectorcall.rs b/tests/ui/feature-gates/feature-gate-vectorcall.rs index aafa6a2ed62..b29fd08473a 100644 --- a/tests/ui/feature-gates/feature-gate-vectorcall.rs +++ b/tests/ui/feature-gates/feature-gate-vectorcall.rs @@ -1,10 +1,12 @@ // gate-test-abi_vectorcall +//@ add-core-stubs //@ needs-llvm-components: x86 //@ compile-flags: --target=i686-pc-windows-msvc --crate-type=rlib #![no_core] #![feature(no_core, lang_items)] -#[lang="sized"] -trait Sized { } + +extern crate minicore; +use minicore::*; // Test that the "vectorcall" ABI is feature-gated, and cannot be used when // the `vectorcall` feature gate is not used. diff --git a/tests/ui/feature-gates/feature-gate-vectorcall.stderr b/tests/ui/feature-gates/feature-gate-vectorcall.stderr index 8f3f47a3d48..81dd10f5fe5 100644 --- a/tests/ui/feature-gates/feature-gate-vectorcall.stderr +++ b/tests/ui/feature-gates/feature-gate-vectorcall.stderr @@ -1,5 +1,5 @@ error[E0658]: the extern "vectorcall" ABI is experimental and subject to change - --> $DIR/feature-gate-vectorcall.rs:12:8 + --> $DIR/feature-gate-vectorcall.rs:14:8 | LL | extern "vectorcall" fn f() {} | ^^^^^^^^^^^^ @@ -9,7 +9,7 @@ LL | extern "vectorcall" fn f() {} = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: the extern "vectorcall" ABI is experimental and subject to change - --> $DIR/feature-gate-vectorcall.rs:15:12 + --> $DIR/feature-gate-vectorcall.rs:17:12 | LL | extern "vectorcall" fn m(); | ^^^^^^^^^^^^ @@ -19,7 +19,7 @@ LL | extern "vectorcall" fn m(); = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: the extern "vectorcall" ABI is experimental and subject to change - --> $DIR/feature-gate-vectorcall.rs:17:12 + --> $DIR/feature-gate-vectorcall.rs:19:12 | LL | extern "vectorcall" fn dm() {} | ^^^^^^^^^^^^ @@ -29,7 +29,7 @@ LL | extern "vectorcall" fn dm() {} = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: the extern "vectorcall" ABI is experimental and subject to change - --> $DIR/feature-gate-vectorcall.rs:22:12 + --> $DIR/feature-gate-vectorcall.rs:24:12 | LL | extern "vectorcall" fn m() {} | ^^^^^^^^^^^^ @@ -39,7 +39,7 @@ LL | extern "vectorcall" fn m() {} = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: the extern "vectorcall" ABI is experimental and subject to change - --> $DIR/feature-gate-vectorcall.rs:26:12 + --> $DIR/feature-gate-vectorcall.rs:28:12 | LL | extern "vectorcall" fn im() {} | ^^^^^^^^^^^^ @@ -49,7 +49,7 @@ LL | extern "vectorcall" fn im() {} = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: the extern "vectorcall" ABI is experimental and subject to change - --> $DIR/feature-gate-vectorcall.rs:29:18 + --> $DIR/feature-gate-vectorcall.rs:31:18 | LL | type TA = extern "vectorcall" fn(); | ^^^^^^^^^^^^ @@ -59,7 +59,7 @@ LL | type TA = extern "vectorcall" fn(); = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: the extern "vectorcall" ABI is experimental and subject to change - --> $DIR/feature-gate-vectorcall.rs:31:8 + --> $DIR/feature-gate-vectorcall.rs:33:8 | LL | extern "vectorcall" {} | ^^^^^^^^^^^^ diff --git a/tests/ui/feature-gates/feature-gate-where_clause_attrs.a.stderr b/tests/ui/feature-gates/feature-gate-where_clause_attrs.a.stderr new file mode 100644 index 00000000000..6a8f01bbcce --- /dev/null +++ b/tests/ui/feature-gates/feature-gate-where_clause_attrs.a.stderr @@ -0,0 +1,883 @@ +error[E0658]: attributes in `where` clause are unstable + --> $DIR/feature-gate-where_clause_attrs.rs:33:5 + | +LL | #[cfg(a)] T: TraitA, + | ^^^^^^^^^ + | + = note: see issue #115590 <https://github.com/rust-lang/rust/issues/115590> for more information + = help: add `#![feature(where_clause_attrs)]` 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[E0658]: attributes in `where` clause are unstable + --> $DIR/feature-gate-where_clause_attrs.rs:34:5 + | +LL | #[cfg(b)] T: TraitB, + | ^^^^^^^^^ + | + = note: see issue #115590 <https://github.com/rust-lang/rust/issues/115590> for more information + = help: add `#![feature(where_clause_attrs)]` 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[E0658]: attributes in `where` clause are unstable + --> $DIR/feature-gate-where_clause_attrs.rs:35:5 + | +LL | #[cfg(all())] T: TraitAll, + | ^^^^^^^^^^^^^ + | + = note: see issue #115590 <https://github.com/rust-lang/rust/issues/115590> for more information + = help: add `#![feature(where_clause_attrs)]` 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[E0658]: attributes in `where` clause are unstable + --> $DIR/feature-gate-where_clause_attrs.rs:36:5 + | +LL | #[cfg(any())] T: TraitAny, + | ^^^^^^^^^^^^^ + | + = note: see issue #115590 <https://github.com/rust-lang/rust/issues/115590> for more information + = help: add `#![feature(where_clause_attrs)]` 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[E0658]: attributes in `where` clause are unstable + --> $DIR/feature-gate-where_clause_attrs.rs:37:5 + | +LL | #[cfg_attr(a, cfg(a))] T: TraitAA, + | ^^^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #115590 <https://github.com/rust-lang/rust/issues/115590> for more information + = help: add `#![feature(where_clause_attrs)]` 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[E0658]: attributes in `where` clause are unstable + --> $DIR/feature-gate-where_clause_attrs.rs:38:5 + | +LL | #[cfg_attr(b, cfg(b))] T: TraitBB, + | ^^^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #115590 <https://github.com/rust-lang/rust/issues/115590> for more information + = help: add `#![feature(where_clause_attrs)]` 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[E0658]: attributes in `where` clause are unstable + --> $DIR/feature-gate-where_clause_attrs.rs:39:5 + | +LL | #[cfg_attr(all(), cfg(all()))] T: TraitAllAll, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #115590 <https://github.com/rust-lang/rust/issues/115590> for more information + = help: add `#![feature(where_clause_attrs)]` 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[E0658]: attributes in `where` clause are unstable + --> $DIR/feature-gate-where_clause_attrs.rs:40:5 + | +LL | #[cfg_attr(any(), cfg(any()))] T: TraitAnyAny, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #115590 <https://github.com/rust-lang/rust/issues/115590> for more information + = help: add `#![feature(where_clause_attrs)]` 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[E0658]: attributes in `where` clause are unstable + --> $DIR/feature-gate-where_clause_attrs.rs:44:9 + | +LL | #[cfg(a)] U: TraitA, + | ^^^^^^^^^ + | + = note: see issue #115590 <https://github.com/rust-lang/rust/issues/115590> for more information + = help: add `#![feature(where_clause_attrs)]` 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[E0658]: attributes in `where` clause are unstable + --> $DIR/feature-gate-where_clause_attrs.rs:45:9 + | +LL | #[cfg(b)] U: TraitB, + | ^^^^^^^^^ + | + = note: see issue #115590 <https://github.com/rust-lang/rust/issues/115590> for more information + = help: add `#![feature(where_clause_attrs)]` 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[E0658]: attributes in `where` clause are unstable + --> $DIR/feature-gate-where_clause_attrs.rs:46:9 + | +LL | #[cfg(all())] U: TraitAll, + | ^^^^^^^^^^^^^ + | + = note: see issue #115590 <https://github.com/rust-lang/rust/issues/115590> for more information + = help: add `#![feature(where_clause_attrs)]` 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[E0658]: attributes in `where` clause are unstable + --> $DIR/feature-gate-where_clause_attrs.rs:47:9 + | +LL | #[cfg(any())] U: TraitAny, + | ^^^^^^^^^^^^^ + | + = note: see issue #115590 <https://github.com/rust-lang/rust/issues/115590> for more information + = help: add `#![feature(where_clause_attrs)]` 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[E0658]: attributes in `where` clause are unstable + --> $DIR/feature-gate-where_clause_attrs.rs:48:9 + | +LL | #[cfg_attr(a, cfg(a))] U: TraitAA, + | ^^^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #115590 <https://github.com/rust-lang/rust/issues/115590> for more information + = help: add `#![feature(where_clause_attrs)]` 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[E0658]: attributes in `where` clause are unstable + --> $DIR/feature-gate-where_clause_attrs.rs:49:9 + | +LL | #[cfg_attr(b, cfg(b))] U: TraitBB, + | ^^^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #115590 <https://github.com/rust-lang/rust/issues/115590> for more information + = help: add `#![feature(where_clause_attrs)]` 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[E0658]: attributes in `where` clause are unstable + --> $DIR/feature-gate-where_clause_attrs.rs:50:9 + | +LL | #[cfg_attr(all(), cfg(all()))] U: TraitAllAll, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #115590 <https://github.com/rust-lang/rust/issues/115590> for more information + = help: add `#![feature(where_clause_attrs)]` 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[E0658]: attributes in `where` clause are unstable + --> $DIR/feature-gate-where_clause_attrs.rs:51:9 + | +LL | #[cfg_attr(any(), cfg(any()))] U: TraitAnyAny; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #115590 <https://github.com/rust-lang/rust/issues/115590> for more information + = help: add `#![feature(where_clause_attrs)]` 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[E0658]: attributes in `where` clause are unstable + --> $DIR/feature-gate-where_clause_attrs.rs:55:9 + | +LL | #[cfg(a)] U: TraitA, + | ^^^^^^^^^ + | + = note: see issue #115590 <https://github.com/rust-lang/rust/issues/115590> for more information + = help: add `#![feature(where_clause_attrs)]` 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[E0658]: attributes in `where` clause are unstable + --> $DIR/feature-gate-where_clause_attrs.rs:56:9 + | +LL | #[cfg(b)] U: TraitB, + | ^^^^^^^^^ + | + = note: see issue #115590 <https://github.com/rust-lang/rust/issues/115590> for more information + = help: add `#![feature(where_clause_attrs)]` 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[E0658]: attributes in `where` clause are unstable + --> $DIR/feature-gate-where_clause_attrs.rs:57:9 + | +LL | #[cfg(all())] U: TraitAll, + | ^^^^^^^^^^^^^ + | + = note: see issue #115590 <https://github.com/rust-lang/rust/issues/115590> for more information + = help: add `#![feature(where_clause_attrs)]` 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[E0658]: attributes in `where` clause are unstable + --> $DIR/feature-gate-where_clause_attrs.rs:58:9 + | +LL | #[cfg(any())] U: TraitAny, + | ^^^^^^^^^^^^^ + | + = note: see issue #115590 <https://github.com/rust-lang/rust/issues/115590> for more information + = help: add `#![feature(where_clause_attrs)]` 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[E0658]: attributes in `where` clause are unstable + --> $DIR/feature-gate-where_clause_attrs.rs:59:9 + | +LL | #[cfg_attr(a, cfg(a))] U: TraitAA, + | ^^^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #115590 <https://github.com/rust-lang/rust/issues/115590> for more information + = help: add `#![feature(where_clause_attrs)]` 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[E0658]: attributes in `where` clause are unstable + --> $DIR/feature-gate-where_clause_attrs.rs:60:9 + | +LL | #[cfg_attr(b, cfg(b))] U: TraitBB, + | ^^^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #115590 <https://github.com/rust-lang/rust/issues/115590> for more information + = help: add `#![feature(where_clause_attrs)]` 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[E0658]: attributes in `where` clause are unstable + --> $DIR/feature-gate-where_clause_attrs.rs:61:9 + | +LL | #[cfg_attr(all(), cfg(all()))] U: TraitAllAll, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #115590 <https://github.com/rust-lang/rust/issues/115590> for more information + = help: add `#![feature(where_clause_attrs)]` 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[E0658]: attributes in `where` clause are unstable + --> $DIR/feature-gate-where_clause_attrs.rs:62:9 + | +LL | #[cfg_attr(any(), cfg(any()))] U: TraitAnyAny; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #115590 <https://github.com/rust-lang/rust/issues/115590> for more information + = help: add `#![feature(where_clause_attrs)]` 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[E0658]: attributes in `where` clause are unstable + --> $DIR/feature-gate-where_clause_attrs.rs:67:5 + | +LL | #[cfg(a)] T: TraitA, + | ^^^^^^^^^ + | + = note: see issue #115590 <https://github.com/rust-lang/rust/issues/115590> for more information + = help: add `#![feature(where_clause_attrs)]` 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[E0658]: attributes in `where` clause are unstable + --> $DIR/feature-gate-where_clause_attrs.rs:68:5 + | +LL | #[cfg(b)] T: TraitB, + | ^^^^^^^^^ + | + = note: see issue #115590 <https://github.com/rust-lang/rust/issues/115590> for more information + = help: add `#![feature(where_clause_attrs)]` 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[E0658]: attributes in `where` clause are unstable + --> $DIR/feature-gate-where_clause_attrs.rs:69:5 + | +LL | #[cfg(all())] T: TraitAll, + | ^^^^^^^^^^^^^ + | + = note: see issue #115590 <https://github.com/rust-lang/rust/issues/115590> for more information + = help: add `#![feature(where_clause_attrs)]` 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[E0658]: attributes in `where` clause are unstable + --> $DIR/feature-gate-where_clause_attrs.rs:70:5 + | +LL | #[cfg(any())] T: TraitAny, + | ^^^^^^^^^^^^^ + | + = note: see issue #115590 <https://github.com/rust-lang/rust/issues/115590> for more information + = help: add `#![feature(where_clause_attrs)]` 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[E0658]: attributes in `where` clause are unstable + --> $DIR/feature-gate-where_clause_attrs.rs:71:5 + | +LL | #[cfg_attr(a, cfg(a))] T: TraitAA, + | ^^^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #115590 <https://github.com/rust-lang/rust/issues/115590> for more information + = help: add `#![feature(where_clause_attrs)]` 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[E0658]: attributes in `where` clause are unstable + --> $DIR/feature-gate-where_clause_attrs.rs:72:5 + | +LL | #[cfg_attr(b, cfg(b))] T: TraitBB, + | ^^^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #115590 <https://github.com/rust-lang/rust/issues/115590> for more information + = help: add `#![feature(where_clause_attrs)]` 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[E0658]: attributes in `where` clause are unstable + --> $DIR/feature-gate-where_clause_attrs.rs:73:5 + | +LL | #[cfg_attr(all(), cfg(all()))] T: TraitAllAll, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #115590 <https://github.com/rust-lang/rust/issues/115590> for more information + = help: add `#![feature(where_clause_attrs)]` 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[E0658]: attributes in `where` clause are unstable + --> $DIR/feature-gate-where_clause_attrs.rs:74:5 + | +LL | #[cfg_attr(any(), cfg(any()))] T: TraitAnyAny, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #115590 <https://github.com/rust-lang/rust/issues/115590> for more information + = help: add `#![feature(where_clause_attrs)]` 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[E0658]: attributes in `where` clause are unstable + --> $DIR/feature-gate-where_clause_attrs.rs:77:9 + | +LL | #[cfg(a)] U: TraitA, + | ^^^^^^^^^ + | + = note: see issue #115590 <https://github.com/rust-lang/rust/issues/115590> for more information + = help: add `#![feature(where_clause_attrs)]` 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[E0658]: attributes in `where` clause are unstable + --> $DIR/feature-gate-where_clause_attrs.rs:78:9 + | +LL | #[cfg(b)] U: TraitB, + | ^^^^^^^^^ + | + = note: see issue #115590 <https://github.com/rust-lang/rust/issues/115590> for more information + = help: add `#![feature(where_clause_attrs)]` 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[E0658]: attributes in `where` clause are unstable + --> $DIR/feature-gate-where_clause_attrs.rs:79:9 + | +LL | #[cfg(all())] U: TraitAll, + | ^^^^^^^^^^^^^ + | + = note: see issue #115590 <https://github.com/rust-lang/rust/issues/115590> for more information + = help: add `#![feature(where_clause_attrs)]` 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[E0658]: attributes in `where` clause are unstable + --> $DIR/feature-gate-where_clause_attrs.rs:80:9 + | +LL | #[cfg(any())] U: TraitAny, + | ^^^^^^^^^^^^^ + | + = note: see issue #115590 <https://github.com/rust-lang/rust/issues/115590> for more information + = help: add `#![feature(where_clause_attrs)]` 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[E0658]: attributes in `where` clause are unstable + --> $DIR/feature-gate-where_clause_attrs.rs:81:9 + | +LL | #[cfg_attr(a, cfg(a))] U: TraitAA, + | ^^^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #115590 <https://github.com/rust-lang/rust/issues/115590> for more information + = help: add `#![feature(where_clause_attrs)]` 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[E0658]: attributes in `where` clause are unstable + --> $DIR/feature-gate-where_clause_attrs.rs:82:9 + | +LL | #[cfg_attr(b, cfg(b))] U: TraitBB, + | ^^^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #115590 <https://github.com/rust-lang/rust/issues/115590> for more information + = help: add `#![feature(where_clause_attrs)]` 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[E0658]: attributes in `where` clause are unstable + --> $DIR/feature-gate-where_clause_attrs.rs:83:9 + | +LL | #[cfg_attr(all(), cfg(all()))] U: TraitAllAll, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #115590 <https://github.com/rust-lang/rust/issues/115590> for more information + = help: add `#![feature(where_clause_attrs)]` 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[E0658]: attributes in `where` clause are unstable + --> $DIR/feature-gate-where_clause_attrs.rs:84:9 + | +LL | #[cfg_attr(any(), cfg(any()))] U: TraitAnyAny; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #115590 <https://github.com/rust-lang/rust/issues/115590> for more information + = help: add `#![feature(where_clause_attrs)]` 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[E0658]: attributes in `where` clause are unstable + --> $DIR/feature-gate-where_clause_attrs.rs:88:9 + | +LL | #[cfg(a)] U: TraitA, + | ^^^^^^^^^ + | + = note: see issue #115590 <https://github.com/rust-lang/rust/issues/115590> for more information + = help: add `#![feature(where_clause_attrs)]` 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[E0658]: attributes in `where` clause are unstable + --> $DIR/feature-gate-where_clause_attrs.rs:89:9 + | +LL | #[cfg(b)] U: TraitB, + | ^^^^^^^^^ + | + = note: see issue #115590 <https://github.com/rust-lang/rust/issues/115590> for more information + = help: add `#![feature(where_clause_attrs)]` 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[E0658]: attributes in `where` clause are unstable + --> $DIR/feature-gate-where_clause_attrs.rs:90:9 + | +LL | #[cfg(all())] T: TraitAll, + | ^^^^^^^^^^^^^ + | + = note: see issue #115590 <https://github.com/rust-lang/rust/issues/115590> for more information + = help: add `#![feature(where_clause_attrs)]` 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[E0658]: attributes in `where` clause are unstable + --> $DIR/feature-gate-where_clause_attrs.rs:91:9 + | +LL | #[cfg(any())] T: TraitAny, + | ^^^^^^^^^^^^^ + | + = note: see issue #115590 <https://github.com/rust-lang/rust/issues/115590> for more information + = help: add `#![feature(where_clause_attrs)]` 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[E0658]: attributes in `where` clause are unstable + --> $DIR/feature-gate-where_clause_attrs.rs:92:9 + | +LL | #[cfg_attr(a, cfg(a))] U: TraitAA, + | ^^^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #115590 <https://github.com/rust-lang/rust/issues/115590> for more information + = help: add `#![feature(where_clause_attrs)]` 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[E0658]: attributes in `where` clause are unstable + --> $DIR/feature-gate-where_clause_attrs.rs:93:9 + | +LL | #[cfg_attr(b, cfg(b))] U: TraitBB, + | ^^^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #115590 <https://github.com/rust-lang/rust/issues/115590> for more information + = help: add `#![feature(where_clause_attrs)]` 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[E0658]: attributes in `where` clause are unstable + --> $DIR/feature-gate-where_clause_attrs.rs:94:9 + | +LL | #[cfg_attr(all(), cfg(all()))] T: TraitAllAll, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #115590 <https://github.com/rust-lang/rust/issues/115590> for more information + = help: add `#![feature(where_clause_attrs)]` 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[E0658]: attributes in `where` clause are unstable + --> $DIR/feature-gate-where_clause_attrs.rs:95:9 + | +LL | #[cfg_attr(any(), cfg(any()))] T: TraitAnyAny, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #115590 <https://github.com/rust-lang/rust/issues/115590> for more information + = help: add `#![feature(where_clause_attrs)]` 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[E0658]: attributes in `where` clause are unstable + --> $DIR/feature-gate-where_clause_attrs.rs:101:5 + | +LL | #[cfg(a)] T: TraitA, + | ^^^^^^^^^ + | + = note: see issue #115590 <https://github.com/rust-lang/rust/issues/115590> for more information + = help: add `#![feature(where_clause_attrs)]` 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[E0658]: attributes in `where` clause are unstable + --> $DIR/feature-gate-where_clause_attrs.rs:102:5 + | +LL | #[cfg(b)] T: TraitB, + | ^^^^^^^^^ + | + = note: see issue #115590 <https://github.com/rust-lang/rust/issues/115590> for more information + = help: add `#![feature(where_clause_attrs)]` 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[E0658]: attributes in `where` clause are unstable + --> $DIR/feature-gate-where_clause_attrs.rs:103:5 + | +LL | #[cfg(all())] T: TraitAll, + | ^^^^^^^^^^^^^ + | + = note: see issue #115590 <https://github.com/rust-lang/rust/issues/115590> for more information + = help: add `#![feature(where_clause_attrs)]` 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[E0658]: attributes in `where` clause are unstable + --> $DIR/feature-gate-where_clause_attrs.rs:104:5 + | +LL | #[cfg(any())] T: TraitAny, + | ^^^^^^^^^^^^^ + | + = note: see issue #115590 <https://github.com/rust-lang/rust/issues/115590> for more information + = help: add `#![feature(where_clause_attrs)]` 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[E0658]: attributes in `where` clause are unstable + --> $DIR/feature-gate-where_clause_attrs.rs:105:5 + | +LL | #[cfg_attr(a, cfg(a))] T: TraitAA, + | ^^^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #115590 <https://github.com/rust-lang/rust/issues/115590> for more information + = help: add `#![feature(where_clause_attrs)]` 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[E0658]: attributes in `where` clause are unstable + --> $DIR/feature-gate-where_clause_attrs.rs:106:5 + | +LL | #[cfg_attr(b, cfg(b))] T: TraitBB, + | ^^^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #115590 <https://github.com/rust-lang/rust/issues/115590> for more information + = help: add `#![feature(where_clause_attrs)]` 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[E0658]: attributes in `where` clause are unstable + --> $DIR/feature-gate-where_clause_attrs.rs:107:5 + | +LL | #[cfg_attr(all(), cfg(all()))] T: TraitAllAll, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #115590 <https://github.com/rust-lang/rust/issues/115590> for more information + = help: add `#![feature(where_clause_attrs)]` 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[E0658]: attributes in `where` clause are unstable + --> $DIR/feature-gate-where_clause_attrs.rs:108:5 + | +LL | #[cfg_attr(any(), cfg(any()))] T: TraitAnyAny, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #115590 <https://github.com/rust-lang/rust/issues/115590> for more information + = help: add `#![feature(where_clause_attrs)]` 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[E0658]: attributes in `where` clause are unstable + --> $DIR/feature-gate-where_clause_attrs.rs:115:5 + | +LL | #[cfg(a)] T: TraitA, + | ^^^^^^^^^ + | + = note: see issue #115590 <https://github.com/rust-lang/rust/issues/115590> for more information + = help: add `#![feature(where_clause_attrs)]` 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[E0658]: attributes in `where` clause are unstable + --> $DIR/feature-gate-where_clause_attrs.rs:116:5 + | +LL | #[cfg(b)] T: TraitB, + | ^^^^^^^^^ + | + = note: see issue #115590 <https://github.com/rust-lang/rust/issues/115590> for more information + = help: add `#![feature(where_clause_attrs)]` 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[E0658]: attributes in `where` clause are unstable + --> $DIR/feature-gate-where_clause_attrs.rs:117:5 + | +LL | #[cfg(all())] T: TraitAll, + | ^^^^^^^^^^^^^ + | + = note: see issue #115590 <https://github.com/rust-lang/rust/issues/115590> for more information + = help: add `#![feature(where_clause_attrs)]` 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[E0658]: attributes in `where` clause are unstable + --> $DIR/feature-gate-where_clause_attrs.rs:118:5 + | +LL | #[cfg(any())] T: TraitAny, + | ^^^^^^^^^^^^^ + | + = note: see issue #115590 <https://github.com/rust-lang/rust/issues/115590> for more information + = help: add `#![feature(where_clause_attrs)]` 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[E0658]: attributes in `where` clause are unstable + --> $DIR/feature-gate-where_clause_attrs.rs:119:5 + | +LL | #[cfg_attr(a, cfg(a))] T: TraitAA, + | ^^^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #115590 <https://github.com/rust-lang/rust/issues/115590> for more information + = help: add `#![feature(where_clause_attrs)]` 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[E0658]: attributes in `where` clause are unstable + --> $DIR/feature-gate-where_clause_attrs.rs:120:5 + | +LL | #[cfg_attr(b, cfg(b))] T: TraitBB, + | ^^^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #115590 <https://github.com/rust-lang/rust/issues/115590> for more information + = help: add `#![feature(where_clause_attrs)]` 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[E0658]: attributes in `where` clause are unstable + --> $DIR/feature-gate-where_clause_attrs.rs:121:5 + | +LL | #[cfg_attr(all(), cfg(all()))] T: TraitAllAll, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #115590 <https://github.com/rust-lang/rust/issues/115590> for more information + = help: add `#![feature(where_clause_attrs)]` 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[E0658]: attributes in `where` clause are unstable + --> $DIR/feature-gate-where_clause_attrs.rs:122:5 + | +LL | #[cfg_attr(any(), cfg(any()))] T: TraitAnyAny, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #115590 <https://github.com/rust-lang/rust/issues/115590> for more information + = help: add `#![feature(where_clause_attrs)]` 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[E0658]: attributes in `where` clause are unstable + --> $DIR/feature-gate-where_clause_attrs.rs:130:5 + | +LL | #[cfg(a)] T: TraitA, + | ^^^^^^^^^ + | + = note: see issue #115590 <https://github.com/rust-lang/rust/issues/115590> for more information + = help: add `#![feature(where_clause_attrs)]` 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[E0658]: attributes in `where` clause are unstable + --> $DIR/feature-gate-where_clause_attrs.rs:131:5 + | +LL | #[cfg(b)] T: TraitB, + | ^^^^^^^^^ + | + = note: see issue #115590 <https://github.com/rust-lang/rust/issues/115590> for more information + = help: add `#![feature(where_clause_attrs)]` 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[E0658]: attributes in `where` clause are unstable + --> $DIR/feature-gate-where_clause_attrs.rs:132:5 + | +LL | #[cfg(all())] T: TraitAll, + | ^^^^^^^^^^^^^ + | + = note: see issue #115590 <https://github.com/rust-lang/rust/issues/115590> for more information + = help: add `#![feature(where_clause_attrs)]` 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[E0658]: attributes in `where` clause are unstable + --> $DIR/feature-gate-where_clause_attrs.rs:133:5 + | +LL | #[cfg(any())] T: TraitAny, + | ^^^^^^^^^^^^^ + | + = note: see issue #115590 <https://github.com/rust-lang/rust/issues/115590> for more information + = help: add `#![feature(where_clause_attrs)]` 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[E0658]: attributes in `where` clause are unstable + --> $DIR/feature-gate-where_clause_attrs.rs:134:5 + | +LL | #[cfg_attr(a, cfg(a))] T: TraitAA, + | ^^^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #115590 <https://github.com/rust-lang/rust/issues/115590> for more information + = help: add `#![feature(where_clause_attrs)]` 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[E0658]: attributes in `where` clause are unstable + --> $DIR/feature-gate-where_clause_attrs.rs:135:5 + | +LL | #[cfg_attr(b, cfg(b))] T: TraitBB, + | ^^^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #115590 <https://github.com/rust-lang/rust/issues/115590> for more information + = help: add `#![feature(where_clause_attrs)]` 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[E0658]: attributes in `where` clause are unstable + --> $DIR/feature-gate-where_clause_attrs.rs:136:5 + | +LL | #[cfg_attr(all(), cfg(all()))] T: TraitAllAll, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #115590 <https://github.com/rust-lang/rust/issues/115590> for more information + = help: add `#![feature(where_clause_attrs)]` 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[E0658]: attributes in `where` clause are unstable + --> $DIR/feature-gate-where_clause_attrs.rs:137:5 + | +LL | #[cfg_attr(any(), cfg(any()))] T: TraitAnyAny, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #115590 <https://github.com/rust-lang/rust/issues/115590> for more information + = help: add `#![feature(where_clause_attrs)]` 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[E0658]: attributes in `where` clause are unstable + --> $DIR/feature-gate-where_clause_attrs.rs:143:5 + | +LL | #[cfg(a)] T: TraitA, + | ^^^^^^^^^ + | + = note: see issue #115590 <https://github.com/rust-lang/rust/issues/115590> for more information + = help: add `#![feature(where_clause_attrs)]` 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[E0658]: attributes in `where` clause are unstable + --> $DIR/feature-gate-where_clause_attrs.rs:144:5 + | +LL | #[cfg(b)] T: TraitB, + | ^^^^^^^^^ + | + = note: see issue #115590 <https://github.com/rust-lang/rust/issues/115590> for more information + = help: add `#![feature(where_clause_attrs)]` 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[E0658]: attributes in `where` clause are unstable + --> $DIR/feature-gate-where_clause_attrs.rs:145:5 + | +LL | #[cfg(all())] T: TraitAll, + | ^^^^^^^^^^^^^ + | + = note: see issue #115590 <https://github.com/rust-lang/rust/issues/115590> for more information + = help: add `#![feature(where_clause_attrs)]` 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[E0658]: attributes in `where` clause are unstable + --> $DIR/feature-gate-where_clause_attrs.rs:146:5 + | +LL | #[cfg(any())] T: TraitAny, + | ^^^^^^^^^^^^^ + | + = note: see issue #115590 <https://github.com/rust-lang/rust/issues/115590> for more information + = help: add `#![feature(where_clause_attrs)]` 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[E0658]: attributes in `where` clause are unstable + --> $DIR/feature-gate-where_clause_attrs.rs:147:5 + | +LL | #[cfg_attr(a, cfg(a))] T: TraitAA, + | ^^^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #115590 <https://github.com/rust-lang/rust/issues/115590> for more information + = help: add `#![feature(where_clause_attrs)]` 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[E0658]: attributes in `where` clause are unstable + --> $DIR/feature-gate-where_clause_attrs.rs:148:5 + | +LL | #[cfg_attr(b, cfg(b))] T: TraitBB, + | ^^^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #115590 <https://github.com/rust-lang/rust/issues/115590> for more information + = help: add `#![feature(where_clause_attrs)]` 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[E0658]: attributes in `where` clause are unstable + --> $DIR/feature-gate-where_clause_attrs.rs:149:5 + | +LL | #[cfg_attr(all(), cfg(all()))] T: TraitAllAll, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #115590 <https://github.com/rust-lang/rust/issues/115590> for more information + = help: add `#![feature(where_clause_attrs)]` 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[E0658]: attributes in `where` clause are unstable + --> $DIR/feature-gate-where_clause_attrs.rs:150:5 + | +LL | #[cfg_attr(any(), cfg(any()))] T: TraitAnyAny, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #115590 <https://github.com/rust-lang/rust/issues/115590> for more information + = help: add `#![feature(where_clause_attrs)]` 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[E0658]: attributes in `where` clause are unstable + --> $DIR/feature-gate-where_clause_attrs.rs:153:9 + | +LL | #[cfg(a)] U: TraitA, + | ^^^^^^^^^ + | + = note: see issue #115590 <https://github.com/rust-lang/rust/issues/115590> for more information + = help: add `#![feature(where_clause_attrs)]` 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[E0658]: attributes in `where` clause are unstable + --> $DIR/feature-gate-where_clause_attrs.rs:154:9 + | +LL | #[cfg(b)] U: TraitB, + | ^^^^^^^^^ + | + = note: see issue #115590 <https://github.com/rust-lang/rust/issues/115590> for more information + = help: add `#![feature(where_clause_attrs)]` 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[E0658]: attributes in `where` clause are unstable + --> $DIR/feature-gate-where_clause_attrs.rs:155:9 + | +LL | #[cfg(all())] U: TraitAll, + | ^^^^^^^^^^^^^ + | + = note: see issue #115590 <https://github.com/rust-lang/rust/issues/115590> for more information + = help: add `#![feature(where_clause_attrs)]` 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[E0658]: attributes in `where` clause are unstable + --> $DIR/feature-gate-where_clause_attrs.rs:156:9 + | +LL | #[cfg(any())] U: TraitAny, + | ^^^^^^^^^^^^^ + | + = note: see issue #115590 <https://github.com/rust-lang/rust/issues/115590> for more information + = help: add `#![feature(where_clause_attrs)]` 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[E0658]: attributes in `where` clause are unstable + --> $DIR/feature-gate-where_clause_attrs.rs:157:9 + | +LL | #[cfg_attr(a, cfg(a))] U: TraitAA, + | ^^^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #115590 <https://github.com/rust-lang/rust/issues/115590> for more information + = help: add `#![feature(where_clause_attrs)]` 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[E0658]: attributes in `where` clause are unstable + --> $DIR/feature-gate-where_clause_attrs.rs:158:9 + | +LL | #[cfg_attr(b, cfg(b))] U: TraitBB, + | ^^^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #115590 <https://github.com/rust-lang/rust/issues/115590> for more information + = help: add `#![feature(where_clause_attrs)]` 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[E0658]: attributes in `where` clause are unstable + --> $DIR/feature-gate-where_clause_attrs.rs:159:9 + | +LL | #[cfg_attr(all(), cfg(all()))] U: TraitAllAll, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #115590 <https://github.com/rust-lang/rust/issues/115590> for more information + = help: add `#![feature(where_clause_attrs)]` 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[E0658]: attributes in `where` clause are unstable + --> $DIR/feature-gate-where_clause_attrs.rs:160:9 + | +LL | #[cfg_attr(any(), cfg(any()))] U: TraitAnyAny, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #115590 <https://github.com/rust-lang/rust/issues/115590> for more information + = help: add `#![feature(where_clause_attrs)]` 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 88 previous errors + +For more information about this error, try `rustc --explain E0658`. diff --git a/tests/ui/feature-gates/feature-gate-where_clause_attrs.b.stderr b/tests/ui/feature-gates/feature-gate-where_clause_attrs.b.stderr new file mode 100644 index 00000000000..6a8f01bbcce --- /dev/null +++ b/tests/ui/feature-gates/feature-gate-where_clause_attrs.b.stderr @@ -0,0 +1,883 @@ +error[E0658]: attributes in `where` clause are unstable + --> $DIR/feature-gate-where_clause_attrs.rs:33:5 + | +LL | #[cfg(a)] T: TraitA, + | ^^^^^^^^^ + | + = note: see issue #115590 <https://github.com/rust-lang/rust/issues/115590> for more information + = help: add `#![feature(where_clause_attrs)]` 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[E0658]: attributes in `where` clause are unstable + --> $DIR/feature-gate-where_clause_attrs.rs:34:5 + | +LL | #[cfg(b)] T: TraitB, + | ^^^^^^^^^ + | + = note: see issue #115590 <https://github.com/rust-lang/rust/issues/115590> for more information + = help: add `#![feature(where_clause_attrs)]` 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[E0658]: attributes in `where` clause are unstable + --> $DIR/feature-gate-where_clause_attrs.rs:35:5 + | +LL | #[cfg(all())] T: TraitAll, + | ^^^^^^^^^^^^^ + | + = note: see issue #115590 <https://github.com/rust-lang/rust/issues/115590> for more information + = help: add `#![feature(where_clause_attrs)]` 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[E0658]: attributes in `where` clause are unstable + --> $DIR/feature-gate-where_clause_attrs.rs:36:5 + | +LL | #[cfg(any())] T: TraitAny, + | ^^^^^^^^^^^^^ + | + = note: see issue #115590 <https://github.com/rust-lang/rust/issues/115590> for more information + = help: add `#![feature(where_clause_attrs)]` 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[E0658]: attributes in `where` clause are unstable + --> $DIR/feature-gate-where_clause_attrs.rs:37:5 + | +LL | #[cfg_attr(a, cfg(a))] T: TraitAA, + | ^^^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #115590 <https://github.com/rust-lang/rust/issues/115590> for more information + = help: add `#![feature(where_clause_attrs)]` 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[E0658]: attributes in `where` clause are unstable + --> $DIR/feature-gate-where_clause_attrs.rs:38:5 + | +LL | #[cfg_attr(b, cfg(b))] T: TraitBB, + | ^^^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #115590 <https://github.com/rust-lang/rust/issues/115590> for more information + = help: add `#![feature(where_clause_attrs)]` 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[E0658]: attributes in `where` clause are unstable + --> $DIR/feature-gate-where_clause_attrs.rs:39:5 + | +LL | #[cfg_attr(all(), cfg(all()))] T: TraitAllAll, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #115590 <https://github.com/rust-lang/rust/issues/115590> for more information + = help: add `#![feature(where_clause_attrs)]` 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[E0658]: attributes in `where` clause are unstable + --> $DIR/feature-gate-where_clause_attrs.rs:40:5 + | +LL | #[cfg_attr(any(), cfg(any()))] T: TraitAnyAny, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #115590 <https://github.com/rust-lang/rust/issues/115590> for more information + = help: add `#![feature(where_clause_attrs)]` 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[E0658]: attributes in `where` clause are unstable + --> $DIR/feature-gate-where_clause_attrs.rs:44:9 + | +LL | #[cfg(a)] U: TraitA, + | ^^^^^^^^^ + | + = note: see issue #115590 <https://github.com/rust-lang/rust/issues/115590> for more information + = help: add `#![feature(where_clause_attrs)]` 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[E0658]: attributes in `where` clause are unstable + --> $DIR/feature-gate-where_clause_attrs.rs:45:9 + | +LL | #[cfg(b)] U: TraitB, + | ^^^^^^^^^ + | + = note: see issue #115590 <https://github.com/rust-lang/rust/issues/115590> for more information + = help: add `#![feature(where_clause_attrs)]` 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[E0658]: attributes in `where` clause are unstable + --> $DIR/feature-gate-where_clause_attrs.rs:46:9 + | +LL | #[cfg(all())] U: TraitAll, + | ^^^^^^^^^^^^^ + | + = note: see issue #115590 <https://github.com/rust-lang/rust/issues/115590> for more information + = help: add `#![feature(where_clause_attrs)]` 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[E0658]: attributes in `where` clause are unstable + --> $DIR/feature-gate-where_clause_attrs.rs:47:9 + | +LL | #[cfg(any())] U: TraitAny, + | ^^^^^^^^^^^^^ + | + = note: see issue #115590 <https://github.com/rust-lang/rust/issues/115590> for more information + = help: add `#![feature(where_clause_attrs)]` 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[E0658]: attributes in `where` clause are unstable + --> $DIR/feature-gate-where_clause_attrs.rs:48:9 + | +LL | #[cfg_attr(a, cfg(a))] U: TraitAA, + | ^^^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #115590 <https://github.com/rust-lang/rust/issues/115590> for more information + = help: add `#![feature(where_clause_attrs)]` 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[E0658]: attributes in `where` clause are unstable + --> $DIR/feature-gate-where_clause_attrs.rs:49:9 + | +LL | #[cfg_attr(b, cfg(b))] U: TraitBB, + | ^^^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #115590 <https://github.com/rust-lang/rust/issues/115590> for more information + = help: add `#![feature(where_clause_attrs)]` 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[E0658]: attributes in `where` clause are unstable + --> $DIR/feature-gate-where_clause_attrs.rs:50:9 + | +LL | #[cfg_attr(all(), cfg(all()))] U: TraitAllAll, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #115590 <https://github.com/rust-lang/rust/issues/115590> for more information + = help: add `#![feature(where_clause_attrs)]` 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[E0658]: attributes in `where` clause are unstable + --> $DIR/feature-gate-where_clause_attrs.rs:51:9 + | +LL | #[cfg_attr(any(), cfg(any()))] U: TraitAnyAny; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #115590 <https://github.com/rust-lang/rust/issues/115590> for more information + = help: add `#![feature(where_clause_attrs)]` 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[E0658]: attributes in `where` clause are unstable + --> $DIR/feature-gate-where_clause_attrs.rs:55:9 + | +LL | #[cfg(a)] U: TraitA, + | ^^^^^^^^^ + | + = note: see issue #115590 <https://github.com/rust-lang/rust/issues/115590> for more information + = help: add `#![feature(where_clause_attrs)]` 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[E0658]: attributes in `where` clause are unstable + --> $DIR/feature-gate-where_clause_attrs.rs:56:9 + | +LL | #[cfg(b)] U: TraitB, + | ^^^^^^^^^ + | + = note: see issue #115590 <https://github.com/rust-lang/rust/issues/115590> for more information + = help: add `#![feature(where_clause_attrs)]` 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[E0658]: attributes in `where` clause are unstable + --> $DIR/feature-gate-where_clause_attrs.rs:57:9 + | +LL | #[cfg(all())] U: TraitAll, + | ^^^^^^^^^^^^^ + | + = note: see issue #115590 <https://github.com/rust-lang/rust/issues/115590> for more information + = help: add `#![feature(where_clause_attrs)]` 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[E0658]: attributes in `where` clause are unstable + --> $DIR/feature-gate-where_clause_attrs.rs:58:9 + | +LL | #[cfg(any())] U: TraitAny, + | ^^^^^^^^^^^^^ + | + = note: see issue #115590 <https://github.com/rust-lang/rust/issues/115590> for more information + = help: add `#![feature(where_clause_attrs)]` 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[E0658]: attributes in `where` clause are unstable + --> $DIR/feature-gate-where_clause_attrs.rs:59:9 + | +LL | #[cfg_attr(a, cfg(a))] U: TraitAA, + | ^^^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #115590 <https://github.com/rust-lang/rust/issues/115590> for more information + = help: add `#![feature(where_clause_attrs)]` 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[E0658]: attributes in `where` clause are unstable + --> $DIR/feature-gate-where_clause_attrs.rs:60:9 + | +LL | #[cfg_attr(b, cfg(b))] U: TraitBB, + | ^^^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #115590 <https://github.com/rust-lang/rust/issues/115590> for more information + = help: add `#![feature(where_clause_attrs)]` 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[E0658]: attributes in `where` clause are unstable + --> $DIR/feature-gate-where_clause_attrs.rs:61:9 + | +LL | #[cfg_attr(all(), cfg(all()))] U: TraitAllAll, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #115590 <https://github.com/rust-lang/rust/issues/115590> for more information + = help: add `#![feature(where_clause_attrs)]` 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[E0658]: attributes in `where` clause are unstable + --> $DIR/feature-gate-where_clause_attrs.rs:62:9 + | +LL | #[cfg_attr(any(), cfg(any()))] U: TraitAnyAny; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #115590 <https://github.com/rust-lang/rust/issues/115590> for more information + = help: add `#![feature(where_clause_attrs)]` 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[E0658]: attributes in `where` clause are unstable + --> $DIR/feature-gate-where_clause_attrs.rs:67:5 + | +LL | #[cfg(a)] T: TraitA, + | ^^^^^^^^^ + | + = note: see issue #115590 <https://github.com/rust-lang/rust/issues/115590> for more information + = help: add `#![feature(where_clause_attrs)]` 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[E0658]: attributes in `where` clause are unstable + --> $DIR/feature-gate-where_clause_attrs.rs:68:5 + | +LL | #[cfg(b)] T: TraitB, + | ^^^^^^^^^ + | + = note: see issue #115590 <https://github.com/rust-lang/rust/issues/115590> for more information + = help: add `#![feature(where_clause_attrs)]` 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[E0658]: attributes in `where` clause are unstable + --> $DIR/feature-gate-where_clause_attrs.rs:69:5 + | +LL | #[cfg(all())] T: TraitAll, + | ^^^^^^^^^^^^^ + | + = note: see issue #115590 <https://github.com/rust-lang/rust/issues/115590> for more information + = help: add `#![feature(where_clause_attrs)]` 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[E0658]: attributes in `where` clause are unstable + --> $DIR/feature-gate-where_clause_attrs.rs:70:5 + | +LL | #[cfg(any())] T: TraitAny, + | ^^^^^^^^^^^^^ + | + = note: see issue #115590 <https://github.com/rust-lang/rust/issues/115590> for more information + = help: add `#![feature(where_clause_attrs)]` 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[E0658]: attributes in `where` clause are unstable + --> $DIR/feature-gate-where_clause_attrs.rs:71:5 + | +LL | #[cfg_attr(a, cfg(a))] T: TraitAA, + | ^^^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #115590 <https://github.com/rust-lang/rust/issues/115590> for more information + = help: add `#![feature(where_clause_attrs)]` 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[E0658]: attributes in `where` clause are unstable + --> $DIR/feature-gate-where_clause_attrs.rs:72:5 + | +LL | #[cfg_attr(b, cfg(b))] T: TraitBB, + | ^^^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #115590 <https://github.com/rust-lang/rust/issues/115590> for more information + = help: add `#![feature(where_clause_attrs)]` 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[E0658]: attributes in `where` clause are unstable + --> $DIR/feature-gate-where_clause_attrs.rs:73:5 + | +LL | #[cfg_attr(all(), cfg(all()))] T: TraitAllAll, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #115590 <https://github.com/rust-lang/rust/issues/115590> for more information + = help: add `#![feature(where_clause_attrs)]` 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[E0658]: attributes in `where` clause are unstable + --> $DIR/feature-gate-where_clause_attrs.rs:74:5 + | +LL | #[cfg_attr(any(), cfg(any()))] T: TraitAnyAny, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #115590 <https://github.com/rust-lang/rust/issues/115590> for more information + = help: add `#![feature(where_clause_attrs)]` 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[E0658]: attributes in `where` clause are unstable + --> $DIR/feature-gate-where_clause_attrs.rs:77:9 + | +LL | #[cfg(a)] U: TraitA, + | ^^^^^^^^^ + | + = note: see issue #115590 <https://github.com/rust-lang/rust/issues/115590> for more information + = help: add `#![feature(where_clause_attrs)]` 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[E0658]: attributes in `where` clause are unstable + --> $DIR/feature-gate-where_clause_attrs.rs:78:9 + | +LL | #[cfg(b)] U: TraitB, + | ^^^^^^^^^ + | + = note: see issue #115590 <https://github.com/rust-lang/rust/issues/115590> for more information + = help: add `#![feature(where_clause_attrs)]` 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[E0658]: attributes in `where` clause are unstable + --> $DIR/feature-gate-where_clause_attrs.rs:79:9 + | +LL | #[cfg(all())] U: TraitAll, + | ^^^^^^^^^^^^^ + | + = note: see issue #115590 <https://github.com/rust-lang/rust/issues/115590> for more information + = help: add `#![feature(where_clause_attrs)]` 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[E0658]: attributes in `where` clause are unstable + --> $DIR/feature-gate-where_clause_attrs.rs:80:9 + | +LL | #[cfg(any())] U: TraitAny, + | ^^^^^^^^^^^^^ + | + = note: see issue #115590 <https://github.com/rust-lang/rust/issues/115590> for more information + = help: add `#![feature(where_clause_attrs)]` 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[E0658]: attributes in `where` clause are unstable + --> $DIR/feature-gate-where_clause_attrs.rs:81:9 + | +LL | #[cfg_attr(a, cfg(a))] U: TraitAA, + | ^^^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #115590 <https://github.com/rust-lang/rust/issues/115590> for more information + = help: add `#![feature(where_clause_attrs)]` 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[E0658]: attributes in `where` clause are unstable + --> $DIR/feature-gate-where_clause_attrs.rs:82:9 + | +LL | #[cfg_attr(b, cfg(b))] U: TraitBB, + | ^^^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #115590 <https://github.com/rust-lang/rust/issues/115590> for more information + = help: add `#![feature(where_clause_attrs)]` 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[E0658]: attributes in `where` clause are unstable + --> $DIR/feature-gate-where_clause_attrs.rs:83:9 + | +LL | #[cfg_attr(all(), cfg(all()))] U: TraitAllAll, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #115590 <https://github.com/rust-lang/rust/issues/115590> for more information + = help: add `#![feature(where_clause_attrs)]` 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[E0658]: attributes in `where` clause are unstable + --> $DIR/feature-gate-where_clause_attrs.rs:84:9 + | +LL | #[cfg_attr(any(), cfg(any()))] U: TraitAnyAny; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #115590 <https://github.com/rust-lang/rust/issues/115590> for more information + = help: add `#![feature(where_clause_attrs)]` 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[E0658]: attributes in `where` clause are unstable + --> $DIR/feature-gate-where_clause_attrs.rs:88:9 + | +LL | #[cfg(a)] U: TraitA, + | ^^^^^^^^^ + | + = note: see issue #115590 <https://github.com/rust-lang/rust/issues/115590> for more information + = help: add `#![feature(where_clause_attrs)]` 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[E0658]: attributes in `where` clause are unstable + --> $DIR/feature-gate-where_clause_attrs.rs:89:9 + | +LL | #[cfg(b)] U: TraitB, + | ^^^^^^^^^ + | + = note: see issue #115590 <https://github.com/rust-lang/rust/issues/115590> for more information + = help: add `#![feature(where_clause_attrs)]` 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[E0658]: attributes in `where` clause are unstable + --> $DIR/feature-gate-where_clause_attrs.rs:90:9 + | +LL | #[cfg(all())] T: TraitAll, + | ^^^^^^^^^^^^^ + | + = note: see issue #115590 <https://github.com/rust-lang/rust/issues/115590> for more information + = help: add `#![feature(where_clause_attrs)]` 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[E0658]: attributes in `where` clause are unstable + --> $DIR/feature-gate-where_clause_attrs.rs:91:9 + | +LL | #[cfg(any())] T: TraitAny, + | ^^^^^^^^^^^^^ + | + = note: see issue #115590 <https://github.com/rust-lang/rust/issues/115590> for more information + = help: add `#![feature(where_clause_attrs)]` 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[E0658]: attributes in `where` clause are unstable + --> $DIR/feature-gate-where_clause_attrs.rs:92:9 + | +LL | #[cfg_attr(a, cfg(a))] U: TraitAA, + | ^^^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #115590 <https://github.com/rust-lang/rust/issues/115590> for more information + = help: add `#![feature(where_clause_attrs)]` 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[E0658]: attributes in `where` clause are unstable + --> $DIR/feature-gate-where_clause_attrs.rs:93:9 + | +LL | #[cfg_attr(b, cfg(b))] U: TraitBB, + | ^^^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #115590 <https://github.com/rust-lang/rust/issues/115590> for more information + = help: add `#![feature(where_clause_attrs)]` 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[E0658]: attributes in `where` clause are unstable + --> $DIR/feature-gate-where_clause_attrs.rs:94:9 + | +LL | #[cfg_attr(all(), cfg(all()))] T: TraitAllAll, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #115590 <https://github.com/rust-lang/rust/issues/115590> for more information + = help: add `#![feature(where_clause_attrs)]` 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[E0658]: attributes in `where` clause are unstable + --> $DIR/feature-gate-where_clause_attrs.rs:95:9 + | +LL | #[cfg_attr(any(), cfg(any()))] T: TraitAnyAny, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #115590 <https://github.com/rust-lang/rust/issues/115590> for more information + = help: add `#![feature(where_clause_attrs)]` 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[E0658]: attributes in `where` clause are unstable + --> $DIR/feature-gate-where_clause_attrs.rs:101:5 + | +LL | #[cfg(a)] T: TraitA, + | ^^^^^^^^^ + | + = note: see issue #115590 <https://github.com/rust-lang/rust/issues/115590> for more information + = help: add `#![feature(where_clause_attrs)]` 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[E0658]: attributes in `where` clause are unstable + --> $DIR/feature-gate-where_clause_attrs.rs:102:5 + | +LL | #[cfg(b)] T: TraitB, + | ^^^^^^^^^ + | + = note: see issue #115590 <https://github.com/rust-lang/rust/issues/115590> for more information + = help: add `#![feature(where_clause_attrs)]` 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[E0658]: attributes in `where` clause are unstable + --> $DIR/feature-gate-where_clause_attrs.rs:103:5 + | +LL | #[cfg(all())] T: TraitAll, + | ^^^^^^^^^^^^^ + | + = note: see issue #115590 <https://github.com/rust-lang/rust/issues/115590> for more information + = help: add `#![feature(where_clause_attrs)]` 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[E0658]: attributes in `where` clause are unstable + --> $DIR/feature-gate-where_clause_attrs.rs:104:5 + | +LL | #[cfg(any())] T: TraitAny, + | ^^^^^^^^^^^^^ + | + = note: see issue #115590 <https://github.com/rust-lang/rust/issues/115590> for more information + = help: add `#![feature(where_clause_attrs)]` 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[E0658]: attributes in `where` clause are unstable + --> $DIR/feature-gate-where_clause_attrs.rs:105:5 + | +LL | #[cfg_attr(a, cfg(a))] T: TraitAA, + | ^^^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #115590 <https://github.com/rust-lang/rust/issues/115590> for more information + = help: add `#![feature(where_clause_attrs)]` 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[E0658]: attributes in `where` clause are unstable + --> $DIR/feature-gate-where_clause_attrs.rs:106:5 + | +LL | #[cfg_attr(b, cfg(b))] T: TraitBB, + | ^^^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #115590 <https://github.com/rust-lang/rust/issues/115590> for more information + = help: add `#![feature(where_clause_attrs)]` 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[E0658]: attributes in `where` clause are unstable + --> $DIR/feature-gate-where_clause_attrs.rs:107:5 + | +LL | #[cfg_attr(all(), cfg(all()))] T: TraitAllAll, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #115590 <https://github.com/rust-lang/rust/issues/115590> for more information + = help: add `#![feature(where_clause_attrs)]` 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[E0658]: attributes in `where` clause are unstable + --> $DIR/feature-gate-where_clause_attrs.rs:108:5 + | +LL | #[cfg_attr(any(), cfg(any()))] T: TraitAnyAny, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #115590 <https://github.com/rust-lang/rust/issues/115590> for more information + = help: add `#![feature(where_clause_attrs)]` 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[E0658]: attributes in `where` clause are unstable + --> $DIR/feature-gate-where_clause_attrs.rs:115:5 + | +LL | #[cfg(a)] T: TraitA, + | ^^^^^^^^^ + | + = note: see issue #115590 <https://github.com/rust-lang/rust/issues/115590> for more information + = help: add `#![feature(where_clause_attrs)]` 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[E0658]: attributes in `where` clause are unstable + --> $DIR/feature-gate-where_clause_attrs.rs:116:5 + | +LL | #[cfg(b)] T: TraitB, + | ^^^^^^^^^ + | + = note: see issue #115590 <https://github.com/rust-lang/rust/issues/115590> for more information + = help: add `#![feature(where_clause_attrs)]` 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[E0658]: attributes in `where` clause are unstable + --> $DIR/feature-gate-where_clause_attrs.rs:117:5 + | +LL | #[cfg(all())] T: TraitAll, + | ^^^^^^^^^^^^^ + | + = note: see issue #115590 <https://github.com/rust-lang/rust/issues/115590> for more information + = help: add `#![feature(where_clause_attrs)]` 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[E0658]: attributes in `where` clause are unstable + --> $DIR/feature-gate-where_clause_attrs.rs:118:5 + | +LL | #[cfg(any())] T: TraitAny, + | ^^^^^^^^^^^^^ + | + = note: see issue #115590 <https://github.com/rust-lang/rust/issues/115590> for more information + = help: add `#![feature(where_clause_attrs)]` 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[E0658]: attributes in `where` clause are unstable + --> $DIR/feature-gate-where_clause_attrs.rs:119:5 + | +LL | #[cfg_attr(a, cfg(a))] T: TraitAA, + | ^^^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #115590 <https://github.com/rust-lang/rust/issues/115590> for more information + = help: add `#![feature(where_clause_attrs)]` 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[E0658]: attributes in `where` clause are unstable + --> $DIR/feature-gate-where_clause_attrs.rs:120:5 + | +LL | #[cfg_attr(b, cfg(b))] T: TraitBB, + | ^^^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #115590 <https://github.com/rust-lang/rust/issues/115590> for more information + = help: add `#![feature(where_clause_attrs)]` 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[E0658]: attributes in `where` clause are unstable + --> $DIR/feature-gate-where_clause_attrs.rs:121:5 + | +LL | #[cfg_attr(all(), cfg(all()))] T: TraitAllAll, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #115590 <https://github.com/rust-lang/rust/issues/115590> for more information + = help: add `#![feature(where_clause_attrs)]` 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[E0658]: attributes in `where` clause are unstable + --> $DIR/feature-gate-where_clause_attrs.rs:122:5 + | +LL | #[cfg_attr(any(), cfg(any()))] T: TraitAnyAny, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #115590 <https://github.com/rust-lang/rust/issues/115590> for more information + = help: add `#![feature(where_clause_attrs)]` 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[E0658]: attributes in `where` clause are unstable + --> $DIR/feature-gate-where_clause_attrs.rs:130:5 + | +LL | #[cfg(a)] T: TraitA, + | ^^^^^^^^^ + | + = note: see issue #115590 <https://github.com/rust-lang/rust/issues/115590> for more information + = help: add `#![feature(where_clause_attrs)]` 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[E0658]: attributes in `where` clause are unstable + --> $DIR/feature-gate-where_clause_attrs.rs:131:5 + | +LL | #[cfg(b)] T: TraitB, + | ^^^^^^^^^ + | + = note: see issue #115590 <https://github.com/rust-lang/rust/issues/115590> for more information + = help: add `#![feature(where_clause_attrs)]` 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[E0658]: attributes in `where` clause are unstable + --> $DIR/feature-gate-where_clause_attrs.rs:132:5 + | +LL | #[cfg(all())] T: TraitAll, + | ^^^^^^^^^^^^^ + | + = note: see issue #115590 <https://github.com/rust-lang/rust/issues/115590> for more information + = help: add `#![feature(where_clause_attrs)]` 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[E0658]: attributes in `where` clause are unstable + --> $DIR/feature-gate-where_clause_attrs.rs:133:5 + | +LL | #[cfg(any())] T: TraitAny, + | ^^^^^^^^^^^^^ + | + = note: see issue #115590 <https://github.com/rust-lang/rust/issues/115590> for more information + = help: add `#![feature(where_clause_attrs)]` 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[E0658]: attributes in `where` clause are unstable + --> $DIR/feature-gate-where_clause_attrs.rs:134:5 + | +LL | #[cfg_attr(a, cfg(a))] T: TraitAA, + | ^^^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #115590 <https://github.com/rust-lang/rust/issues/115590> for more information + = help: add `#![feature(where_clause_attrs)]` 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[E0658]: attributes in `where` clause are unstable + --> $DIR/feature-gate-where_clause_attrs.rs:135:5 + | +LL | #[cfg_attr(b, cfg(b))] T: TraitBB, + | ^^^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #115590 <https://github.com/rust-lang/rust/issues/115590> for more information + = help: add `#![feature(where_clause_attrs)]` 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[E0658]: attributes in `where` clause are unstable + --> $DIR/feature-gate-where_clause_attrs.rs:136:5 + | +LL | #[cfg_attr(all(), cfg(all()))] T: TraitAllAll, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #115590 <https://github.com/rust-lang/rust/issues/115590> for more information + = help: add `#![feature(where_clause_attrs)]` 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[E0658]: attributes in `where` clause are unstable + --> $DIR/feature-gate-where_clause_attrs.rs:137:5 + | +LL | #[cfg_attr(any(), cfg(any()))] T: TraitAnyAny, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #115590 <https://github.com/rust-lang/rust/issues/115590> for more information + = help: add `#![feature(where_clause_attrs)]` 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[E0658]: attributes in `where` clause are unstable + --> $DIR/feature-gate-where_clause_attrs.rs:143:5 + | +LL | #[cfg(a)] T: TraitA, + | ^^^^^^^^^ + | + = note: see issue #115590 <https://github.com/rust-lang/rust/issues/115590> for more information + = help: add `#![feature(where_clause_attrs)]` 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[E0658]: attributes in `where` clause are unstable + --> $DIR/feature-gate-where_clause_attrs.rs:144:5 + | +LL | #[cfg(b)] T: TraitB, + | ^^^^^^^^^ + | + = note: see issue #115590 <https://github.com/rust-lang/rust/issues/115590> for more information + = help: add `#![feature(where_clause_attrs)]` 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[E0658]: attributes in `where` clause are unstable + --> $DIR/feature-gate-where_clause_attrs.rs:145:5 + | +LL | #[cfg(all())] T: TraitAll, + | ^^^^^^^^^^^^^ + | + = note: see issue #115590 <https://github.com/rust-lang/rust/issues/115590> for more information + = help: add `#![feature(where_clause_attrs)]` 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[E0658]: attributes in `where` clause are unstable + --> $DIR/feature-gate-where_clause_attrs.rs:146:5 + | +LL | #[cfg(any())] T: TraitAny, + | ^^^^^^^^^^^^^ + | + = note: see issue #115590 <https://github.com/rust-lang/rust/issues/115590> for more information + = help: add `#![feature(where_clause_attrs)]` 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[E0658]: attributes in `where` clause are unstable + --> $DIR/feature-gate-where_clause_attrs.rs:147:5 + | +LL | #[cfg_attr(a, cfg(a))] T: TraitAA, + | ^^^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #115590 <https://github.com/rust-lang/rust/issues/115590> for more information + = help: add `#![feature(where_clause_attrs)]` 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[E0658]: attributes in `where` clause are unstable + --> $DIR/feature-gate-where_clause_attrs.rs:148:5 + | +LL | #[cfg_attr(b, cfg(b))] T: TraitBB, + | ^^^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #115590 <https://github.com/rust-lang/rust/issues/115590> for more information + = help: add `#![feature(where_clause_attrs)]` 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[E0658]: attributes in `where` clause are unstable + --> $DIR/feature-gate-where_clause_attrs.rs:149:5 + | +LL | #[cfg_attr(all(), cfg(all()))] T: TraitAllAll, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #115590 <https://github.com/rust-lang/rust/issues/115590> for more information + = help: add `#![feature(where_clause_attrs)]` 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[E0658]: attributes in `where` clause are unstable + --> $DIR/feature-gate-where_clause_attrs.rs:150:5 + | +LL | #[cfg_attr(any(), cfg(any()))] T: TraitAnyAny, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #115590 <https://github.com/rust-lang/rust/issues/115590> for more information + = help: add `#![feature(where_clause_attrs)]` 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[E0658]: attributes in `where` clause are unstable + --> $DIR/feature-gate-where_clause_attrs.rs:153:9 + | +LL | #[cfg(a)] U: TraitA, + | ^^^^^^^^^ + | + = note: see issue #115590 <https://github.com/rust-lang/rust/issues/115590> for more information + = help: add `#![feature(where_clause_attrs)]` 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[E0658]: attributes in `where` clause are unstable + --> $DIR/feature-gate-where_clause_attrs.rs:154:9 + | +LL | #[cfg(b)] U: TraitB, + | ^^^^^^^^^ + | + = note: see issue #115590 <https://github.com/rust-lang/rust/issues/115590> for more information + = help: add `#![feature(where_clause_attrs)]` 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[E0658]: attributes in `where` clause are unstable + --> $DIR/feature-gate-where_clause_attrs.rs:155:9 + | +LL | #[cfg(all())] U: TraitAll, + | ^^^^^^^^^^^^^ + | + = note: see issue #115590 <https://github.com/rust-lang/rust/issues/115590> for more information + = help: add `#![feature(where_clause_attrs)]` 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[E0658]: attributes in `where` clause are unstable + --> $DIR/feature-gate-where_clause_attrs.rs:156:9 + | +LL | #[cfg(any())] U: TraitAny, + | ^^^^^^^^^^^^^ + | + = note: see issue #115590 <https://github.com/rust-lang/rust/issues/115590> for more information + = help: add `#![feature(where_clause_attrs)]` 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[E0658]: attributes in `where` clause are unstable + --> $DIR/feature-gate-where_clause_attrs.rs:157:9 + | +LL | #[cfg_attr(a, cfg(a))] U: TraitAA, + | ^^^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #115590 <https://github.com/rust-lang/rust/issues/115590> for more information + = help: add `#![feature(where_clause_attrs)]` 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[E0658]: attributes in `where` clause are unstable + --> $DIR/feature-gate-where_clause_attrs.rs:158:9 + | +LL | #[cfg_attr(b, cfg(b))] U: TraitBB, + | ^^^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #115590 <https://github.com/rust-lang/rust/issues/115590> for more information + = help: add `#![feature(where_clause_attrs)]` 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[E0658]: attributes in `where` clause are unstable + --> $DIR/feature-gate-where_clause_attrs.rs:159:9 + | +LL | #[cfg_attr(all(), cfg(all()))] U: TraitAllAll, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #115590 <https://github.com/rust-lang/rust/issues/115590> for more information + = help: add `#![feature(where_clause_attrs)]` 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[E0658]: attributes in `where` clause are unstable + --> $DIR/feature-gate-where_clause_attrs.rs:160:9 + | +LL | #[cfg_attr(any(), cfg(any()))] U: TraitAnyAny, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #115590 <https://github.com/rust-lang/rust/issues/115590> for more information + = help: add `#![feature(where_clause_attrs)]` 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 88 previous errors + +For more information about this error, try `rustc --explain E0658`. diff --git a/tests/ui/feature-gates/feature-gate-where_clause_attrs.rs b/tests/ui/feature-gates/feature-gate-where_clause_attrs.rs new file mode 100644 index 00000000000..09c734a52de --- /dev/null +++ b/tests/ui/feature-gates/feature-gate-where_clause_attrs.rs @@ -0,0 +1,162 @@ +//@ revisions: a b + +#![crate_type = "lib"] +use std::marker::PhantomData; + +#[cfg(a)] +trait TraitA {} + +#[cfg(b)] +trait TraitB {} + +#[cfg_attr(a, cfg(a))] +trait TraitAA {} + +#[cfg_attr(b, cfg(b))] +trait TraitBB {} + +#[cfg(all())] +trait TraitAll {} + +#[cfg(any())] +trait TraitAny {} + +#[cfg_attr(all(), cfg(all()))] +trait TraitAllAll {} + +#[cfg_attr(any(), cfg(any()))] +trait TraitAnyAny {} + + +trait A<T> +where + #[cfg(a)] T: TraitA, //~ ERROR attributes in `where` clause are unstable + #[cfg(b)] T: TraitB, //~ ERROR attributes in `where` clause are unstable + #[cfg(all())] T: TraitAll, //~ ERROR attributes in `where` clause are unstable + #[cfg(any())] T: TraitAny, //~ ERROR attributes in `where` clause are unstable + #[cfg_attr(a, cfg(a))] T: TraitAA, //~ ERROR attributes in `where` clause are unstable + #[cfg_attr(b, cfg(b))] T: TraitBB, //~ ERROR attributes in `where` clause are unstable + #[cfg_attr(all(), cfg(all()))] T: TraitAllAll, //~ ERROR attributes in `where` clause are unstable + #[cfg_attr(any(), cfg(any()))] T: TraitAnyAny, //~ ERROR attributes in `where` clause are unstable +{ + type B<U> + where + #[cfg(a)] U: TraitA, //~ ERROR attributes in `where` clause are unstable + #[cfg(b)] U: TraitB, //~ ERROR attributes in `where` clause are unstable + #[cfg(all())] U: TraitAll, //~ ERROR attributes in `where` clause are unstable + #[cfg(any())] U: TraitAny, //~ ERROR attributes in `where` clause are unstable + #[cfg_attr(a, cfg(a))] U: TraitAA, //~ ERROR attributes in `where` clause are unstable + #[cfg_attr(b, cfg(b))] U: TraitBB, //~ ERROR attributes in `where` clause are unstable + #[cfg_attr(all(), cfg(all()))] U: TraitAllAll, //~ ERROR attributes in `where` clause are unstable + #[cfg_attr(any(), cfg(any()))] U: TraitAnyAny; //~ ERROR attributes in `where` clause are unstable + + fn foo<U>(&self) + where + #[cfg(a)] U: TraitA, //~ ERROR attributes in `where` clause are unstable + #[cfg(b)] U: TraitB, //~ ERROR attributes in `where` clause are unstable + #[cfg(all())] U: TraitAll, //~ ERROR attributes in `where` clause are unstable + #[cfg(any())] U: TraitAny, //~ ERROR attributes in `where` clause are unstable + #[cfg_attr(a, cfg(a))] U: TraitAA, //~ ERROR attributes in `where` clause are unstable + #[cfg_attr(b, cfg(b))] U: TraitBB, //~ ERROR attributes in `where` clause are unstable + #[cfg_attr(all(), cfg(all()))] U: TraitAllAll, //~ ERROR attributes in `where` clause are unstable + #[cfg_attr(any(), cfg(any()))] U: TraitAnyAny; //~ ERROR attributes in `where` clause are unstable +} + +impl<T> A<T> for T +where + #[cfg(a)] T: TraitA, //~ ERROR attributes in `where` clause are unstable + #[cfg(b)] T: TraitB, //~ ERROR attributes in `where` clause are unstable + #[cfg(all())] T: TraitAll, //~ ERROR attributes in `where` clause are unstable + #[cfg(any())] T: TraitAny, //~ ERROR attributes in `where` clause are unstable + #[cfg_attr(a, cfg(a))] T: TraitAA, //~ ERROR attributes in `where` clause are unstable + #[cfg_attr(b, cfg(b))] T: TraitBB, //~ ERROR attributes in `where` clause are unstable + #[cfg_attr(all(), cfg(all()))] T: TraitAllAll, //~ ERROR attributes in `where` clause are unstable + #[cfg_attr(any(), cfg(any()))] T: TraitAnyAny, //~ ERROR attributes in `where` clause are unstable +{ + type B<U> = () where + #[cfg(a)] U: TraitA, //~ ERROR attributes in `where` clause are unstable + #[cfg(b)] U: TraitB, //~ ERROR attributes in `where` clause are unstable + #[cfg(all())] U: TraitAll, //~ ERROR attributes in `where` clause are unstable + #[cfg(any())] U: TraitAny, //~ ERROR attributes in `where` clause are unstable + #[cfg_attr(a, cfg(a))] U: TraitAA, //~ ERROR attributes in `where` clause are unstable + #[cfg_attr(b, cfg(b))] U: TraitBB, //~ ERROR attributes in `where` clause are unstable + #[cfg_attr(all(), cfg(all()))] U: TraitAllAll, //~ ERROR attributes in `where` clause are unstable + #[cfg_attr(any(), cfg(any()))] U: TraitAnyAny; //~ ERROR attributes in `where` clause are unstable + + fn foo<U>(&self) + where + #[cfg(a)] U: TraitA, //~ ERROR attributes in `where` clause are unstable + #[cfg(b)] U: TraitB, //~ ERROR attributes in `where` clause are unstable + #[cfg(all())] T: TraitAll, //~ ERROR attributes in `where` clause are unstable + #[cfg(any())] T: TraitAny, //~ ERROR attributes in `where` clause are unstable + #[cfg_attr(a, cfg(a))] U: TraitAA, //~ ERROR attributes in `where` clause are unstable + #[cfg_attr(b, cfg(b))] U: TraitBB, //~ ERROR attributes in `where` clause are unstable + #[cfg_attr(all(), cfg(all()))] T: TraitAllAll, //~ ERROR attributes in `where` clause are unstable + #[cfg_attr(any(), cfg(any()))] T: TraitAnyAny, //~ ERROR attributes in `where` clause are unstable + {} +} + +struct C<T> +where + #[cfg(a)] T: TraitA, //~ ERROR attributes in `where` clause are unstable + #[cfg(b)] T: TraitB, //~ ERROR attributes in `where` clause are unstable + #[cfg(all())] T: TraitAll, //~ ERROR attributes in `where` clause are unstable + #[cfg(any())] T: TraitAny, //~ ERROR attributes in `where` clause are unstable + #[cfg_attr(a, cfg(a))] T: TraitAA, //~ ERROR attributes in `where` clause are unstable + #[cfg_attr(b, cfg(b))] T: TraitBB, //~ ERROR attributes in `where` clause are unstable + #[cfg_attr(all(), cfg(all()))] T: TraitAllAll, //~ ERROR attributes in `where` clause are unstable + #[cfg_attr(any(), cfg(any()))] T: TraitAnyAny, //~ ERROR attributes in `where` clause are unstable +{ + _t: PhantomData<T>, +} + +union D<T> +where + #[cfg(a)] T: TraitA, //~ ERROR attributes in `where` clause are unstable + #[cfg(b)] T: TraitB, //~ ERROR attributes in `where` clause are unstable + #[cfg(all())] T: TraitAll, //~ ERROR attributes in `where` clause are unstable + #[cfg(any())] T: TraitAny, //~ ERROR attributes in `where` clause are unstable + #[cfg_attr(a, cfg(a))] T: TraitAA, //~ ERROR attributes in `where` clause are unstable + #[cfg_attr(b, cfg(b))] T: TraitBB, //~ ERROR attributes in `where` clause are unstable + #[cfg_attr(all(), cfg(all()))] T: TraitAllAll, //~ ERROR attributes in `where` clause are unstable + #[cfg_attr(any(), cfg(any()))] T: TraitAnyAny, //~ ERROR attributes in `where` clause are unstable +{ + + _t: PhantomData<T>, +} + +enum E<T> +where + #[cfg(a)] T: TraitA, //~ ERROR attributes in `where` clause are unstable + #[cfg(b)] T: TraitB, //~ ERROR attributes in `where` clause are unstable + #[cfg(all())] T: TraitAll, //~ ERROR attributes in `where` clause are unstable + #[cfg(any())] T: TraitAny, //~ ERROR attributes in `where` clause are unstable + #[cfg_attr(a, cfg(a))] T: TraitAA, //~ ERROR attributes in `where` clause are unstable + #[cfg_attr(b, cfg(b))] T: TraitBB, //~ ERROR attributes in `where` clause are unstable + #[cfg_attr(all(), cfg(all()))] T: TraitAllAll, //~ ERROR attributes in `where` clause are unstable + #[cfg_attr(any(), cfg(any()))] T: TraitAnyAny, //~ ERROR attributes in `where` clause are unstable +{ + E(PhantomData<T>), +} + +impl<T> C<T> where + #[cfg(a)] T: TraitA, //~ ERROR attributes in `where` clause are unstable + #[cfg(b)] T: TraitB, //~ ERROR attributes in `where` clause are unstable + #[cfg(all())] T: TraitAll, //~ ERROR attributes in `where` clause are unstable + #[cfg(any())] T: TraitAny, //~ ERROR attributes in `where` clause are unstable + #[cfg_attr(a, cfg(a))] T: TraitAA, //~ ERROR attributes in `where` clause are unstable + #[cfg_attr(b, cfg(b))] T: TraitBB, //~ ERROR attributes in `where` clause are unstable + #[cfg_attr(all(), cfg(all()))] T: TraitAllAll, //~ ERROR attributes in `where` clause are unstable + #[cfg_attr(any(), cfg(any()))] T: TraitAnyAny, //~ ERROR attributes in `where` clause are unstable +{ + fn new<U>() where + #[cfg(a)] U: TraitA, //~ ERROR attributes in `where` clause are unstable + #[cfg(b)] U: TraitB, //~ ERROR attributes in `where` clause are unstable + #[cfg(all())] U: TraitAll, //~ ERROR attributes in `where` clause are unstable + #[cfg(any())] U: TraitAny, //~ ERROR attributes in `where` clause are unstable + #[cfg_attr(a, cfg(a))] U: TraitAA, //~ ERROR attributes in `where` clause are unstable + #[cfg_attr(b, cfg(b))] U: TraitBB, //~ ERROR attributes in `where` clause are unstable + #[cfg_attr(all(), cfg(all()))] U: TraitAllAll, //~ ERROR attributes in `where` clause are unstable + #[cfg_attr(any(), cfg(any()))] U: TraitAnyAny, //~ ERROR attributes in `where` clause are unstable + {} +} diff --git a/tests/ui/feature-gates/feature-gate-yield-expr.rs b/tests/ui/feature-gates/feature-gate-yield-expr.rs new file mode 100644 index 00000000000..382bf89069e --- /dev/null +++ b/tests/ui/feature-gates/feature-gate-yield-expr.rs @@ -0,0 +1,9 @@ +//@ edition: 2024 +#![feature(stmt_expr_attributes)] + +fn main() { + yield (); //~ ERROR yield syntax is experimental + //~^ ERROR yield syntax is experimental + //~^^ ERROR `yield` can only be used in `#[coroutine]` closures, or `gen` blocks + //~^^^ ERROR yield expression outside of coroutine literal +} diff --git a/tests/ui/feature-gates/feature-gate-yield-expr.stderr b/tests/ui/feature-gates/feature-gate-yield-expr.stderr new file mode 100644 index 00000000000..ad8a15a0f36 --- /dev/null +++ b/tests/ui/feature-gates/feature-gate-yield-expr.stderr @@ -0,0 +1,41 @@ +error[E0658]: yield syntax is experimental + --> $DIR/feature-gate-yield-expr.rs:5:5 + | +LL | yield (); + | ^^^^^^^^ + | + = note: see issue #43122 <https://github.com/rust-lang/rust/issues/43122> for more information + = help: add `#![feature(coroutines)]` 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[E0658]: yield syntax is experimental + --> $DIR/feature-gate-yield-expr.rs:5:5 + | +LL | yield (); + | ^^^^^^^^ + | + = note: see issue #43122 <https://github.com/rust-lang/rust/issues/43122> for more information + = help: add `#![feature(yield_expr)]` 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: `yield` can only be used in `#[coroutine]` closures, or `gen` blocks + --> $DIR/feature-gate-yield-expr.rs:5:5 + | +LL | yield (); + | ^^^^^^^^ + | +help: use `#[coroutine]` to make this closure a coroutine + | +LL | #[coroutine] fn main() { + | ++++++++++++ + +error[E0627]: yield expression outside of coroutine literal + --> $DIR/feature-gate-yield-expr.rs:5:5 + | +LL | yield (); + | ^^^^^^^^ + +error: aborting due to 4 previous errors + +Some errors have detailed explanations: E0627, E0658. +For more information about an error, try `rustc --explain E0627`. diff --git a/tests/ui/feature-gates/issue-43106-gating-of-builtin-attrs-error.stderr b/tests/ui/feature-gates/issue-43106-gating-of-builtin-attrs-error.stderr index 648bafe6460..5c2a3ae699c 100644 --- a/tests/ui/feature-gates/issue-43106-gating-of-builtin-attrs-error.stderr +++ b/tests/ui/feature-gates/issue-43106-gating-of-builtin-attrs-error.stderr @@ -130,21 +130,6 @@ LL - #![rustc_main] LL + #[rustc_main] | -error: `repr` attribute cannot be used at crate level - --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:17:1 - | -LL | #![repr()] - | ^^^^^^^^^^ -... -LL | mod inline { - | ------ the inner attribute doesn't annotate this module - | -help: perhaps you meant to use an outer attribute - | -LL - #![repr()] -LL + #[repr()] - | - error: `path` attribute cannot be used at crate level --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:19:1 | @@ -175,6 +160,21 @@ LL - #![automatically_derived] LL + #[automatically_derived] | +error: `repr` attribute cannot be used at crate level + --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:17:1 + | +LL | #![repr()] + | ^^^^^^^^^^ +... +LL | mod inline { + | ------ the inner attribute doesn't annotate this module + | +help: perhaps you meant to use an outer attribute + | +LL - #![repr()] +LL + #[repr()] + | + error[E0518]: attribute should be applied to function or closure --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:40:17 | diff --git a/tests/ui/force-inlining/asm.rs b/tests/ui/force-inlining/asm.rs index 85014ffa515..2b5f87c59d3 100644 --- a/tests/ui/force-inlining/asm.rs +++ b/tests/ui/force-inlining/asm.rs @@ -1,3 +1,4 @@ +//@ add-core-stubs //@ build-fail //@ compile-flags: --crate-type=lib --target thumbv4t-none-eabi //@ needs-llvm-components: arm @@ -9,17 +10,8 @@ #![feature(no_core, lang_items)] #![no_core] -#[lang = "sized"] -pub trait Sized {} -#[lang = "copy"] -pub trait Copy {} -#[lang = "freeze"] -pub unsafe trait Freeze {} - -#[lang = "start"] -fn start<T>(_main: fn() -> T, _argc: isize, _argv: *const *const u8, _sigpipe: u8) -> isize { - 0 -} +extern crate minicore; +use minicore::*; #[rustc_builtin_macro] #[macro_export] diff --git a/tests/ui/force-inlining/asm.stderr b/tests/ui/force-inlining/asm.stderr index ef04688965b..1744c0215bb 100644 --- a/tests/ui/force-inlining/asm.stderr +++ b/tests/ui/force-inlining/asm.stderr @@ -1,5 +1,5 @@ error: `instruction_set_a32` could not be inlined into `t32` but is required to be inlined - --> $DIR/asm.rs:53:5 + --> $DIR/asm.rs:45:5 | LL | instruction_set_a32(); | ^^^^^^^^^^^^^^^^^^^^^ ...`instruction_set_a32` called here @@ -7,7 +7,7 @@ LL | instruction_set_a32(); = note: could not be inlined due to: incompatible instruction set error: `inline_always_and_using_inline_asm` could not be inlined into `t32` but is required to be inlined - --> $DIR/asm.rs:57:5 + --> $DIR/asm.rs:49:5 | LL | inline_always_and_using_inline_asm(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ...`inline_always_and_using_inline_asm` called here @@ -15,7 +15,7 @@ LL | inline_always_and_using_inline_asm(); = note: could not be inlined due to: cannot move inline-asm across instruction sets error: `instruction_set_a32` could not be inlined into `default` but is required to be inlined - --> $DIR/asm.rs:62:5 + --> $DIR/asm.rs:54:5 | LL | instruction_set_a32(); | ^^^^^^^^^^^^^^^^^^^^^ ...`instruction_set_a32` called here @@ -23,7 +23,7 @@ LL | instruction_set_a32(); = note: could not be inlined due to: incompatible instruction set error: `instruction_set_t32` could not be inlined into `default` but is required to be inlined - --> $DIR/asm.rs:64:5 + --> $DIR/asm.rs:56:5 | LL | instruction_set_t32(); | ^^^^^^^^^^^^^^^^^^^^^ ...`instruction_set_t32` called here diff --git a/tests/ui/force-inlining/gate.rs b/tests/ui/force-inlining/gate.rs index d6a01a74a44..cea094c14f2 100644 --- a/tests/ui/force-inlining/gate.rs +++ b/tests/ui/force-inlining/gate.rs @@ -2,11 +2,11 @@ #![allow(internal_features)] #[rustc_force_inline] -//~^ ERROR #![rustc_force_inline] forces a free function to be inlined +//~^ ERROR #[rustc_force_inline] forces a free function to be inlined pub fn bare() { } #[rustc_force_inline = "the test requires it"] -//~^ ERROR #![rustc_force_inline] forces a free function to be inlined +//~^ ERROR #[rustc_force_inline] forces a free function to be inlined pub fn justified() { } diff --git a/tests/ui/force-inlining/gate.stderr b/tests/ui/force-inlining/gate.stderr index e3973a08c23..964d43fa18f 100644 --- a/tests/ui/force-inlining/gate.stderr +++ b/tests/ui/force-inlining/gate.stderr @@ -1,4 +1,4 @@ -error[E0658]: #![rustc_force_inline] forces a free function to be inlined +error[E0658]: #[rustc_force_inline] forces a free function to be inlined --> $DIR/gate.rs:4:1 | LL | #[rustc_force_inline] @@ -7,7 +7,7 @@ LL | #[rustc_force_inline] = help: add `#![feature(rustc_attrs)]` 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[E0658]: #![rustc_force_inline] forces a free function to be inlined +error[E0658]: #[rustc_force_inline] forces a free function to be inlined --> $DIR/gate.rs:9:1 | LL | #[rustc_force_inline = "the test requires it"] diff --git a/tests/ui/generic-const-items/def-site-eval.fail.stderr b/tests/ui/generic-const-items/def-site-eval.fail.stderr index 22a5f291697..1ba4455c7be 100644 --- a/tests/ui/generic-const-items/def-site-eval.fail.stderr +++ b/tests/ui/generic-const-items/def-site-eval.fail.stderr @@ -2,7 +2,7 @@ error[E0080]: evaluation of `_::<'_>` failed --> $DIR/def-site-eval.rs:14:20 | LL | const _<'_a>: () = panic!(); - | ^^^^^^^^ the evaluated program panicked at 'explicit panic', $DIR/def-site-eval.rs:14:20 + | ^^^^^^^^ evaluation panicked: explicit panic | = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/tests/ui/generic-const-items/wfcheck_err_leak_issue_118179.stderr b/tests/ui/generic-const-items/wfcheck_err_leak_issue_118179.stderr index 654004571db..2b28e29421c 100644 --- a/tests/ui/generic-const-items/wfcheck_err_leak_issue_118179.stderr +++ b/tests/ui/generic-const-items/wfcheck_err_leak_issue_118179.stderr @@ -3,8 +3,6 @@ error[E0770]: the type of const parameters must not depend on other generic para | LL | struct G<T, const N: Vec<T>>(T); | ^ the type must not depend on the parameter `T` - | - = note: type parameters may not be used in the type of const parameters error: aborting due to 1 previous error diff --git a/tests/ui/generics/post_monomorphization_error_backtrace.rs b/tests/ui/generics/post_monomorphization_error_backtrace.rs index 2c18f2b233a..f5f36ef03ae 100644 --- a/tests/ui/generics/post_monomorphization_error_backtrace.rs +++ b/tests/ui/generics/post_monomorphization_error_backtrace.rs @@ -6,10 +6,10 @@ fn assert_zst<T>() { const V: () = assert!(std::mem::size_of::<T>() == 0); //~^ ERROR: evaluation of `assert_zst::F::<u32>::V` failed [E0080] //~| NOTE: in this expansion of assert! - //~| NOTE: the evaluated program panicked + //~| NOTE: assertion failed //~| ERROR: evaluation of `assert_zst::F::<i32>::V` failed [E0080] //~| NOTE: in this expansion of assert! - //~| NOTE: the evaluated program panicked + //~| NOTE: assertion failed } F::<T>::V; //~^NOTE: erroneous constant diff --git a/tests/ui/generics/post_monomorphization_error_backtrace.stderr b/tests/ui/generics/post_monomorphization_error_backtrace.stderr index 8a57979bca7..1366d5491f4 100644 --- a/tests/ui/generics/post_monomorphization_error_backtrace.stderr +++ b/tests/ui/generics/post_monomorphization_error_backtrace.stderr @@ -2,7 +2,7 @@ error[E0080]: evaluation of `assert_zst::F::<u32>::V` failed --> $DIR/post_monomorphization_error_backtrace.rs:6:23 | LL | const V: () = assert!(std::mem::size_of::<T>() == 0); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the evaluated program panicked at 'assertion failed: std::mem::size_of::<T>() == 0', $DIR/post_monomorphization_error_backtrace.rs:6:23 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation panicked: assertion failed: std::mem::size_of::<T>() == 0 | = note: this error originates in the macro `assert` (in Nightly builds, run with -Z macro-backtrace for more info) @@ -22,7 +22,7 @@ error[E0080]: evaluation of `assert_zst::F::<i32>::V` failed --> $DIR/post_monomorphization_error_backtrace.rs:6:23 | LL | const V: () = assert!(std::mem::size_of::<T>() == 0); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the evaluated program panicked at 'assertion failed: std::mem::size_of::<T>() == 0', $DIR/post_monomorphization_error_backtrace.rs:6:23 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation panicked: assertion failed: std::mem::size_of::<T>() == 0 | = note: this error originates in the macro `assert` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/tests/ui/higher-ranked/trait-bounds/hang-on-deeply-nested-dyn.rs b/tests/ui/higher-ranked/trait-bounds/hang-on-deeply-nested-dyn.rs index 7b6ba9f7f16..e22a49d0399 100644 --- a/tests/ui/higher-ranked/trait-bounds/hang-on-deeply-nested-dyn.rs +++ b/tests/ui/higher-ranked/trait-bounds/hang-on-deeply-nested-dyn.rs @@ -1,5 +1,3 @@ -//@ normalize-stderr: "long-type-\d+" -> "long-type-hash" - fn id( f: &dyn Fn(u32), ) -> &dyn Fn( diff --git a/tests/ui/higher-ranked/trait-bounds/hang-on-deeply-nested-dyn.stderr b/tests/ui/higher-ranked/trait-bounds/hang-on-deeply-nested-dyn.stderr index be2eca3e61a..00a5948bdd4 100644 --- a/tests/ui/higher-ranked/trait-bounds/hang-on-deeply-nested-dyn.stderr +++ b/tests/ui/higher-ranked/trait-bounds/hang-on-deeply-nested-dyn.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/hang-on-deeply-nested-dyn.rs:12:5 + --> $DIR/hang-on-deeply-nested-dyn.rs:10:5 | LL | ) -> &dyn Fn( | ______- diff --git a/tests/ui/higher-ranked/trait-bounds/hrtb-doesnt-borrow-self-1.rs b/tests/ui/higher-ranked/trait-bounds/hrtb-doesnt-borrow-self-1.rs index f880749ec83..ff6f4861e14 100644 --- a/tests/ui/higher-ranked/trait-bounds/hrtb-doesnt-borrow-self-1.rs +++ b/tests/ui/higher-ranked/trait-bounds/hrtb-doesnt-borrow-self-1.rs @@ -1,5 +1,3 @@ -//@ normalize-stderr: "long-type-\d+" -> "long-type-hash" - // rust-lang/rust#30786: the use of `for<'b> &'b mut A: Stream<Item=T>` // should act as assertion that item does not borrow from its stream; // but an earlier buggy rustc allowed `.map(|x: &_| x)` which does diff --git a/tests/ui/higher-ranked/trait-bounds/hrtb-doesnt-borrow-self-1.stderr b/tests/ui/higher-ranked/trait-bounds/hrtb-doesnt-borrow-self-1.stderr index ae364de8cc0..240e1c3dde1 100644 --- a/tests/ui/higher-ranked/trait-bounds/hrtb-doesnt-borrow-self-1.stderr +++ b/tests/ui/higher-ranked/trait-bounds/hrtb-doesnt-borrow-self-1.stderr @@ -1,5 +1,5 @@ -error[E0599]: the method `filterx` exists for struct `Map<Repeat, {closure@hrtb-doesnt-borrow-self-1.rs:115:27}>`, but its trait bounds were not satisfied - --> $DIR/hrtb-doesnt-borrow-self-1.rs:116:22 +error[E0599]: the method `filterx` exists for struct `Map<Repeat, {closure@hrtb-doesnt-borrow-self-1.rs:113:27}>`, but its trait bounds were not satisfied + --> $DIR/hrtb-doesnt-borrow-self-1.rs:114:22 | LL | pub struct Map<S, F> { | -------------------- method `filterx` not found for this struct because it doesn't satisfy `_: StreamExt` @@ -8,16 +8,16 @@ LL | let filter = map.filterx(|x: &_| true); | ^^^^^^^ method cannot be called due to unsatisfied trait bounds | note: the following trait bounds were not satisfied: - `&'a mut &Map<Repeat, {closure@$DIR/hrtb-doesnt-borrow-self-1.rs:115:27: 115:34}>: Stream` - `&'a mut &mut Map<Repeat, {closure@$DIR/hrtb-doesnt-borrow-self-1.rs:115:27: 115:34}>: Stream` - `&'a mut Map<Repeat, {closure@$DIR/hrtb-doesnt-borrow-self-1.rs:115:27: 115:34}>: Stream` - --> $DIR/hrtb-doesnt-borrow-self-1.rs:98:50 + `&'a mut &Map<Repeat, {closure@$DIR/hrtb-doesnt-borrow-self-1.rs:113:27: 113:34}>: Stream` + `&'a mut &mut Map<Repeat, {closure@$DIR/hrtb-doesnt-borrow-self-1.rs:113:27: 113:34}>: Stream` + `&'a mut Map<Repeat, {closure@$DIR/hrtb-doesnt-borrow-self-1.rs:113:27: 113:34}>: Stream` + --> $DIR/hrtb-doesnt-borrow-self-1.rs:96:50 | LL | impl<T> StreamExt for T where for<'a> &'a mut T: Stream {} | --------- - ^^^^^^ unsatisfied trait bound introduced here = help: items from traits can only be used if the trait is implemented and in scope note: `StreamExt` defines an item `filterx`, perhaps you need to implement it - --> $DIR/hrtb-doesnt-borrow-self-1.rs:66:1 + --> $DIR/hrtb-doesnt-borrow-self-1.rs:64:1 | LL | pub trait StreamExt | ^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/higher-ranked/trait-bounds/hrtb-doesnt-borrow-self-2.rs b/tests/ui/higher-ranked/trait-bounds/hrtb-doesnt-borrow-self-2.rs index ff4c0cf24d6..d8a1f3fa69e 100644 --- a/tests/ui/higher-ranked/trait-bounds/hrtb-doesnt-borrow-self-2.rs +++ b/tests/ui/higher-ranked/trait-bounds/hrtb-doesnt-borrow-self-2.rs @@ -1,5 +1,3 @@ -//@ normalize-stderr: "long-type-\d+" -> "long-type-hash" - // rust-lang/rust#30786: the use of `for<'b> &'b mut A: Stream<Item=T` // should act as assertion that item does not borrow from its stream; // but an earlier buggy rustc allowed `.map(|x: &_| x)` which does diff --git a/tests/ui/higher-ranked/trait-bounds/hrtb-doesnt-borrow-self-2.stderr b/tests/ui/higher-ranked/trait-bounds/hrtb-doesnt-borrow-self-2.stderr index eeb4e12fa8b..13041ea2bb0 100644 --- a/tests/ui/higher-ranked/trait-bounds/hrtb-doesnt-borrow-self-2.stderr +++ b/tests/ui/higher-ranked/trait-bounds/hrtb-doesnt-borrow-self-2.stderr @@ -1,5 +1,5 @@ -error[E0599]: the method `countx` exists for struct `Filter<Map<Repeat, fn(&u64) -> &u64 {identity::<u64>}>, {closure@hrtb-doesnt-borrow-self-2.rs:111:30}>`, but its trait bounds were not satisfied - --> $DIR/hrtb-doesnt-borrow-self-2.rs:112:24 +error[E0599]: the method `countx` exists for struct `Filter<Map<Repeat, fn(&u64) -> &u64 {identity::<u64>}>, {closure@hrtb-doesnt-borrow-self-2.rs:109:30}>`, but its trait bounds were not satisfied + --> $DIR/hrtb-doesnt-borrow-self-2.rs:110:24 | LL | pub struct Filter<S, F> { | ----------------------- method `countx` not found for this struct because it doesn't satisfy `_: StreamExt` @@ -8,16 +8,16 @@ LL | let count = filter.countx(); | ^^^^^^ method cannot be called due to unsatisfied trait bounds | note: the following trait bounds were not satisfied: - `&'a mut &Filter<Map<Repeat, for<'a> fn(&'a u64) -> &'a u64 {identity::<u64>}>, {closure@$DIR/hrtb-doesnt-borrow-self-2.rs:111:30: 111:37}>: Stream` - `&'a mut &mut Filter<Map<Repeat, for<'a> fn(&'a u64) -> &'a u64 {identity::<u64>}>, {closure@$DIR/hrtb-doesnt-borrow-self-2.rs:111:30: 111:37}>: Stream` - `&'a mut Filter<Map<Repeat, for<'a> fn(&'a u64) -> &'a u64 {identity::<u64>}>, {closure@$DIR/hrtb-doesnt-borrow-self-2.rs:111:30: 111:37}>: Stream` - --> $DIR/hrtb-doesnt-borrow-self-2.rs:98:50 + `&'a mut &Filter<Map<Repeat, for<'a> fn(&'a u64) -> &'a u64 {identity::<u64>}>, {closure@$DIR/hrtb-doesnt-borrow-self-2.rs:109:30: 109:37}>: Stream` + `&'a mut &mut Filter<Map<Repeat, for<'a> fn(&'a u64) -> &'a u64 {identity::<u64>}>, {closure@$DIR/hrtb-doesnt-borrow-self-2.rs:109:30: 109:37}>: Stream` + `&'a mut Filter<Map<Repeat, for<'a> fn(&'a u64) -> &'a u64 {identity::<u64>}>, {closure@$DIR/hrtb-doesnt-borrow-self-2.rs:109:30: 109:37}>: Stream` + --> $DIR/hrtb-doesnt-borrow-self-2.rs:96:50 | LL | impl<T> StreamExt for T where for<'a> &'a mut T: Stream {} | --------- - ^^^^^^ unsatisfied trait bound introduced here = help: items from traits can only be used if the trait is implemented and in scope note: `StreamExt` defines an item `countx`, perhaps you need to implement it - --> $DIR/hrtb-doesnt-borrow-self-2.rs:66:1 + --> $DIR/hrtb-doesnt-borrow-self-2.rs:64:1 | LL | pub trait StreamExt | ^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/higher-ranked/trait-bounds/hrtb-just-for-static.stderr b/tests/ui/higher-ranked/trait-bounds/hrtb-just-for-static.stderr index 31e11e12835..1c077a9b906 100644 --- a/tests/ui/higher-ranked/trait-bounds/hrtb-just-for-static.stderr +++ b/tests/ui/higher-ranked/trait-bounds/hrtb-just-for-static.stderr @@ -2,7 +2,7 @@ error: implementation of `Foo` is not general enough --> $DIR/hrtb-just-for-static.rs:24:5 | LL | want_hrtb::<StaticInt>() - | ^^^^^^^^^^^^^^^^^^^^^^ implementation of `Foo` is not general enough + | ^^^^^^^^^^^^^^^^^^^^^^^^ implementation of `Foo` is not general enough | = note: `StaticInt` must implement `Foo<&'0 isize>`, for any lifetime `'0`... = note: ...but it actually implements `Foo<&'static isize>` diff --git a/tests/ui/hygiene/generate-mod.stderr b/tests/ui/hygiene/generate-mod.stderr index 32a2e145ca9..58b9c642dab 100644 --- a/tests/ui/hygiene/generate-mod.stderr +++ b/tests/ui/hygiene/generate-mod.stderr @@ -1,12 +1,18 @@ error[E0412]: cannot find type `FromOutside` in this scope --> $DIR/generate-mod.rs:35:13 | +LL | type A = $FromOutside; + | ------------ due to this macro variable +... LL | genmod!(FromOutside, Outer); | ^^^^^^^^^^^ not found in this scope error[E0412]: cannot find type `Outer` in this scope --> $DIR/generate-mod.rs:35:26 | +LL | struct $Outer; + | ------ due to this macro variable +... LL | genmod!(FromOutside, Outer); | ^^^^^ not found in this scope diff --git a/tests/ui/hygiene/globs.stderr b/tests/ui/hygiene/globs.stderr index 3f7a0ae7efa..31f25b182f1 100644 --- a/tests/ui/hygiene/globs.stderr +++ b/tests/ui/hygiene/globs.stderr @@ -50,6 +50,9 @@ error[E0425]: cannot find function `f` in this scope LL | n!(f); | ----- in this macro invocation ... +LL | $j(); + | -- due to this macro variable +... LL | n!(f); | ^ not found in this scope | @@ -63,6 +66,9 @@ error[E0425]: cannot find function `f` in this scope LL | n!(f); | ----- in this macro invocation ... +LL | $j(); + | -- due to this macro variable +... LL | f | ^ not found in this scope | diff --git a/tests/ui/impl-trait/in-trait/opaque-and-lifetime-mismatch.rs b/tests/ui/impl-trait/in-trait/opaque-and-lifetime-mismatch.rs index 21e2fda1c3a..b9b551c1b23 100644 --- a/tests/ui/impl-trait/in-trait/opaque-and-lifetime-mismatch.rs +++ b/tests/ui/impl-trait/in-trait/opaque-and-lifetime-mismatch.rs @@ -8,8 +8,6 @@ trait Foo { impl Foo for () { fn bar() -> i32 { - //~^ ERROR method `bar` has an incompatible type for trait - //~| ERROR method `bar` has an incompatible return type for trait 0 } } diff --git a/tests/ui/impl-trait/in-trait/opaque-and-lifetime-mismatch.stderr b/tests/ui/impl-trait/in-trait/opaque-and-lifetime-mismatch.stderr index d575fedbb58..24896151bed 100644 --- a/tests/ui/impl-trait/in-trait/opaque-and-lifetime-mismatch.stderr +++ b/tests/ui/impl-trait/in-trait/opaque-and-lifetime-mismatch.stderr @@ -11,7 +11,7 @@ LL | fn bar() -> Wrapper<'static, impl Sized>; | ++++++++ error[E0106]: missing lifetime specifier - --> $DIR/opaque-and-lifetime-mismatch.rs:18:24 + --> $DIR/opaque-and-lifetime-mismatch.rs:16:24 | LL | fn foo() -> Wrapper<impl Sized>; | ^ expected named lifetime parameter @@ -23,7 +23,7 @@ LL | fn foo() -> Wrapper<'static, impl Sized>; | ++++++++ error[E0106]: missing lifetime specifier - --> $DIR/opaque-and-lifetime-mismatch.rs:24:24 + --> $DIR/opaque-and-lifetime-mismatch.rs:22:24 | LL | fn foo() -> Wrapper<impl Sized> { | ^ expected named lifetime parameter @@ -49,7 +49,7 @@ LL | struct Wrapper<'rom>(&'rom ()); | ^^^^^^^ error[E0107]: struct takes 0 generic arguments but 1 generic argument was supplied - --> $DIR/opaque-and-lifetime-mismatch.rs:18:17 + --> $DIR/opaque-and-lifetime-mismatch.rs:16:17 | LL | fn foo() -> Wrapper<impl Sized>; | ^^^^^^^ ---------- help: remove the unnecessary generic argument @@ -62,36 +62,8 @@ note: struct defined here, with 0 generic parameters LL | struct Wrapper<'rom>(&'rom ()); | ^^^^^^^ -error[E0053]: method `bar` has an incompatible return type for trait - --> $DIR/opaque-and-lifetime-mismatch.rs:10:17 - | -LL | fn bar() -> i32 { - | ^^^ - | | - | expected `Wrapper<'static>`, found `i32` - | return type in trait - -error[E0053]: method `bar` has an incompatible type for trait - --> $DIR/opaque-and-lifetime-mismatch.rs:10:17 - | -LL | fn bar() -> i32 { - | ^^^ expected `Wrapper<'static>`, found `i32` - | -note: type in trait - --> $DIR/opaque-and-lifetime-mismatch.rs:4:17 - | -LL | fn bar() -> Wrapper<impl Sized>; - | ^^^^^^^^^^^^^^^^^^^ - = note: expected signature `fn() -> Wrapper<'static>` - found signature `fn() -> i32` -help: change the output type to match the trait - | -LL - fn bar() -> i32 { -LL + fn bar() -> Wrapper<'static> { - | - error[E0107]: struct takes 0 generic arguments but 1 generic argument was supplied - --> $DIR/opaque-and-lifetime-mismatch.rs:24:17 + --> $DIR/opaque-and-lifetime-mismatch.rs:22:17 | LL | fn foo() -> Wrapper<impl Sized> { | ^^^^^^^ ---------- help: remove the unnecessary generic argument @@ -104,7 +76,7 @@ note: struct defined here, with 0 generic parameters LL | struct Wrapper<'rom>(&'rom ()); | ^^^^^^^ -error: aborting due to 8 previous errors +error: aborting due to 6 previous errors -Some errors have detailed explanations: E0053, E0106, E0107. -For more information about an error, try `rustc --explain E0053`. +Some errors have detailed explanations: E0106, E0107. +For more information about an error, try `rustc --explain E0106`. diff --git a/tests/ui/impl-trait/method-suggestion-no-duplication.stderr b/tests/ui/impl-trait/method-suggestion-no-duplication.stderr index c401269da83..6bc57f89467 100644 --- a/tests/ui/impl-trait/method-suggestion-no-duplication.stderr +++ b/tests/ui/impl-trait/method-suggestion-no-duplication.stderr @@ -8,8 +8,9 @@ LL | foo(|s| s.is_empty()); | ^^^^^^^^ method not found in `Foo` | = help: items from traits can only be used if the trait is implemented and in scope - = note: the following trait defines an item `is_empty`, perhaps you need to implement it: + = note: the following traits define an item `is_empty`, perhaps you need to implement one of them: candidate #1: `ExactSizeIterator` + candidate #2: `RangeBounds` error: aborting due to 1 previous error diff --git a/tests/ui/impl-trait/opaque-used-in-extraneous-argument.stderr b/tests/ui/impl-trait/opaque-used-in-extraneous-argument.stderr index 4198095db65..73e7890f91f 100644 --- a/tests/ui/impl-trait/opaque-used-in-extraneous-argument.stderr +++ b/tests/ui/impl-trait/opaque-used-in-extraneous-argument.stderr @@ -75,7 +75,7 @@ error[E0061]: this function takes 0 arguments but 1 argument was supplied --> $DIR/opaque-used-in-extraneous-argument.rs:20:5 | LL | open_parent(&old_path) - | ^^^^^^^^^^^ --------- unexpected argument of type `&impl Fn<{type error}> + FnOnce<{type error}, Output = {type error}> + 'static` + | ^^^^^^^^^^^ --------- unexpected argument of type `&impl Fn<{type error}> + FnOnce<{type error}, Output = {type error}> + '_` | note: function defined here --> $DIR/opaque-used-in-extraneous-argument.rs:12:4 diff --git a/tests/ui/impl-trait/precise-capturing/bad-lifetimes.rs b/tests/ui/impl-trait/precise-capturing/bad-lifetimes.rs index 161fe23c899..8e30973cd3a 100644 --- a/tests/ui/impl-trait/precise-capturing/bad-lifetimes.rs +++ b/tests/ui/impl-trait/precise-capturing/bad-lifetimes.rs @@ -1,6 +1,5 @@ fn no_elided_lt() -> impl Sized + use<'_> {} //~^ ERROR missing lifetime specifier -//~| ERROR expected lifetime parameter in `use<...>` precise captures list, found `'_` fn static_lt() -> impl Sized + use<'static> {} //~^ ERROR expected lifetime parameter in `use<...>` precise captures list, found `'static` diff --git a/tests/ui/impl-trait/precise-capturing/bad-lifetimes.stderr b/tests/ui/impl-trait/precise-capturing/bad-lifetimes.stderr index c8dac3a69cd..98f629f52cf 100644 --- a/tests/ui/impl-trait/precise-capturing/bad-lifetimes.stderr +++ b/tests/ui/impl-trait/precise-capturing/bad-lifetimes.stderr @@ -12,26 +12,20 @@ LL + fn no_elided_lt() -> impl Sized + use<'static> {} | error[E0261]: use of undeclared lifetime name `'missing` - --> $DIR/bad-lifetimes.rs:8:37 + --> $DIR/bad-lifetimes.rs:7:37 | LL | fn missing_lt() -> impl Sized + use<'missing> {} | - ^^^^^^^^ undeclared lifetime | | | help: consider introducing lifetime `'missing` here: `<'missing>` -error: expected lifetime parameter in `use<...>` precise captures list, found `'_` - --> $DIR/bad-lifetimes.rs:1:39 - | -LL | fn no_elided_lt() -> impl Sized + use<'_> {} - | ^^ - error: expected lifetime parameter in `use<...>` precise captures list, found `'static` - --> $DIR/bad-lifetimes.rs:5:36 + --> $DIR/bad-lifetimes.rs:4:36 | LL | fn static_lt() -> impl Sized + use<'static> {} | ^^^^^^^ -error: aborting due to 4 previous errors +error: aborting due to 3 previous errors Some errors have detailed explanations: E0106, E0261. For more information about an error, try `rustc --explain E0106`. diff --git a/tests/ui/impl-trait/unsize_tuple.rs b/tests/ui/impl-trait/unsize_tuple.rs deleted file mode 100644 index 2678564f0e8..00000000000 --- a/tests/ui/impl-trait/unsize_tuple.rs +++ /dev/null @@ -1,15 +0,0 @@ -//! Test that we allow unsizing `([Opaque; N],)` to `([Concrete],)`. - -//@check-pass - -#![feature(unsized_tuple_coercion)] - -fn hello() -> ([impl Sized; 2],) { - if false { - let x = hello(); - let _: &([i32],) = &x; - } - todo!() -} - -fn main() {} diff --git a/tests/ui/implied-bounds/from-trait-impl.rs b/tests/ui/implied-bounds/from-trait-impl.rs index 6e126575aa9..5822c5474bd 100644 --- a/tests/ui/implied-bounds/from-trait-impl.rs +++ b/tests/ui/implied-bounds/from-trait-impl.rs @@ -12,6 +12,7 @@ where fn func1(foo: Foo<(&str,)>) { //~^ ERROR `&str` does not fulfill the required lifetime + //~| ERROR lifetime may not live long enough let _: &'static str = foo.0.0; } @@ -19,5 +20,6 @@ trait TestTrait {} impl<X> TestTrait for [Foo<(X,)>; 1] {} //~^ ERROR `X` may not live long enough +//~| ERROR `X` may not live long enough fn main() {} diff --git a/tests/ui/implied-bounds/from-trait-impl.stderr b/tests/ui/implied-bounds/from-trait-impl.stderr index 4151d206ae2..5f189d3385a 100644 --- a/tests/ui/implied-bounds/from-trait-impl.stderr +++ b/tests/ui/implied-bounds/from-trait-impl.stderr @@ -7,7 +7,21 @@ LL | fn func1(foo: Foo<(&str,)>) { = note: type must satisfy the static lifetime error[E0310]: the parameter type `X` may not live long enough - --> $DIR/from-trait-impl.rs:20:23 + --> $DIR/from-trait-impl.rs:21:1 + | +LL | impl<X> TestTrait for [Foo<(X,)>; 1] {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | | + | the parameter type `X` must be valid for the static lifetime... + | ...so that the type `X` will meet its required lifetime bounds + | +help: consider adding an explicit lifetime bound + | +LL | impl<X: 'static> TestTrait for [Foo<(X,)>; 1] {} + | +++++++++ + +error[E0310]: the parameter type `X` may not live long enough + --> $DIR/from-trait-impl.rs:21:23 | LL | impl<X> TestTrait for [Foo<(X,)>; 1] {} | ^^^^^^^^^^^^^^ @@ -20,7 +34,16 @@ help: consider adding an explicit lifetime bound LL | impl<X: 'static> TestTrait for [Foo<(X,)>; 1] {} | +++++++++ -error: aborting due to 2 previous errors +error: lifetime may not live long enough + --> $DIR/from-trait-impl.rs:13:1 + | +LL | fn func1(foo: Foo<(&str,)>) { + | ^^^^^^^^^^^^^^^^^^^-^^^^^^^ + | | | + | | let's call the lifetime of this reference `'1` + | requires that `'1` must outlive `'static` + +error: aborting due to 4 previous errors Some errors have detailed explanations: E0310, E0477. For more information about an error, try `rustc --explain E0310`. diff --git a/tests/ui/implied-bounds/normalization-nested.lifetime.stderr b/tests/ui/implied-bounds/normalization-nested.lifetime.stderr deleted file mode 100644 index c43cc0999f1..00000000000 --- a/tests/ui/implied-bounds/normalization-nested.lifetime.stderr +++ /dev/null @@ -1,10 +0,0 @@ -error: lifetime may not live long enough - --> $DIR/normalization-nested.rs:40:5 - | -LL | pub fn test_borrowck<'x>(_: Map<Vec<&'x ()>>, s: &'x str) -> &'static str { - | -- lifetime `'x` defined here -LL | s - | ^ returning this value requires that `'x` must outlive `'static` - -error: aborting due to 1 previous error - diff --git a/tests/ui/implied-bounds/normalization-nested.rs b/tests/ui/implied-bounds/normalization-nested.rs index 4527e33a291..9a0defd1667 100644 --- a/tests/ui/implied-bounds/normalization-nested.rs +++ b/tests/ui/implied-bounds/normalization-nested.rs @@ -3,9 +3,7 @@ // //@ revisions: param_ty lifetime param_ty_no_compat lifetime_no_compat -//@[param_ty] check-pass -//@[param_ty_no_compat] check-pass -//@[lifetime_no_compat] check-pass +//@ check-pass //@[param_ty_no_compat] compile-flags: -Zno-implied-bounds-compat //@[lifetime_no_compat] compile-flags: -Zno-implied-bounds-compat @@ -38,7 +36,6 @@ pub fn test_wfcheck<'x>(_: Map<Vec<&'x ()>>) {} pub fn test_borrowck<'x>(_: Map<Vec<&'x ()>>, s: &'x str) -> &'static str { s - //[lifetime]~^ ERROR lifetime may not live long enough } fn main() {} diff --git a/tests/ui/implied-bounds/normalization-placeholder-leak.fail.stderr b/tests/ui/implied-bounds/normalization-placeholder-leak.fail.stderr index a591d0f5d4d..8919919d04e 100644 --- a/tests/ui/implied-bounds/normalization-placeholder-leak.fail.stderr +++ b/tests/ui/implied-bounds/normalization-placeholder-leak.fail.stderr @@ -1,15 +1,45 @@ error[E0477]: the type `&'lt u8` does not fulfill the required lifetime + --> $DIR/normalization-placeholder-leak.rs:31:5 + | +LL | fn test_lifetime<'lt, T: Trait>(_: Foo<&'lt u8>) {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error[E0477]: the type `&'lt u8` does not fulfill the required lifetime --> $DIR/normalization-placeholder-leak.rs:31:40 | LL | fn test_lifetime<'lt, T: Trait>(_: Foo<&'lt u8>) {} | ^^^^^^^^^^^^ error[E0477]: the type `<T as AnotherTrait>::Ty2<'lt>` does not fulfill the required lifetime - --> $DIR/normalization-placeholder-leak.rs:36:44 + --> $DIR/normalization-placeholder-leak.rs:38:5 + | +LL | fn test_alias<'lt, T: AnotherTrait>(_: Foo<T::Ty2::<'lt>>) {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error[E0477]: the type `<T as AnotherTrait>::Ty2<'lt>` does not fulfill the required lifetime + --> $DIR/normalization-placeholder-leak.rs:38:44 | LL | fn test_alias<'lt, T: AnotherTrait>(_: Foo<T::Ty2::<'lt>>) {} | ^^^^^^^^^^^^^^^^^^ -error: aborting due to 2 previous errors +error: lifetime may not live long enough + --> $DIR/normalization-placeholder-leak.rs:31:5 + | +LL | fn test_lifetime<'lt, T: Trait>(_: Foo<&'lt u8>) {} + | ^^^^^^^^^^^^^^^^^---^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | | | + | | lifetime `'lt` defined here + | requires that `'lt` must outlive `'static` + +error: lifetime may not live long enough + --> $DIR/normalization-placeholder-leak.rs:38:5 + | +LL | fn test_alias<'lt, T: AnotherTrait>(_: Foo<T::Ty2::<'lt>>) {} + | ^^^^^^^^^^^^^^---^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | | | + | | lifetime `'lt` defined here + | requires that `'lt` must outlive `'static` + +error: aborting due to 6 previous errors For more information about this error, try `rustc --explain E0477`. diff --git a/tests/ui/implied-bounds/normalization-placeholder-leak.rs b/tests/ui/implied-bounds/normalization-placeholder-leak.rs index a9dfa69cfd6..3a15897db82 100644 --- a/tests/ui/implied-bounds/normalization-placeholder-leak.rs +++ b/tests/ui/implied-bounds/normalization-placeholder-leak.rs @@ -30,11 +30,15 @@ mod fail { // don't use the bound to prove `'lt: 'static`. fn test_lifetime<'lt, T: Trait>(_: Foo<&'lt u8>) {} //[fail]~^ ERROR `&'lt u8` does not fulfill the required lifetime + //[fail]~| ERROR `&'lt u8` does not fulfill the required lifetime + //[fail]~| ERROR may not live long enough // implied bound: `T::Ty2<'lt>: placeholder('x)`. // don't use the bound to prove `T::Ty2<'lt>: 'static`. fn test_alias<'lt, T: AnotherTrait>(_: Foo<T::Ty2::<'lt>>) {} //[fail]~^ ERROR `<T as AnotherTrait>::Ty2<'lt>` does not fulfill the required lifetime + //[fail]~| ERROR `<T as AnotherTrait>::Ty2<'lt>` does not fulfill the required lifetime + //[fail]~| ERROR may not live long enough } diff --git a/tests/ui/implied-bounds/sod_service_chain.rs b/tests/ui/implied-bounds/sod_service_chain.rs index 7443a29f30c..032483e1be4 100644 --- a/tests/ui/implied-bounds/sod_service_chain.rs +++ b/tests/ui/implied-bounds/sod_service_chain.rs @@ -27,11 +27,19 @@ pub struct ServiceChainBuilder<P: Service, S: Service<Input = P::Output>> { } impl<P: Service, S: Service<Input = P::Output>> ServiceChainBuilder<P, S> { pub fn next<NS: Service<Input = S::Output>>( + //~^ the associated type + //~| the associated type + //~| the associated type + //~| the associated type + //~| the associated type + //~| the associated type + //~| may not live long enough self, ) -> ServiceChainBuilder<ServiceChain<P, S>, NS> { //~^ the associated type //~| the associated type //~| the associated type + //~| the associated type panic!(); } } diff --git a/tests/ui/implied-bounds/sod_service_chain.stderr b/tests/ui/implied-bounds/sod_service_chain.stderr index 1c0ef573e7d..f5221fc1105 100644 --- a/tests/ui/implied-bounds/sod_service_chain.stderr +++ b/tests/ui/implied-bounds/sod_service_chain.stderr @@ -1,5 +1,39 @@ error[E0310]: the associated type `<P as Service>::Error` may not live long enough - --> $DIR/sod_service_chain.rs:31:10 + --> $DIR/sod_service_chain.rs:29:5 + | +LL | / pub fn next<NS: Service<Input = S::Output>>( +... | +LL | | self, +LL | | ) -> ServiceChainBuilder<ServiceChain<P, S>, NS> { + | | ^ + | | | + | |____________________________________________________the associated type `<P as Service>::Error` must be valid for the static lifetime... + | ...so that the type `<P as Service>::Error` will meet its required lifetime bounds + | +help: consider adding an explicit lifetime bound + | +LL | ) -> ServiceChainBuilder<ServiceChain<P, S>, NS> where <P as Service>::Error: 'static { + | ++++++++++++++++++++++++++++++++++++ + +error[E0310]: the associated type `<S as Service>::Error` may not live long enough + --> $DIR/sod_service_chain.rs:29:5 + | +LL | / pub fn next<NS: Service<Input = S::Output>>( +... | +LL | | self, +LL | | ) -> ServiceChainBuilder<ServiceChain<P, S>, NS> { + | | ^ + | | | + | |____________________________________________________the associated type `<S as Service>::Error` must be valid for the static lifetime... + | ...so that the type `<S as Service>::Error` will meet its required lifetime bounds + | +help: consider adding an explicit lifetime bound + | +LL | ) -> ServiceChainBuilder<ServiceChain<P, S>, NS> where <S as Service>::Error: 'static { + | ++++++++++++++++++++++++++++++++++++ + +error[E0310]: the associated type `<P as Service>::Error` may not live long enough + --> $DIR/sod_service_chain.rs:38:10 | LL | ) -> ServiceChainBuilder<ServiceChain<P, S>, NS> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -13,7 +47,7 @@ LL | ) -> ServiceChainBuilder<ServiceChain<P, S>, NS> where <P as Service>:: | ++++++++++++++++++++++++++++++++++++ error[E0310]: the associated type `<S as Service>::Error` may not live long enough - --> $DIR/sod_service_chain.rs:31:10 + --> $DIR/sod_service_chain.rs:38:10 | LL | ) -> ServiceChainBuilder<ServiceChain<P, S>, NS> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -26,6 +60,42 @@ help: consider adding an explicit lifetime bound LL | ) -> ServiceChainBuilder<ServiceChain<P, S>, NS> where <S as Service>::Error: 'static { | ++++++++++++++++++++++++++++++++++++ -error: aborting due to 2 previous errors +error[E0310]: the associated type `<P as Service>::Error` may not live long enough + --> $DIR/sod_service_chain.rs:29:5 + | +LL | / pub fn next<NS: Service<Input = S::Output>>( +... | +LL | | self, +LL | | ) -> ServiceChainBuilder<ServiceChain<P, S>, NS> { + | | ^ + | | | + | |____________________________________________________the associated type `<P as Service>::Error` must be valid for the static lifetime... + | ...so that the type `<P as Service>::Error` will meet its required lifetime bounds + | + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` +help: consider adding an explicit lifetime bound + | +LL | ) -> ServiceChainBuilder<ServiceChain<P, S>, NS> where <P as Service>::Error: 'static { + | ++++++++++++++++++++++++++++++++++++ + +error[E0310]: the associated type `<S as Service>::Error` may not live long enough + --> $DIR/sod_service_chain.rs:29:5 + | +LL | / pub fn next<NS: Service<Input = S::Output>>( +... | +LL | | self, +LL | | ) -> ServiceChainBuilder<ServiceChain<P, S>, NS> { + | | ^ + | | | + | |____________________________________________________the associated type `<S as Service>::Error` must be valid for the static lifetime... + | ...so that the type `<S as Service>::Error` will meet its required lifetime bounds + | + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` +help: consider adding an explicit lifetime bound + | +LL | ) -> ServiceChainBuilder<ServiceChain<P, S>, NS> where <S as Service>::Error: 'static { + | ++++++++++++++++++++++++++++++++++++ + +error: aborting due to 6 previous errors For more information about this error, try `rustc --explain E0310`. diff --git a/tests/ui/imports/import-prefix-macro-2.rs b/tests/ui/imports/import-prefix-macro-2.rs index 952d161e83f..17898c0a679 100644 --- a/tests/ui/imports/import-prefix-macro-2.rs +++ b/tests/ui/imports/import-prefix-macro-2.rs @@ -8,7 +8,7 @@ mod a { } macro_rules! import { - ($p: path) => (use ::$p {S, Z}); //~ERROR expected identifier, found `a::b::c` + ($p: path) => (use ::$p {S, Z}); //~ERROR expected identifier, found metavariable } import! { a::b::c } diff --git a/tests/ui/imports/import-prefix-macro-2.stderr b/tests/ui/imports/import-prefix-macro-2.stderr index 070186f2bf2..fbeca99b138 100644 --- a/tests/ui/imports/import-prefix-macro-2.stderr +++ b/tests/ui/imports/import-prefix-macro-2.stderr @@ -1,8 +1,8 @@ -error: expected identifier, found `a::b::c` +error: expected identifier, found metavariable --> $DIR/import-prefix-macro-2.rs:11:26 | LL | ($p: path) => (use ::$p {S, Z}); - | ^^ expected identifier + | ^^ expected identifier, found metavariable ... LL | import! { a::b::c } | ------------------- in this macro invocation diff --git a/tests/ui/inference/issue-86094-suggest-add-return-to-coerce-ret-ty.stderr b/tests/ui/inference/issue-86094-suggest-add-return-to-coerce-ret-ty.stderr index 1fea73529a8..c61ca699b0d 100644 --- a/tests/ui/inference/issue-86094-suggest-add-return-to-coerce-ret-ty.stderr +++ b/tests/ui/inference/issue-86094-suggest-add-return-to-coerce-ret-ty.stderr @@ -8,10 +8,6 @@ help: consider specifying the generic arguments | LL | Err::<T, MyError>(MyError); | ++++++++++++++ -help: you might have meant to return this to infer its type parameters - | -LL | return Err(MyError); - | ++++++ error[E0282]: type annotations needed --> $DIR/issue-86094-suggest-add-return-to-coerce-ret-ty.rs:14:9 @@ -23,10 +19,6 @@ help: consider specifying the generic arguments | LL | Ok::<(), E>(()); | +++++++++ -help: you might have meant to return this to infer its type parameters - | -LL | return Ok(()); - | ++++++ error[E0308]: mismatched types --> $DIR/issue-86094-suggest-add-return-to-coerce-ret-ty.rs:21:20 diff --git a/tests/ui/infinite/infinite-instantiation-struct-tail-ice-114484.rs b/tests/ui/infinite/infinite-instantiation-struct-tail-ice-114484.rs index 62fc079d9d9..e28b8f373da 100644 --- a/tests/ui/infinite/infinite-instantiation-struct-tail-ice-114484.rs +++ b/tests/ui/infinite/infinite-instantiation-struct-tail-ice-114484.rs @@ -3,9 +3,6 @@ //@ error-pattern: reached the recursion limit while instantiating //@ error-pattern: reached the recursion limit finding the struct tail -// The regex below normalizes the long type file name to make it suitable for compare-modes. -//@ normalize-stderr: "'\$TEST_BUILD_DIR/.*\.long-type.txt'" -> "'$$TEST_BUILD_DIR/$$FILE.long-type.txt'" - // Regression test for #114484: This used to ICE during monomorphization, because we treated // `<VirtualWrapper<...> as Pointee>::Metadata` as a rigid projection after reaching the recursion // limit when finding the struct tail. diff --git a/tests/ui/infinite/infinite-instantiation-struct-tail-ice-114484.stderr b/tests/ui/infinite/infinite-instantiation-struct-tail-ice-114484.stderr index b67e000bf74..475e26fd0f0 100644 --- a/tests/ui/infinite/infinite-instantiation-struct-tail-ice-114484.stderr +++ b/tests/ui/infinite/infinite-instantiation-struct-tail-ice-114484.stderr @@ -18,7 +18,7 @@ error: reached the recursion limit finding the struct tail for `[u8; 256]` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` note: the above error was encountered while instantiating `fn virtualize_my_trait::<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<SomeData<256>, 0>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>>` - --> $DIR/infinite-instantiation-struct-tail-ice-114484.rs:29:18 + --> $DIR/infinite-instantiation-struct-tail-ice-114484.rs:26:18 | LL | unsafe { virtualize_my_trait(L, self) } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -43,7 +43,7 @@ error: reached the recursion limit finding the struct tail for `SomeData<256>` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` note: the above error was encountered while instantiating `fn virtualize_my_trait::<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<SomeData<256>, 0>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>>` - --> $DIR/infinite-instantiation-struct-tail-ice-114484.rs:29:18 + --> $DIR/infinite-instantiation-struct-tail-ice-114484.rs:26:18 | LL | unsafe { virtualize_my_trait(L, self) } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -68,7 +68,7 @@ error: reached the recursion limit finding the struct tail for `VirtualWrapper<S = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` note: the above error was encountered while instantiating `fn virtualize_my_trait::<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<SomeData<256>, 0>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>>` - --> $DIR/infinite-instantiation-struct-tail-ice-114484.rs:29:18 + --> $DIR/infinite-instantiation-struct-tail-ice-114484.rs:26:18 | LL | unsafe { virtualize_my_trait(L, self) } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -76,11 +76,11 @@ LL | unsafe { virtualize_my_trait(L, self) } error: reached the recursion limit while instantiating `<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<..., 1>, 1>, 1>, 1>, 1> as MyTrait>::virtualize` | note: `<VirtualWrapper<T, L> as MyTrait>::virtualize` defined here - --> $DIR/infinite-instantiation-struct-tail-ice-114484.rs:28:5 + --> $DIR/infinite-instantiation-struct-tail-ice-114484.rs:25:5 | LL | fn virtualize(&self) -> &dyn MyTrait { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - = note: the full type name has been written to '$TEST_BUILD_DIR/$FILE.long-type.txt' + = note: the full type name has been written to '$TEST_BUILD_DIR/infinite-instantiation-struct-tail-ice-114484.long-type.txt' error: aborting due to 13 previous errors diff --git a/tests/ui/infinite/infinite-instantiation.rs b/tests/ui/infinite/infinite-instantiation.rs index d5cb8e79592..7898cc1ffc1 100644 --- a/tests/ui/infinite/infinite-instantiation.rs +++ b/tests/ui/infinite/infinite-instantiation.rs @@ -1,6 +1,4 @@ //@ build-fail -// The regex below normalizes the long type file name to make it suitable for compare-modes. -//@ normalize-stderr: "'\$TEST_BUILD_DIR/.*\.long-type.txt'" -> "'$$TEST_BUILD_DIR/$$FILE.long-type.txt'" trait ToOpt: Sized { fn to_option(&self) -> Option<Self>; diff --git a/tests/ui/infinite/infinite-instantiation.stderr b/tests/ui/infinite/infinite-instantiation.stderr index 71c745cf5eb..d7a4a49961a 100644 --- a/tests/ui/infinite/infinite-instantiation.stderr +++ b/tests/ui/infinite/infinite-instantiation.stderr @@ -1,15 +1,15 @@ error: reached the recursion limit while instantiating `function::<Option<Option<Option<Option<Option<...>>>>>>` - --> $DIR/infinite-instantiation.rs:23:9 + --> $DIR/infinite-instantiation.rs:21:9 | LL | function(counter - 1, t.to_option()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: `function` defined here - --> $DIR/infinite-instantiation.rs:21:1 + --> $DIR/infinite-instantiation.rs:19:1 | LL | fn function<T:ToOpt + Clone>(counter: usize, t: T) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - = note: the full type name has been written to '$TEST_BUILD_DIR/$FILE.long-type.txt' + = note: the full type name has been written to '$TEST_BUILD_DIR/infinite-instantiation.long-type.txt' error: aborting due to 1 previous error diff --git a/tests/ui/infinite/infinite-recursion-const-fn.rs b/tests/ui/infinite/infinite-recursion-const-fn.rs index 4209153116d..7b7f6fafab5 100644 --- a/tests/ui/infinite/infinite-recursion-const-fn.rs +++ b/tests/ui/infinite/infinite-recursion-const-fn.rs @@ -1,11 +1,11 @@ //https://github.com/rust-lang/rust/issues/31364 const fn a() -> usize { - b() //~ ERROR evaluation of constant value failed [E0080] + b() } const fn b() -> usize { a() } -const ARR: [i32; a()] = [5; 6]; +const ARR: [i32; a()] = [5; 6]; //~ ERROR evaluation of constant value failed [E0080] fn main() {} diff --git a/tests/ui/infinite/infinite-recursion-const-fn.stderr b/tests/ui/infinite/infinite-recursion-const-fn.stderr index fd5a3c3c546..524abdf4d7a 100644 --- a/tests/ui/infinite/infinite-recursion-const-fn.stderr +++ b/tests/ui/infinite/infinite-recursion-const-fn.stderr @@ -1,8 +1,8 @@ error[E0080]: evaluation of constant value failed - --> $DIR/infinite-recursion-const-fn.rs:4:5 + --> $DIR/infinite-recursion-const-fn.rs:9:18 | -LL | b() - | ^^^ reached the configured maximum number of stack frames +LL | const ARR: [i32; a()] = [5; 6]; + | ^^^ reached the configured maximum number of stack frames | note: inside `a` --> $DIR/infinite-recursion-const-fn.rs:4:5 @@ -638,12 +638,7 @@ note: inside `a` --> $DIR/infinite-recursion-const-fn.rs:4:5 | LL | b() - | ^^^ -note: inside `ARR::{constant#0}` - --> $DIR/infinite-recursion-const-fn.rs:9:18 - | -LL | const ARR: [i32; a()] = [5; 6]; - | ^^^ + | ^^^ the failure occurred here error: aborting due to 1 previous error diff --git a/tests/ui/inline-const/collect-scopes-in-pat.rs b/tests/ui/inline-const/collect-scopes-in-pat.rs index 024fde53741..16baf920f58 100644 --- a/tests/ui/inline-const/collect-scopes-in-pat.rs +++ b/tests/ui/inline-const/collect-scopes-in-pat.rs @@ -1,4 +1,4 @@ -// @compile-flags: -Zlint-mir +//@ compile-flags: -Zlint-mir //@ check-pass #![feature(inline_const_pat)] diff --git a/tests/ui/inline-const/const-expr-generic-err.stderr b/tests/ui/inline-const/const-expr-generic-err.stderr index dcd6b62bbfc..e67c0b28e02 100644 --- a/tests/ui/inline-const/const-expr-generic-err.stderr +++ b/tests/ui/inline-const/const-expr-generic-err.stderr @@ -2,7 +2,7 @@ error[E0080]: evaluation of `foo::<i32>::{constant#0}` failed --> $DIR/const-expr-generic-err.rs:4:13 | LL | const { assert!(std::mem::size_of::<T>() == 0); } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the evaluated program panicked at 'assertion failed: std::mem::size_of::<T>() == 0', $DIR/const-expr-generic-err.rs:4:13 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation panicked: assertion failed: std::mem::size_of::<T>() == 0 | = note: this error originates in the macro `assert` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/tests/ui/inline-const/required-const.stderr b/tests/ui/inline-const/required-const.stderr index 6ca4c250223..a6c630b5477 100644 --- a/tests/ui/inline-const/required-const.stderr +++ b/tests/ui/inline-const/required-const.stderr @@ -2,7 +2,7 @@ error[E0080]: evaluation of `foo::<i32>::{constant#0}` failed --> $DIR/required-const.rs:6:17 | LL | const { panic!() } - | ^^^^^^^^ the evaluated program panicked at 'explicit panic', $DIR/required-const.rs:6:17 + | ^^^^^^^^ evaluation panicked: explicit panic | = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/tests/ui/internal/internal-unstable.rs b/tests/ui/internal/internal-unstable.rs index 35a2941633a..381c1337148 100644 --- a/tests/ui/internal/internal-unstable.rs +++ b/tests/ui/internal/internal-unstable.rs @@ -7,7 +7,7 @@ extern crate internal_unstable; struct Baz { - #[allow_internal_unstable] + #[allow_internal_unstable] //~ ERROR `allow_internal_unstable` expects a list of feature names baz: u8, } @@ -56,7 +56,7 @@ fn main() { bar!(internal_unstable::unstable()); //~ ERROR use of unstable match true { - #[allow_internal_unstable] + #[allow_internal_unstable] //~ ERROR `allow_internal_unstable` expects a list of feature names _ => {} } diff --git a/tests/ui/internal/internal-unstable.stderr b/tests/ui/internal/internal-unstable.stderr index ea74175f09b..bbf589d3f92 100644 --- a/tests/ui/internal/internal-unstable.stderr +++ b/tests/ui/internal/internal-unstable.stderr @@ -1,3 +1,15 @@ +error: `allow_internal_unstable` expects a list of feature names + --> $DIR/internal-unstable.rs:10:5 + | +LL | #[allow_internal_unstable] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: `allow_internal_unstable` expects a list of feature names + --> $DIR/internal-unstable.rs:59:9 + | +LL | #[allow_internal_unstable] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + error[E0658]: use of unstable library feature `function` --> $DIR/internal-unstable.rs:48:25 | @@ -47,6 +59,6 @@ LL | bar!(internal_unstable::unstable()); = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date = note: this error originates in the macro `foo` which comes from the expansion of the macro `bar` (in Nightly builds, run with -Z macro-backtrace for more info) -error: aborting due to 5 previous errors +error: aborting due to 7 previous errors For more information about this error, try `rustc --explain E0658`. diff --git a/tests/ui/intrinsics/always-gets-overridden.rs b/tests/ui/intrinsics/always-gets-overridden.rs index 2fb64f96d83..aaac5415c21 100644 --- a/tests/ui/intrinsics/always-gets-overridden.rs +++ b/tests/ui/intrinsics/always-gets-overridden.rs @@ -1,5 +1,5 @@ -//! Check that `vtable_size` gets overridden by llvm backend even if there is no -//! `rustc_intrinsic_must_be_overridden` attribute on this usage. +//! Check that `vtable_size` gets overridden by llvm backend even if there is a +//! fallback body. #![feature(intrinsics)] //@run-pass diff --git a/tests/ui/intrinsics/bad-intrinsic-monomorphization.rs b/tests/ui/intrinsics/bad-intrinsic-monomorphization.rs index 254ac24f0b9..d68cbf26ef1 100644 --- a/tests/ui/intrinsics/bad-intrinsic-monomorphization.rs +++ b/tests/ui/intrinsics/bad-intrinsic-monomorphization.rs @@ -7,10 +7,6 @@ // Bad monomorphizations could previously cause LLVM asserts even though the // error was caught in the compiler. -extern "rust-intrinsic" { - fn simd_add<T>(x: T, y: T) -> T; -} - use std::intrinsics; #[derive(Copy, Clone)] @@ -27,6 +23,6 @@ pub unsafe fn test_fadd_fast(a: Foo, b: Foo) -> Foo { } pub unsafe fn test_simd_add(a: Foo, b: Foo) -> Foo { - simd_add(a, b) + intrinsics::simd::simd_add(a, b) //~^ ERROR `simd_add` intrinsic: expected SIMD input type, found non-SIMD `Foo` } diff --git a/tests/ui/intrinsics/bad-intrinsic-monomorphization.stderr b/tests/ui/intrinsics/bad-intrinsic-monomorphization.stderr index c070f018181..f49d95e9cfc 100644 --- a/tests/ui/intrinsics/bad-intrinsic-monomorphization.stderr +++ b/tests/ui/intrinsics/bad-intrinsic-monomorphization.stderr @@ -1,20 +1,20 @@ error[E0511]: invalid monomorphization of `cttz` intrinsic: expected basic integer type, found `Foo` - --> $DIR/bad-intrinsic-monomorphization.rs:20:5 + --> $DIR/bad-intrinsic-monomorphization.rs:16:5 | LL | intrinsics::cttz(v) | ^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `fadd_fast` intrinsic: expected basic float type, found `Foo` - --> $DIR/bad-intrinsic-monomorphization.rs:25:5 + --> $DIR/bad-intrinsic-monomorphization.rs:21:5 | LL | intrinsics::fadd_fast(a, b) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_add` intrinsic: expected SIMD input type, found non-SIMD `Foo` - --> $DIR/bad-intrinsic-monomorphization.rs:30:5 + --> $DIR/bad-intrinsic-monomorphization.rs:26:5 | -LL | simd_add(a, b) - | ^^^^^^^^^^^^^^ +LL | intrinsics::simd::simd_add(a, b) + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 3 previous errors diff --git a/tests/ui/invalid-compile-flags/print-without-arg.stderr b/tests/ui/invalid-compile-flags/print-without-arg.stderr index a18d2779cad..05d42247d41 100644 --- a/tests/ui/invalid-compile-flags/print-without-arg.stderr +++ b/tests/ui/invalid-compile-flags/print-without-arg.stderr @@ -1,5 +1,5 @@ error: Argument to option 'print' missing Usage: - --print [crate-name|file-names|sysroot|target-libdir|cfg|check-cfg|calling-conventions|target-list|target-cpus|target-features|relocation-models|code-models|tls-models|target-spec-json|all-target-specs-json|native-static-libs|stack-protector-strategies|link-args|deployment-target] + --print [all-target-specs-json|calling-conventions|cfg|check-cfg|code-models|crate-name|deployment-target|file-names|host-tuple|link-args|native-static-libs|relocation-models|split-debuginfo|stack-protector-strategies|sysroot|target-cpus|target-features|target-libdir|target-list|target-spec-json|tls-models] Compiler information to print on stdout diff --git a/tests/ui/invalid/issue-114435-layout-type-err.rs b/tests/ui/invalid/issue-114435-layout-type-err.rs index f68744a13c1..2a86839e416 100644 --- a/tests/ui/invalid/issue-114435-layout-type-err.rs +++ b/tests/ui/invalid/issue-114435-layout-type-err.rs @@ -1,6 +1,6 @@ -//@ build-fail +//@ check-fail //@ compile-flags: --crate-type lib -Cdebuginfo=2 -//@ error-pattern: the type has an unknown layout +//@ error-pattern: recursion limit #![recursion_limit = "10"] macro_rules! link { @@ -28,7 +28,6 @@ impl Bottom { } } - link!(A, B); link!(B, C); link!(C, D); @@ -41,4 +40,4 @@ link!(I, J); link!(J, K); link!(K, Bottom); -fn main() { } +fn main() {} diff --git a/tests/ui/invalid/issue-114435-layout-type-err.stderr b/tests/ui/invalid/issue-114435-layout-type-err.stderr index a2db74ff8bd..2fddc62f004 100644 --- a/tests/ui/invalid/issue-114435-layout-type-err.stderr +++ b/tests/ui/invalid/issue-114435-layout-type-err.stderr @@ -2,7 +2,5 @@ error: reached the recursion limit finding the struct tail for `Bottom` | = help: consider increasing the recursion limit by adding a `#![recursion_limit = "20"]` -error: the type has an unknown layout - -error: aborting due to 2 previous errors +error: aborting due to 1 previous error diff --git a/tests/ui/invalid_dispatch_from_dyn_impls.rs b/tests/ui/invalid_dispatch_from_dyn_impls.rs index b7bc766fbe0..972465d7197 100644 --- a/tests/ui/invalid_dispatch_from_dyn_impls.rs +++ b/tests/ui/invalid_dispatch_from_dyn_impls.rs @@ -8,9 +8,10 @@ use std::{ struct WrapperWithExtraField<T>(T, i32); impl<T, U> DispatchFromDyn<WrapperWithExtraField<U>> for WrapperWithExtraField<T> +//~^ ERROR [E0378] where T: DispatchFromDyn<U>, -{} //~^^^ ERROR [E0378] +{} struct MultiplePointers<T: ?Sized>{ @@ -19,9 +20,10 @@ struct MultiplePointers<T: ?Sized>{ } impl<T: ?Sized, U: ?Sized> DispatchFromDyn<MultiplePointers<U>> for MultiplePointers<T> +//~^ implementing `DispatchFromDyn` does not allow multiple fields to be coerced where T: Unsize<U>, -{} //~^^^ ERROR [E0378] +{} struct NothingToCoerce<T: ?Sized> { @@ -29,23 +31,25 @@ struct NothingToCoerce<T: ?Sized> { } impl<T: ?Sized, U: ?Sized> DispatchFromDyn<NothingToCoerce<T>> for NothingToCoerce<U> {} -//~^ ERROR [E0378] +//~^ ERROR implementing `DispatchFromDyn` requires a field to be coerced #[repr(C)] struct HasReprC<T: ?Sized>(Box<T>); impl<T: ?Sized, U: ?Sized> DispatchFromDyn<HasReprC<U>> for HasReprC<T> +//~^ ERROR [E0378] where T: Unsize<U>, -{} //~^^^ ERROR [E0378] +{} #[repr(align(64))] struct OverAlignedZst; struct OverAligned<T: ?Sized>(Box<T>, OverAlignedZst); impl<T: ?Sized, U: ?Sized> DispatchFromDyn<OverAligned<U>> for OverAligned<T> +//~^ ERROR [E0378] where T: Unsize<U>, -{} //~^^^ ERROR [E0378] +{} fn main() {} diff --git a/tests/ui/invalid_dispatch_from_dyn_impls.stderr b/tests/ui/invalid_dispatch_from_dyn_impls.stderr index 02718334c73..93ec6bbe089 100644 --- a/tests/ui/invalid_dispatch_from_dyn_impls.stderr +++ b/tests/ui/invalid_dispatch_from_dyn_impls.stderr @@ -2,25 +2,32 @@ error[E0378]: the trait `DispatchFromDyn` may only be implemented for structs co --> $DIR/invalid_dispatch_from_dyn_impls.rs:10:1 | LL | / impl<T, U> DispatchFromDyn<WrapperWithExtraField<U>> for WrapperWithExtraField<T> +LL | | LL | | where LL | | T: DispatchFromDyn<U>, | |__________________________^ | = note: extra field `1` of type `i32` is not allowed -error[E0378]: implementing the `DispatchFromDyn` trait requires multiple coercions - --> $DIR/invalid_dispatch_from_dyn_impls.rs:21:1 +error[E0375]: implementing `DispatchFromDyn` does not allow multiple fields to be coerced + --> $DIR/invalid_dispatch_from_dyn_impls.rs:22:1 | LL | / impl<T: ?Sized, U: ?Sized> DispatchFromDyn<MultiplePointers<U>> for MultiplePointers<T> +LL | | LL | | where LL | | T: Unsize<U>, | |_________________^ | - = note: the trait `DispatchFromDyn` may only be implemented for a coercion between structures with a single field being coerced - = note: currently, 2 fields need coercions: `ptr1` (`*const T` to `*const U`), `ptr2` (`*const T` to `*const U`) +note: the trait `DispatchFromDyn` may only be implemented when a single field is being coerced + --> $DIR/invalid_dispatch_from_dyn_impls.rs:18:5 + | +LL | ptr1: *const T, + | ^^^^^^^^^^^^^^ +LL | ptr2: *const T, + | ^^^^^^^^^^^^^^ -error[E0378]: the trait `DispatchFromDyn` may only be implemented for a coercion between structures - --> $DIR/invalid_dispatch_from_dyn_impls.rs:31:1 +error[E0374]: implementing `DispatchFromDyn` requires a field to be coerced + --> $DIR/invalid_dispatch_from_dyn_impls.rs:33:1 | LL | impl<T: ?Sized, U: ?Sized> DispatchFromDyn<NothingToCoerce<T>> for NothingToCoerce<U> {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -28,17 +35,19 @@ LL | impl<T: ?Sized, U: ?Sized> DispatchFromDyn<NothingToCoerce<T>> for NothingT = note: expected a single field to be coerced, none found error[E0378]: structs implementing `DispatchFromDyn` may not have `#[repr(packed)]` or `#[repr(C)]` - --> $DIR/invalid_dispatch_from_dyn_impls.rs:37:1 + --> $DIR/invalid_dispatch_from_dyn_impls.rs:39:1 | LL | / impl<T: ?Sized, U: ?Sized> DispatchFromDyn<HasReprC<U>> for HasReprC<T> +LL | | LL | | where LL | | T: Unsize<U>, | |_________________^ error[E0378]: the trait `DispatchFromDyn` may only be implemented for structs containing the field being coerced, ZST fields with 1 byte alignment that don't mention type/const generics, and nothing else - --> $DIR/invalid_dispatch_from_dyn_impls.rs:46:1 + --> $DIR/invalid_dispatch_from_dyn_impls.rs:49:1 | LL | / impl<T: ?Sized, U: ?Sized> DispatchFromDyn<OverAligned<U>> for OverAligned<T> +LL | | LL | | where LL | | T: Unsize<U>, | |_____________________^ @@ -47,4 +56,5 @@ LL | | T: Unsize<U>, error: aborting due to 5 previous errors -For more information about this error, try `rustc --explain E0378`. +Some errors have detailed explanations: E0374, E0375, E0378. +For more information about an error, try `rustc --explain E0374`. diff --git a/tests/ui/issues/issue-106755.rs b/tests/ui/issues/issue-106755.rs index 689b1d885ae..d7e7122ebda 100644 --- a/tests/ui/issues/issue-106755.rs +++ b/tests/ui/issues/issue-106755.rs @@ -10,10 +10,13 @@ struct TestType<T>(::std::marker::PhantomData<T>); unsafe impl<T: MyTrait + 'static> Send for TestType<T> {} -impl<T: MyTrait> !Send for TestType<T> {} //~ ERROR found both positive and negative implementation +impl<T: MyTrait> !Send for TestType<T> {} +//~^ ERROR found both positive and negative implementation +//~| ERROR `!Send` impl requires `T: MyTrait` but the struct it is implemented for does not unsafe impl<T: 'static> Send for TestType<T> {} //~ ERROR conflicting implementations impl !Send for TestType<i32> {} +//~^ ERROR `!Send` impls cannot be specialized fn main() {} diff --git a/tests/ui/issues/issue-106755.stderr b/tests/ui/issues/issue-106755.stderr index 54397034062..da6b8c5c563 100644 --- a/tests/ui/issues/issue-106755.stderr +++ b/tests/ui/issues/issue-106755.stderr @@ -8,7 +8,7 @@ LL | impl<T: MyTrait> !Send for TestType<T> {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ negative implementation here error[E0119]: conflicting implementations of trait `Send` for type `TestType<_>` - --> $DIR/issue-106755.rs:15:1 + --> $DIR/issue-106755.rs:17:1 | LL | unsafe impl<T: MyTrait + 'static> Send for TestType<T> {} | ------------------------------------------------------ first implementation here @@ -16,7 +16,32 @@ LL | unsafe impl<T: MyTrait + 'static> Send for TestType<T> {} LL | unsafe impl<T: 'static> Send for TestType<T> {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `TestType<_>` -error: aborting due to 2 previous errors +error[E0367]: `!Send` impl requires `T: MyTrait` but the struct it is implemented for does not + --> $DIR/issue-106755.rs:13:9 + | +LL | impl<T: MyTrait> !Send for TestType<T> {} + | ^^^^^^^ + | +note: the implementor must specify the same requirement + --> $DIR/issue-106755.rs:9:1 + | +LL | struct TestType<T>(::std::marker::PhantomData<T>); + | ^^^^^^^^^^^^^^^^^^ + +error[E0366]: `!Send` impls cannot be specialized + --> $DIR/issue-106755.rs:19:1 + | +LL | impl !Send for TestType<i32> {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: `i32` is not a generic parameter +note: use the same sequence of generic lifetime, type and const parameters as the struct definition + --> $DIR/issue-106755.rs:9:1 + | +LL | struct TestType<T>(::std::marker::PhantomData<T>); + | ^^^^^^^^^^^^^^^^^^ + +error: aborting due to 4 previous errors -Some errors have detailed explanations: E0119, E0751. +Some errors have detailed explanations: E0119, E0366, E0367, E0751. For more information about an error, try `rustc --explain E0119`. diff --git a/tests/ui/issues/issue-13497.rs b/tests/ui/issues/issue-13497.rs index 7f786a54b9f..4b2795aa841 100644 --- a/tests/ui/issues/issue-13497.rs +++ b/tests/ui/issues/issue-13497.rs @@ -3,7 +3,6 @@ fn read_lines_borrowed1() -> Vec< > { let rawLines: Vec<String> = vec!["foo ".to_string(), " bar".to_string()]; rawLines.iter().map(|l| l.trim()).collect() - //~^ ERROR: cannot return value referencing } fn main() {} diff --git a/tests/ui/issues/issue-13497.stderr b/tests/ui/issues/issue-13497.stderr index 8016b55d6aa..ee111f1d262 100644 --- a/tests/ui/issues/issue-13497.stderr +++ b/tests/ui/issues/issue-13497.stderr @@ -15,16 +15,6 @@ LL - &str LL + String | -error[E0515]: cannot return value referencing local variable `rawLines` - --> $DIR/issue-13497.rs:5:5 - | -LL | rawLines.iter().map(|l| l.trim()).collect() - | --------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | | - | returns a value referencing data owned by the current function - | `rawLines` is borrowed here - -error: aborting due to 2 previous errors +error: aborting due to 1 previous error -Some errors have detailed explanations: E0106, E0515. -For more information about an error, try `rustc --explain E0106`. +For more information about this error, try `rustc --explain E0106`. diff --git a/tests/ui/issues/issue-17373.stderr b/tests/ui/issues/issue-17373.stderr index 9438f5c6345..0e16d08c87d 100644 --- a/tests/ui/issues/issue-17373.stderr +++ b/tests/ui/issues/issue-17373.stderr @@ -2,7 +2,7 @@ error[E0614]: type `!` cannot be dereferenced --> $DIR/issue-17373.rs:2:5 | LL | *return - | ^^^^^^^ + | ^^^^^^^ can't be dereferenced error: aborting due to 1 previous error diff --git a/tests/ui/issues/issue-20413.rs b/tests/ui/issues/issue-20413.rs index 7766f375599..138a235e675 100644 --- a/tests/ui/issues/issue-20413.rs +++ b/tests/ui/issues/issue-20413.rs @@ -1,4 +1,3 @@ -//@ normalize-stderr: "long-type-\d+" -> "long-type-hash" trait Foo { fn answer(self); } diff --git a/tests/ui/issues/issue-20413.stderr b/tests/ui/issues/issue-20413.stderr index 5d442eb9898..42f3cd2d062 100644 --- a/tests/ui/issues/issue-20413.stderr +++ b/tests/ui/issues/issue-20413.stderr @@ -1,5 +1,5 @@ error[E0392]: type parameter `T` is never used - --> $DIR/issue-20413.rs:6:15 + --> $DIR/issue-20413.rs:5:15 | LL | struct NoData<T>; | ^ unused type parameter @@ -8,14 +8,14 @@ LL | struct NoData<T>; = help: if you intended `T` to be a const parameter, use `const T: /* Type */` instead error[E0275]: overflow evaluating the requirement `NoData<NoData<NoData<NoData<NoData<NoData<NoData<...>>>>>>>: Foo` - --> $DIR/issue-20413.rs:9:36 + --> $DIR/issue-20413.rs:8:36 | LL | impl<T> Foo for T where NoData<T>: Foo { | ^^^ | = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`issue_20413`) note: required for `NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<T>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>` to implement `Foo` - --> $DIR/issue-20413.rs:9:9 + --> $DIR/issue-20413.rs:8:9 | LL | impl<T> Foo for T where NoData<T>: Foo { | ^^^ ^ --- unsatisfied trait bound introduced here @@ -23,19 +23,19 @@ LL | impl<T> Foo for T where NoData<T>: Foo { = note: required for `NoData<T>` to implement `Foo` error[E0275]: overflow evaluating the requirement `AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<...>>>>>>>: Bar` - --> $DIR/issue-20413.rs:28:42 + --> $DIR/issue-20413.rs:27:42 | LL | impl<T> Bar for T where EvenLessData<T>: Baz { | ^^^ | = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`issue_20413`) note: required for `EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<T>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>` to implement `Baz` - --> $DIR/issue-20413.rs:35:9 + --> $DIR/issue-20413.rs:34:9 | LL | impl<T> Baz for T where AlmostNoData<T>: Bar { | ^^^ ^ --- unsatisfied trait bound introduced here note: required for `AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<T>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>` to implement `Bar` - --> $DIR/issue-20413.rs:28:9 + --> $DIR/issue-20413.rs:27:9 | LL | impl<T> Bar for T where EvenLessData<T>: Baz { | ^^^ ^ --- unsatisfied trait bound introduced here @@ -43,19 +43,19 @@ LL | impl<T> Bar for T where EvenLessData<T>: Baz { = note: required for `EvenLessData<T>` to implement `Baz` error[E0275]: overflow evaluating the requirement `EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<...>>>>>>>: Baz` - --> $DIR/issue-20413.rs:35:42 + --> $DIR/issue-20413.rs:34:42 | LL | impl<T> Baz for T where AlmostNoData<T>: Bar { | ^^^ | = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`issue_20413`) note: required for `AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<T>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>` to implement `Bar` - --> $DIR/issue-20413.rs:28:9 + --> $DIR/issue-20413.rs:27:9 | LL | impl<T> Bar for T where EvenLessData<T>: Baz { | ^^^ ^ --- unsatisfied trait bound introduced here note: required for `EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<T>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>` to implement `Baz` - --> $DIR/issue-20413.rs:35:9 + --> $DIR/issue-20413.rs:34:9 | LL | impl<T> Baz for T where AlmostNoData<T>: Bar { | ^^^ ^ --- unsatisfied trait bound introduced here diff --git a/tests/ui/issues/issue-37311-type-length-limit/issue-37311.rs b/tests/ui/issues/issue-37311-type-length-limit/issue-37311.rs index ebaf244ac9c..05adde45204 100644 --- a/tests/ui/issues/issue-37311-type-length-limit/issue-37311.rs +++ b/tests/ui/issues/issue-37311-type-length-limit/issue-37311.rs @@ -1,6 +1,4 @@ //@ build-fail -// The regex below normalizes the long type file name to make it suitable for compare-modes. -//@ normalize-stderr: "'\$TEST_BUILD_DIR/.*\.long-type.txt'" -> "'$$TEST_BUILD_DIR/$$FILE.long-type.txt'" trait Mirror { type Image; diff --git a/tests/ui/issues/issue-37311-type-length-limit/issue-37311.stderr b/tests/ui/issues/issue-37311-type-length-limit/issue-37311.stderr index fbbf80021be..945fa605e14 100644 --- a/tests/ui/issues/issue-37311-type-length-limit/issue-37311.stderr +++ b/tests/ui/issues/issue-37311-type-length-limit/issue-37311.stderr @@ -1,15 +1,15 @@ error: reached the recursion limit while instantiating `<(&(&(..., ...), ...), ...) as Foo>::recurse` - --> $DIR/issue-37311.rs:18:9 + --> $DIR/issue-37311.rs:16:9 | LL | (self, self).recurse(); | ^^^^^^^^^^^^^^^^^^^^^^ | note: `<T as Foo>::recurse` defined here - --> $DIR/issue-37311.rs:17:5 + --> $DIR/issue-37311.rs:15:5 | LL | fn recurse(&self) { | ^^^^^^^^^^^^^^^^^ - = note: the full type name has been written to '$TEST_BUILD_DIR/$FILE.long-type.txt' + = note: the full type name has been written to '$TEST_BUILD_DIR/issue-37311.long-type.txt' error: aborting due to 1 previous error diff --git a/tests/ui/issues/issue-43988.stderr b/tests/ui/issues/issue-43988.stderr index 7bbb8ed2ca9..d629f199b22 100644 --- a/tests/ui/issues/issue-43988.stderr +++ b/tests/ui/issues/issue-43988.stderr @@ -10,22 +10,6 @@ error: malformed `repr` attribute input LL | let _z = #[repr] 1; | ^^^^^^^ help: must be of the form: `#[repr(C)]` -error[E0518]: attribute should be applied to function or closure - --> $DIR/issue-43988.rs:5:5 - | -LL | #[inline] - | ^^^^^^^^^ -LL | let _a = 4; - | ----------- not a function or closure - -error[E0518]: attribute should be applied to function or closure - --> $DIR/issue-43988.rs:10:5 - | -LL | #[inline(XYZ)] - | ^^^^^^^^^^^^^^ -LL | let _b = 4; - | ----------- not a function or closure - error[E0552]: unrecognized representation hint --> $DIR/issue-43988.rs:14:12 | @@ -43,6 +27,22 @@ LL | #[repr(something_not_real)] = help: valid reprs are `Rust` (default), `C`, `align`, `packed`, `transparent`, `simd`, `i8`, `u8`, `i16`, `u16`, `i32`, `u32`, `i64`, `u64`, `i128`, `u128`, `isize`, `usize` error[E0518]: attribute should be applied to function or closure + --> $DIR/issue-43988.rs:5:5 + | +LL | #[inline] + | ^^^^^^^^^ +LL | let _a = 4; + | ----------- not a function or closure + +error[E0518]: attribute should be applied to function or closure + --> $DIR/issue-43988.rs:10:5 + | +LL | #[inline(XYZ)] + | ^^^^^^^^^^^^^^ +LL | let _b = 4; + | ----------- not a function or closure + +error[E0518]: attribute should be applied to function or closure --> $DIR/issue-43988.rs:30:5 | LL | #[inline(ABC)] diff --git a/tests/ui/issues/issue-44078.stderr b/tests/ui/issues/issue-44078.stderr index 41106b29aad..3e12de34e11 100644 --- a/tests/ui/issues/issue-44078.stderr +++ b/tests/ui/issues/issue-44078.stderr @@ -4,7 +4,7 @@ error[E0765]: unterminated double quote string LL | "😊""; | _________^ LL | | } - | |_^ + | |__^ error: aborting due to 1 previous error diff --git a/tests/ui/issues/issue-54410.stderr b/tests/ui/issues/issue-54410.stderr index 97e5990750e..2cd5a2a49ef 100644 --- a/tests/ui/issues/issue-54410.stderr +++ b/tests/ui/issues/issue-54410.stderr @@ -5,6 +5,7 @@ LL | pub static mut symbol: [i8]; | ^^^^ doesn't have a size known at compile-time | = help: the trait `Sized` is not implemented for `[i8]` + = note: statics and constants must have a statically known size error: aborting due to 1 previous error diff --git a/tests/ui/issues/issue-67552.rs b/tests/ui/issues/issue-67552.rs index 8c7e95bd2e3..53f0e931d60 100644 --- a/tests/ui/issues/issue-67552.rs +++ b/tests/ui/issues/issue-67552.rs @@ -1,7 +1,5 @@ //@ build-fail //@ compile-flags: -Copt-level=0 -// The regex below normalizes the long type file name to make it suitable for compare-modes. -//@ normalize-stderr: "'\$TEST_BUILD_DIR/.*\.long-type.txt'" -> "'$$TEST_BUILD_DIR/$$FILE.long-type.txt'" fn main() { rec(Empty); diff --git a/tests/ui/issues/issue-67552.stderr b/tests/ui/issues/issue-67552.stderr index f94cd78c870..def0a29f3e5 100644 --- a/tests/ui/issues/issue-67552.stderr +++ b/tests/ui/issues/issue-67552.stderr @@ -1,17 +1,17 @@ error: reached the recursion limit while instantiating `rec::<&mut &mut &mut &mut &mut ...>` - --> $DIR/issue-67552.rs:30:9 + --> $DIR/issue-67552.rs:28:9 | LL | rec(identity(&mut it)) | ^^^^^^^^^^^^^^^^^^^^^^ | note: `rec` defined here - --> $DIR/issue-67552.rs:23:1 + --> $DIR/issue-67552.rs:21:1 | LL | / fn rec<T>(mut it: T) LL | | where LL | | T: Iterator, | |________________^ - = note: the full type name has been written to '$TEST_BUILD_DIR/$FILE.long-type.txt' + = note: the full type name has been written to '$TEST_BUILD_DIR/issue-67552.long-type.txt' error: aborting due to 1 previous error diff --git a/tests/ui/issues/issue-76191.stderr b/tests/ui/issues/issue-76191.stderr index a397d082142..de08fc4ed0d 100644 --- a/tests/ui/issues/issue-76191.stderr +++ b/tests/ui/issues/issue-76191.stderr @@ -2,7 +2,7 @@ error[E0080]: evaluation of constant value failed --> $DIR/issue-76191.rs:8:37 | LL | const RANGE2: RangeInclusive<i32> = panic!(); - | ^^^^^^^^ the evaluated program panicked at 'explicit panic', $DIR/issue-76191.rs:8:37 + | ^^^^^^^^ evaluation panicked: explicit panic | = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/tests/ui/issues/issue-8727.rs b/tests/ui/issues/issue-8727.rs index 7767729109e..1883287f140 100644 --- a/tests/ui/issues/issue-8727.rs +++ b/tests/ui/issues/issue-8727.rs @@ -2,8 +2,6 @@ // recursions. //@ build-fail -// The regex below normalizes the long type file name to make it suitable for compare-modes. -//@ normalize-stderr: "'\$TEST_BUILD_DIR/.*\.long-type.txt'" -> "'$$TEST_BUILD_DIR/$$FILE.long-type.txt'" fn generic<T>() { //~ WARN function cannot return without recursing generic::<Option<T>>(); diff --git a/tests/ui/issues/issue-8727.stderr b/tests/ui/issues/issue-8727.stderr index 22286eb8d7b..04158962a01 100644 --- a/tests/ui/issues/issue-8727.stderr +++ b/tests/ui/issues/issue-8727.stderr @@ -1,5 +1,5 @@ warning: function cannot return without recursing - --> $DIR/issue-8727.rs:8:1 + --> $DIR/issue-8727.rs:6:1 | LL | fn generic<T>() { | ^^^^^^^^^^^^^^^ cannot return without recursing @@ -10,17 +10,17 @@ LL | generic::<Option<T>>(); = note: `#[warn(unconditional_recursion)]` on by default error: reached the recursion limit while instantiating `generic::<Option<Option<Option<Option<Option<...>>>>>>` - --> $DIR/issue-8727.rs:9:5 + --> $DIR/issue-8727.rs:7:5 | LL | generic::<Option<T>>(); | ^^^^^^^^^^^^^^^^^^^^^^ | note: `generic` defined here - --> $DIR/issue-8727.rs:8:1 + --> $DIR/issue-8727.rs:6:1 | LL | fn generic<T>() { | ^^^^^^^^^^^^^^^ - = note: the full type name has been written to '$TEST_BUILD_DIR/$FILE.long-type.txt' + = note: the full type name has been written to '$TEST_BUILD_DIR/issue-8727.long-type.txt' error: aborting due to 1 previous error; 1 warning emitted diff --git a/tests/ui/issues/issue-9814.stderr b/tests/ui/issues/issue-9814.stderr index d647edaf37e..fa23fb7c176 100644 --- a/tests/ui/issues/issue-9814.stderr +++ b/tests/ui/issues/issue-9814.stderr @@ -2,7 +2,7 @@ error[E0614]: type `Foo` cannot be dereferenced --> $DIR/issue-9814.rs:7:13 | LL | let _ = *Foo::Bar(2); - | ^^^^^^^^^^^^ + | ^^^^^^^^^^^^ can't be dereferenced error: aborting due to 1 previous error diff --git a/tests/ui/json/json-multiple.stderr b/tests/ui/json/json-multiple.stderr index 7689fb94a6c..e285817cffb 100644 --- a/tests/ui/json/json-multiple.stderr +++ b/tests/ui/json/json-multiple.stderr @@ -1 +1 @@ -{"$message_type":"artifact","artifact":"$TEST_BUILD_DIR/json/json-multiple/libjson_multiple.rlib","emit":"link"} +{"$message_type":"artifact","artifact":"$TEST_BUILD_DIR/libjson_multiple.rlib","emit":"link"} diff --git a/tests/ui/json/json-options.stderr b/tests/ui/json/json-options.stderr index 668fc18097f..fff4ec9a6df 100644 --- a/tests/ui/json/json-options.stderr +++ b/tests/ui/json/json-options.stderr @@ -1 +1 @@ -{"$message_type":"artifact","artifact":"$TEST_BUILD_DIR/json/json-options/libjson_options.rlib","emit":"link"} +{"$message_type":"artifact","artifact":"$TEST_BUILD_DIR/libjson_options.rlib","emit":"link"} diff --git a/tests/ui/kindck/kindck-inherited-copy-bound.rs b/tests/ui/kindck/kindck-inherited-copy-bound.rs index dda95229ddf..20d54a3fb10 100644 --- a/tests/ui/kindck/kindck-inherited-copy-bound.rs +++ b/tests/ui/kindck/kindck-inherited-copy-bound.rs @@ -1,8 +1,4 @@ // Test that Copy bounds inherited by trait are checked. -// -//@ revisions: curr dyn_compatible_for_dispatch - -#![cfg_attr(dyn_compatible_for_dispatch, feature(dyn_compatible_for_dispatch))] use std::any::Any; @@ -18,17 +14,15 @@ fn take_param<T:Foo>(foo: &T) { } fn a() { let x: Box<_> = Box::new(3); - take_param(&x); //[curr]~ ERROR E0277 - //[dyn_compatible_for_dispatch]~^ ERROR E0277 + take_param(&x); //~ ERROR E0277 } fn b() { let x: Box<_> = Box::new(3); let y = &x; let z = &x as &dyn Foo; - //[curr]~^ ERROR E0038 - //[curr]~| ERROR E0038 - //[dyn_compatible_for_dispatch]~^^^ ERROR E0038 + //~^ ERROR E0038 + //~| ERROR E0038 } fn main() { } diff --git a/tests/ui/kindck/kindck-inherited-copy-bound.dyn_compatible_for_dispatch.stderr b/tests/ui/kindck/kindck-inherited-copy-bound.stderr index 296f011193e..edfa7ae7769 100644 --- a/tests/ui/kindck/kindck-inherited-copy-bound.dyn_compatible_for_dispatch.stderr +++ b/tests/ui/kindck/kindck-inherited-copy-bound.stderr @@ -1,5 +1,5 @@ error[E0277]: the trait bound `Box<{integer}>: Foo` is not satisfied - --> $DIR/kindck-inherited-copy-bound.rs:21:16 + --> $DIR/kindck-inherited-copy-bound.rs:17:16 | LL | take_param(&x); | ---------- ^^ the trait `Copy` is not implemented for `Box<{integer}>` @@ -7,35 +7,50 @@ LL | take_param(&x); | required by a bound introduced by this call | note: required for `Box<{integer}>` to implement `Foo` - --> $DIR/kindck-inherited-copy-bound.rs:14:14 + --> $DIR/kindck-inherited-copy-bound.rs:10:14 | LL | impl<T:Copy> Foo for T { | ---- ^^^ ^ | | | unsatisfied trait bound introduced here note: required by a bound in `take_param` - --> $DIR/kindck-inherited-copy-bound.rs:17:17 + --> $DIR/kindck-inherited-copy-bound.rs:13:17 | LL | fn take_param<T:Foo>(foo: &T) { } | ^^^ required by this bound in `take_param` error[E0038]: the trait `Foo` is not dyn compatible - --> $DIR/kindck-inherited-copy-bound.rs:28:13 + --> $DIR/kindck-inherited-copy-bound.rs:23:19 + | +LL | let z = &x as &dyn Foo; + | ^^^^^^^^ `Foo` is not dyn compatible + | +note: for a trait to be dyn compatible it needs to allow building a vtable + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> + --> $DIR/kindck-inherited-copy-bound.rs:6:13 + | +LL | trait Foo : Copy { + | --- ^^^^ ...because it requires `Self: Sized` + | | + | this trait is not dyn compatible... + +error[E0038]: the trait `Foo` is not dyn compatible + --> $DIR/kindck-inherited-copy-bound.rs:23:13 | LL | let z = &x as &dyn Foo; | ^^ `Foo` is not dyn compatible | note: for a trait to be dyn compatible it needs to allow building a vtable for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> - --> $DIR/kindck-inherited-copy-bound.rs:10:13 + --> $DIR/kindck-inherited-copy-bound.rs:6:13 | LL | trait Foo : Copy { | --- ^^^^ ...because it requires `Self: Sized` | | | this trait is not dyn compatible... - = note: required for the cast from `&Box<i32>` to `&dyn Foo` + = note: required for the cast from `&Box<{integer}>` to `&dyn Foo` -error: aborting due to 2 previous errors +error: aborting due to 3 previous errors Some errors have detailed explanations: E0038, E0277. For more information about an error, try `rustc --explain E0038`. diff --git a/tests/ui/layout/debug.stderr b/tests/ui/layout/debug.stderr index 07cad776692..80b35ff6ad4 100644 --- a/tests/ui/layout/debug.stderr +++ b/tests/ui/layout/debug.stderr @@ -10,7 +10,7 @@ error: layout_of(E) = Layout { abi: Align(4 bytes), pref: $SOME_ALIGN, }, - abi: Memory { + backend_repr: Memory { sized: true, }, fields: Arbitrary { @@ -49,7 +49,7 @@ error: layout_of(E) = Layout { abi: Align(1 bytes), pref: $SOME_ALIGN, }, - abi: Memory { + backend_repr: Memory { sized: true, }, fields: Arbitrary { @@ -71,7 +71,7 @@ error: layout_of(E) = Layout { abi: Align(4 bytes), pref: $SOME_ALIGN, }, - abi: Memory { + backend_repr: Memory { sized: true, }, fields: Arbitrary { @@ -112,7 +112,7 @@ error: layout_of(S) = Layout { abi: Align(4 bytes), pref: $SOME_ALIGN, }, - abi: ScalarPair( + backend_repr: ScalarPair( Initialized { value: Int( I32, @@ -160,7 +160,7 @@ error: layout_of(U) = Layout { abi: Align(4 bytes), pref: $SOME_ALIGN, }, - abi: Memory { + backend_repr: Memory { sized: true, }, fields: Union( @@ -186,7 +186,7 @@ error: layout_of(Result<i32, i32>) = Layout { abi: Align(4 bytes), pref: $SOME_ALIGN, }, - abi: ScalarPair( + backend_repr: ScalarPair( Initialized { value: Int( I32, @@ -238,7 +238,7 @@ error: layout_of(Result<i32, i32>) = Layout { abi: Align(4 bytes), pref: $SOME_ALIGN, }, - abi: ScalarPair( + backend_repr: ScalarPair( Initialized { value: Int( I32, @@ -277,7 +277,7 @@ error: layout_of(Result<i32, i32>) = Layout { abi: Align(4 bytes), pref: $SOME_ALIGN, }, - abi: ScalarPair( + backend_repr: ScalarPair( Initialized { value: Int( I32, @@ -327,7 +327,7 @@ error: layout_of(i32) = Layout { abi: Align(4 bytes), pref: $SOME_ALIGN, }, - abi: Scalar( + backend_repr: Scalar( Initialized { value: Int( I32, @@ -357,7 +357,7 @@ error: layout_of(V) = Layout { abi: Align(2 bytes), pref: $SOME_ALIGN, }, - abi: Memory { + backend_repr: Memory { sized: true, }, fields: Union( @@ -383,7 +383,7 @@ error: layout_of(W) = Layout { abi: Align(2 bytes), pref: $SOME_ALIGN, }, - abi: Memory { + backend_repr: Memory { sized: true, }, fields: Union( @@ -409,7 +409,7 @@ error: layout_of(Y) = Layout { abi: Align(2 bytes), pref: $SOME_ALIGN, }, - abi: Memory { + backend_repr: Memory { sized: true, }, fields: Union( @@ -435,7 +435,7 @@ error: layout_of(P1) = Layout { abi: Align(1 bytes), pref: $SOME_ALIGN, }, - abi: Memory { + backend_repr: Memory { sized: true, }, fields: Union( @@ -461,7 +461,7 @@ error: layout_of(P2) = Layout { abi: Align(1 bytes), pref: $SOME_ALIGN, }, - abi: Memory { + backend_repr: Memory { sized: true, }, fields: Union( @@ -487,7 +487,7 @@ error: layout_of(P3) = Layout { abi: Align(1 bytes), pref: $SOME_ALIGN, }, - abi: Memory { + backend_repr: Memory { sized: true, }, fields: Union( @@ -513,7 +513,7 @@ error: layout_of(P4) = Layout { abi: Align(1 bytes), pref: $SOME_ALIGN, }, - abi: Memory { + backend_repr: Memory { sized: true, }, fields: Union( @@ -539,7 +539,7 @@ error: layout_of(P5) = Layout { abi: Align(1 bytes), pref: $SOME_ALIGN, }, - abi: Scalar( + backend_repr: Scalar( Union { value: Int( I8, @@ -570,7 +570,7 @@ error: layout_of(MaybeUninit<u8>) = Layout { abi: Align(1 bytes), pref: $SOME_ALIGN, }, - abi: Scalar( + backend_repr: Scalar( Union { value: Int( I8, diff --git a/tests/ui/layout/hexagon-enum.rs b/tests/ui/layout/hexagon-enum.rs index 5fa12e479e7..02833eb41fa 100644 --- a/tests/ui/layout/hexagon-enum.rs +++ b/tests/ui/layout/hexagon-enum.rs @@ -1,3 +1,4 @@ +//@ add-core-stubs //@ compile-flags: --target hexagon-unknown-linux-musl //@ normalize-stderr: "randomization_seed: \d+" -> "randomization_seed: $$SEED" //@ needs-llvm-components: hexagon @@ -9,8 +10,8 @@ #![crate_type = "lib"] #![no_core] -#[lang="sized"] -trait Sized {} +extern crate minicore; +use minicore::*; #[rustc_layout(debug)] #[repr(C)] diff --git a/tests/ui/layout/hexagon-enum.stderr b/tests/ui/layout/hexagon-enum.stderr index 90c06ba1f83..9c3a8662d4f 100644 --- a/tests/ui/layout/hexagon-enum.stderr +++ b/tests/ui/layout/hexagon-enum.stderr @@ -4,7 +4,7 @@ error: layout_of(A) = Layout { abi: Align(1 bytes), pref: Align(1 bytes), }, - abi: Scalar( + backend_repr: Scalar( Initialized { value: Int( I8, @@ -49,7 +49,7 @@ error: layout_of(A) = Layout { abi: Align(1 bytes), pref: Align(1 bytes), }, - abi: Memory { + backend_repr: Memory { sized: true, }, fields: Arbitrary { @@ -71,7 +71,7 @@ error: layout_of(A) = Layout { unadjusted_abi_align: Align(1 bytes), randomization_seed: $SEED, } - --> $DIR/hexagon-enum.rs:17:1 + --> $DIR/hexagon-enum.rs:18:1 | LL | enum A { Apple } | ^^^^^^ @@ -82,7 +82,7 @@ error: layout_of(B) = Layout { abi: Align(1 bytes), pref: Align(1 bytes), }, - abi: Scalar( + backend_repr: Scalar( Initialized { value: Int( I8, @@ -127,7 +127,7 @@ error: layout_of(B) = Layout { abi: Align(1 bytes), pref: Align(1 bytes), }, - abi: Memory { + backend_repr: Memory { sized: true, }, fields: Arbitrary { @@ -149,7 +149,7 @@ error: layout_of(B) = Layout { unadjusted_abi_align: Align(1 bytes), randomization_seed: $SEED, } - --> $DIR/hexagon-enum.rs:21:1 + --> $DIR/hexagon-enum.rs:22:1 | LL | enum B { Banana = 255, } | ^^^^^^ @@ -160,7 +160,7 @@ error: layout_of(C) = Layout { abi: Align(2 bytes), pref: Align(2 bytes), }, - abi: Scalar( + backend_repr: Scalar( Initialized { value: Int( I16, @@ -205,7 +205,7 @@ error: layout_of(C) = Layout { abi: Align(2 bytes), pref: Align(2 bytes), }, - abi: Memory { + backend_repr: Memory { sized: true, }, fields: Arbitrary { @@ -227,7 +227,7 @@ error: layout_of(C) = Layout { unadjusted_abi_align: Align(2 bytes), randomization_seed: $SEED, } - --> $DIR/hexagon-enum.rs:25:1 + --> $DIR/hexagon-enum.rs:26:1 | LL | enum C { Chaenomeles = 256, } | ^^^^^^ @@ -238,7 +238,7 @@ error: layout_of(P) = Layout { abi: Align(4 bytes), pref: Align(4 bytes), }, - abi: Scalar( + backend_repr: Scalar( Initialized { value: Int( I32, @@ -283,7 +283,7 @@ error: layout_of(P) = Layout { abi: Align(4 bytes), pref: Align(4 bytes), }, - abi: Memory { + backend_repr: Memory { sized: true, }, fields: Arbitrary { @@ -305,7 +305,7 @@ error: layout_of(P) = Layout { unadjusted_abi_align: Align(4 bytes), randomization_seed: $SEED, } - --> $DIR/hexagon-enum.rs:29:1 + --> $DIR/hexagon-enum.rs:30:1 | LL | enum P { Peach = 0x1000_0000isize, } | ^^^^^^ @@ -316,7 +316,7 @@ error: layout_of(T) = Layout { abi: Align(4 bytes), pref: Align(4 bytes), }, - abi: Scalar( + backend_repr: Scalar( Initialized { value: Int( I32, @@ -361,7 +361,7 @@ error: layout_of(T) = Layout { abi: Align(4 bytes), pref: Align(4 bytes), }, - abi: Memory { + backend_repr: Memory { sized: true, }, fields: Arbitrary { @@ -383,7 +383,7 @@ error: layout_of(T) = Layout { unadjusted_abi_align: Align(4 bytes), randomization_seed: $SEED, } - --> $DIR/hexagon-enum.rs:35:1 + --> $DIR/hexagon-enum.rs:36:1 | LL | enum T { Tangerine = TANGERINE as isize } | ^^^^^^ diff --git a/tests/ui/layout/invalid-unsized-in-always-sized-tail.rs b/tests/ui/layout/invalid-unsized-in-always-sized-tail.rs index 5df97338710..c6d5f2bfa0e 100644 --- a/tests/ui/layout/invalid-unsized-in-always-sized-tail.rs +++ b/tests/ui/layout/invalid-unsized-in-always-sized-tail.rs @@ -12,6 +12,6 @@ struct P2 { //~^ ERROR: the size for values of type `[bool]` cannot be known at compilation time } -static CHECK: () = assert!(align_of::<P2>() == 1); +static CHECK: () = assert!(align_of::<P2>() == 1); //~ ERROR could not evaluate static initializer fn main() {} diff --git a/tests/ui/layout/invalid-unsized-in-always-sized-tail.stderr b/tests/ui/layout/invalid-unsized-in-always-sized-tail.stderr index f54e97e2a5c..3a4735e4832 100644 --- a/tests/ui/layout/invalid-unsized-in-always-sized-tail.stderr +++ b/tests/ui/layout/invalid-unsized-in-always-sized-tail.stderr @@ -19,17 +19,13 @@ LL | struct MySlice<T>(T); | this could be changed to `T: ?Sized`... error[E0080]: could not evaluate static initializer - --> $SRC_DIR/core/src/mem/mod.rs:LL:COL + --> $DIR/invalid-unsized-in-always-sized-tail.rs:15:28 | - = note: the type `MySlice<[bool]>` has an unknown layout +LL | static CHECK: () = assert!(align_of::<P2>() == 1); + | ^^^^^^^^^^^^^^^^ the type `MySlice<[bool]>` has an unknown layout | note: inside `align_of::<P2>` --> $SRC_DIR/core/src/mem/mod.rs:LL:COL -note: inside `CHECK` - --> $DIR/invalid-unsized-in-always-sized-tail.rs:15:28 - | -LL | static CHECK: () = assert!(align_of::<P2>() == 1); - | ^^^^^^^^^^^^^^^^ error: aborting due to 2 previous errors diff --git a/tests/ui/layout/issue-84108.stderr b/tests/ui/layout/issue-84108.stderr index 8ddce285e23..e296abfc3b5 100644 --- a/tests/ui/layout/issue-84108.stderr +++ b/tests/ui/layout/issue-84108.stderr @@ -30,6 +30,15 @@ LL | const BAR: (&Path, [u8], usize) = ("hello", [], 42); = note: only the last element of a tuple may have a dynamically sized type error[E0277]: the size for values of type `[u8]` cannot be known at compilation time + --> $DIR/issue-84108.rs:15:13 + | +LL | static BAZ: ([u8], usize) = ([], 0); + | ^^^^^^^^^^^^^ doesn't have a size known at compile-time + | + = help: the trait `Sized` is not implemented for `[u8]` + = note: only the last element of a tuple may have a dynamically sized type + +error[E0277]: the size for values of type `[u8]` cannot be known at compilation time --> $DIR/issue-84108.rs:9:12 | LL | const BAR: (&Path, [u8], usize) = ("hello", [], 42); @@ -56,15 +65,6 @@ LL | static BAZ: ([u8], usize) = ([], 0); | = help: the trait `Sized` is not implemented for `[u8]` = note: only the last element of a tuple may have a dynamically sized type - -error[E0277]: the size for values of type `[u8]` cannot be known at compilation time - --> $DIR/issue-84108.rs:15:13 - | -LL | static BAZ: ([u8], usize) = ([], 0); - | ^^^^^^^^^^^^^ doesn't have a size known at compile-time - | - = help: the trait `Sized` is not implemented for `[u8]` - = note: only the last element of a tuple may have a dynamically sized type = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error[E0308]: mismatched types 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 3bdb9c5c143..ef7f0cd2d1c 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 @@ -4,7 +4,7 @@ error: layout_of(MissingPayloadField) = Layout { abi: Align(1 bytes), pref: $PREF_ALIGN, }, - abi: ScalarPair( + backend_repr: ScalarPair( Initialized { value: Int( I8, @@ -55,7 +55,7 @@ error: layout_of(MissingPayloadField) = Layout { abi: Align(1 bytes), pref: $PREF_ALIGN, }, - abi: ScalarPair( + backend_repr: ScalarPair( Initialized { value: Int( I8, @@ -93,7 +93,7 @@ error: layout_of(MissingPayloadField) = Layout { abi: Align(1 bytes), pref: $PREF_ALIGN, }, - abi: Memory { + backend_repr: Memory { sized: true, }, fields: Arbitrary { @@ -126,7 +126,7 @@ error: layout_of(CommonPayloadField) = Layout { abi: Align(1 bytes), pref: $PREF_ALIGN, }, - abi: ScalarPair( + backend_repr: ScalarPair( Initialized { value: Int( I8, @@ -178,7 +178,7 @@ error: layout_of(CommonPayloadField) = Layout { abi: Align(1 bytes), pref: $PREF_ALIGN, }, - abi: ScalarPair( + backend_repr: ScalarPair( Initialized { value: Int( I8, @@ -217,7 +217,7 @@ error: layout_of(CommonPayloadField) = Layout { abi: Align(1 bytes), pref: $PREF_ALIGN, }, - abi: ScalarPair( + backend_repr: ScalarPair( Initialized { value: Int( I8, @@ -267,7 +267,7 @@ error: layout_of(CommonPayloadFieldIsMaybeUninit) = Layout { abi: Align(1 bytes), pref: $PREF_ALIGN, }, - abi: ScalarPair( + backend_repr: ScalarPair( Initialized { value: Int( I8, @@ -318,7 +318,7 @@ error: layout_of(CommonPayloadFieldIsMaybeUninit) = Layout { abi: Align(1 bytes), pref: $PREF_ALIGN, }, - abi: ScalarPair( + backend_repr: ScalarPair( Initialized { value: Int( I8, @@ -356,7 +356,7 @@ error: layout_of(CommonPayloadFieldIsMaybeUninit) = Layout { abi: Align(1 bytes), pref: $PREF_ALIGN, }, - abi: ScalarPair( + backend_repr: ScalarPair( Initialized { value: Int( I8, @@ -405,7 +405,7 @@ error: layout_of(NicheFirst) = Layout { abi: Align(1 bytes), pref: $PREF_ALIGN, }, - abi: ScalarPair( + backend_repr: ScalarPair( Initialized { value: Int( I8, @@ -460,7 +460,7 @@ error: layout_of(NicheFirst) = Layout { abi: Align(1 bytes), pref: $PREF_ALIGN, }, - abi: ScalarPair( + backend_repr: ScalarPair( Initialized { value: Int( I8, @@ -510,7 +510,7 @@ error: layout_of(NicheFirst) = Layout { abi: Align(1 bytes), pref: $PREF_ALIGN, }, - abi: Memory { + backend_repr: Memory { sized: true, }, fields: Arbitrary { @@ -532,7 +532,7 @@ error: layout_of(NicheFirst) = Layout { abi: Align(1 bytes), pref: $PREF_ALIGN, }, - abi: Memory { + backend_repr: Memory { sized: true, }, fields: Arbitrary { @@ -565,7 +565,7 @@ error: layout_of(NicheSecond) = Layout { abi: Align(1 bytes), pref: $PREF_ALIGN, }, - abi: ScalarPair( + backend_repr: ScalarPair( Initialized { value: Int( I8, @@ -620,7 +620,7 @@ error: layout_of(NicheSecond) = Layout { abi: Align(1 bytes), pref: $PREF_ALIGN, }, - abi: ScalarPair( + backend_repr: ScalarPair( Initialized { value: Int( I8, @@ -670,7 +670,7 @@ error: layout_of(NicheSecond) = Layout { abi: Align(1 bytes), pref: $PREF_ALIGN, }, - abi: Memory { + backend_repr: Memory { sized: true, }, fields: Arbitrary { @@ -692,7 +692,7 @@ error: layout_of(NicheSecond) = Layout { abi: Align(1 bytes), pref: $PREF_ALIGN, }, - abi: Memory { + backend_repr: Memory { sized: true, }, fields: Arbitrary { diff --git a/tests/ui/layout/issue-96185-overaligned-enum.stderr b/tests/ui/layout/issue-96185-overaligned-enum.stderr index 1d4e4436448..a9081afc509 100644 --- a/tests/ui/layout/issue-96185-overaligned-enum.stderr +++ b/tests/ui/layout/issue-96185-overaligned-enum.stderr @@ -4,7 +4,7 @@ error: layout_of(Aligned1) = Layout { abi: Align(8 bytes), pref: $PREF_ALIGN, }, - abi: Memory { + backend_repr: Memory { sized: true, }, fields: Arbitrary { @@ -43,7 +43,7 @@ error: layout_of(Aligned1) = Layout { abi: Align(8 bytes), pref: $PREF_ALIGN, }, - abi: Memory { + backend_repr: Memory { sized: true, }, fields: Arbitrary { @@ -67,7 +67,7 @@ error: layout_of(Aligned1) = Layout { abi: Align(8 bytes), pref: $PREF_ALIGN, }, - abi: Memory { + backend_repr: Memory { sized: true, }, fields: Arbitrary { @@ -104,7 +104,7 @@ error: layout_of(Aligned2) = Layout { abi: Align(1 bytes), pref: $PREF_ALIGN, }, - abi: Scalar( + backend_repr: Scalar( Initialized { value: Int( I8, @@ -149,7 +149,7 @@ error: layout_of(Aligned2) = Layout { abi: Align(1 bytes), pref: $PREF_ALIGN, }, - abi: Memory { + backend_repr: Memory { sized: true, }, fields: Arbitrary { @@ -173,7 +173,7 @@ error: layout_of(Aligned2) = Layout { abi: Align(1 bytes), pref: $PREF_ALIGN, }, - abi: Memory { + backend_repr: Memory { sized: true, }, fields: Arbitrary { diff --git a/tests/ui/layout/thumb-enum.rs b/tests/ui/layout/thumb-enum.rs index 2381d9d0292..1c4fab812f9 100644 --- a/tests/ui/layout/thumb-enum.rs +++ b/tests/ui/layout/thumb-enum.rs @@ -1,3 +1,4 @@ +//@ add-core-stubs //@ compile-flags: --target thumbv8m.main-none-eabihf //@ normalize-stderr: "randomization_seed: \d+" -> "randomization_seed: $$SEED" //@ needs-llvm-components: arm @@ -9,8 +10,8 @@ #![crate_type = "lib"] #![no_core] -#[lang="sized"] -trait Sized {} +extern crate minicore; +use minicore::*; #[rustc_layout(debug)] #[repr(C)] diff --git a/tests/ui/layout/thumb-enum.stderr b/tests/ui/layout/thumb-enum.stderr index 0c343318564..b635d1a45bb 100644 --- a/tests/ui/layout/thumb-enum.stderr +++ b/tests/ui/layout/thumb-enum.stderr @@ -4,7 +4,7 @@ error: layout_of(A) = Layout { abi: Align(1 bytes), pref: Align(4 bytes), }, - abi: Scalar( + backend_repr: Scalar( Initialized { value: Int( I8, @@ -49,7 +49,7 @@ error: layout_of(A) = Layout { abi: Align(1 bytes), pref: Align(4 bytes), }, - abi: Memory { + backend_repr: Memory { sized: true, }, fields: Arbitrary { @@ -71,7 +71,7 @@ error: layout_of(A) = Layout { unadjusted_abi_align: Align(1 bytes), randomization_seed: $SEED, } - --> $DIR/thumb-enum.rs:17:1 + --> $DIR/thumb-enum.rs:18:1 | LL | enum A { Apple } | ^^^^^^ @@ -82,7 +82,7 @@ error: layout_of(B) = Layout { abi: Align(1 bytes), pref: Align(4 bytes), }, - abi: Scalar( + backend_repr: Scalar( Initialized { value: Int( I8, @@ -127,7 +127,7 @@ error: layout_of(B) = Layout { abi: Align(1 bytes), pref: Align(4 bytes), }, - abi: Memory { + backend_repr: Memory { sized: true, }, fields: Arbitrary { @@ -149,7 +149,7 @@ error: layout_of(B) = Layout { unadjusted_abi_align: Align(1 bytes), randomization_seed: $SEED, } - --> $DIR/thumb-enum.rs:21:1 + --> $DIR/thumb-enum.rs:22:1 | LL | enum B { Banana = 255, } | ^^^^^^ @@ -160,7 +160,7 @@ error: layout_of(C) = Layout { abi: Align(2 bytes), pref: Align(4 bytes), }, - abi: Scalar( + backend_repr: Scalar( Initialized { value: Int( I16, @@ -205,7 +205,7 @@ error: layout_of(C) = Layout { abi: Align(2 bytes), pref: Align(4 bytes), }, - abi: Memory { + backend_repr: Memory { sized: true, }, fields: Arbitrary { @@ -227,7 +227,7 @@ error: layout_of(C) = Layout { unadjusted_abi_align: Align(2 bytes), randomization_seed: $SEED, } - --> $DIR/thumb-enum.rs:25:1 + --> $DIR/thumb-enum.rs:26:1 | LL | enum C { Chaenomeles = 256, } | ^^^^^^ @@ -238,7 +238,7 @@ error: layout_of(P) = Layout { abi: Align(4 bytes), pref: Align(4 bytes), }, - abi: Scalar( + backend_repr: Scalar( Initialized { value: Int( I32, @@ -283,7 +283,7 @@ error: layout_of(P) = Layout { abi: Align(4 bytes), pref: Align(4 bytes), }, - abi: Memory { + backend_repr: Memory { sized: true, }, fields: Arbitrary { @@ -305,7 +305,7 @@ error: layout_of(P) = Layout { unadjusted_abi_align: Align(4 bytes), randomization_seed: $SEED, } - --> $DIR/thumb-enum.rs:29:1 + --> $DIR/thumb-enum.rs:30:1 | LL | enum P { Peach = 0x1000_0000isize, } | ^^^^^^ @@ -316,7 +316,7 @@ error: layout_of(T) = Layout { abi: Align(4 bytes), pref: Align(4 bytes), }, - abi: Scalar( + backend_repr: Scalar( Initialized { value: Int( I32, @@ -361,7 +361,7 @@ error: layout_of(T) = Layout { abi: Align(4 bytes), pref: Align(4 bytes), }, - abi: Memory { + backend_repr: Memory { sized: true, }, fields: Arbitrary { @@ -383,7 +383,7 @@ error: layout_of(T) = Layout { unadjusted_abi_align: Align(4 bytes), randomization_seed: $SEED, } - --> $DIR/thumb-enum.rs:35:1 + --> $DIR/thumb-enum.rs:36:1 | LL | enum T { Tangerine = TANGERINE as isize } | ^^^^^^ diff --git a/tests/ui/layout/too-big-with-padding.rs b/tests/ui/layout/too-big-with-padding.rs index 8423ad2e1d6..0f03bd10fb6 100644 --- a/tests/ui/layout/too-big-with-padding.rs +++ b/tests/ui/layout/too-big-with-padding.rs @@ -1,3 +1,4 @@ +//@ add-core-stubs //@ build-fail //@ compile-flags: --target i686-unknown-linux-gnu --crate-type lib //@ needs-llvm-components: x86 @@ -6,13 +7,11 @@ #![no_std] #![no_core] +extern crate minicore; +use minicore::*; + // 0x7fffffff is fine, but after rounding up it becomes too big #[repr(C, align(2))] pub struct Example([u8; 0x7fffffff]); pub fn lib(_x: Example) {} //~ERROR: too big for the target architecture - -#[lang = "sized"] -pub trait Sized {} -#[lang = "copy"] -pub trait Copy: Sized {} diff --git a/tests/ui/layout/too-big-with-padding.stderr b/tests/ui/layout/too-big-with-padding.stderr index fc3b4db049a..761ac7514ee 100644 --- a/tests/ui/layout/too-big-with-padding.stderr +++ b/tests/ui/layout/too-big-with-padding.stderr @@ -1,5 +1,5 @@ error: values of the type `Example` are too big for the target architecture - --> $DIR/too-big-with-padding.rs:13:1 + --> $DIR/too-big-with-padding.rs:17:1 | LL | pub fn lib(_x: Example) {} | ^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/layout/unknown-when-no-type-parameter.stderr b/tests/ui/layout/unknown-when-no-type-parameter.stderr index d0456e2b329..9e414d224bb 100644 --- a/tests/ui/layout/unknown-when-no-type-parameter.stderr +++ b/tests/ui/layout/unknown-when-no-type-parameter.stderr @@ -1,15 +1,11 @@ error[E0080]: evaluation of constant value failed - --> $SRC_DIR/core/src/mem/mod.rs:LL:COL + --> $DIR/unknown-when-no-type-parameter.rs:11:10 | - = note: the type `<() as Project>::Assoc` has an unknown layout +LL | [(); size_of::<<() as Project>::Assoc>()]; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the type `<() as Project>::Assoc` has an unknown layout | note: inside `std::mem::size_of::<<() as Project>::Assoc>` --> $SRC_DIR/core/src/mem/mod.rs:LL:COL -note: inside `foo::{constant#0}` - --> $DIR/unknown-when-no-type-parameter.rs:11:10 - | -LL | [(); size_of::<<() as Project>::Assoc>()]; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 1 previous error diff --git a/tests/ui/layout/zero-sized-array-enum-niche.stderr b/tests/ui/layout/zero-sized-array-enum-niche.stderr index 33d2eede220..1ba184bdace 100644 --- a/tests/ui/layout/zero-sized-array-enum-niche.stderr +++ b/tests/ui/layout/zero-sized-array-enum-niche.stderr @@ -4,7 +4,7 @@ error: layout_of(Result<[u32; 0], bool>) = Layout { abi: Align(4 bytes), pref: $PREF_ALIGN, }, - abi: Memory { + backend_repr: Memory { sized: true, }, fields: Arbitrary { @@ -43,7 +43,7 @@ error: layout_of(Result<[u32; 0], bool>) = Layout { abi: Align(4 bytes), pref: $PREF_ALIGN, }, - abi: Memory { + backend_repr: Memory { sized: true, }, fields: Arbitrary { @@ -69,7 +69,7 @@ error: layout_of(Result<[u32; 0], bool>) = Layout { abi: Align(1 bytes), pref: $PREF_ALIGN, }, - abi: Memory { + backend_repr: Memory { sized: true, }, fields: Arbitrary { @@ -115,7 +115,7 @@ error: layout_of(MultipleAlignments) = Layout { abi: Align(4 bytes), pref: $PREF_ALIGN, }, - abi: Memory { + backend_repr: Memory { sized: true, }, fields: Arbitrary { @@ -154,7 +154,7 @@ error: layout_of(MultipleAlignments) = Layout { abi: Align(2 bytes), pref: $PREF_ALIGN, }, - abi: Memory { + backend_repr: Memory { sized: true, }, fields: Arbitrary { @@ -180,7 +180,7 @@ error: layout_of(MultipleAlignments) = Layout { abi: Align(4 bytes), pref: $PREF_ALIGN, }, - abi: Memory { + backend_repr: Memory { sized: true, }, fields: Arbitrary { @@ -206,7 +206,7 @@ error: layout_of(MultipleAlignments) = Layout { abi: Align(1 bytes), pref: $PREF_ALIGN, }, - abi: Memory { + backend_repr: Memory { sized: true, }, fields: Arbitrary { @@ -252,7 +252,7 @@ error: layout_of(Result<[u32; 0], Packed<NonZero<u16>>>) = Layout { abi: Align(4 bytes), pref: $PREF_ALIGN, }, - abi: Memory { + backend_repr: Memory { sized: true, }, fields: Arbitrary { @@ -291,7 +291,7 @@ error: layout_of(Result<[u32; 0], Packed<NonZero<u16>>>) = Layout { abi: Align(4 bytes), pref: $PREF_ALIGN, }, - abi: Memory { + backend_repr: Memory { sized: true, }, fields: Arbitrary { @@ -317,7 +317,7 @@ error: layout_of(Result<[u32; 0], Packed<NonZero<u16>>>) = Layout { abi: Align(1 bytes), pref: $PREF_ALIGN, }, - abi: Memory { + backend_repr: Memory { sized: true, }, fields: Arbitrary { @@ -363,7 +363,7 @@ error: layout_of(Result<[u32; 0], Packed<U16IsZero>>) = Layout { abi: Align(4 bytes), pref: $PREF_ALIGN, }, - abi: Memory { + backend_repr: Memory { sized: true, }, fields: Arbitrary { @@ -406,7 +406,7 @@ error: layout_of(Result<[u32; 0], Packed<U16IsZero>>) = Layout { abi: Align(4 bytes), pref: $PREF_ALIGN, }, - abi: Memory { + backend_repr: Memory { sized: true, }, fields: Arbitrary { @@ -432,7 +432,7 @@ error: layout_of(Result<[u32; 0], Packed<U16IsZero>>) = Layout { abi: Align(1 bytes), pref: $PREF_ALIGN, }, - abi: Memory { + backend_repr: Memory { sized: true, }, fields: Arbitrary { diff --git a/tests/ui/lexer/unterminated-nested-comment.stderr b/tests/ui/lexer/unterminated-nested-comment.stderr index 78b72ce1fe4..9117b689c94 100644 --- a/tests/ui/lexer/unterminated-nested-comment.stderr +++ b/tests/ui/lexer/unterminated-nested-comment.stderr @@ -12,7 +12,7 @@ LL | | /* | | | | | ...as last nested comment starts here, maybe you want to close this instead? LL | | */ - | |_-^ + | |_--^ | | | ...and last nested comment terminates here. diff --git a/tests/ui/lifetimes/issue-26638.rs b/tests/ui/lifetimes/issue-26638.rs index 11c730165f2..e73cf21bd6c 100644 --- a/tests/ui/lifetimes/issue-26638.rs +++ b/tests/ui/lifetimes/issue-26638.rs @@ -3,7 +3,6 @@ fn parse_type(iter: Box<dyn Iterator<Item=&str>+'static>) -> &str { iter.next() fn parse_type_2(iter: fn(&u8)->&u8) -> &str { iter() } //~^ ERROR missing lifetime specifier [E0106] -//~| ERROR mismatched types //~| ERROR function takes 1 argument but 0 arguments were supplied fn parse_type_3() -> &str { unimplemented!() } diff --git a/tests/ui/lifetimes/issue-26638.stderr b/tests/ui/lifetimes/issue-26638.stderr index bdf91136765..74a1676f684 100644 --- a/tests/ui/lifetimes/issue-26638.stderr +++ b/tests/ui/lifetimes/issue-26638.stderr @@ -32,7 +32,7 @@ LL + fn parse_type_2(iter: fn(&u8)->&u8) -> String { iter() } | error[E0106]: missing lifetime specifier - --> $DIR/issue-26638.rs:9:22 + --> $DIR/issue-26638.rs:8:22 | LL | fn parse_type_3() -> &str { unimplemented!() } | ^ expected named lifetime parameter @@ -59,18 +59,7 @@ help: provide the argument LL | fn parse_type_2(iter: fn(&u8)->&u8) -> &str { iter(/* &u8 */) } | +++++++++ -error[E0308]: mismatched types - --> $DIR/issue-26638.rs:4:47 - | -LL | fn parse_type_2(iter: fn(&u8)->&u8) -> &str { iter() } - | ---- ^^^^^^ expected `&str`, found `&u8` - | | - | expected `&'static str` because of return type - | - = note: expected reference `&'static str` - found reference `&u8` - -error: aborting due to 5 previous errors +error: aborting due to 4 previous errors -Some errors have detailed explanations: E0061, E0106, E0308. +Some errors have detailed explanations: E0061, E0106. For more information about an error, try `rustc --explain E0061`. diff --git a/tests/ui/lifetimes/static-typos.rs b/tests/ui/lifetimes/static-typos.rs new file mode 100644 index 00000000000..941d1b376bc --- /dev/null +++ b/tests/ui/lifetimes/static-typos.rs @@ -0,0 +1,7 @@ +fn stati<T: 'stati>() {} +//~^ ERROR use of undeclared lifetime name `'stati` + +fn statoc<T: 'statoc>() {} +//~^ ERROR use of undeclared lifetime name `'statoc` + +fn main() {} diff --git a/tests/ui/lifetimes/static-typos.stderr b/tests/ui/lifetimes/static-typos.stderr new file mode 100644 index 00000000000..a817fa89c7e --- /dev/null +++ b/tests/ui/lifetimes/static-typos.stderr @@ -0,0 +1,26 @@ +error[E0261]: use of undeclared lifetime name `'stati` + --> $DIR/static-typos.rs:1:13 + | +LL | fn stati<T: 'stati>() {} + | ^^^^^^ undeclared lifetime + | +help: you may have misspelled the `'static` lifetime + | +LL | fn stati<T: 'static>() {} + | + + +error[E0261]: use of undeclared lifetime name `'statoc` + --> $DIR/static-typos.rs:4:14 + | +LL | fn statoc<T: 'statoc>() {} + | ^^^^^^^ undeclared lifetime + | +help: you may have misspelled the `'static` lifetime + | +LL - fn statoc<T: 'statoc>() {} +LL + fn statoc<T: 'static>() {} + | + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0261`. diff --git a/tests/ui/lifetimes/unusual-rib-combinations.stderr b/tests/ui/lifetimes/unusual-rib-combinations.stderr index b7effdc8d61..7373ca8cf84 100644 --- a/tests/ui/lifetimes/unusual-rib-combinations.stderr +++ b/tests/ui/lifetimes/unusual-rib-combinations.stderr @@ -9,8 +9,6 @@ error[E0770]: the type of const parameters must not depend on other generic para | LL | struct Bar<const N: &'a (dyn for<'a> Foo<'a>)>; | ^^ the type must not depend on the parameter `'a` - | - = note: lifetime parameters may not be used in the type of const parameters error[E0214]: parenthesized type parameters may only be used with a `Fn` trait --> $DIR/unusual-rib-combinations.rs:11:15 diff --git a/tests/ui/limits/issue-55878.stderr b/tests/ui/limits/issue-55878.stderr index d2b5150c556..d705b3daf79 100644 --- a/tests/ui/limits/issue-55878.stderr +++ b/tests/ui/limits/issue-55878.stderr @@ -1,15 +1,11 @@ error[E0080]: evaluation of constant value failed - --> $SRC_DIR/core/src/mem/mod.rs:LL:COL + --> $DIR/issue-55878.rs:5:26 | - = note: values of the type `[u8; usize::MAX]` are too big for the target architecture +LL | println!("Size: {}", std::mem::size_of::<[u8; u64::MAX as usize]>()); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ values of the type `[u8; usize::MAX]` are too big for the target architecture | note: inside `std::mem::size_of::<[u8; usize::MAX]>` --> $SRC_DIR/core/src/mem/mod.rs:LL:COL -note: inside `main` - --> $DIR/issue-55878.rs:5:26 - | -LL | println!("Size: {}", std::mem::size_of::<[u8; u64::MAX as usize]>()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 1 previous error diff --git a/tests/ui/linkage-attr/raw-dylib/elf/multiple-libraries.rs b/tests/ui/linkage-attr/raw-dylib/elf/multiple-libraries.rs new file mode 100644 index 00000000000..f4715ff2d3d --- /dev/null +++ b/tests/ui/linkage-attr/raw-dylib/elf/multiple-libraries.rs @@ -0,0 +1,37 @@ +//@ only-elf +//@ needs-dynamic-linking +// FIXME(raw_dylib_elf): Debug the failures on other targets. +//@ only-gnu +//@ only-x86_64 + +//@ revisions: with without + +//@ [without] build-fail +//@ [without] regex-error-pattern:error: linking with `.*` failed +//@ [without] dont-check-compiler-stderr + +//@ [with] build-pass + +//! Ensures that linking fails when there's an undefined symbol, +//! and that it does succeed with raw-dylib. + +#![feature(raw_dylib_elf)] +#![allow(incomplete_features)] + +#[cfg_attr(with, link(name = "rawdylibbutforcats", kind = "raw-dylib"))] +#[cfg_attr(without, link(name = "rawdylibbutforcats"))] +unsafe extern "C" { + safe fn meooooooooooooooow(); +} + + +#[cfg_attr(with, link(name = "rawdylibbutfordogs", kind = "raw-dylib"))] +#[cfg_attr(without, link(name = "rawdylibbutfordogs"))] +unsafe extern "C" { + safe fn woooooooooooooooooof(); +} + +fn main() { + meooooooooooooooow(); + woooooooooooooooooof(); +} diff --git a/tests/ui/linkage-attr/raw-dylib/elf/single-symbol.rs b/tests/ui/linkage-attr/raw-dylib/elf/single-symbol.rs new file mode 100644 index 00000000000..fe9c7884e54 --- /dev/null +++ b/tests/ui/linkage-attr/raw-dylib/elf/single-symbol.rs @@ -0,0 +1,28 @@ +//@ only-elf +//@ needs-dynamic-linking +// FIXME(raw_dylib_elf): Debug the failures on other targets. +//@ only-gnu +//@ only-x86_64 +//@ revisions: with without + +//@ [without] build-fail +//@ [without] regex-error-pattern:error: linking with `.*` failed +//@ [without] dont-check-compiler-stderr + +//@ [with] build-pass + +//! Ensures that linking fails when there's an undefined symbol, +//! and that it does succeed with raw-dylib. + +#![feature(raw_dylib_elf)] +#![allow(incomplete_features)] + +#[cfg_attr(with, link(name = "rawdylibbutforcats", kind = "raw-dylib"))] +#[cfg_attr(without, link(name = "rawdylibbutforcats"))] +unsafe extern "C" { + safe fn meooooooooooooooow(); +} + +fn main() { + meooooooooooooooow(); +} diff --git a/tests/ui/linkage-attr/raw-dylib/elf/verbatim.rs b/tests/ui/linkage-attr/raw-dylib/elf/verbatim.rs new file mode 100644 index 00000000000..72cba18d841 --- /dev/null +++ b/tests/ui/linkage-attr/raw-dylib/elf/verbatim.rs @@ -0,0 +1,29 @@ +//@ only-elf +//@ needs-dynamic-linking +// FIXME(raw_dylib_elf): Debug the failures on other targets. +//@ only-gnu +//@ only-x86_64 + +//@ revisions: with without + +//@ [without] build-fail +//@ [without] regex-error-pattern:error: linking with `.*` failed +//@ [without] dont-check-compiler-stderr + +//@ [with] build-pass + +//! Ensures that linking fails when there's an undefined symbol, +//! and that it does succeed with raw-dylib, but with verbatim. + +#![feature(raw_dylib_elf)] +#![allow(incomplete_features)] + +#[cfg_attr(with, link(name = "rawdylibbutforcats", kind = "raw-dylib", modifiers = "+verbatim"))] +#[cfg_attr(without, link(name = "rawdylibbutforcats", modifiers = "+verbatim"))] +unsafe extern "C" { + safe fn meooooooooooooooow(); +} + +fn main() { + meooooooooooooooow(); +} diff --git a/tests/ui/rfcs/rfc-2627-raw-dylib/dlltool-failed.rs b/tests/ui/linkage-attr/raw-dylib/windows/dlltool-failed.rs index e69a4537935..e69a4537935 100644 --- a/tests/ui/rfcs/rfc-2627-raw-dylib/dlltool-failed.rs +++ b/tests/ui/linkage-attr/raw-dylib/windows/dlltool-failed.rs diff --git a/tests/ui/rfcs/rfc-2627-raw-dylib/dlltool-failed.stderr b/tests/ui/linkage-attr/raw-dylib/windows/dlltool-failed.stderr index 90cca83d1c1..90cca83d1c1 100644 --- a/tests/ui/rfcs/rfc-2627-raw-dylib/dlltool-failed.stderr +++ b/tests/ui/linkage-attr/raw-dylib/windows/dlltool-failed.stderr diff --git a/tests/ui/rfcs/rfc-2627-raw-dylib/import-name-type-invalid-format.rs b/tests/ui/linkage-attr/raw-dylib/windows/import-name-type-invalid-format.rs index 50ad8a173ad..50ad8a173ad 100644 --- a/tests/ui/rfcs/rfc-2627-raw-dylib/import-name-type-invalid-format.rs +++ b/tests/ui/linkage-attr/raw-dylib/windows/import-name-type-invalid-format.rs diff --git a/tests/ui/rfcs/rfc-2627-raw-dylib/import-name-type-invalid-format.stderr b/tests/ui/linkage-attr/raw-dylib/windows/import-name-type-invalid-format.stderr index d2cf7a0ba1f..d2cf7a0ba1f 100644 --- a/tests/ui/rfcs/rfc-2627-raw-dylib/import-name-type-invalid-format.stderr +++ b/tests/ui/linkage-attr/raw-dylib/windows/import-name-type-invalid-format.stderr diff --git a/tests/ui/rfcs/rfc-2627-raw-dylib/import-name-type-multiple.rs b/tests/ui/linkage-attr/raw-dylib/windows/import-name-type-multiple.rs index cf456b9b261..cf456b9b261 100644 --- a/tests/ui/rfcs/rfc-2627-raw-dylib/import-name-type-multiple.rs +++ b/tests/ui/linkage-attr/raw-dylib/windows/import-name-type-multiple.rs diff --git a/tests/ui/rfcs/rfc-2627-raw-dylib/import-name-type-multiple.stderr b/tests/ui/linkage-attr/raw-dylib/windows/import-name-type-multiple.stderr index 8e65baf65df..8e65baf65df 100644 --- a/tests/ui/rfcs/rfc-2627-raw-dylib/import-name-type-multiple.stderr +++ b/tests/ui/linkage-attr/raw-dylib/windows/import-name-type-multiple.stderr diff --git a/tests/ui/rfcs/rfc-2627-raw-dylib/import-name-type-unknown-value.rs b/tests/ui/linkage-attr/raw-dylib/windows/import-name-type-unknown-value.rs index b3859ba1ce6..b3859ba1ce6 100644 --- a/tests/ui/rfcs/rfc-2627-raw-dylib/import-name-type-unknown-value.rs +++ b/tests/ui/linkage-attr/raw-dylib/windows/import-name-type-unknown-value.rs diff --git a/tests/ui/rfcs/rfc-2627-raw-dylib/import-name-type-unknown-value.stderr b/tests/ui/linkage-attr/raw-dylib/windows/import-name-type-unknown-value.stderr index 4b8b90eb6e2..4b8b90eb6e2 100644 --- a/tests/ui/rfcs/rfc-2627-raw-dylib/import-name-type-unknown-value.stderr +++ b/tests/ui/linkage-attr/raw-dylib/windows/import-name-type-unknown-value.stderr diff --git a/tests/ui/rfcs/rfc-2627-raw-dylib/import-name-type-unsupported-link-kind.rs b/tests/ui/linkage-attr/raw-dylib/windows/import-name-type-unsupported-link-kind.rs index 3ead5cb1fd7..3ead5cb1fd7 100644 --- a/tests/ui/rfcs/rfc-2627-raw-dylib/import-name-type-unsupported-link-kind.rs +++ b/tests/ui/linkage-attr/raw-dylib/windows/import-name-type-unsupported-link-kind.rs diff --git a/tests/ui/rfcs/rfc-2627-raw-dylib/import-name-type-unsupported-link-kind.stderr b/tests/ui/linkage-attr/raw-dylib/windows/import-name-type-unsupported-link-kind.stderr index 75cadc471c4..75cadc471c4 100644 --- a/tests/ui/rfcs/rfc-2627-raw-dylib/import-name-type-unsupported-link-kind.stderr +++ b/tests/ui/linkage-attr/raw-dylib/windows/import-name-type-unsupported-link-kind.stderr diff --git a/tests/ui/rfcs/rfc-2627-raw-dylib/import-name-type-x86-only.rs b/tests/ui/linkage-attr/raw-dylib/windows/import-name-type-x86-only.rs index ab0dcda64e6..ab0dcda64e6 100644 --- a/tests/ui/rfcs/rfc-2627-raw-dylib/import-name-type-x86-only.rs +++ b/tests/ui/linkage-attr/raw-dylib/windows/import-name-type-x86-only.rs diff --git a/tests/ui/rfcs/rfc-2627-raw-dylib/import-name-type-x86-only.stderr b/tests/ui/linkage-attr/raw-dylib/windows/import-name-type-x86-only.stderr index 757f1f7994e..757f1f7994e 100644 --- a/tests/ui/rfcs/rfc-2627-raw-dylib/import-name-type-x86-only.stderr +++ b/tests/ui/linkage-attr/raw-dylib/windows/import-name-type-x86-only.stderr diff --git a/tests/ui/rfcs/rfc-2627-raw-dylib/invalid-dlltool.rs b/tests/ui/linkage-attr/raw-dylib/windows/invalid-dlltool.rs index 057242246f0..057242246f0 100644 --- a/tests/ui/rfcs/rfc-2627-raw-dylib/invalid-dlltool.rs +++ b/tests/ui/linkage-attr/raw-dylib/windows/invalid-dlltool.rs diff --git a/tests/ui/rfcs/rfc-2627-raw-dylib/invalid-dlltool.stderr b/tests/ui/linkage-attr/raw-dylib/windows/invalid-dlltool.stderr index 4bbad9b30a7..4bbad9b30a7 100644 --- a/tests/ui/rfcs/rfc-2627-raw-dylib/invalid-dlltool.stderr +++ b/tests/ui/linkage-attr/raw-dylib/windows/invalid-dlltool.stderr diff --git a/tests/ui/rfcs/rfc-2627-raw-dylib/link-ordinal-and-name.rs b/tests/ui/linkage-attr/raw-dylib/windows/link-ordinal-and-name.rs index b04c2facbcd..b04c2facbcd 100644 --- a/tests/ui/rfcs/rfc-2627-raw-dylib/link-ordinal-and-name.rs +++ b/tests/ui/linkage-attr/raw-dylib/windows/link-ordinal-and-name.rs diff --git a/tests/ui/rfcs/rfc-2627-raw-dylib/link-ordinal-and-name.stderr b/tests/ui/linkage-attr/raw-dylib/windows/link-ordinal-and-name.stderr index f1e54d37827..f1e54d37827 100644 --- a/tests/ui/rfcs/rfc-2627-raw-dylib/link-ordinal-and-name.stderr +++ b/tests/ui/linkage-attr/raw-dylib/windows/link-ordinal-and-name.stderr diff --git a/tests/ui/rfcs/rfc-2627-raw-dylib/link-ordinal-invalid-format.rs b/tests/ui/linkage-attr/raw-dylib/windows/link-ordinal-invalid-format.rs index 9b7e8d70743..9b7e8d70743 100644 --- a/tests/ui/rfcs/rfc-2627-raw-dylib/link-ordinal-invalid-format.rs +++ b/tests/ui/linkage-attr/raw-dylib/windows/link-ordinal-invalid-format.rs diff --git a/tests/ui/rfcs/rfc-2627-raw-dylib/link-ordinal-invalid-format.stderr b/tests/ui/linkage-attr/raw-dylib/windows/link-ordinal-invalid-format.stderr index 6341e57a0be..6341e57a0be 100644 --- a/tests/ui/rfcs/rfc-2627-raw-dylib/link-ordinal-invalid-format.stderr +++ b/tests/ui/linkage-attr/raw-dylib/windows/link-ordinal-invalid-format.stderr diff --git a/tests/ui/rfcs/rfc-2627-raw-dylib/link-ordinal-missing-argument.rs b/tests/ui/linkage-attr/raw-dylib/windows/link-ordinal-missing-argument.rs index 6b8cd49566d..6b8cd49566d 100644 --- a/tests/ui/rfcs/rfc-2627-raw-dylib/link-ordinal-missing-argument.rs +++ b/tests/ui/linkage-attr/raw-dylib/windows/link-ordinal-missing-argument.rs diff --git a/tests/ui/rfcs/rfc-2627-raw-dylib/link-ordinal-missing-argument.stderr b/tests/ui/linkage-attr/raw-dylib/windows/link-ordinal-missing-argument.stderr index 1b04bb228e7..1b04bb228e7 100644 --- a/tests/ui/rfcs/rfc-2627-raw-dylib/link-ordinal-missing-argument.stderr +++ b/tests/ui/linkage-attr/raw-dylib/windows/link-ordinal-missing-argument.stderr diff --git a/tests/ui/rfcs/rfc-2627-raw-dylib/link-ordinal-multiple.rs b/tests/ui/linkage-attr/raw-dylib/windows/link-ordinal-multiple.rs index f5fb1649cdc..f5fb1649cdc 100644 --- a/tests/ui/rfcs/rfc-2627-raw-dylib/link-ordinal-multiple.rs +++ b/tests/ui/linkage-attr/raw-dylib/windows/link-ordinal-multiple.rs diff --git a/tests/ui/rfcs/rfc-2627-raw-dylib/link-ordinal-multiple.stderr b/tests/ui/linkage-attr/raw-dylib/windows/link-ordinal-multiple.stderr index 2e6cf3761c2..2e6cf3761c2 100644 --- a/tests/ui/rfcs/rfc-2627-raw-dylib/link-ordinal-multiple.stderr +++ b/tests/ui/linkage-attr/raw-dylib/windows/link-ordinal-multiple.stderr diff --git a/tests/ui/rfcs/rfc-2627-raw-dylib/link-ordinal-not-foreign-fn.rs b/tests/ui/linkage-attr/raw-dylib/windows/link-ordinal-not-foreign-fn.rs index 5982c771033..5982c771033 100644 --- a/tests/ui/rfcs/rfc-2627-raw-dylib/link-ordinal-not-foreign-fn.rs +++ b/tests/ui/linkage-attr/raw-dylib/windows/link-ordinal-not-foreign-fn.rs diff --git a/tests/ui/rfcs/rfc-2627-raw-dylib/link-ordinal-not-foreign-fn.stderr b/tests/ui/linkage-attr/raw-dylib/windows/link-ordinal-not-foreign-fn.stderr index 8f279508720..8f279508720 100644 --- a/tests/ui/rfcs/rfc-2627-raw-dylib/link-ordinal-not-foreign-fn.stderr +++ b/tests/ui/linkage-attr/raw-dylib/windows/link-ordinal-not-foreign-fn.stderr diff --git a/tests/ui/rfcs/rfc-2627-raw-dylib/link-ordinal-too-large.rs b/tests/ui/linkage-attr/raw-dylib/windows/link-ordinal-too-large.rs index 9d741630fc9..9d741630fc9 100644 --- a/tests/ui/rfcs/rfc-2627-raw-dylib/link-ordinal-too-large.rs +++ b/tests/ui/linkage-attr/raw-dylib/windows/link-ordinal-too-large.rs diff --git a/tests/ui/rfcs/rfc-2627-raw-dylib/link-ordinal-too-large.stderr b/tests/ui/linkage-attr/raw-dylib/windows/link-ordinal-too-large.stderr index 811145e77ee..811145e77ee 100644 --- a/tests/ui/rfcs/rfc-2627-raw-dylib/link-ordinal-too-large.stderr +++ b/tests/ui/linkage-attr/raw-dylib/windows/link-ordinal-too-large.stderr diff --git a/tests/ui/rfcs/rfc-2627-raw-dylib/link-ordinal-too-many-arguments.rs b/tests/ui/linkage-attr/raw-dylib/windows/link-ordinal-too-many-arguments.rs index 9988115fd8b..9988115fd8b 100644 --- a/tests/ui/rfcs/rfc-2627-raw-dylib/link-ordinal-too-many-arguments.rs +++ b/tests/ui/linkage-attr/raw-dylib/windows/link-ordinal-too-many-arguments.rs diff --git a/tests/ui/rfcs/rfc-2627-raw-dylib/link-ordinal-too-many-arguments.stderr b/tests/ui/linkage-attr/raw-dylib/windows/link-ordinal-too-many-arguments.stderr index d5ce8aff34f..d5ce8aff34f 100644 --- a/tests/ui/rfcs/rfc-2627-raw-dylib/link-ordinal-too-many-arguments.stderr +++ b/tests/ui/linkage-attr/raw-dylib/windows/link-ordinal-too-many-arguments.stderr diff --git a/tests/ui/rfcs/rfc-2627-raw-dylib/link-ordinal-unsupported-link-kind.rs b/tests/ui/linkage-attr/raw-dylib/windows/link-ordinal-unsupported-link-kind.rs index 14e915d602a..14e915d602a 100644 --- a/tests/ui/rfcs/rfc-2627-raw-dylib/link-ordinal-unsupported-link-kind.rs +++ b/tests/ui/linkage-attr/raw-dylib/windows/link-ordinal-unsupported-link-kind.rs diff --git a/tests/ui/rfcs/rfc-2627-raw-dylib/link-ordinal-unsupported-link-kind.stderr b/tests/ui/linkage-attr/raw-dylib/windows/link-ordinal-unsupported-link-kind.stderr index 200b8f62874..200b8f62874 100644 --- a/tests/ui/rfcs/rfc-2627-raw-dylib/link-ordinal-unsupported-link-kind.stderr +++ b/tests/ui/linkage-attr/raw-dylib/windows/link-ordinal-unsupported-link-kind.stderr diff --git a/tests/ui/rfcs/rfc-2627-raw-dylib/multiple-declarations.rs b/tests/ui/linkage-attr/raw-dylib/windows/multiple-declarations.rs index bf3c5e4d435..bf3c5e4d435 100644 --- a/tests/ui/rfcs/rfc-2627-raw-dylib/multiple-declarations.rs +++ b/tests/ui/linkage-attr/raw-dylib/windows/multiple-declarations.rs diff --git a/tests/ui/rfcs/rfc-2627-raw-dylib/multiple-declarations.stderr b/tests/ui/linkage-attr/raw-dylib/windows/multiple-declarations.stderr index b766b5c8dd8..b766b5c8dd8 100644 --- a/tests/ui/rfcs/rfc-2627-raw-dylib/multiple-declarations.stderr +++ b/tests/ui/linkage-attr/raw-dylib/windows/multiple-declarations.stderr diff --git a/tests/ui/linkage-attr/raw-dylib/windows/raw-dylib-windows-only.elf.stderr b/tests/ui/linkage-attr/raw-dylib/windows/raw-dylib-windows-only.elf.stderr new file mode 100644 index 00000000000..70945ed6fc0 --- /dev/null +++ b/tests/ui/linkage-attr/raw-dylib/windows/raw-dylib-windows-only.elf.stderr @@ -0,0 +1,13 @@ +error[E0658]: link kind `raw-dylib` is unstable on ELF platforms + --> $DIR/raw-dylib-windows-only.rs:6:29 + | +LL | #[link(name = "foo", kind = "raw-dylib")] + | ^^^^^^^^^^^ + | + = note: see issue #135694 <https://github.com/rust-lang/rust/issues/135694> for more information + = help: add `#![feature(raw_dylib_elf)]` 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 + +For more information about this error, try `rustc --explain E0658`. diff --git a/tests/ui/rfcs/rfc-2627-raw-dylib/raw-dylib-windows-only.stderr b/tests/ui/linkage-attr/raw-dylib/windows/raw-dylib-windows-only.notelf.stderr index ede20cb8c3f..daed15d784a 100644 --- a/tests/ui/rfcs/rfc-2627-raw-dylib/raw-dylib-windows-only.stderr +++ b/tests/ui/linkage-attr/raw-dylib/windows/raw-dylib-windows-only.notelf.stderr @@ -1,5 +1,5 @@ error[E0455]: link kind `raw-dylib` is only supported on Windows targets - --> $DIR/raw-dylib-windows-only.rs:3:29 + --> $DIR/raw-dylib-windows-only.rs:6:29 | LL | #[link(name = "foo", kind = "raw-dylib")] | ^^^^^^^^^^^ diff --git a/tests/ui/linkage-attr/raw-dylib/windows/raw-dylib-windows-only.rs b/tests/ui/linkage-attr/raw-dylib/windows/raw-dylib-windows-only.rs new file mode 100644 index 00000000000..935c59b5aaa --- /dev/null +++ b/tests/ui/linkage-attr/raw-dylib/windows/raw-dylib-windows-only.rs @@ -0,0 +1,9 @@ +//@ revisions: elf notelf +//@ [elf] only-elf +//@ [notelf] ignore-windows +//@ [notelf] ignore-elf +//@ compile-flags: --crate-type lib +#[link(name = "foo", kind = "raw-dylib")] +//[notelf]~^ ERROR: link kind `raw-dylib` is only supported on Windows targets +//[elf]~^^ ERROR: link kind `raw-dylib` is unstable on ELF platforms +extern "C" {} diff --git a/tests/ui/rfcs/rfc-2627-raw-dylib/unsupported-abi.rs b/tests/ui/linkage-attr/raw-dylib/windows/unsupported-abi.rs index 48af6b009d3..48af6b009d3 100644 --- a/tests/ui/rfcs/rfc-2627-raw-dylib/unsupported-abi.rs +++ b/tests/ui/linkage-attr/raw-dylib/windows/unsupported-abi.rs diff --git a/tests/ui/rfcs/rfc-2627-raw-dylib/unsupported-abi.stderr b/tests/ui/linkage-attr/raw-dylib/windows/unsupported-abi.stderr index ef022404e7f..ef022404e7f 100644 --- a/tests/ui/rfcs/rfc-2627-raw-dylib/unsupported-abi.stderr +++ b/tests/ui/linkage-attr/raw-dylib/windows/unsupported-abi.stderr diff --git a/tests/ui/lint/clashing-extern-fn.stderr b/tests/ui/lint/clashing-extern-fn.stderr index 118b18b224c..0c27547a6ed 100644 --- a/tests/ui/lint/clashing-extern-fn.stderr +++ b/tests/ui/lint/clashing-extern-fn.stderr @@ -17,7 +17,7 @@ LL | fn hidden_niche_unsafe_cell() -> Option<UnsafeCell<NonZero<usiz = help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum = note: enum has no representation hint -warning: `extern` block uses type `Option<(usize) is 0..=>`, which is not FFI-safe +warning: `extern` block uses type `Option<(usize) is 0..>`, which is not FFI-safe --> $DIR/clashing-extern-fn.rs:502:54 | LL | fn pt_non_zero_usize_opt_full_range() -> Option<pattern_type!(usize is 0..)>; diff --git a/tests/ui/lint/dead-code/allow-or-expect-dead_code-114557-2.rs b/tests/ui/lint/dead-code/allow-or-expect-dead_code-114557-2.rs index 20999df9844..db23dcd5e5e 100644 --- a/tests/ui/lint/dead-code/allow-or-expect-dead_code-114557-2.rs +++ b/tests/ui/lint/dead-code/allow-or-expect-dead_code-114557-2.rs @@ -1,10 +1,10 @@ //@ check-pass -// this test checks that the `dead_code` lint is *NOT* being emited +// this test checks that the `dead_code` lint is *NOT* being emitted // for `foo` as `foo` is being used by `main`, and so the `#[expect]` // is unfulfilled // -// it also checks that the `dead_code` lint is also *NOT* emited +// it also checks that the `dead_code` lint is also *NOT* emitted // for `bar` as it's suppresed by the `#[expect]` on `bar` #![warn(dead_code)] // to override compiletest diff --git a/tests/ui/lint/dead-code/allow-or-expect-dead_code-114557-3.rs b/tests/ui/lint/dead-code/allow-or-expect-dead_code-114557-3.rs index 08103b23387..c4476e43e1f 100644 --- a/tests/ui/lint/dead-code/allow-or-expect-dead_code-114557-3.rs +++ b/tests/ui/lint/dead-code/allow-or-expect-dead_code-114557-3.rs @@ -1,7 +1,7 @@ //@ check-pass // this test makes sure that the `unfulfilled_lint_expectations` lint -// is being emited for `foo` as foo is not dead code, it's pub +// is being emitted for `foo` as foo is not dead code, it's pub #![warn(dead_code)] // to override compiletest diff --git a/tests/ui/lint/dead-code/allow-or-expect-dead_code-114557.rs b/tests/ui/lint/dead-code/allow-or-expect-dead_code-114557.rs index f2625f0781f..ea2e81261d1 100644 --- a/tests/ui/lint/dead-code/allow-or-expect-dead_code-114557.rs +++ b/tests/ui/lint/dead-code/allow-or-expect-dead_code-114557.rs @@ -2,7 +2,7 @@ //@ revisions: allow expect // this test checks that no matter if we put #[allow(dead_code)] -// or #[expect(dead_code)], no warning is being emited +// or #[expect(dead_code)], no warning is being emitted #![warn(dead_code)] // to override compiletest diff --git a/tests/ui/lint/removed-lints/README.md b/tests/ui/lint/removed-lints/README.md new file mode 100644 index 00000000000..abe7ee04115 --- /dev/null +++ b/tests/ui/lint/removed-lints/README.md @@ -0,0 +1,4 @@ +# Removed lints + +This directory contains tests to confirm that lints that have been +removed do not cause errors and produce the appropriate warnings. diff --git a/tests/ui/lint/removed-lints/ptr_cast_add_auto_to_object.rs b/tests/ui/lint/removed-lints/ptr_cast_add_auto_to_object.rs new file mode 100644 index 00000000000..7fb635487ff --- /dev/null +++ b/tests/ui/lint/removed-lints/ptr_cast_add_auto_to_object.rs @@ -0,0 +1,5 @@ +//@ check-pass + +#![deny(ptr_cast_add_auto_to_object)] +//~^ WARN lint `ptr_cast_add_auto_to_object` has been removed +fn main() {} diff --git a/tests/ui/lint/removed-lints/ptr_cast_add_auto_to_object.stderr b/tests/ui/lint/removed-lints/ptr_cast_add_auto_to_object.stderr new file mode 100644 index 00000000000..36b5e847d80 --- /dev/null +++ b/tests/ui/lint/removed-lints/ptr_cast_add_auto_to_object.stderr @@ -0,0 +1,10 @@ +warning: lint `ptr_cast_add_auto_to_object` has been removed: converted into hard error, see issue #127323 <https://github.com/rust-lang/rust/issues/127323> for more information + --> $DIR/ptr_cast_add_auto_to_object.rs:3:9 + | +LL | #![deny(ptr_cast_add_auto_to_object)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: `#[warn(renamed_and_removed_lints)]` on by default + +warning: 1 warning emitted + diff --git a/tests/ui/lint/type-overflow.rs b/tests/ui/lint/type-overflow.rs index 1e74a8925f6..16a021da065 100644 --- a/tests/ui/lint/type-overflow.rs +++ b/tests/ui/lint/type-overflow.rs @@ -41,8 +41,12 @@ fn main() { let fail = 0x8FFF_FFFF_FFFF_FFFE; //~WARNING literal out of range for `i32` //~| HELP consider using the type `u64` instead - //~| HELP + //~| HELP consider using the type `u64` for the literal and cast it to `i32` let fail = -0b1111_1111i8; //~WARNING literal out of range for `i8` //~| HELP consider using the type `i16` instead + + let fail = 0x8000_0000_0000_0000_0000_0000_FFFF_FFFE; //~WARNING literal out of range for `i32` + //~| HELP consider using the type `u128` instead + //~| HELP consider using the type `u128` for the literal and cast it to `i32` } diff --git a/tests/ui/lint/type-overflow.stderr b/tests/ui/lint/type-overflow.stderr index 4d6403b1e7d..065c530adcf 100644 --- a/tests/ui/lint/type-overflow.stderr +++ b/tests/ui/lint/type-overflow.stderr @@ -112,9 +112,9 @@ LL | let fail = 0x8FFF_FFFF_FFFF_FFFE; | = note: the literal `0x8FFF_FFFF_FFFF_FFFE` (decimal `10376293541461622782`) does not fit into the type `i32` and will become `-2i32` = help: consider using the type `u64` instead -help: to use as a negative number (decimal `-2`), consider using the type `u32` for the literal and cast it to `i32` +help: to use as a negative number (decimal `-2`), consider using the type `u64` for the literal and cast it to `i32` | -LL | let fail = 0x8FFF_FFFF_FFFF_FFFEu32 as i32; +LL | let fail = 0x8FFF_FFFF_FFFF_FFFEu64 as i32; | ++++++++++ warning: literal out of range for `i8` @@ -126,5 +126,18 @@ LL | let fail = -0b1111_1111i8; = note: the literal `0b1111_1111i8` (decimal `255`) does not fit into the type `i8` = note: and the value `-0b1111_1111i8` will become `1i8` -warning: 11 warnings emitted +warning: literal out of range for `i32` + --> $DIR/type-overflow.rs:49:16 + | +LL | let fail = 0x8000_0000_0000_0000_0000_0000_FFFF_FFFE; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: the literal `0x8000_0000_0000_0000_0000_0000_FFFF_FFFE` (decimal `170141183460469231731687303720179073022`) does not fit into the type `i32` and will become `-2i32` + = help: consider using the type `u128` instead +help: to use as a negative number (decimal `-2`), consider using the type `u128` for the literal and cast it to `i32` + | +LL | let fail = 0x8000_0000_0000_0000_0000_0000_FFFF_FFFEu128 as i32; + | +++++++++++ + +warning: 12 warnings emitted diff --git a/tests/ui/lint/unused/must-use-ops.rs b/tests/ui/lint/unused/must-use-ops.rs index f61cf0fcfcb..5085dbb58c1 100644 --- a/tests/ui/lint/unused/must-use-ops.rs +++ b/tests/ui/lint/unused/must-use-ops.rs @@ -6,7 +6,7 @@ #![feature(never_type)] fn deref_never(x: &!) { - // Don't lint for uninhabited typess + // Don't lint for uninhabited types *x; } diff --git a/tests/ui/lowering/no-name-for-DefPath-issue-133426.rs b/tests/ui/lowering/no-name-for-DefPath-issue-133426.rs new file mode 100644 index 00000000000..fc3b51b40a5 --- /dev/null +++ b/tests/ui/lowering/no-name-for-DefPath-issue-133426.rs @@ -0,0 +1,20 @@ +//! Test for the crash in #133426, caused by an empty symbol being used for a +//! type name. + +#![allow(incomplete_features)] +#![feature(never_patterns)] + +fn a( + _: impl Iterator< + Item = [(); { + match *todo!() { ! }; //~ ERROR type `!` cannot be dereferenced + }], + >, +) { +} + +fn b(_: impl Iterator<Item = { match 0 { ! } }>) {} +//~^ ERROR associated const equality is incomplete +//~| ERROR expected type, found constant + +fn main() {} diff --git a/tests/ui/lowering/no-name-for-DefPath-issue-133426.stderr b/tests/ui/lowering/no-name-for-DefPath-issue-133426.stderr new file mode 100644 index 00000000000..555d8eec6ba --- /dev/null +++ b/tests/ui/lowering/no-name-for-DefPath-issue-133426.stderr @@ -0,0 +1,31 @@ +error[E0658]: associated const equality is incomplete + --> $DIR/no-name-for-DefPath-issue-133426.rs:16:23 + | +LL | fn b(_: impl Iterator<Item = { match 0 { ! } }>) {} + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #92827 <https://github.com/rust-lang/rust/issues/92827> for more information + = help: add `#![feature(associated_const_equality)]` 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[E0614]: type `!` cannot be dereferenced + --> $DIR/no-name-for-DefPath-issue-133426.rs:10:19 + | +LL | match *todo!() { ! }; + | ^^^^^^^^ can't be dereferenced + +error: expected type, found constant + --> $DIR/no-name-for-DefPath-issue-133426.rs:16:30 + | +LL | fn b(_: impl Iterator<Item = { match 0 { ! } }>) {} + | ---- ^^^^^^^^^^^^^^^^^ unexpected constant + | | + | expected a type because of this associated type + | +note: the associated type is defined here + --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL + +error: aborting due to 3 previous errors + +Some errors have detailed explanations: E0614, E0658. +For more information about an error, try `rustc --explain E0614`. diff --git a/tests/ui/macros/macro-parameter-span.stderr b/tests/ui/macros/macro-parameter-span.stderr index 247750a8ad7..44c8c56dff9 100644 --- a/tests/ui/macros/macro-parameter-span.stderr +++ b/tests/ui/macros/macro-parameter-span.stderr @@ -1,6 +1,9 @@ error[E0425]: cannot find value `x` in this scope --> $DIR/macro-parameter-span.rs:11:9 | +LL | $id + | --- due to this macro variable +... LL | x | ^ not found in this scope diff --git a/tests/ui/macros/nonterminal-matching.rs b/tests/ui/macros/nonterminal-matching.rs index a655b665103..ca95e8fac05 100644 --- a/tests/ui/macros/nonterminal-matching.rs +++ b/tests/ui/macros/nonterminal-matching.rs @@ -31,7 +31,7 @@ macro_rules! foo { (tt $x:tt) => { bar!(tt $x); }; (expr $x:expr) => { bar!(expr $x); }; //~ ERROR: no rules expected expression `3` (literal $x:literal) => { bar!(literal $x); }; //~ ERROR: no rules expected literal `4` - (path $x:path) => { bar!(path $x); }; //~ ERROR: no rules expected path `a::b::c` + (path $x:path) => { bar!(path $x); }; //~ ERROR: no rules expected `path` metavariable (stmt $x:stmt) => { bar!(stmt $x); }; //~ ERROR: no rules expected statement `let abc = 0` } diff --git a/tests/ui/macros/nonterminal-matching.stderr b/tests/ui/macros/nonterminal-matching.stderr index e283dfcb8fd..ba2b3e213ad 100644 --- a/tests/ui/macros/nonterminal-matching.stderr +++ b/tests/ui/macros/nonterminal-matching.stderr @@ -67,7 +67,7 @@ LL | (literal 4) => {}; = help: try using `:tt` instead in the macro definition = note: this error originates in the macro `foo` (in Nightly builds, run with -Z macro-backtrace for more info) -error: no rules expected path `a::b::c` +error: no rules expected `path` metavariable --> $DIR/nonterminal-matching.rs:34:35 | LL | (path $x:path) => { bar!(path $x); }; diff --git a/tests/ui/macros/not-utf8.stderr b/tests/ui/macros/not-utf8.stderr index 17ee8197ac8..be028816e0f 100644 --- a/tests/ui/macros/not-utf8.stderr +++ b/tests/ui/macros/not-utf8.stderr @@ -7,7 +7,7 @@ LL | include!("not-utf8.bin"); note: byte `193` is not valid utf-8 --> $DIR/not-utf8.bin:1:1 | -LL | �|�␂!5�cc␕␂�Ӻi��WWj�ȥ�'�}�␒�J�ȉ��W�␞O�@����␜w�V���LO����␔[ ␃_�'���SQ�~ذ��ų&��- ��lN~��!@␌ _#���kQ��h�␝�:�... +LL | �|�␂!5�cc␕␂�Ӻi��WWj�ȥ�'�}�␒�J�ȉ��W�␞O�@����␜w�V���LO����␔[ ␃_�'���SQ�~ذ��ų&��- ��lN~��!@␌ _#���kQ��h�␝�:�␜␇� | ^ = note: this error originates in the macro `include` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/tests/ui/macros/rfc-3086-metavar-expr/syntax-errors.stderr b/tests/ui/macros/rfc-3086-metavar-expr/syntax-errors.stderr index ce7694ecb1d..d9646760cea 100644 --- a/tests/ui/macros/rfc-3086-metavar-expr/syntax-errors.stderr +++ b/tests/ui/macros/rfc-3086-metavar-expr/syntax-errors.stderr @@ -338,6 +338,9 @@ LL | no_curly__no_rhs_dollar__no_round!(a); error[E0425]: cannot find value `a` in this scope --> $DIR/syntax-errors.rs:152:37 | +LL | ( $i:ident ) => { count($i) }; + | -- due to this macro variable +... LL | no_curly__rhs_dollar__no_round!(a); | ^ not found in this scope diff --git a/tests/ui/macros/same-sequence-span.stderr b/tests/ui/macros/same-sequence-span.stderr index ff32ef94386..34df201f5a5 100644 --- a/tests/ui/macros/same-sequence-span.stderr +++ b/tests/ui/macros/same-sequence-span.stderr @@ -18,7 +18,7 @@ error: `$x:expr` may be followed by `$y:tt`, which is not allowed for `expr` fra --> $DIR/same-sequence-span.rs:19:1 | LL | | macro_rules! manual_foo { - | |_________________________________^ not allowed after `expr` fragments + | |__________________________^not allowed after `expr` fragments ... LL | proc_macro_sequence::make_foo!(); | ^------------------------------- diff --git a/tests/ui/macros/trace_faulty_macros.rs b/tests/ui/macros/trace_faulty_macros.rs index 87036bb9c6f..e0cbbd8f5c9 100644 --- a/tests/ui/macros/trace_faulty_macros.rs +++ b/tests/ui/macros/trace_faulty_macros.rs @@ -46,7 +46,7 @@ macro_rules! test { (let $p:pat = $e:expr) => {test!(($p,$e))}; // this should be expr // vvv - (($p:pat, $e:pat)) => {let $p = $e;}; //~ ERROR expected expression, found pattern `1+1` + (($p:pat, $e:pat)) => {let $p = $e;}; //~ ERROR expected expression, found `pat` metavariable } fn foo() { diff --git a/tests/ui/macros/trace_faulty_macros.stderr b/tests/ui/macros/trace_faulty_macros.stderr index 10ad3faab16..73fed66e619 100644 --- a/tests/ui/macros/trace_faulty_macros.stderr +++ b/tests/ui/macros/trace_faulty_macros.stderr @@ -50,7 +50,7 @@ LL | my_recursive_macro!(); = note: expanding `my_recursive_macro! { }` = note: to `my_recursive_macro! ();` -error: expected expression, found pattern `A { a : a, b : 0, c : _, .. }` +error: expected expression, found `pat` metavariable --> $DIR/trace_faulty_macros.rs:16:9 | LL | $a @@ -69,22 +69,15 @@ LL | #[derive(Debug)] LL | fn use_derive_macro_as_attr() {} | -------------------------------- not a `struct`, `enum` or `union` -error: expected expression, found pattern `1+1` +error: expected expression, found `pat` metavariable --> $DIR/trace_faulty_macros.rs:49:37 | -LL | (let $p:pat = $e:expr) => {test!(($p,$e))}; - | -- this is interpreted as expression, but it is expected to be pattern -... LL | (($p:pat, $e:pat)) => {let $p = $e;}; | ^^ expected expression ... LL | test!(let x = 1+1); - | ------------------ - | | | - | | this is expected to be expression - | in this macro invocation + | ------------------ in this macro invocation | - = note: when forwarding a matched fragment to another macro-by-example, matchers in the second macro will see an opaque AST of the fragment type, not the underlying tokens = note: this error originates in the macro `test` (in Nightly builds, run with -Z macro-backtrace for more info) note: trace_macro diff --git a/tests/ui/methods/ident-from-macro-expansion.rs b/tests/ui/methods/ident-from-macro-expansion.rs new file mode 100644 index 00000000000..38d2fee0e53 --- /dev/null +++ b/tests/ui/methods/ident-from-macro-expansion.rs @@ -0,0 +1,18 @@ +macro_rules! dot { + ($id:ident) => { + ().$id(); + } +} + +macro_rules! dispatch { + ($id:ident) => { + <()>::$id(); + } +} + +fn main() { + dot!(hello); + //~^ ERROR no method named `hello` found for unit type `()` in the current scope + dispatch!(hello); + //~^ ERROR no function or associated item named `hello` found for unit type `()` in the current scope +} diff --git a/tests/ui/methods/ident-from-macro-expansion.stderr b/tests/ui/methods/ident-from-macro-expansion.stderr new file mode 100644 index 00000000000..b596ce29f6f --- /dev/null +++ b/tests/ui/methods/ident-from-macro-expansion.stderr @@ -0,0 +1,21 @@ +error[E0599]: no method named `hello` found for unit type `()` in the current scope + --> $DIR/ident-from-macro-expansion.rs:14:10 + | +LL | ().$id(); + | --- due to this macro variable +... +LL | dot!(hello); + | ^^^^^ method not found in `()` + +error[E0599]: no function or associated item named `hello` found for unit type `()` in the current scope + --> $DIR/ident-from-macro-expansion.rs:16:15 + | +LL | <()>::$id(); + | --- due to this macro variable +... +LL | dispatch!(hello); + | ^^^^^ function or associated item not found in `()` + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0599`. diff --git a/tests/ui/methods/inherent-bound-in-probe.rs b/tests/ui/methods/inherent-bound-in-probe.rs index 9b9eb91559b..4add93e808d 100644 --- a/tests/ui/methods/inherent-bound-in-probe.rs +++ b/tests/ui/methods/inherent-bound-in-probe.rs @@ -1,5 +1,3 @@ -//@ normalize-stderr: "long-type-\d+" -> "long-type-hash" - // Fixes #110131 // // The issue is that we were constructing an `ImplDerived` cause code for the diff --git a/tests/ui/methods/inherent-bound-in-probe.stderr b/tests/ui/methods/inherent-bound-in-probe.stderr index 433ef02a2aa..77aed390c9a 100644 --- a/tests/ui/methods/inherent-bound-in-probe.stderr +++ b/tests/ui/methods/inherent-bound-in-probe.stderr @@ -1,5 +1,5 @@ error[E0277]: `Helper<'a, T>` is not an iterator - --> $DIR/inherent-bound-in-probe.rs:40:21 + --> $DIR/inherent-bound-in-probe.rs:38:21 | LL | type IntoIter = Helper<'a, T>; | ^^^^^^^^^^^^^ `Helper<'a, T>` is not an iterator @@ -9,14 +9,14 @@ note: required by a bound in `std::iter::IntoIterator::IntoIter` --> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL error[E0275]: overflow evaluating the requirement `&_: IntoIterator` - --> $DIR/inherent-bound-in-probe.rs:44:9 + --> $DIR/inherent-bound-in-probe.rs:42:9 | LL | Helper::new(&self.0) | ^^^^^^ | = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`inherent_bound_in_probe`) note: required for `&BitReaderWrapper<_>` to implement `IntoIterator` - --> $DIR/inherent-bound-in-probe.rs:34:13 + --> $DIR/inherent-bound-in-probe.rs:32:13 | LL | impl<'a, T> IntoIterator for &'a BitReaderWrapper<T> | ^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^ @@ -26,7 +26,7 @@ LL | &'a T: IntoIterator<Item = &'a u8>, = note: 126 redundant requirements hidden = note: required for `&BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<_>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>` to implement `IntoIterator` note: required by a bound in `Helper` - --> $DIR/inherent-bound-in-probe.rs:18:12 + --> $DIR/inherent-bound-in-probe.rs:16:12 | LL | struct Helper<'a, T> | ------ required by a bound in this struct diff --git a/tests/ui/mir/checks_without_panic_impl.rs b/tests/ui/mir/checks_without_panic_impl.rs index 0dba5784daa..11ab50a5f9a 100644 --- a/tests/ui/mir/checks_without_panic_impl.rs +++ b/tests/ui/mir/checks_without_panic_impl.rs @@ -2,6 +2,7 @@ // does not prevent crates without a panic_impl from compiling. // See rust-lang/rust#109996 +//@ add-core-stubs //@ build-pass //@ compile-flags: -Cdebug-assertions=yes @@ -11,7 +12,7 @@ #![feature(no_core)] #![no_core] -#[lang = "sized"] -trait Foo {} +extern crate minicore; +use minicore::*; pub unsafe fn foo(x: *const i32) -> &'static i32 { unsafe { &*x } } diff --git a/tests/ui/never_type/unused_trait_in_never_pattern_body.rs b/tests/ui/never_type/unused_trait_in_never_pattern_body.rs new file mode 100644 index 00000000000..8179c94b72b --- /dev/null +++ b/tests/ui/never_type/unused_trait_in_never_pattern_body.rs @@ -0,0 +1,12 @@ +fn a() { + match 0 { + ! => || { //~ ERROR `!` patterns are experimental + //~^ ERROR a never pattern is always unreachable + //~^^ ERROR mismatched types + use std::ops::Add; + 0.add(1) + }, + } +} + +fn main() {} diff --git a/tests/ui/never_type/unused_trait_in_never_pattern_body.stderr b/tests/ui/never_type/unused_trait_in_never_pattern_body.stderr new file mode 100644 index 00000000000..18ca9f12b7e --- /dev/null +++ b/tests/ui/never_type/unused_trait_in_never_pattern_body.stderr @@ -0,0 +1,36 @@ +error[E0658]: `!` patterns are experimental + --> $DIR/unused_trait_in_never_pattern_body.rs:3:9 + | +LL | ! => || { + | ^ + | + = note: see issue #118155 <https://github.com/rust-lang/rust/issues/118155> for more information + = help: add `#![feature(never_patterns)]` 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: a never pattern is always unreachable + --> $DIR/unused_trait_in_never_pattern_body.rs:3:14 + | +LL | ! => || { + | ______________^ +LL | | +LL | | +LL | | use std::ops::Add; +LL | | 0.add(1) +LL | | }, + | | ^ + | | | + | |_________this will never be executed + | help: remove this expression + +error: mismatched types + --> $DIR/unused_trait_in_never_pattern_body.rs:3:9 + | +LL | ! => || { + | ^ a never pattern must be used on an uninhabited type + | + = note: the matched value is of type `i32` + +error: aborting due to 3 previous errors + +For more information about this error, try `rustc --explain E0658`. diff --git a/tests/ui/nll/issue-97997.rs b/tests/ui/nll/issue-97997.rs index c64e720b12f..8e0fbe89ac2 100644 --- a/tests/ui/nll/issue-97997.rs +++ b/tests/ui/nll/issue-97997.rs @@ -12,5 +12,4 @@ fn main() { <fn(&u8) as Foo>::ASSOC; //~^ ERROR implementation of `Foo` is not general enough - //~| ERROR implementation of `Foo` is not general enough } diff --git a/tests/ui/nll/issue-97997.stderr b/tests/ui/nll/issue-97997.stderr index 89eaf77adf0..ff08daaeaac 100644 --- a/tests/ui/nll/issue-97997.stderr +++ b/tests/ui/nll/issue-97997.stderr @@ -7,15 +7,5 @@ LL | <fn(&u8) as Foo>::ASSOC; = note: `Foo` would have to be implemented for the type `for<'a> fn(&'a u8)` = note: ...but `Foo` is actually implemented for the type `fn(&'0 u8)`, for some specific lifetime `'0` -error: implementation of `Foo` is not general enough - --> $DIR/issue-97997.rs:13:5 - | -LL | <fn(&u8) as Foo>::ASSOC; - | ^^^^^^^^^^^^^^^^^^^^^^^ implementation of `Foo` is not general enough - | - = note: `Foo` would have to be implemented for the type `for<'a> fn(&'a u8)` - = note: ...but `Foo` is actually implemented for the type `fn(&'0 u8)`, for some specific lifetime `'0` - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` - -error: aborting due to 2 previous errors +error: aborting due to 1 previous error diff --git a/tests/ui/parser/attribute/attr-bad-meta-4.rs b/tests/ui/parser/attribute/attr-bad-meta-4.rs index 2a69ae5ac06..2d0c6dbb50a 100644 --- a/tests/ui/parser/attribute/attr-bad-meta-4.rs +++ b/tests/ui/parser/attribute/attr-bad-meta-4.rs @@ -1,8 +1,8 @@ macro_rules! mac { ($attr_item: meta) => { #[cfg($attr_item)] - //~^ ERROR expected unsuffixed literal, found `an(arbitrary token stream)` - //~| ERROR expected unsuffixed literal, found `an(arbitrary token stream)` + //~^ ERROR expected unsuffixed literal, found `meta` metavariable + //~| ERROR expected unsuffixed literal, found `meta` metavariable struct S; } } diff --git a/tests/ui/parser/attribute/attr-bad-meta-4.stderr b/tests/ui/parser/attribute/attr-bad-meta-4.stderr index 192be28db3f..dea574fd36d 100644 --- a/tests/ui/parser/attribute/attr-bad-meta-4.stderr +++ b/tests/ui/parser/attribute/attr-bad-meta-4.stderr @@ -4,7 +4,7 @@ error: expected unsuffixed literal, found `-` LL | #[cfg(feature = -1)] | ^ -error: expected unsuffixed literal, found `an(arbitrary token stream)` +error: expected unsuffixed literal, found `meta` metavariable --> $DIR/attr-bad-meta-4.rs:3:15 | LL | #[cfg($attr_item)] @@ -15,7 +15,7 @@ LL | mac!(an(arbitrary token stream)); | = note: this error originates in the macro `mac` (in Nightly builds, run with -Z macro-backtrace for more info) -error: expected unsuffixed literal, found `an(arbitrary token stream)` +error: expected unsuffixed literal, found `meta` metavariable --> $DIR/attr-bad-meta-4.rs:3:15 | LL | #[cfg($attr_item)] diff --git a/tests/ui/parser/attribute/attr-unquoted-ident.rs b/tests/ui/parser/attribute/attr-unquoted-ident.rs index 5b15b8d69fc..396265f715e 100644 --- a/tests/ui/parser/attribute/attr-unquoted-ident.rs +++ b/tests/ui/parser/attribute/attr-unquoted-ident.rs @@ -19,7 +19,7 @@ fn main() { macro_rules! make { ($name:ident) => { #[doc(alias = $name)] pub struct S; } - //~^ ERROR expected unsuffixed literal, found `nickname` + //~^ ERROR expected unsuffixed literal, found identifier `nickname` } make!(nickname); //~ NOTE in this expansion diff --git a/tests/ui/parser/attribute/attr-unquoted-ident.stderr b/tests/ui/parser/attribute/attr-unquoted-ident.stderr index e0f99459c44..2d7997f1aea 100644 --- a/tests/ui/parser/attribute/attr-unquoted-ident.stderr +++ b/tests/ui/parser/attribute/attr-unquoted-ident.stderr @@ -20,7 +20,7 @@ help: surround the identifier with quotation marks to make it into a string lite LL | #[cfg(key="foo bar baz")] | + + -error: expected unsuffixed literal, found `nickname` +error: expected unsuffixed literal, found identifier `nickname` --> $DIR/attr-unquoted-ident.rs:21:38 | LL | ($name:ident) => { #[doc(alias = $name)] pub struct S; } diff --git a/tests/ui/parser/block-no-opening-brace.rs b/tests/ui/parser/block-no-opening-brace.rs index 2fde37ce6ac..b08c830bfc7 100644 --- a/tests/ui/parser/block-no-opening-brace.rs +++ b/tests/ui/parser/block-no-opening-brace.rs @@ -30,7 +30,7 @@ fn in_try() { // FIXME(#80931) fn in_async() { async - let x = 0; //~ ERROR expected one of `move`, `|`, or `||`, found keyword `let` + let x = 0; //~ ERROR expected one of `move`, `use`, `|`, or `||`, found keyword `let` } // FIXME(#78168) diff --git a/tests/ui/parser/block-no-opening-brace.stderr b/tests/ui/parser/block-no-opening-brace.stderr index b65de4eac3f..f51ee92626f 100644 --- a/tests/ui/parser/block-no-opening-brace.stderr +++ b/tests/ui/parser/block-no-opening-brace.stderr @@ -43,11 +43,11 @@ error: expected expression, found reserved keyword `try` LL | try | ^^^ expected expression -error: expected one of `move`, `|`, or `||`, found keyword `let` +error: expected one of `move`, `use`, `|`, or `||`, found keyword `let` --> $DIR/block-no-opening-brace.rs:33:9 | LL | async - | - expected one of `move`, `|`, or `||` + | - expected one of `move`, `use`, `|`, or `||` LL | let x = 0; | ^^^ unexpected token diff --git a/tests/ui/parser/bounds-lifetime-where.rs b/tests/ui/parser/bounds-lifetime-where.rs index 7ff75233d3a..730be7139be 100644 --- a/tests/ui/parser/bounds-lifetime-where.rs +++ b/tests/ui/parser/bounds-lifetime-where.rs @@ -5,6 +5,6 @@ type A where 'a:, = u8; // OK type A where 'a: 'b + 'c = u8; // OK type A where = u8; // OK type A where 'a: 'b + = u8; // OK -type A where , = u8; //~ ERROR expected one of `;`, `=`, `where`, lifetime, or type, found `,` +type A where , = u8; //~ ERROR expected one of `#`, `;`, `=`, `where`, lifetime, or type, found `,` fn main() {} diff --git a/tests/ui/parser/bounds-lifetime-where.stderr b/tests/ui/parser/bounds-lifetime-where.stderr index 9dd963afc79..5aadb5fff32 100644 --- a/tests/ui/parser/bounds-lifetime-where.stderr +++ b/tests/ui/parser/bounds-lifetime-where.stderr @@ -1,8 +1,8 @@ -error: expected one of `;`, `=`, `where`, lifetime, or type, found `,` +error: expected one of `#`, `;`, `=`, `where`, lifetime, or type, found `,` --> $DIR/bounds-lifetime-where.rs:8:14 | LL | type A where , = u8; - | ^ expected one of `;`, `=`, `where`, lifetime, or type + | ^ expected one of `#`, `;`, `=`, `where`, lifetime, or type error: aborting due to 1 previous error diff --git a/tests/ui/parser/byte-string-literals.stderr b/tests/ui/parser/byte-string-literals.stderr index 08633742557..3e589258d41 100644 --- a/tests/ui/parser/byte-string-literals.stderr +++ b/tests/ui/parser/byte-string-literals.stderr @@ -44,7 +44,7 @@ error[E0766]: unterminated double quote byte string LL | b"a | ______^ LL | | } - | |_^ + | |__^ error: aborting due to 6 previous errors diff --git a/tests/ui/parser/expr-as-stmt.stderr b/tests/ui/parser/expr-as-stmt.stderr index 76a83aa0161..577c3455a71 100644 --- a/tests/ui/parser/expr-as-stmt.stderr +++ b/tests/ui/parser/expr-as-stmt.stderr @@ -133,7 +133,7 @@ error[E0614]: type `{integer}` cannot be dereferenced --> $DIR/expr-as-stmt.rs:25:11 | LL | { 3 } * 3 - | ^^^ + | ^^^ can't be dereferenced | help: parentheses are required to parse this as an expression | diff --git a/tests/ui/parser/issues/issue-65122-mac-invoc-in-mut-patterns.rs b/tests/ui/parser/issues/issue-65122-mac-invoc-in-mut-patterns.rs index 30f3781bf77..1a0833ebb2f 100644 --- a/tests/ui/parser/issues/issue-65122-mac-invoc-in-mut-patterns.rs +++ b/tests/ui/parser/issues/issue-65122-mac-invoc-in-mut-patterns.rs @@ -12,7 +12,7 @@ macro_rules! mac2 { ($eval:pat) => { let mut $eval = (); //~^ ERROR `mut` must be followed by a named binding - //~| ERROR expected identifier, found `does_not_exist!()` + //~| ERROR expected identifier, found metavariable }; } diff --git a/tests/ui/parser/issues/issue-65122-mac-invoc-in-mut-patterns.stderr b/tests/ui/parser/issues/issue-65122-mac-invoc-in-mut-patterns.stderr index dda37d83282..59e1b64686b 100644 --- a/tests/ui/parser/issues/issue-65122-mac-invoc-in-mut-patterns.stderr +++ b/tests/ui/parser/issues/issue-65122-mac-invoc-in-mut-patterns.stderr @@ -15,11 +15,11 @@ LL - let mut $eval = (); LL + let $eval = (); | -error: expected identifier, found `does_not_exist!()` +error: expected identifier, found metavariable --> $DIR/issue-65122-mac-invoc-in-mut-patterns.rs:13:17 | LL | let mut $eval = (); - | ^^^^^ expected identifier + | ^^^^^ expected identifier, found metavariable ... LL | mac2! { does_not_exist!() } | --------------------------- in this macro invocation diff --git a/tests/ui/parser/issues/misplaced-return-type-where-in-next-line-issue-126311.stderr b/tests/ui/parser/issues/misplaced-return-type-where-in-next-line-issue-126311.stderr index 196a46d7ea5..6245f81d533 100644 --- a/tests/ui/parser/issues/misplaced-return-type-where-in-next-line-issue-126311.stderr +++ b/tests/ui/parser/issues/misplaced-return-type-where-in-next-line-issue-126311.stderr @@ -2,7 +2,7 @@ error: return type should be specified after the function parameters --> $DIR/misplaced-return-type-where-in-next-line-issue-126311.rs:5:15 | LL | K: Clone, -> Result<u8, String> - | ^^ expected one of `{`, lifetime, or type + | ^^ expected one of `#`, `{`, lifetime, or type | help: place the return type after the function parameters | diff --git a/tests/ui/parser/misspelled-keywords/async-move.stderr b/tests/ui/parser/misspelled-keywords/async-move.stderr index a002d54dc91..2507326fb28 100644 --- a/tests/ui/parser/misspelled-keywords/async-move.stderr +++ b/tests/ui/parser/misspelled-keywords/async-move.stderr @@ -1,8 +1,8 @@ -error: expected one of `move`, `|`, or `||`, found `Move` +error: expected one of `move`, `use`, `|`, or `||`, found `Move` --> $DIR/async-move.rs:4:11 | LL | async Move {} - | ^^^^ expected one of `move`, `|`, or `||` + | ^^^^ expected one of `move`, `use`, `|`, or `||` | help: write keyword `move` in lowercase | diff --git a/tests/ui/parser/mut-patterns.rs b/tests/ui/parser/mut-patterns.rs index 45968a516e3..ed33968c627 100644 --- a/tests/ui/parser/mut-patterns.rs +++ b/tests/ui/parser/mut-patterns.rs @@ -45,7 +45,7 @@ pub fn main() { // Make sure we don't accidentally allow `mut $p` where `$p:pat`. macro_rules! foo { ($p:pat) => { - let mut $p = 0; //~ ERROR expected identifier, found `x` + let mut $p = 0; //~ ERROR expected identifier, found metavariable } } foo!(x); diff --git a/tests/ui/parser/mut-patterns.stderr b/tests/ui/parser/mut-patterns.stderr index 43f6a344bf3..9dda2499f03 100644 --- a/tests/ui/parser/mut-patterns.stderr +++ b/tests/ui/parser/mut-patterns.stderr @@ -158,11 +158,11 @@ LL - let mut W(mut a, W(b, W(ref c, W(d, B { box f })))) LL + let W(mut a, W(mut b, W(ref c, W(mut d, B { box mut f })))) | -error: expected identifier, found `x` +error: expected identifier, found metavariable --> $DIR/mut-patterns.rs:48:21 | LL | let mut $p = 0; - | ^^ expected identifier + | ^^ expected identifier, found metavariable ... LL | foo!(x); | ------- in this macro invocation diff --git a/tests/ui/parser/ranges-precedence.rs b/tests/ui/parser/ranges-precedence.rs index 14dd6488ff2..783799f7099 100644 --- a/tests/ui/parser/ranges-precedence.rs +++ b/tests/ui/parser/ranges-precedence.rs @@ -1,7 +1,8 @@ //@ run-pass +//@ edition: 2021 // Test that the precedence of ranges is correct - +use core::ops::{Add, RangeTo}; struct Foo { foo: usize, @@ -11,6 +12,13 @@ impl Foo { fn bar(&self) -> usize { 5 } } +impl Add<RangeTo<usize>> for Foo { + type Output = usize; + fn add(self, range: RangeTo<usize>) -> Self::Output { + self.foo + range.end + } +} + fn main() { let x = 1+3..4+5; assert_eq!(x, (4..9)); @@ -49,4 +57,22 @@ fn main() { let y = ..; assert_eq!(y, (..)); + + let reference = &..0; + assert_eq!(*reference, ..0); + let reference2 = &&..0; + assert_eq!(**reference2, ..0); + + let closure = || ..0; + assert_eq!(closure(), ..0); + + let sum = Foo { foo: 3 } + ..4; + assert_eq!(sum, 7); + + macro_rules! expr { + ($e:expr) => {}; + } + expr!(!..0); + expr!(-..0); + expr!(*..0); } diff --git a/tests/ui/parser/raw/too-many-hash.stderr b/tests/ui/parser/raw/too-many-hash.stderr index 1c46b5385cd..6b3854eb4a2 100644 --- a/tests/ui/parser/raw/too-many-hash.stderr +++ b/tests/ui/parser/raw/too-many-hash.stderr @@ -1,8 +1,8 @@ error: too many `#` symbols: raw strings may be delimited by up to 255 `#` symbols, but found 256 --> $DIR/too-many-hash.rs:4:19 | -LL | ... = r################################################################################################################################################################################################################################################################"very raw"##############################################################################################################################################################################################################################################################... - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | ... = r####################################################...#######################################; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^...^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 1 previous error diff --git a/tests/ui/parser/recover/recover-quantified-closure.rs b/tests/ui/parser/recover/recover-quantified-closure.rs index 10af39b7007..1f5004ad099 100644 --- a/tests/ui/parser/recover/recover-quantified-closure.rs +++ b/tests/ui/parser/recover/recover-quantified-closure.rs @@ -7,6 +7,6 @@ fn main() { enum Foo { Bar } fn foo(x: impl Iterator<Item = Foo>) { for <Foo>::Bar in x {} - //~^ ERROR expected one of `move`, `static`, `|` + //~^ ERROR expected one of `move`, `static`, `use`, `|` //~^^ ERROR `for<...>` binders for closures are experimental } diff --git a/tests/ui/parser/recover/recover-quantified-closure.stderr b/tests/ui/parser/recover/recover-quantified-closure.stderr index 6e03bbb5869..48dea071ae6 100644 --- a/tests/ui/parser/recover/recover-quantified-closure.stderr +++ b/tests/ui/parser/recover/recover-quantified-closure.stderr @@ -1,8 +1,8 @@ -error: expected one of `move`, `static`, `|`, or `||`, found `::` +error: expected one of `move`, `static`, `use`, `|`, or `||`, found `::` --> $DIR/recover-quantified-closure.rs:9:14 | LL | for <Foo>::Bar in x {} - | ^^ expected one of `move`, `static`, `|`, or `||` + | ^^ expected one of `move`, `static`, `use`, `|`, or `||` error[E0658]: `for<...>` binders for closures are experimental --> $DIR/recover-quantified-closure.rs:2:5 diff --git a/tests/ui/parser/unbalanced-doublequote.stderr b/tests/ui/parser/unbalanced-doublequote.stderr index 9fdad87a86c..d40b982da7c 100644 --- a/tests/ui/parser/unbalanced-doublequote.stderr +++ b/tests/ui/parser/unbalanced-doublequote.stderr @@ -3,7 +3,7 @@ error[E0765]: unterminated double quote string | LL | / " LL | | } - | |_^ + | |__^ error: aborting due to 1 previous error diff --git a/tests/ui/pattern/bindings-after-at/nested-binding-modes-ref.stderr b/tests/ui/pattern/bindings-after-at/nested-binding-modes-ref.stderr index b378fe356ce..46477f16090 100644 --- a/tests/ui/pattern/bindings-after-at/nested-binding-modes-ref.stderr +++ b/tests/ui/pattern/bindings-after-at/nested-binding-modes-ref.stderr @@ -2,13 +2,13 @@ error[E0614]: type `{integer}` cannot be dereferenced --> $DIR/nested-binding-modes-ref.rs:4:5 | LL | *is_val; - | ^^^^^^^ + | ^^^^^^^ can't be dereferenced error[E0614]: type `{integer}` cannot be dereferenced --> $DIR/nested-binding-modes-ref.rs:9:5 | LL | *is_val; - | ^^^^^^^ + | ^^^^^^^ can't be dereferenced error: aborting due to 2 previous errors diff --git a/tests/ui/privacy/pub-priv-dep/priv-dep-issue-122756.rs b/tests/ui/privacy/pub-priv-dep/priv-dep-issue-122756.rs index d7ade7f0e96..009cc66f3f7 100644 --- a/tests/ui/privacy/pub-priv-dep/priv-dep-issue-122756.rs +++ b/tests/ui/privacy/pub-priv-dep/priv-dep-issue-122756.rs @@ -5,7 +5,7 @@ #![deny(exported_private_dependencies)] // Ensure the libbar.rlib is loaded first. If the command line parameter `--extern foo` does not -// exist, previus version would fail to compile +// exist, previous version would fail to compile #![crate_type = "rlib"] extern crate bar; extern crate foo; diff --git a/tests/ui/proc-macro/derive-cfg-nested-tokens.rs b/tests/ui/proc-macro/derive-cfg-nested-tokens.rs new file mode 100644 index 00000000000..7d4e8d8373d --- /dev/null +++ b/tests/ui/proc-macro/derive-cfg-nested-tokens.rs @@ -0,0 +1,23 @@ +// A regression test for issue #81099. + +//@ check-pass +//@ proc-macro:test-macros.rs + +#![feature(stmt_expr_attributes)] +#![feature(proc_macro_hygiene)] + +#[macro_use] +extern crate test_macros; + +#[derive(Clone, Copy)] +struct S { + // `print_args` runs twice + // - on eagerly configured `S` (from `impl Copy`), only 11 should be printed + // - on non-configured `S` (from `struct S`), both 10 and 11 should be printed + field: [u8; #[print_attr] { + #[cfg(FALSE)] { 10 } + #[cfg(not(FALSE))] { 11 } + }], +} + +fn main() {} diff --git a/tests/ui/proc-macro/derive-cfg-nested-tokens.stdout b/tests/ui/proc-macro/derive-cfg-nested-tokens.stdout new file mode 100644 index 00000000000..05bf21ee8f9 --- /dev/null +++ b/tests/ui/proc-macro/derive-cfg-nested-tokens.stdout @@ -0,0 +1,149 @@ +PRINT-ATTR INPUT (DISPLAY): { #[cfg(not(FALSE))] { 11 } } +PRINT-ATTR INPUT (DEBUG): TokenStream [ + Group { + delimiter: Brace, + stream: TokenStream [ + Punct { + ch: '#', + spacing: Alone, + span: #0 bytes(491..492), + }, + Group { + delimiter: Bracket, + stream: TokenStream [ + Ident { + ident: "cfg", + span: #0 bytes(493..496), + }, + Group { + delimiter: Parenthesis, + stream: TokenStream [ + Ident { + ident: "not", + span: #0 bytes(497..500), + }, + Group { + delimiter: Parenthesis, + stream: TokenStream [ + Ident { + ident: "FALSE", + span: #0 bytes(501..506), + }, + ], + span: #0 bytes(500..507), + }, + ], + span: #0 bytes(496..508), + }, + ], + span: #0 bytes(492..509), + }, + Group { + delimiter: Brace, + stream: TokenStream [ + Literal { + kind: Integer, + symbol: "11", + suffix: None, + span: #0 bytes(513..515), + }, + ], + span: #0 bytes(511..517), + }, + ], + span: #0 bytes(452..523), + }, +] +PRINT-ATTR INPUT (DISPLAY): { #[cfg(FALSE)] { 10 } #[cfg(not(FALSE))] { 11 } } +PRINT-ATTR INPUT (DEBUG): TokenStream [ + Group { + delimiter: Brace, + stream: TokenStream [ + Punct { + ch: '#', + spacing: Alone, + span: #0 bytes(462..463), + }, + Group { + delimiter: Bracket, + stream: TokenStream [ + Ident { + ident: "cfg", + span: #0 bytes(464..467), + }, + Group { + delimiter: Parenthesis, + stream: TokenStream [ + Ident { + ident: "FALSE", + span: #0 bytes(468..473), + }, + ], + span: #0 bytes(467..474), + }, + ], + span: #0 bytes(463..475), + }, + Group { + delimiter: Brace, + stream: TokenStream [ + Literal { + kind: Integer, + symbol: "10", + suffix: None, + span: #0 bytes(478..480), + }, + ], + span: #0 bytes(476..482), + }, + Punct { + ch: '#', + spacing: Alone, + span: #0 bytes(491..492), + }, + Group { + delimiter: Bracket, + stream: TokenStream [ + Ident { + ident: "cfg", + span: #0 bytes(493..496), + }, + Group { + delimiter: Parenthesis, + stream: TokenStream [ + Ident { + ident: "not", + span: #0 bytes(497..500), + }, + Group { + delimiter: Parenthesis, + stream: TokenStream [ + Ident { + ident: "FALSE", + span: #0 bytes(501..506), + }, + ], + span: #0 bytes(500..507), + }, + ], + span: #0 bytes(496..508), + }, + ], + span: #0 bytes(492..509), + }, + Group { + delimiter: Brace, + stream: TokenStream [ + Literal { + kind: Integer, + symbol: "11", + suffix: None, + span: #0 bytes(513..515), + }, + ], + span: #0 bytes(511..517), + }, + ], + span: #0 bytes(452..523), + }, +] diff --git a/tests/ui/process/win-command-child-path.rs b/tests/ui/process/win-command-child-path.rs new file mode 100644 index 00000000000..7ec2679749f --- /dev/null +++ b/tests/ui/process/win-command-child-path.rs @@ -0,0 +1,72 @@ +//@ run-pass +//@ only-windows +//@ needs-subprocess +//@ no-prefer-dynamic + +// Test Windows std::process::Command search path semantics when setting PATH on the child process. +// NOTE: The exact semantics here are (possibly) subject to change. + +use std::process::Command; +use std::{env, fs, path}; + +fn main() { + if env::args().skip(1).any(|s| s == "--child") { + child(); + } else if env::args().skip(1).any(|s| s == "--parent") { + parent(); + } else { + setup(); + } +} + +// Set up the directories so that there are three app dirs: +// app: Where the parent app is run from +// parent: In the parent's PATH env var +// child: In the child's PATH env var +fn setup() { + let exe = env::current_exe().unwrap(); + + fs::create_dir_all("app").unwrap(); + fs::copy(&exe, "app/myapp.exe").unwrap(); + fs::create_dir_all("parent").unwrap(); + fs::copy(&exe, "parent/myapp.exe").unwrap(); + fs::create_dir_all("child").unwrap(); + fs::copy(&exe, "child/myapp.exe").unwrap(); + + let parent_path = path::absolute("parent").unwrap(); + let status = + Command::new("./app/myapp.exe").env("PATH", parent_path).arg("--parent").status().unwrap(); + // print the status in case of abnormal exit + dbg!(status); + assert!(status.success()); +} + +// The child simply prints the name of its parent directory. +fn child() { + let exe = env::current_exe().unwrap(); + let parent = exe.parent().unwrap().file_name().unwrap(); + println!("{}", parent.display()); +} + +fn parent() { + let exe = env::current_exe().unwrap(); + let name = exe.file_name().unwrap(); + + // By default, the application dir will be search first for the exe + let output = Command::new(&name).arg("--child").output().unwrap(); + assert_eq!(output.stdout, b"app\n"); + + // Setting an environment variable should not change the above. + let output = Command::new(&name).arg("--child").env("a", "b").output().unwrap(); + assert_eq!(output.stdout, b"app\n"); + + // Setting a child path means that path will be searched first. + let child_path = path::absolute("child").unwrap(); + let output = Command::new(&name).arg("--child").env("PATH", child_path).output().unwrap(); + assert_eq!(output.stdout, b"child\n"); + + // Setting a child path that does not contain the exe (currently) means + // we fallback to searching the app dir. + let output = Command::new(&name).arg("--child").env("PATH", "").output().unwrap(); + assert_eq!(output.stdout, b"app\n"); +} diff --git a/tests/ui/reachable/expr_unary.stderr b/tests/ui/reachable/expr_unary.stderr index 0a763087c6f..7deca1b8602 100644 --- a/tests/ui/reachable/expr_unary.stderr +++ b/tests/ui/reachable/expr_unary.stderr @@ -2,7 +2,7 @@ error[E0614]: type `!` cannot be dereferenced --> $DIR/expr_unary.rs:8:16 | LL | let x: ! = * { return; }; - | ^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^ can't be dereferenced error: unreachable expression --> $DIR/expr_unary.rs:8:16 diff --git a/tests/ui/recursion/issue-23122-2.rs b/tests/ui/recursion/issue-23122-2.rs index 3e14fa92dd0..95e1f60d8b0 100644 --- a/tests/ui/recursion/issue-23122-2.rs +++ b/tests/ui/recursion/issue-23122-2.rs @@ -1,4 +1,3 @@ -//@ normalize-stderr: "long-type-\d+" -> "long-type-hash" trait Next { type Next: Next; } diff --git a/tests/ui/recursion/issue-23122-2.stderr b/tests/ui/recursion/issue-23122-2.stderr index 10463ab2c33..c5774cc1888 100644 --- a/tests/ui/recursion/issue-23122-2.stderr +++ b/tests/ui/recursion/issue-23122-2.stderr @@ -1,12 +1,12 @@ error[E0275]: overflow evaluating the requirement `<<<<<<<... as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next: Sized` - --> $DIR/issue-23122-2.rs:11:17 + --> $DIR/issue-23122-2.rs:10:17 | LL | type Next = <GetNext<T::Next> as Next>::Next; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`issue_23122_2`) note: required for `GetNext<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<T as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next>` to implement `Next` - --> $DIR/issue-23122-2.rs:10:15 + --> $DIR/issue-23122-2.rs:9:15 | LL | impl<T: Next> Next for GetNext<T> { | - ^^^^ ^^^^^^^^^^ diff --git a/tests/ui/recursion/issue-83150.rs b/tests/ui/recursion/issue-83150.rs index ea1bef4fce3..b720c168187 100644 --- a/tests/ui/recursion/issue-83150.rs +++ b/tests/ui/recursion/issue-83150.rs @@ -1,7 +1,6 @@ -//~ ERROR overflow evaluating the requirement `Map<&mut std::ops::Range<u8>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>: Iterator` +//~ ERROR overflow evaluating the requirement `Map<&mut std::ops::Range<u8>, {closure@$DIR/issue-83150.rs:12:24: 12:27}>: Iterator` //@ build-fail //@ compile-flags: -Copt-level=0 -//@ normalize-stderr: "long-type-\d+" -> "long-type-hash" fn main() { let mut iter = 0u8..1; diff --git a/tests/ui/recursion/issue-83150.stderr b/tests/ui/recursion/issue-83150.stderr index 92a39a44e4f..600922f1e57 100644 --- a/tests/ui/recursion/issue-83150.stderr +++ b/tests/ui/recursion/issue-83150.stderr @@ -1,5 +1,5 @@ warning: function cannot return without recursing - --> $DIR/issue-83150.rs:11:1 + --> $DIR/issue-83150.rs:10:1 | LL | fn func<T: Iterator<Item = u8>>(iter: &mut T) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot return without recursing @@ -10,12 +10,12 @@ LL | func(&mut iter.map(|x| x + 1)) = help: a `loop` may express intention better if this is on purpose = note: `#[warn(unconditional_recursion)]` on by default -error[E0275]: overflow evaluating the requirement `Map<&mut std::ops::Range<u8>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>: Iterator` +error[E0275]: overflow evaluating the requirement `Map<&mut std::ops::Range<u8>, {closure@$DIR/issue-83150.rs:12:24: 12:27}>: Iterator` | = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`issue_83150`) - = note: required for `&mut Map<&mut std::ops::Range<u8>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>` to implement `Iterator` + = note: required for `&mut Map<&mut std::ops::Range<u8>, {closure@$DIR/issue-83150.rs:12:24: 12:27}>` to implement `Iterator` = note: 65 redundant requirements hidden - = note: required for `&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut std::ops::Range<u8>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>` to implement `Iterator` + = note: required for `&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut std::ops::Range<u8>, {closure@$DIR/issue-83150.rs:12:24: 12:27}>, {closure@$DIR/issue-83150.rs:12:24: 12:27}>, {closure@$DIR/issue-83150.rs:12:24: 12:27}>, {closure@$DIR/issue-83150.rs:12:24: 12:27}>, {closure@$DIR/issue-83150.rs:12:24: 12:27}>, {closure@$DIR/issue-83150.rs:12:24: 12:27}>, {closure@$DIR/issue-83150.rs:12:24: 12:27}>, {closure@$DIR/issue-83150.rs:12:24: 12:27}>, {closure@$DIR/issue-83150.rs:12:24: 12:27}>, {closure@$DIR/issue-83150.rs:12:24: 12:27}>, {closure@$DIR/issue-83150.rs:12:24: 12:27}>, {closure@$DIR/issue-83150.rs:12:24: 12:27}>, {closure@$DIR/issue-83150.rs:12:24: 12:27}>, {closure@$DIR/issue-83150.rs:12:24: 12:27}>, {closure@$DIR/issue-83150.rs:12:24: 12:27}>, {closure@$DIR/issue-83150.rs:12:24: 12:27}>, {closure@$DIR/issue-83150.rs:12:24: 12:27}>, {closure@$DIR/issue-83150.rs:12:24: 12:27}>, {closure@$DIR/issue-83150.rs:12:24: 12:27}>, {closure@$DIR/issue-83150.rs:12:24: 12:27}>, {closure@$DIR/issue-83150.rs:12:24: 12:27}>, {closure@$DIR/issue-83150.rs:12:24: 12:27}>, {closure@$DIR/issue-83150.rs:12:24: 12:27}>, {closure@$DIR/issue-83150.rs:12:24: 12:27}>, {closure@$DIR/issue-83150.rs:12:24: 12:27}>, {closure@$DIR/issue-83150.rs:12:24: 12:27}>, {closure@$DIR/issue-83150.rs:12:24: 12:27}>, {closure@$DIR/issue-83150.rs:12:24: 12:27}>, {closure@$DIR/issue-83150.rs:12:24: 12:27}>, {closure@$DIR/issue-83150.rs:12:24: 12:27}>, {closure@$DIR/issue-83150.rs:12:24: 12:27}>, {closure@$DIR/issue-83150.rs:12:24: 12:27}>, {closure@$DIR/issue-83150.rs:12:24: 12:27}>, {closure@$DIR/issue-83150.rs:12:24: 12:27}>, {closure@$DIR/issue-83150.rs:12:24: 12:27}>, {closure@$DIR/issue-83150.rs:12:24: 12:27}>, {closure@$DIR/issue-83150.rs:12:24: 12:27}>, {closure@$DIR/issue-83150.rs:12:24: 12:27}>, {closure@$DIR/issue-83150.rs:12:24: 12:27}>, {closure@$DIR/issue-83150.rs:12:24: 12:27}>, {closure@$DIR/issue-83150.rs:12:24: 12:27}>, {closure@$DIR/issue-83150.rs:12:24: 12:27}>, {closure@$DIR/issue-83150.rs:12:24: 12:27}>, {closure@$DIR/issue-83150.rs:12:24: 12:27}>, {closure@$DIR/issue-83150.rs:12:24: 12:27}>, {closure@$DIR/issue-83150.rs:12:24: 12:27}>, {closure@$DIR/issue-83150.rs:12:24: 12:27}>, {closure@$DIR/issue-83150.rs:12:24: 12:27}>, {closure@$DIR/issue-83150.rs:12:24: 12:27}>, {closure@$DIR/issue-83150.rs:12:24: 12:27}>, {closure@$DIR/issue-83150.rs:12:24: 12:27}>, {closure@$DIR/issue-83150.rs:12:24: 12:27}>, {closure@$DIR/issue-83150.rs:12:24: 12:27}>, {closure@$DIR/issue-83150.rs:12:24: 12:27}>, {closure@$DIR/issue-83150.rs:12:24: 12:27}>, {closure@$DIR/issue-83150.rs:12:24: 12:27}>, {closure@$DIR/issue-83150.rs:12:24: 12:27}>, {closure@$DIR/issue-83150.rs:12:24: 12:27}>, {closure@$DIR/issue-83150.rs:12:24: 12:27}>, {closure@$DIR/issue-83150.rs:12:24: 12:27}>, {closure@$DIR/issue-83150.rs:12:24: 12:27}>, {closure@$DIR/issue-83150.rs:12:24: 12:27}>, {closure@$DIR/issue-83150.rs:12:24: 12:27}>, {closure@$DIR/issue-83150.rs:12:24: 12:27}>, {closure@$DIR/issue-83150.rs:12:24: 12:27}>` to implement `Iterator` error: aborting due to 1 previous error; 1 warning emitted diff --git a/tests/ui/recursion/recursion.rs b/tests/ui/recursion/recursion.rs index ce56fe974b7..5cd4012a9d2 100644 --- a/tests/ui/recursion/recursion.rs +++ b/tests/ui/recursion/recursion.rs @@ -1,7 +1,5 @@ //@ build-fail //@ compile-flags:-C overflow-checks=off -// The regex below normalizes the long type file name to make it suitable for compare-modes. -//@ normalize-stderr: "'\$TEST_BUILD_DIR/.*\.long-type.txt'" -> "'$$TEST_BUILD_DIR/$$FILE.long-type.txt'" enum Nil {NilValue} struct Cons<T> {head:isize, tail:T} diff --git a/tests/ui/recursion/recursion.stderr b/tests/ui/recursion/recursion.stderr index cb9f67ba741..f959805defc 100644 --- a/tests/ui/recursion/recursion.stderr +++ b/tests/ui/recursion/recursion.stderr @@ -1,15 +1,15 @@ error: reached the recursion limit while instantiating `test::<Cons<Cons<Cons<Cons<Cons<...>>>>>>` - --> $DIR/recursion.rs:19:11 + --> $DIR/recursion.rs:17:11 | LL | _ => {test (n-1, i+1, Cons {head:2*i+1, tail:first}, Cons{head:i*i, tail:second})} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: `test` defined here - --> $DIR/recursion.rs:17:1 + --> $DIR/recursion.rs:15:1 | LL | fn test<T:Dot> (n:isize, i:isize, first:T, second:T) ->isize { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - = note: the full type name has been written to '$TEST_BUILD_DIR/$FILE.long-type.txt' + = note: the full type name has been written to '$TEST_BUILD_DIR/recursion.long-type.txt' error: aborting due to 1 previous error diff --git a/tests/ui/regions/issue-102374.rs b/tests/ui/regions/issue-102374.rs index d640c29b2f4..e0a1164211a 100644 --- a/tests/ui/regions/issue-102374.rs +++ b/tests/ui/regions/issue-102374.rs @@ -1,4 +1,3 @@ -//@ normalize-stderr: "long-type-\d+" -> "long-type-hash" use std::cell::Cell; #[rustfmt::skip] diff --git a/tests/ui/regions/issue-102374.stderr b/tests/ui/regions/issue-102374.stderr index e07dca0c7ee..5416125d1c7 100644 --- a/tests/ui/regions/issue-102374.stderr +++ b/tests/ui/regions/issue-102374.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/issue-102374.rs:17:5 + --> $DIR/issue-102374.rs:16:5 | LL | ) -> i32 { | --- expected `i32` because of return type diff --git a/tests/ui/repeat-expr/copy-check-deferred-after-fallback.rs b/tests/ui/repeat-expr/copy-check-deferred-after-fallback.rs new file mode 100644 index 00000000000..d9ad93541ec --- /dev/null +++ b/tests/ui/repeat-expr/copy-check-deferred-after-fallback.rs @@ -0,0 +1,37 @@ +#![feature(generic_arg_infer)] + +// Test that would start passing if we defer repeat expr copy checks to end of +// typechecking and they're checked after integer fallback occurs. We accomplish +// this by contriving a situation where integer fallback allows progress to be +// made on a trait goal that infers the length of a repeat expr. + +use std::marker::PhantomData; + +struct NotCopy; + +trait Trait<const N: usize> {} + +impl Trait<2> for u32 {} +impl Trait<1> for i32 {} + +fn make_goal<T: Trait<N>, const N: usize>(_: &T, _: [NotCopy; N]) {} + +fn main() { + let a = 1; + let b = [NotCopy; _]; + //~^ ERROR: type annotations needed + + // a is of type `?y` + // b is of type `[NotCopy; ?x]` + // there is a goal ?y: Trait<?x>` with two candidates: + // - `i32: Trait<1>`, ?y=i32 ?x=1 which doesnt require `NotCopy: Copy` + // - `u32: Trait<2>` ?y=u32 ?x=2 which requires `NotCopy: Copy` + make_goal(&a, b); + + // final repeat expr checks: + // + // `NotCopy; ?x` + // - succeeds if fallback happens before repeat exprs as `i32: Trait<?x>` infers `?x=1` + // - fails if repeat expr checks happen first as `?x` is unconstrained so cannot be + // structurally resolved +} diff --git a/tests/ui/repeat-expr/copy-check-deferred-after-fallback.stderr b/tests/ui/repeat-expr/copy-check-deferred-after-fallback.stderr new file mode 100644 index 00000000000..2a0cb3fb7a3 --- /dev/null +++ b/tests/ui/repeat-expr/copy-check-deferred-after-fallback.stderr @@ -0,0 +1,14 @@ +error[E0282]: type annotations needed for `[NotCopy; _]` + --> $DIR/copy-check-deferred-after-fallback.rs:21:9 + | +LL | let b = [NotCopy; _]; + | ^ ------- type must be known at this point + | +help: consider giving `b` an explicit type, where the value of const parameter `N` is specified + | +LL | let b: [_; N] = [NotCopy; _]; + | ++++++++ + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0282`. diff --git a/tests/ui/repeat-expr/copy-check-deferred-before-fallback.rs b/tests/ui/repeat-expr/copy-check-deferred-before-fallback.rs new file mode 100644 index 00000000000..4654d7483a6 --- /dev/null +++ b/tests/ui/repeat-expr/copy-check-deferred-before-fallback.rs @@ -0,0 +1,59 @@ +//@ check-pass + +#![feature(generic_arg_infer)] + +// Test that if we defer repeat expr copy checks to end of typechecking they're +// checked before integer fallback occurs. We accomplish this by contriving a +// situation where we have a goal that can be proven either via another repeat expr +// check or by integer fallback. In the integer fallback case an array length would +// be inferred to `2` requiring `NotCopy: Copy`, and in the repeat expr case it would +// be inferred to `1`. + +use std::marker::PhantomData; + +struct NotCopy; + +struct Foo<T>(PhantomData<T>); + +impl Clone for Foo<u32> { + fn clone(&self) -> Self { + Foo(PhantomData) + } +} + +impl Copy for Foo<u32> {} + +fn tie<T>(_: &T, _: [Foo<T>; 2]) {} + +trait Trait<const N: usize> {} + +impl Trait<2> for i32 {} +impl Trait<1> for u32 {} + +fn make_goal<T: Trait<N>, const N: usize>(_: &T, _: [NotCopy; N]) {} + +fn main() { + let a = 1; + let b: [Foo<_>; 2] = [Foo(PhantomData); _]; + tie(&a, b); + let c = [NotCopy; _]; + + // a is of type `?y` + // b is of type `[Foo<?y>; 2]` + // c is of type `[NotCopy; ?x]` + // there is a goal ?y: Trait<?x>` with two candidates: + // - `i32: Trait<2>`, ?y=i32 ?x=2 which requires `NotCopy: Copy` when expr checks happen + // - `u32: Trait<1>` ?y=u32 ?x=1 which doesnt require `NotCopy: Copy` + make_goal(&a, c); + + // final repeat expr checks: + // + // `Foo<?y>; 2` + // - Foo<?y>: Copy + // - requires ?y=u32 + // + // `NotCopy; ?x` + // - fails if fallback happens before repeat exprs as `i32: Trait<?x>` infers `?x=2` + // - succeeds if repeat expr checks happen first as `?y=u32` means `u32: Trait<?x>` + // infers `?x=1` +} diff --git a/tests/ui/repeat-expr/copy-inference-side-effects-are-lazy.gai.stderr b/tests/ui/repeat-expr/copy-inference-side-effects-are-lazy.gai.stderr new file mode 100644 index 00000000000..de38476c82b --- /dev/null +++ b/tests/ui/repeat-expr/copy-inference-side-effects-are-lazy.gai.stderr @@ -0,0 +1,17 @@ +error[E0282]: type annotations needed for `[Foo<_>; 2]` + --> $DIR/copy-inference-side-effects-are-lazy.rs:22:9 + | +LL | let x = [Foo(PhantomData); 2]; + | ^ +LL | +LL | _ = extract(x).max(2); + | ---------- type must be known at this point + | +help: consider giving `x` an explicit type, where the type for type parameter `T` is specified + | +LL | let x: [Foo<T>; 2] = [Foo(PhantomData); 2]; + | +++++++++++++ + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0282`. diff --git a/tests/ui/repeat-expr/copy-inference-side-effects-are-lazy.rs b/tests/ui/repeat-expr/copy-inference-side-effects-are-lazy.rs new file mode 100644 index 00000000000..0b0672d9c2b --- /dev/null +++ b/tests/ui/repeat-expr/copy-inference-side-effects-are-lazy.rs @@ -0,0 +1,25 @@ +//@revisions: current gai +//@[current] check-pass + +#![cfg_attr(gai, feature(generic_arg_infer))] + +use std::marker::PhantomData; + +struct Foo<T>(PhantomData<T>); + +impl Clone for Foo<u8> { + fn clone(&self) -> Self { + Foo(PhantomData) + } +} +impl Copy for Foo<u8> {} + +fn extract<T, const N: usize>(_: [Foo<T>; N]) -> T { + loop {} +} + +fn main() { + let x = [Foo(PhantomData); 2]; + //[gai]~^ ERROR: type annotations needed + _ = extract(x).max(2); +} diff --git a/tests/ui/repeat-expr/infer.rs b/tests/ui/repeat-expr/copy-inference-side-effects.rs index eb47b5f462f..eb47b5f462f 100644 --- a/tests/ui/repeat-expr/infer.rs +++ b/tests/ui/repeat-expr/copy-inference-side-effects.rs diff --git a/tests/ui/repeat-expr/dont-require-copy-on-infer.rs b/tests/ui/repeat-expr/dont-require-copy-on-infer.rs new file mode 100644 index 00000000000..e81bf1595be --- /dev/null +++ b/tests/ui/repeat-expr/dont-require-copy-on-infer.rs @@ -0,0 +1,6 @@ +//@ check-pass +#![feature(generic_arg_infer)] + +fn main() { + let a: [_; 1] = [String::new(); _]; +} diff --git a/tests/ui/repeat-expr/no-conservative-copy-impl-requirement.rs b/tests/ui/repeat-expr/no-conservative-copy-impl-requirement.rs new file mode 100644 index 00000000000..eb70df62996 --- /dev/null +++ b/tests/ui/repeat-expr/no-conservative-copy-impl-requirement.rs @@ -0,0 +1,20 @@ +#![feature(generic_arg_infer)] + +struct Foo<const N: usize>; + +impl Clone for Foo<1> { + fn clone(&self) -> Self { + Foo + } +} +impl Copy for Foo<1> {} + +fn unify<const N: usize>(_: &[Foo<N>; N]) { + loop {} +} + +fn main() { + let x = &[Foo::<_>; _]; + //~^ ERROR: type annotations needed for `&[Foo<_>; _]` + _ = unify(x); +} diff --git a/tests/ui/repeat-expr/no-conservative-copy-impl-requirement.stderr b/tests/ui/repeat-expr/no-conservative-copy-impl-requirement.stderr new file mode 100644 index 00000000000..04f8ff33fda --- /dev/null +++ b/tests/ui/repeat-expr/no-conservative-copy-impl-requirement.stderr @@ -0,0 +1,14 @@ +error[E0282]: type annotations needed for `&[Foo<_>; _]` + --> $DIR/no-conservative-copy-impl-requirement.rs:17:9 + | +LL | let x = &[Foo::<_>; _]; + | ^ -------- type must be known at this point + | +help: consider giving `x` an explicit type, where the value of const parameter `N` is specified + | +LL | let x: &[Foo<N>; N] = &[Foo::<_>; _]; + | ++++++++++++++ + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0282`. diff --git a/tests/ui/repr/16-bit-repr-c-enum.rs b/tests/ui/repr/16-bit-repr-c-enum.rs index 011076882d2..d4d5a086dcc 100644 --- a/tests/ui/repr/16-bit-repr-c-enum.rs +++ b/tests/ui/repr/16-bit-repr-c-enum.rs @@ -1,3 +1,4 @@ +//@ add-core-stubs //@ build-pass //@ revisions: avr msp430 // @@ -11,6 +12,9 @@ #![stable(feature = "intrinsics_for_test", since = "3.3.3")] #![allow(dead_code)] +extern crate minicore; +use minicore::*; + // Test that the repr(C) attribute doesn't break compilation // Previous bad assumption was that 32-bit enum default width is fine on msp430, avr // But the width of the C int on these platforms is 16 bits, and C enums <= C int range @@ -24,15 +28,7 @@ enum Foo { #[stable(feature = "intrinsics_for_test", since = "3.3.3")] #[rustc_const_stable(feature = "intrinsics_for_test", since = "3.3.3")] #[rustc_intrinsic] -#[rustc_intrinsic_must_be_overridden] -const fn size_of<T>() -> usize { - loop {} -} - -#[lang="sized"] -trait Sized {} -#[lang="copy"] -trait Copy {} +const fn size_of<T>() -> usize; const EXPECTED: usize = 2; const ACTUAL: usize = size_of::<Foo>(); diff --git a/tests/ui/repr/invalid_repr_list_help.stderr b/tests/ui/repr/invalid_repr_list_help.stderr index e87cbd37a99..763ad9c2795 100644 --- a/tests/ui/repr/invalid_repr_list_help.stderr +++ b/tests/ui/repr/invalid_repr_list_help.stderr @@ -30,14 +30,6 @@ LL | #[repr(uwu, u8)] | = help: valid reprs are `Rust` (default), `C`, `align`, `packed`, `transparent`, `simd`, `i8`, `u8`, `i16`, `u16`, `i32`, `u32`, `i64`, `u64`, `i128`, `u128`, `isize`, `usize` -error: unknown `doc` attribute `owo` - --> $DIR/invalid_repr_list_help.rs:20:7 - | -LL | #[doc(owo)] - | ^^^ - | - = note: `#[deny(invalid_doc_attributes)]` on by default - error[E0552]: unrecognized representation hint --> $DIR/invalid_repr_list_help.rs:19:8 | @@ -46,6 +38,14 @@ LL | #[repr(uwu)] | = help: valid reprs are `Rust` (default), `C`, `align`, `packed`, `transparent`, `simd`, `i8`, `u8`, `i16`, `u16`, `i32`, `u32`, `i64`, `u64`, `i128`, `u128`, `isize`, `usize` +error: unknown `doc` attribute `owo` + --> $DIR/invalid_repr_list_help.rs:20:7 + | +LL | #[doc(owo)] + | ^^^ + | + = note: `#[deny(invalid_doc_attributes)]` on by default + error: aborting due to 6 previous errors For more information about this error, try `rustc --explain E0552`. diff --git a/tests/ui/repr/issue-83505-repr-simd.stderr b/tests/ui/repr/issue-83505-repr-simd.stderr index 44e154b4bb6..57cfbeb95de 100644 --- a/tests/ui/repr/issue-83505-repr-simd.stderr +++ b/tests/ui/repr/issue-83505-repr-simd.stderr @@ -26,10 +26,10 @@ LL | enum Es {} | ---------- not a struct error[E0084]: unsupported representation for zero-variant enum - --> $DIR/issue-83505-repr-simd.rs:5:1 + --> $DIR/issue-83505-repr-simd.rs:5:8 | LL | #[repr(simd)] - | ^^^^^^^^^^^^^ + | ^^^^ ... LL | enum Es {} | ------- zero-variant enum diff --git a/tests/ui/repr/malformed-repr-hints.stderr b/tests/ui/repr/malformed-repr-hints.stderr index 6fb92755761..7a6e9ccc73e 100644 --- a/tests/ui/repr/malformed-repr-hints.stderr +++ b/tests/ui/repr/malformed-repr-hints.stderr @@ -1,15 +1,3 @@ -error[E0552]: incorrect `repr(packed)` attribute format: `packed` takes exactly one parenthesized argument, or no parentheses at all - --> $DIR/malformed-repr-hints.rs:6:8 - | -LL | #[repr(packed())] - | ^^^^^^^^ - -error[E0589]: invalid `repr(align)` attribute: `align` needs an argument - --> $DIR/malformed-repr-hints.rs:10:8 - | -LL | #[repr(align)] - | ^^^^^ help: supply an argument here: `align(...)` - error[E0693]: incorrect `repr(align)` attribute format: `align` takes exactly one argument in parentheses --> $DIR/malformed-repr-hints.rs:14:8 | @@ -22,6 +10,18 @@ error[E0693]: incorrect `repr(align)` attribute format: `align` takes exactly on LL | #[repr(align())] | ^^^^^^^ +error[E0552]: incorrect `repr(packed)` attribute format: `packed` takes exactly one parenthesized argument, or no parentheses at all + --> $DIR/malformed-repr-hints.rs:6:8 + | +LL | #[repr(packed())] + | ^^^^^^^^ + +error[E0589]: invalid `repr(align)` attribute: `align` needs an argument + --> $DIR/malformed-repr-hints.rs:10:8 + | +LL | #[repr(align)] + | ^^^^^ help: supply an argument here: `align(...)` + error[E0552]: invalid representation hint: `Rust` does not take a parenthesized argument list --> $DIR/malformed-repr-hints.rs:23:8 | diff --git a/tests/ui/repr/repr-align-assign.fixed b/tests/ui/repr/repr-align-assign.fixed index d40fcadf57b..96f9866611b 100644 --- a/tests/ui/repr/repr-align-assign.fixed +++ b/tests/ui/repr/repr-align-assign.fixed @@ -3,11 +3,9 @@ #![allow(dead_code)] #[repr(align(8))] //~ ERROR incorrect `repr(align)` attribute format - //~| ERROR incorrect `repr(align)` attribute format struct A(u64); #[repr(align(8))] //~ ERROR incorrect `repr(align)` attribute format - //~| ERROR incorrect `repr(align)` attribute format struct B(u64); fn main() {} diff --git a/tests/ui/repr/repr-align-assign.rs b/tests/ui/repr/repr-align-assign.rs index 3aff84a91f7..0b30ee65664 100644 --- a/tests/ui/repr/repr-align-assign.rs +++ b/tests/ui/repr/repr-align-assign.rs @@ -3,11 +3,9 @@ #![allow(dead_code)] #[repr(align=8)] //~ ERROR incorrect `repr(align)` attribute format - //~| ERROR incorrect `repr(align)` attribute format struct A(u64); #[repr(align="8")] //~ ERROR incorrect `repr(align)` attribute format - //~| ERROR incorrect `repr(align)` attribute format struct B(u64); fn main() {} diff --git a/tests/ui/repr/repr-align-assign.stderr b/tests/ui/repr/repr-align-assign.stderr index 3606d02210b..cc046e04de5 100644 --- a/tests/ui/repr/repr-align-assign.stderr +++ b/tests/ui/repr/repr-align-assign.stderr @@ -5,27 +5,11 @@ LL | #[repr(align=8)] | ^^^^^^^ help: use parentheses instead: `align(8)` error[E0693]: incorrect `repr(align)` attribute format - --> $DIR/repr-align-assign.rs:9:8 + --> $DIR/repr-align-assign.rs:8:8 | LL | #[repr(align="8")] | ^^^^^^^^^ help: use parentheses instead: `align(8)` -error[E0693]: incorrect `repr(align)` attribute format - --> $DIR/repr-align-assign.rs:5:8 - | -LL | #[repr(align=8)] - | ^^^^^^^ help: use parentheses instead: `align(8)` - | - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` - -error[E0693]: incorrect `repr(align)` attribute format - --> $DIR/repr-align-assign.rs:9:8 - | -LL | #[repr(align="8")] - | ^^^^^^^^^ help: use parentheses instead: `align(8)` - | - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` - -error: aborting due to 4 previous errors +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0693`. diff --git a/tests/ui/repr/repr-align.rs b/tests/ui/repr/repr-align.rs index 33aa727d4bd..6b60a765461 100644 --- a/tests/ui/repr/repr-align.rs +++ b/tests/ui/repr/repr-align.rs @@ -1,41 +1,33 @@ #![allow(dead_code)] #[repr(align(16.0))] //~ ERROR: invalid `repr(align)` attribute: not an unsuffixed integer - //~| ERROR: invalid `repr(align)` attribute: not an unsuffixed integer struct S0(i32); #[repr(align(15))] //~ ERROR: invalid `repr(align)` attribute: not a power of two - //~| ERROR: invalid `repr(align)` attribute: not a power of two struct S1(i32); #[repr(align(4294967296))] //~ ERROR: invalid `repr(align)` attribute: larger than 2^29 - //~| ERROR: invalid `repr(align)` attribute: larger than 2^29 struct S2(i32); #[repr(align(536870912))] // ok: this is the largest accepted alignment struct S3(i32); #[repr(align(0))] //~ ERROR: invalid `repr(align)` attribute: not a power of two - //~| ERROR: invalid `repr(align)` attribute: not a power of two struct S4(i32); #[repr(align(16.0))] //~ ERROR: invalid `repr(align)` attribute: not an unsuffixed integer - //~| ERROR: invalid `repr(align)` attribute: not an unsuffixed integer enum E0 { A, B } #[repr(align(15))] //~ ERROR: invalid `repr(align)` attribute: not a power of two - //~| ERROR: invalid `repr(align)` attribute: not a power of two enum E1 { A, B } #[repr(align(4294967296))] //~ ERROR: invalid `repr(align)` attribute: larger than 2^29 - //~| ERROR: invalid `repr(align)` attribute: larger than 2^29 enum E2 { A, B } #[repr(align(536870912))] // ok: this is the largest accepted alignment enum E3 { A, B } #[repr(align(0))] //~ ERROR: invalid `repr(align)` attribute: not a power of two - //~| ERROR: invalid `repr(align)` attribute: not a power of two enum E4 { A, B } fn main() {} diff --git a/tests/ui/repr/repr-align.stderr b/tests/ui/repr/repr-align.stderr index 660247840c4..fe919e30b15 100644 --- a/tests/ui/repr/repr-align.stderr +++ b/tests/ui/repr/repr-align.stderr @@ -5,111 +5,47 @@ LL | #[repr(align(16.0))] | ^^^^ error[E0589]: invalid `repr(align)` attribute: not a power of two - --> $DIR/repr-align.rs:7:14 + --> $DIR/repr-align.rs:6:14 | LL | #[repr(align(15))] | ^^ error[E0589]: invalid `repr(align)` attribute: larger than 2^29 - --> $DIR/repr-align.rs:11:14 + --> $DIR/repr-align.rs:9:14 | LL | #[repr(align(4294967296))] | ^^^^^^^^^^ error[E0589]: invalid `repr(align)` attribute: not a power of two - --> $DIR/repr-align.rs:18:14 + --> $DIR/repr-align.rs:15:14 | LL | #[repr(align(0))] | ^ error[E0589]: invalid `repr(align)` attribute: not an unsuffixed integer - --> $DIR/repr-align.rs:22:14 - | -LL | #[repr(align(16.0))] - | ^^^^ - -error[E0589]: invalid `repr(align)` attribute: not a power of two - --> $DIR/repr-align.rs:26:14 - | -LL | #[repr(align(15))] - | ^^ - -error[E0589]: invalid `repr(align)` attribute: larger than 2^29 - --> $DIR/repr-align.rs:30:14 - | -LL | #[repr(align(4294967296))] - | ^^^^^^^^^^ - -error[E0589]: invalid `repr(align)` attribute: not a power of two - --> $DIR/repr-align.rs:37:14 - | -LL | #[repr(align(0))] - | ^ - -error[E0589]: invalid `repr(align)` attribute: not an unsuffixed integer - --> $DIR/repr-align.rs:3:14 - | -LL | #[repr(align(16.0))] - | ^^^^ - | - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` - -error[E0589]: invalid `repr(align)` attribute: not a power of two - --> $DIR/repr-align.rs:7:14 - | -LL | #[repr(align(15))] - | ^^ - | - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` - -error[E0589]: invalid `repr(align)` attribute: larger than 2^29 - --> $DIR/repr-align.rs:11:14 - | -LL | #[repr(align(4294967296))] - | ^^^^^^^^^^ - | - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` - -error[E0589]: invalid `repr(align)` attribute: not a power of two --> $DIR/repr-align.rs:18:14 | -LL | #[repr(align(0))] - | ^ - | - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` - -error[E0589]: invalid `repr(align)` attribute: not an unsuffixed integer - --> $DIR/repr-align.rs:22:14 - | LL | #[repr(align(16.0))] | ^^^^ - | - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error[E0589]: invalid `repr(align)` attribute: not a power of two - --> $DIR/repr-align.rs:26:14 + --> $DIR/repr-align.rs:21:14 | LL | #[repr(align(15))] | ^^ - | - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error[E0589]: invalid `repr(align)` attribute: larger than 2^29 - --> $DIR/repr-align.rs:30:14 + --> $DIR/repr-align.rs:24:14 | LL | #[repr(align(4294967296))] | ^^^^^^^^^^ - | - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error[E0589]: invalid `repr(align)` attribute: not a power of two - --> $DIR/repr-align.rs:37:14 + --> $DIR/repr-align.rs:30:14 | LL | #[repr(align(0))] | ^ - | - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` -error: aborting due to 16 previous errors +error: aborting due to 8 previous errors For more information about this error, try `rustc --explain E0589`. 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 204db30786e..c11acc98637 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 @@ -4,7 +4,7 @@ error: layout_of(Univariant) = Layout { abi: Align(4 bytes), pref: $SOME_ALIGN, }, - abi: Scalar( + backend_repr: Scalar( Initialized { value: Int( I32, @@ -49,7 +49,7 @@ error: layout_of(Univariant) = Layout { abi: Align(4 bytes), pref: $SOME_ALIGN, }, - abi: Scalar( + backend_repr: Scalar( Initialized { value: Int( I32, @@ -81,7 +81,7 @@ error: layout_of(Univariant) = Layout { unadjusted_abi_align: Align(4 bytes), randomization_seed: $SEED, } - --> $DIR/repr-c-dead-variants.rs:39:1 + --> $DIR/repr-c-dead-variants.rs:43:1 | LL | enum Univariant { | ^^^^^^^^^^^^^^^ @@ -92,7 +92,7 @@ error: layout_of(TwoVariants) = Layout { abi: Align(4 bytes), pref: $SOME_ALIGN, }, - abi: ScalarPair( + backend_repr: ScalarPair( Initialized { value: Int( I32, @@ -143,7 +143,7 @@ error: layout_of(TwoVariants) = Layout { abi: Align(4 bytes), pref: $SOME_ALIGN, }, - abi: ScalarPair( + backend_repr: ScalarPair( Initialized { value: Int( I32, @@ -181,7 +181,7 @@ error: layout_of(TwoVariants) = Layout { abi: Align(4 bytes), pref: $SOME_ALIGN, }, - abi: ScalarPair( + backend_repr: ScalarPair( Initialized { value: Int( I32, @@ -219,7 +219,7 @@ error: layout_of(TwoVariants) = Layout { unadjusted_abi_align: Align(4 bytes), randomization_seed: $SEED, } - --> $DIR/repr-c-dead-variants.rs:46:1 + --> $DIR/repr-c-dead-variants.rs:50:1 | LL | enum TwoVariants { | ^^^^^^^^^^^^^^^^ @@ -230,7 +230,7 @@ error: layout_of(DeadBranchHasOtherField) = Layout { abi: Align(8 bytes), pref: $SOME_ALIGN, }, - abi: Memory { + backend_repr: Memory { sized: true, }, fields: Arbitrary { @@ -269,7 +269,7 @@ error: layout_of(DeadBranchHasOtherField) = Layout { abi: Align(8 bytes), pref: $SOME_ALIGN, }, - abi: Memory { + backend_repr: Memory { sized: true, }, fields: Arbitrary { @@ -299,7 +299,7 @@ error: layout_of(DeadBranchHasOtherField) = Layout { abi: Align(8 bytes), pref: $SOME_ALIGN, }, - abi: Memory { + backend_repr: Memory { sized: true, }, fields: Arbitrary { @@ -327,7 +327,7 @@ error: layout_of(DeadBranchHasOtherField) = Layout { unadjusted_abi_align: Align(8 bytes), randomization_seed: $SEED, } - --> $DIR/repr-c-dead-variants.rs:58:1 + --> $DIR/repr-c-dead-variants.rs:62:1 | LL | enum DeadBranchHasOtherField { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 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 1fab00bf50c..a7888155dea 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 @@ -4,7 +4,7 @@ error: layout_of(Univariant) = Layout { abi: Align(1 bytes), pref: $SOME_ALIGN, }, - abi: Scalar( + backend_repr: Scalar( Initialized { value: Int( I8, @@ -49,7 +49,7 @@ error: layout_of(Univariant) = Layout { abi: Align(1 bytes), pref: $SOME_ALIGN, }, - abi: Scalar( + backend_repr: Scalar( Initialized { value: Int( I8, @@ -81,7 +81,7 @@ error: layout_of(Univariant) = Layout { unadjusted_abi_align: Align(1 bytes), randomization_seed: $SEED, } - --> $DIR/repr-c-dead-variants.rs:39:1 + --> $DIR/repr-c-dead-variants.rs:43:1 | LL | enum Univariant { | ^^^^^^^^^^^^^^^ @@ -92,7 +92,7 @@ error: layout_of(TwoVariants) = Layout { abi: Align(1 bytes), pref: $SOME_ALIGN, }, - abi: ScalarPair( + backend_repr: ScalarPair( Initialized { value: Int( I8, @@ -143,7 +143,7 @@ error: layout_of(TwoVariants) = Layout { abi: Align(1 bytes), pref: $SOME_ALIGN, }, - abi: ScalarPair( + backend_repr: ScalarPair( Initialized { value: Int( I8, @@ -181,7 +181,7 @@ error: layout_of(TwoVariants) = Layout { abi: Align(1 bytes), pref: $SOME_ALIGN, }, - abi: ScalarPair( + backend_repr: ScalarPair( Initialized { value: Int( I8, @@ -219,7 +219,7 @@ error: layout_of(TwoVariants) = Layout { unadjusted_abi_align: Align(1 bytes), randomization_seed: $SEED, } - --> $DIR/repr-c-dead-variants.rs:46:1 + --> $DIR/repr-c-dead-variants.rs:50:1 | LL | enum TwoVariants { | ^^^^^^^^^^^^^^^^ @@ -230,7 +230,7 @@ error: layout_of(DeadBranchHasOtherField) = Layout { abi: Align(8 bytes), pref: $SOME_ALIGN, }, - abi: Memory { + backend_repr: Memory { sized: true, }, fields: Arbitrary { @@ -269,7 +269,7 @@ error: layout_of(DeadBranchHasOtherField) = Layout { abi: Align(8 bytes), pref: $SOME_ALIGN, }, - abi: Memory { + backend_repr: Memory { sized: true, }, fields: Arbitrary { @@ -299,7 +299,7 @@ error: layout_of(DeadBranchHasOtherField) = Layout { abi: Align(8 bytes), pref: $SOME_ALIGN, }, - abi: Memory { + backend_repr: Memory { sized: true, }, fields: Arbitrary { @@ -327,7 +327,7 @@ error: layout_of(DeadBranchHasOtherField) = Layout { unadjusted_abi_align: Align(8 bytes), randomization_seed: $SEED, } - --> $DIR/repr-c-dead-variants.rs:58:1 + --> $DIR/repr-c-dead-variants.rs:62:1 | LL | enum DeadBranchHasOtherField { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 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 204db30786e..c11acc98637 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 @@ -4,7 +4,7 @@ error: layout_of(Univariant) = Layout { abi: Align(4 bytes), pref: $SOME_ALIGN, }, - abi: Scalar( + backend_repr: Scalar( Initialized { value: Int( I32, @@ -49,7 +49,7 @@ error: layout_of(Univariant) = Layout { abi: Align(4 bytes), pref: $SOME_ALIGN, }, - abi: Scalar( + backend_repr: Scalar( Initialized { value: Int( I32, @@ -81,7 +81,7 @@ error: layout_of(Univariant) = Layout { unadjusted_abi_align: Align(4 bytes), randomization_seed: $SEED, } - --> $DIR/repr-c-dead-variants.rs:39:1 + --> $DIR/repr-c-dead-variants.rs:43:1 | LL | enum Univariant { | ^^^^^^^^^^^^^^^ @@ -92,7 +92,7 @@ error: layout_of(TwoVariants) = Layout { abi: Align(4 bytes), pref: $SOME_ALIGN, }, - abi: ScalarPair( + backend_repr: ScalarPair( Initialized { value: Int( I32, @@ -143,7 +143,7 @@ error: layout_of(TwoVariants) = Layout { abi: Align(4 bytes), pref: $SOME_ALIGN, }, - abi: ScalarPair( + backend_repr: ScalarPair( Initialized { value: Int( I32, @@ -181,7 +181,7 @@ error: layout_of(TwoVariants) = Layout { abi: Align(4 bytes), pref: $SOME_ALIGN, }, - abi: ScalarPair( + backend_repr: ScalarPair( Initialized { value: Int( I32, @@ -219,7 +219,7 @@ error: layout_of(TwoVariants) = Layout { unadjusted_abi_align: Align(4 bytes), randomization_seed: $SEED, } - --> $DIR/repr-c-dead-variants.rs:46:1 + --> $DIR/repr-c-dead-variants.rs:50:1 | LL | enum TwoVariants { | ^^^^^^^^^^^^^^^^ @@ -230,7 +230,7 @@ error: layout_of(DeadBranchHasOtherField) = Layout { abi: Align(8 bytes), pref: $SOME_ALIGN, }, - abi: Memory { + backend_repr: Memory { sized: true, }, fields: Arbitrary { @@ -269,7 +269,7 @@ error: layout_of(DeadBranchHasOtherField) = Layout { abi: Align(8 bytes), pref: $SOME_ALIGN, }, - abi: Memory { + backend_repr: Memory { sized: true, }, fields: Arbitrary { @@ -299,7 +299,7 @@ error: layout_of(DeadBranchHasOtherField) = Layout { abi: Align(8 bytes), pref: $SOME_ALIGN, }, - abi: Memory { + backend_repr: Memory { sized: true, }, fields: Arbitrary { @@ -327,7 +327,7 @@ error: layout_of(DeadBranchHasOtherField) = Layout { unadjusted_abi_align: Align(8 bytes), randomization_seed: $SEED, } - --> $DIR/repr-c-dead-variants.rs:58:1 + --> $DIR/repr-c-dead-variants.rs:62:1 | LL | enum DeadBranchHasOtherField { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/repr/repr-c-dead-variants.rs b/tests/ui/repr/repr-c-dead-variants.rs index 99f20982a99..7f274308562 100644 --- a/tests/ui/repr/repr-c-dead-variants.rs +++ b/tests/ui/repr/repr-c-dead-variants.rs @@ -4,8 +4,12 @@ #![no_std] #![no_core] +extern crate minicore; +use minicore::*; + // See also: repr-c-int-dead-variants.rs +//@ add-core-stubs //@ normalize-stderr: "pref: Align\([1-8] bytes\)" -> "pref: $$SOME_ALIGN" //@ normalize-stderr: "randomization_seed: \d+" -> "randomization_seed: $$SEED" @@ -59,6 +63,3 @@ enum DeadBranchHasOtherField { //~ ERROR layout_of Variant1(Void, Align8U64), Variant2(u8), } - -#[lang = "sized"] -trait Sized {} 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 204db30786e..c11acc98637 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 @@ -4,7 +4,7 @@ error: layout_of(Univariant) = Layout { abi: Align(4 bytes), pref: $SOME_ALIGN, }, - abi: Scalar( + backend_repr: Scalar( Initialized { value: Int( I32, @@ -49,7 +49,7 @@ error: layout_of(Univariant) = Layout { abi: Align(4 bytes), pref: $SOME_ALIGN, }, - abi: Scalar( + backend_repr: Scalar( Initialized { value: Int( I32, @@ -81,7 +81,7 @@ error: layout_of(Univariant) = Layout { unadjusted_abi_align: Align(4 bytes), randomization_seed: $SEED, } - --> $DIR/repr-c-dead-variants.rs:39:1 + --> $DIR/repr-c-dead-variants.rs:43:1 | LL | enum Univariant { | ^^^^^^^^^^^^^^^ @@ -92,7 +92,7 @@ error: layout_of(TwoVariants) = Layout { abi: Align(4 bytes), pref: $SOME_ALIGN, }, - abi: ScalarPair( + backend_repr: ScalarPair( Initialized { value: Int( I32, @@ -143,7 +143,7 @@ error: layout_of(TwoVariants) = Layout { abi: Align(4 bytes), pref: $SOME_ALIGN, }, - abi: ScalarPair( + backend_repr: ScalarPair( Initialized { value: Int( I32, @@ -181,7 +181,7 @@ error: layout_of(TwoVariants) = Layout { abi: Align(4 bytes), pref: $SOME_ALIGN, }, - abi: ScalarPair( + backend_repr: ScalarPair( Initialized { value: Int( I32, @@ -219,7 +219,7 @@ error: layout_of(TwoVariants) = Layout { unadjusted_abi_align: Align(4 bytes), randomization_seed: $SEED, } - --> $DIR/repr-c-dead-variants.rs:46:1 + --> $DIR/repr-c-dead-variants.rs:50:1 | LL | enum TwoVariants { | ^^^^^^^^^^^^^^^^ @@ -230,7 +230,7 @@ error: layout_of(DeadBranchHasOtherField) = Layout { abi: Align(8 bytes), pref: $SOME_ALIGN, }, - abi: Memory { + backend_repr: Memory { sized: true, }, fields: Arbitrary { @@ -269,7 +269,7 @@ error: layout_of(DeadBranchHasOtherField) = Layout { abi: Align(8 bytes), pref: $SOME_ALIGN, }, - abi: Memory { + backend_repr: Memory { sized: true, }, fields: Arbitrary { @@ -299,7 +299,7 @@ error: layout_of(DeadBranchHasOtherField) = Layout { abi: Align(8 bytes), pref: $SOME_ALIGN, }, - abi: Memory { + backend_repr: Memory { sized: true, }, fields: Arbitrary { @@ -327,7 +327,7 @@ error: layout_of(DeadBranchHasOtherField) = Layout { unadjusted_abi_align: Align(8 bytes), randomization_seed: $SEED, } - --> $DIR/repr-c-dead-variants.rs:58:1 + --> $DIR/repr-c-dead-variants.rs:62:1 | LL | enum DeadBranchHasOtherField { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/repr/repr-c-int-dead-variants.stderr b/tests/ui/repr/repr-c-int-dead-variants.stderr index f852212deb9..f63574182c2 100644 --- a/tests/ui/repr/repr-c-int-dead-variants.stderr +++ b/tests/ui/repr/repr-c-int-dead-variants.stderr @@ -4,7 +4,7 @@ error: layout_of(UnivariantU8) = Layout { abi: Align(1 bytes), pref: $SOME_ALIGN, }, - abi: Scalar( + backend_repr: Scalar( Initialized { value: Int( I8, @@ -49,7 +49,7 @@ error: layout_of(UnivariantU8) = Layout { abi: Align(1 bytes), pref: $SOME_ALIGN, }, - abi: Scalar( + backend_repr: Scalar( Initialized { value: Int( I8, @@ -92,7 +92,7 @@ error: layout_of(TwoVariantsU8) = Layout { abi: Align(1 bytes), pref: $SOME_ALIGN, }, - abi: ScalarPair( + backend_repr: ScalarPair( Initialized { value: Int( I8, @@ -143,7 +143,7 @@ error: layout_of(TwoVariantsU8) = Layout { abi: Align(1 bytes), pref: $SOME_ALIGN, }, - abi: ScalarPair( + backend_repr: ScalarPair( Initialized { value: Int( I8, @@ -181,7 +181,7 @@ error: layout_of(TwoVariantsU8) = Layout { abi: Align(1 bytes), pref: $SOME_ALIGN, }, - abi: ScalarPair( + backend_repr: ScalarPair( Initialized { value: Int( I8, @@ -230,7 +230,7 @@ error: layout_of(DeadBranchHasOtherFieldU8) = Layout { abi: Align(8 bytes), pref: $SOME_ALIGN, }, - abi: Memory { + backend_repr: Memory { sized: true, }, fields: Arbitrary { @@ -269,7 +269,7 @@ error: layout_of(DeadBranchHasOtherFieldU8) = Layout { abi: Align(8 bytes), pref: $SOME_ALIGN, }, - abi: Memory { + backend_repr: Memory { sized: true, }, fields: Arbitrary { @@ -299,7 +299,7 @@ error: layout_of(DeadBranchHasOtherFieldU8) = Layout { abi: Align(8 bytes), pref: $SOME_ALIGN, }, - abi: Memory { + backend_repr: Memory { sized: true, }, fields: Arbitrary { diff --git a/tests/ui/repr/repr-transparent.stderr b/tests/ui/repr/repr-transparent.stderr index d0c78a8418a..2cafb989bce 100644 --- a/tests/ui/repr/repr-transparent.stderr +++ b/tests/ui/repr/repr-transparent.stderr @@ -35,10 +35,10 @@ LL | struct GenericAlign<T>(ZstAlign32<T>, u32); | needs at most one field with non-trivial size or alignment, but has 2 error[E0084]: unsupported representation for zero-variant enum - --> $DIR/repr-transparent.rs:47:1 + --> $DIR/repr-transparent.rs:47:8 | LL | #[repr(transparent)] - | ^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^ LL | enum Void {} | --------- zero-variant enum diff --git a/tests/ui/repr/repr_align_greater_usize.msp430.stderr b/tests/ui/repr/repr_align_greater_usize.msp430.stderr index 7c85249c009..db25cb1b5f2 100644 --- a/tests/ui/repr/repr_align_greater_usize.msp430.stderr +++ b/tests/ui/repr/repr_align_greater_usize.msp430.stderr @@ -1,5 +1,5 @@ error[E0589]: alignment must not be greater than `isize::MAX` bytes - --> $DIR/repr_align_greater_usize.rs:21:8 + --> $DIR/repr_align_greater_usize.rs:22:8 | LL | #[repr(align(32768))] | ^^^^^^^^^^^^ @@ -7,7 +7,7 @@ LL | #[repr(align(32768))] = note: `isize::MAX` is 32767 for the current target error[E0589]: alignment must not be greater than `isize::MAX` bytes - --> $DIR/repr_align_greater_usize.rs:24:8 + --> $DIR/repr_align_greater_usize.rs:25:8 | LL | #[repr(align(65536))] | ^^^^^^^^^^^^ diff --git a/tests/ui/repr/repr_align_greater_usize.rs b/tests/ui/repr/repr_align_greater_usize.rs index b47320b6d9b..7499e242d59 100644 --- a/tests/ui/repr/repr_align_greater_usize.rs +++ b/tests/ui/repr/repr_align_greater_usize.rs @@ -1,3 +1,4 @@ +//@ add-core-stubs //@ revisions: msp430 aarch32 //@[msp430] needs-llvm-components: msp430 //@[msp430] compile-flags: --target=msp430-none-elf @@ -12,8 +13,8 @@ #![no_core] #![crate_type = "lib"] -#[lang = "sized"] -trait Sized {} +extern crate minicore; +use minicore::*; #[repr(align(16384))] struct Kitten; diff --git a/tests/ui/return/tail-expr-as-potential-return.rs b/tests/ui/return/tail-expr-as-potential-return.rs index 11ecddb049b..2e638f1897c 100644 --- a/tests/ui/return/tail-expr-as-potential-return.rs +++ b/tests/ui/return/tail-expr-as-potential-return.rs @@ -60,7 +60,6 @@ fn method() -> Option<i32> { Receiver.generic(); //~^ ERROR type annotations needed //~| HELP consider specifying the generic argument - //~| HELP you might have meant to return this to infer its type parameters } None diff --git a/tests/ui/return/tail-expr-as-potential-return.stderr b/tests/ui/return/tail-expr-as-potential-return.stderr index 756de2b5a16..8105b2df3fe 100644 --- a/tests/ui/return/tail-expr-as-potential-return.stderr +++ b/tests/ui/return/tail-expr-as-potential-return.stderr @@ -57,10 +57,6 @@ help: consider specifying the generic argument | LL | Receiver.generic::<T>(); | +++++ -help: you might have meant to return this to infer its type parameters - | -LL | return Receiver.generic(); - | ++++++ error: aborting due to 4 previous errors diff --git a/tests/ui/rfcs/rfc-2027-dyn-compatible-for-dispatch/downcast-unsafe-trait-objects.rs b/tests/ui/rfcs/rfc-2027-dyn-compatible-for-dispatch/downcast-unsafe-trait-objects.rs deleted file mode 100644 index b1b2dcf3eb9..00000000000 --- a/tests/ui/rfcs/rfc-2027-dyn-compatible-for-dispatch/downcast-unsafe-trait-objects.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Check that we if we get ahold of a dyn-incompatible trait -// object with auto traits and lifetimes, we can downcast it -// -//@ check-pass - -#![feature(dyn_compatible_for_dispatch)] - -trait Trait: Sized {} - -fn downcast_auto(t: &(dyn Trait + Send)) -> &dyn Trait { - t -} - -fn downcast_lifetime<'a, 'b, 't>(t: &'a (dyn Trait + 't)) - -> &'b (dyn Trait + 't) -where - 'a: 'b, - 't: 'a + 'b, -{ - t -} - -fn main() {} diff --git a/tests/ui/rfcs/rfc-2027-dyn-compatible-for-dispatch/manual-self-impl-for-unsafe-obj.current.stderr b/tests/ui/rfcs/rfc-2027-dyn-compatible-for-dispatch/manual-self-impl-for-unsafe-obj.current.stderr deleted file mode 100644 index 1489791b20d..00000000000 --- a/tests/ui/rfcs/rfc-2027-dyn-compatible-for-dispatch/manual-self-impl-for-unsafe-obj.current.stderr +++ /dev/null @@ -1,15 +0,0 @@ -warning: methods `good_virt` and `good_indirect` are never used - --> $DIR/manual-self-impl-for-unsafe-obj.rs:23:8 - | -LL | trait Good { - | ---- methods in this trait -LL | fn good_virt(&self) -> char { - | ^^^^^^^^^ -... -LL | fn good_indirect(&self) -> char { - | ^^^^^^^^^^^^^ - | - = note: `#[warn(dead_code)]` on by default - -warning: 1 warning emitted - diff --git a/tests/ui/rfcs/rfc-2027-dyn-compatible-for-dispatch/manual-self-impl-for-unsafe-obj.next.stderr b/tests/ui/rfcs/rfc-2027-dyn-compatible-for-dispatch/manual-self-impl-for-unsafe-obj.next.stderr deleted file mode 100644 index 1489791b20d..00000000000 --- a/tests/ui/rfcs/rfc-2027-dyn-compatible-for-dispatch/manual-self-impl-for-unsafe-obj.next.stderr +++ /dev/null @@ -1,15 +0,0 @@ -warning: methods `good_virt` and `good_indirect` are never used - --> $DIR/manual-self-impl-for-unsafe-obj.rs:23:8 - | -LL | trait Good { - | ---- methods in this trait -LL | fn good_virt(&self) -> char { - | ^^^^^^^^^ -... -LL | fn good_indirect(&self) -> char { - | ^^^^^^^^^^^^^ - | - = note: `#[warn(dead_code)]` on by default - -warning: 1 warning emitted - diff --git a/tests/ui/rfcs/rfc-2027-dyn-compatible-for-dispatch/manual-self-impl-for-unsafe-obj.rs b/tests/ui/rfcs/rfc-2027-dyn-compatible-for-dispatch/manual-self-impl-for-unsafe-obj.rs deleted file mode 100644 index 425dc130d45..00000000000 --- a/tests/ui/rfcs/rfc-2027-dyn-compatible-for-dispatch/manual-self-impl-for-unsafe-obj.rs +++ /dev/null @@ -1,69 +0,0 @@ -// Check that we can manually implement a dyn-incompatible trait for its trait object. - -//@ revisions: current next -//@ ignore-compare-mode-next-solver (explicit revisions) -//@[next] compile-flags: -Znext-solver -//@ run-pass - -#![feature(dyn_compatible_for_dispatch)] - -trait Bad { - fn stat() -> char { - 'A' - } - fn virt(&self) -> char { - 'B' - } - fn indirect(&self) -> char { - Self::stat() - } -} - -trait Good { - fn good_virt(&self) -> char { //~ WARN methods `good_virt` and `good_indirect` are never used - panic!() - } - fn good_indirect(&self) -> char { - panic!() - } -} - -impl<'a> Bad for dyn Bad + 'a { - fn stat() -> char { - 'C' - } - fn virt(&self) -> char { - 'D' - } -} - -struct Struct {} - -impl Bad for Struct {} - -impl Good for Struct {} - -fn main() { - let s = Struct {}; - - let mut res = String::new(); - - // Directly call static. - res.push(Struct::stat()); // "A" - res.push(<dyn Bad>::stat()); // "AC" - - let good: &dyn Good = &s; - - // These look similar enough... - let bad = unsafe { std::mem::transmute::<&dyn Good, &dyn Bad>(good) }; - - // Call virtual. - res.push(s.virt()); // "ACB" - res.push(bad.virt()); // "ACBD" - - // Indirectly call static. - res.push(s.indirect()); // "ACBDA" - res.push(bad.indirect()); // "ACBDAC" - - assert_eq!(&res, "ACBDAC"); -} diff --git a/tests/ui/rfcs/rfc-2027-dyn-compatible-for-dispatch/static-dispatch-unsafe-object.rs b/tests/ui/rfcs/rfc-2027-dyn-compatible-for-dispatch/static-dispatch-unsafe-object.rs deleted file mode 100644 index c38928a9f44..00000000000 --- a/tests/ui/rfcs/rfc-2027-dyn-compatible-for-dispatch/static-dispatch-unsafe-object.rs +++ /dev/null @@ -1,37 +0,0 @@ -// Check that we can statically dispatch methods for object -// unsafe trait objects, directly and indirectly -// -//@ check-pass - -#![feature(dyn_compatible_for_dispatch)] - -trait Statics { - fn plain() {} - fn generic<T>() {} -} - -trait Trait: Sized {} - -impl<'a> Statics for dyn Trait + 'a {} - -fn static_poly<T: Statics + ?Sized>() { - T::plain(); - T::generic::<usize>(); -} - -fn inferred_poly<T: Statics + ?Sized>(t: &T) { - static_poly::<T>(); - T::plain(); - T::generic::<usize>(); -} - -fn call(t: &dyn Trait) { - static_poly::<dyn Trait>(); - inferred_poly(t); -} - -fn main() { - static_poly::<dyn Trait>(); - <dyn Trait>::plain(); - <dyn Trait>::generic::<usize>() -} diff --git a/tests/ui/rfcs/rfc-2627-raw-dylib/raw-dylib-windows-only.rs b/tests/ui/rfcs/rfc-2627-raw-dylib/raw-dylib-windows-only.rs deleted file mode 100644 index 3b982857db8..00000000000 --- a/tests/ui/rfcs/rfc-2627-raw-dylib/raw-dylib-windows-only.rs +++ /dev/null @@ -1,5 +0,0 @@ -//@ ignore-windows -//@ compile-flags: --crate-type lib -#[link(name = "foo", kind = "raw-dylib")] -//~^ ERROR: link kind `raw-dylib` is only supported on Windows targets -extern "C" {} diff --git a/tests/ui/rmeta/emit-artifact-notifications.stderr b/tests/ui/rmeta/emit-artifact-notifications.stderr index 4f68a2d74ed..c002be7bcff 100644 --- a/tests/ui/rmeta/emit-artifact-notifications.stderr +++ b/tests/ui/rmeta/emit-artifact-notifications.stderr @@ -1 +1 @@ -{"$message_type":"artifact","artifact":"$TEST_BUILD_DIR/rmeta/emit-artifact-notifications/libemit_artifact_notifications.rmeta","emit":"metadata"} +{"$message_type":"artifact","artifact":"$TEST_BUILD_DIR/libemit_artifact_notifications.rmeta","emit":"metadata"} diff --git a/tests/ui/rust-2021/ice-return-unsized-can-impl-2.rs b/tests/ui/rust-2021/ice-return-unsized-can-impl-2.rs index e57e9ce4844..567d37e1b82 100644 --- a/tests/ui/rust-2021/ice-return-unsized-can-impl-2.rs +++ b/tests/ui/rust-2021/ice-return-unsized-can-impl-2.rs @@ -1,15 +1,17 @@ // Doesn't trigger ICE when returning unsized trait that can be impl // issue https://github.com/rust-lang/rust/issues/125512 //@ edition:2021 -#![feature(dyn_compatible_for_dispatch)] + trait B { fn f(a: A) -> A; //~^ ERROR: expected a type, found a trait //~| ERROR: expected a type, found a trait } + trait A { fn concrete(b: B) -> B; //~^ ERROR: expected a type, found a trait //~| ERROR: expected a type, found a trait } + fn main() {} diff --git a/tests/ui/rust-2021/ice-return-unsized-can-impl-2.stderr b/tests/ui/rust-2021/ice-return-unsized-can-impl-2.stderr index ac19f91881d..f2942820e28 100644 --- a/tests/ui/rust-2021/ice-return-unsized-can-impl-2.stderr +++ b/tests/ui/rust-2021/ice-return-unsized-can-impl-2.stderr @@ -1,5 +1,5 @@ error[E0782]: expected a type, found a trait - --> $DIR/ice-return-unsized-can-impl-2.rs:11:20 + --> $DIR/ice-return-unsized-can-impl-2.rs:12:20 | LL | fn concrete(b: B) -> B; | ^ @@ -16,7 +16,7 @@ LL | fn concrete(b: impl B) -> B; | ++++ error[E0782]: expected a type, found a trait - --> $DIR/ice-return-unsized-can-impl-2.rs:11:26 + --> $DIR/ice-return-unsized-can-impl-2.rs:12:26 | LL | fn concrete(b: B) -> B; | ^ diff --git a/tests/ui/rust-2021/ice-return-unsized-can-impl.rs b/tests/ui/rust-2021/ice-return-unsized-can-impl.rs index 055b11b4424..8b83b7b537a 100644 --- a/tests/ui/rust-2021/ice-return-unsized-can-impl.rs +++ b/tests/ui/rust-2021/ice-return-unsized-can-impl.rs @@ -1,7 +1,6 @@ // Doesn't trigger ICE when returning unsized trait that can be impl // issue https://github.com/rust-lang/rust/issues/120482 //@ edition:2021 -#![feature(dyn_compatible_for_dispatch)] trait B { fn bar(&self, x: &Self); diff --git a/tests/ui/rust-2021/ice-return-unsized-can-impl.stderr b/tests/ui/rust-2021/ice-return-unsized-can-impl.stderr index 463c6892ca2..cfee506e29b 100644 --- a/tests/ui/rust-2021/ice-return-unsized-can-impl.stderr +++ b/tests/ui/rust-2021/ice-return-unsized-can-impl.stderr @@ -1,5 +1,5 @@ error[E0782]: expected a type, found a trait - --> $DIR/ice-return-unsized-can-impl.rs:11:15 + --> $DIR/ice-return-unsized-can-impl.rs:10:15 | LL | fn g(new: B) -> B; | ^ @@ -16,7 +16,7 @@ LL | fn g(new: impl B) -> B; | ++++ error[E0782]: expected a type, found a trait - --> $DIR/ice-return-unsized-can-impl.rs:11:21 + --> $DIR/ice-return-unsized-can-impl.rs:10:21 | LL | fn g(new: B) -> B; | ^ diff --git a/tests/ui/rust-2021/ice-unsized-fn-params-2.rs b/tests/ui/rust-2021/ice-unsized-fn-params-2.rs index 2b4f7bd088f..8af56ffe80d 100644 --- a/tests/ui/rust-2021/ice-unsized-fn-params-2.rs +++ b/tests/ui/rust-2021/ice-unsized-fn-params-2.rs @@ -1,7 +1,7 @@ //@ edition:2021 // Test that it doesn't trigger an ICE when using an unsized fn params. // https://github.com/rust-lang/rust/issues/120241 -#![feature(dyn_compatible_for_dispatch)] + #![feature(unsized_fn_params)] fn guard(_s: Copy) -> bool { diff --git a/tests/ui/rust-2021/ice-unsized-fn-params.rs b/tests/ui/rust-2021/ice-unsized-fn-params.rs index 6d8c1c3f152..6ed67698e96 100644 --- a/tests/ui/rust-2021/ice-unsized-fn-params.rs +++ b/tests/ui/rust-2021/ice-unsized-fn-params.rs @@ -1,7 +1,6 @@ //@ edition:2021 // Test that it doesn't trigger an ICE when using an unsized fn params. // https://github.com/rust-lang/rust/issues/120241 -#![feature(dyn_compatible_for_dispatch)] trait B { fn f(a: A) -> A; diff --git a/tests/ui/rust-2021/ice-unsized-fn-params.stderr b/tests/ui/rust-2021/ice-unsized-fn-params.stderr index c31500ba800..4d900711ed6 100644 --- a/tests/ui/rust-2021/ice-unsized-fn-params.stderr +++ b/tests/ui/rust-2021/ice-unsized-fn-params.stderr @@ -1,5 +1,5 @@ error[E0782]: expected a type, found a trait - --> $DIR/ice-unsized-fn-params.rs:13:13 + --> $DIR/ice-unsized-fn-params.rs:12:13 | LL | fn g(b: B) -> B; | ^ @@ -16,7 +16,7 @@ LL | fn g(b: impl B) -> B; | ++++ error[E0782]: expected a type, found a trait - --> $DIR/ice-unsized-fn-params.rs:13:19 + --> $DIR/ice-unsized-fn-params.rs:12:19 | LL | fn g(b: B) -> B; | ^ @@ -27,7 +27,7 @@ LL | fn g(b: B) -> impl B; | ++++ error[E0782]: expected a type, found a trait - --> $DIR/ice-unsized-fn-params.rs:7:13 + --> $DIR/ice-unsized-fn-params.rs:6:13 | LL | fn f(a: A) -> A; | ^ @@ -44,7 +44,7 @@ LL | fn f(a: impl A) -> A; | ++++ error[E0782]: expected a type, found a trait - --> $DIR/ice-unsized-fn-params.rs:7:19 + --> $DIR/ice-unsized-fn-params.rs:6:19 | LL | fn f(a: A) -> A; | ^ diff --git a/tests/ui/rust-2024/reserved-guarded-strings.stderr b/tests/ui/rust-2024/reserved-guarded-strings.stderr index 0f3b06147c4..fde3a719e67 100644 --- a/tests/ui/rust-2024/reserved-guarded-strings.stderr +++ b/tests/ui/rust-2024/reserved-guarded-strings.stderr @@ -241,7 +241,7 @@ LL | demo2!(#"foo"## #); error: invalid string literal --> $DIR/reserved-guarded-strings.rs:71:12 | -LL | ...n!(####################################################################################################################################################################################################################################################################"foo... +LL | ...n!(####################################################################################################################################################################################################################################################################"foo"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: unprefixed guarded string literals are reserved for future use since Rust 2024 diff --git a/tests/ui/sanitizer/cfg-kasan.rs b/tests/ui/sanitizer/cfg-kasan.rs index 491eaf3acc1..ba0abf60570 100644 --- a/tests/ui/sanitizer/cfg-kasan.rs +++ b/tests/ui/sanitizer/cfg-kasan.rs @@ -1,6 +1,7 @@ // Verifies that when compiling with -Zsanitizer=kernel-address, // the `#[cfg(sanitize = "address")]` attribute is configured. +//@ add-core-stubs //@ check-pass //@ compile-flags: -Zsanitizer=kernel-address //@ revisions: aarch64 riscv64imac riscv64gc x86_64 @@ -17,8 +18,8 @@ #![feature(cfg_sanitize, no_core, lang_items)] #![no_core] -#[lang = "sized"] -trait Sized {} +extern crate minicore; +use minicore::*; const _: fn() -> () = main; diff --git a/tests/ui/sanitizer/cfg.rs b/tests/ui/sanitizer/cfg.rs index 7b8f285e41a..a43813c0446 100644 --- a/tests/ui/sanitizer/cfg.rs +++ b/tests/ui/sanitizer/cfg.rs @@ -1,6 +1,7 @@ // Verifies that when compiling with -Zsanitizer=option, // the `#[cfg(sanitize = "option")]` attribute is configured. +//@ add-core-stubs //@ check-pass //@ revisions: address cfi kcfi leak memory thread //@compile-flags: -Ctarget-feature=-crt-static @@ -23,10 +24,8 @@ #![crate_type="lib"] #![no_core] -#[lang="sized"] -trait Sized { } -#[lang="copy"] -trait Copy { } +extern crate minicore; +use minicore::*; #[cfg(all(sanitize = "address", address))] fn main() {} diff --git a/tests/ui/self/arbitrary-self-types-dyn-incompatible.dyn_compatible_for_dispatch.stderr b/tests/ui/self/arbitrary-self-types-dyn-incompatible.dyn_compatible_for_dispatch.stderr deleted file mode 100644 index d324f4641cf..00000000000 --- a/tests/ui/self/arbitrary-self-types-dyn-incompatible.dyn_compatible_for_dispatch.stderr +++ /dev/null @@ -1,23 +0,0 @@ -error[E0038]: the trait `Foo` is not dyn compatible - --> $DIR/arbitrary-self-types-dyn-incompatible.rs:33:13 - | -LL | fn foo(self: &Rc<Self>) -> usize; - | --------- help: consider changing method `foo`'s `self` parameter to be `&self`: `&Self` -... -LL | let x = Rc::new(5usize) as Rc<dyn Foo>; - | ^^^^^^^^^^^^^^^ `Foo` is not dyn compatible - | -note: for a trait to be dyn compatible it needs to allow building a vtable - for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> - --> $DIR/arbitrary-self-types-dyn-incompatible.rs:8:18 - | -LL | trait Foo { - | --- this trait is not dyn compatible... -LL | fn foo(self: &Rc<Self>) -> usize; - | ^^^^^^^^^ ...because method `foo`'s `self` parameter cannot be dispatched on - = help: only type `usize` implements `Foo`; consider using it directly instead. - = note: required for the cast from `Rc<usize>` to `Rc<dyn Foo>` - -error: aborting due to 1 previous error - -For more information about this error, try `rustc --explain E0038`. diff --git a/tests/ui/self/arbitrary-self-types-dyn-incompatible.rs b/tests/ui/self/arbitrary-self-types-dyn-incompatible.rs index 940b2f1e8e2..0477d9d79c7 100644 --- a/tests/ui/self/arbitrary-self-types-dyn-incompatible.rs +++ b/tests/ui/self/arbitrary-self-types-dyn-incompatible.rs @@ -1,7 +1,3 @@ -//@ revisions: curr dyn_compatible_for_dispatch - -#![cfg_attr(dyn_compatible_for_dispatch, feature(dyn_compatible_for_dispatch))] - use std::rc::Rc; trait Foo { @@ -31,9 +27,8 @@ impl Bar for usize { fn make_foo() { let x = Rc::new(5usize) as Rc<dyn Foo>; - //[curr]~^ ERROR E0038 - //[curr]~| ERROR E0038 - //[dyn_compatible_for_dispatch]~^^^ ERROR E0038 + //~^ ERROR E0038 + //~| ERROR E0038 } fn make_bar() { diff --git a/tests/ui/self/arbitrary-self-types-dyn-incompatible.stderr b/tests/ui/self/arbitrary-self-types-dyn-incompatible.stderr new file mode 100644 index 00000000000..9fb4c80329d --- /dev/null +++ b/tests/ui/self/arbitrary-self-types-dyn-incompatible.stderr @@ -0,0 +1,42 @@ +error[E0038]: the trait `Foo` is not dyn compatible + --> $DIR/arbitrary-self-types-dyn-incompatible.rs:29:32 + | +LL | fn foo(self: &Rc<Self>) -> usize; + | --------- help: consider changing method `foo`'s `self` parameter to be `&self`: `&Self` +... +LL | let x = Rc::new(5usize) as Rc<dyn Foo>; + | ^^^^^^^^^^^ `Foo` is not dyn compatible + | +note: for a trait to be dyn compatible it needs to allow building a vtable + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> + --> $DIR/arbitrary-self-types-dyn-incompatible.rs:4:18 + | +LL | trait Foo { + | --- this trait is not dyn compatible... +LL | fn foo(self: &Rc<Self>) -> usize; + | ^^^^^^^^^ ...because method `foo`'s `self` parameter cannot be dispatched on + = help: only type `usize` implements `Foo`; consider using it directly instead. + +error[E0038]: the trait `Foo` is not dyn compatible + --> $DIR/arbitrary-self-types-dyn-incompatible.rs:29:13 + | +LL | fn foo(self: &Rc<Self>) -> usize; + | --------- help: consider changing method `foo`'s `self` parameter to be `&self`: `&Self` +... +LL | let x = Rc::new(5usize) as Rc<dyn Foo>; + | ^^^^^^^^^^^^^^^ `Foo` is not dyn compatible + | +note: for a trait to be dyn compatible it needs to allow building a vtable + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> + --> $DIR/arbitrary-self-types-dyn-incompatible.rs:4:18 + | +LL | trait Foo { + | --- this trait is not dyn compatible... +LL | fn foo(self: &Rc<Self>) -> usize; + | ^^^^^^^^^ ...because method `foo`'s `self` parameter cannot be dispatched on + = help: only type `usize` implements `Foo`; consider using it directly instead. + = note: required for the cast from `Rc<usize>` to `Rc<dyn Foo>` + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0038`. diff --git a/tests/ui/self/dispatch-from-dyn-zst-transmute-zst-nonzst.rs b/tests/ui/self/dispatch-from-dyn-zst-transmute-zst-nonzst.rs index 71f198f7dc7..94b76fe9685 100644 --- a/tests/ui/self/dispatch-from-dyn-zst-transmute-zst-nonzst.rs +++ b/tests/ui/self/dispatch-from-dyn-zst-transmute-zst-nonzst.rs @@ -15,7 +15,7 @@ struct Dispatchable<T: ?Sized, Z> { } impl<T, U> DispatchFromDyn<Dispatchable<U, i32>> for Dispatchable<T, ()> -//~^ ERROR implementing the `DispatchFromDyn` trait requires multiple coercions +//~^ ERROR implementing `DispatchFromDyn` does not allow multiple fields to be coerced where T: Unsize<U> + ?Sized, U: ?Sized, diff --git a/tests/ui/self/dispatch-from-dyn-zst-transmute-zst-nonzst.stderr b/tests/ui/self/dispatch-from-dyn-zst-transmute-zst-nonzst.stderr index 1f13c51f679..91760b9e2ea 100644 --- a/tests/ui/self/dispatch-from-dyn-zst-transmute-zst-nonzst.stderr +++ b/tests/ui/self/dispatch-from-dyn-zst-transmute-zst-nonzst.stderr @@ -1,4 +1,4 @@ -error[E0378]: implementing the `DispatchFromDyn` trait requires multiple coercions +error[E0375]: implementing `DispatchFromDyn` does not allow multiple fields to be coerced --> $DIR/dispatch-from-dyn-zst-transmute-zst-nonzst.rs:17:1 | LL | / impl<T, U> DispatchFromDyn<Dispatchable<U, i32>> for Dispatchable<T, ()> @@ -8,9 +8,14 @@ LL | | T: Unsize<U> + ?Sized, LL | | U: ?Sized, | |______________^ | - = note: the trait `DispatchFromDyn` may only be implemented for a coercion between structures with a single field being coerced - = note: currently, 2 fields need coercions: `_ptr` (`Box<T>` to `Box<U>`), `z` (`()` to `i32`) +note: the trait `DispatchFromDyn` may only be implemented when a single field is being coerced + --> $DIR/dispatch-from-dyn-zst-transmute-zst-nonzst.rs:13:5 + | +LL | _ptr: Box<T>, + | ^^^^^^^^^^^^ +LL | z: Z, + | ^^^^ error: aborting due to 1 previous error -For more information about this error, try `rustc --explain E0378`. +For more information about this error, try `rustc --explain E0375`. diff --git a/tests/ui/self/dispatch-from-dyn-zst-transmute.rs b/tests/ui/self/dispatch-from-dyn-zst-transmute.rs index 57c255b4d7b..967958ab486 100644 --- a/tests/ui/self/dispatch-from-dyn-zst-transmute.rs +++ b/tests/ui/self/dispatch-from-dyn-zst-transmute.rs @@ -15,7 +15,7 @@ struct Foo<'a, U: ?Sized> { } impl<'a, T, U> DispatchFromDyn<Foo<'a, U>> for Foo<'a, T> -//~^ ERROR implementing the `DispatchFromDyn` trait requires multiple coercions +//~^ ERROR implementing `DispatchFromDyn` does not allow multiple fields to be coerced where T: Unsize<U> + ?Sized, U: ?Sized {} diff --git a/tests/ui/self/dispatch-from-dyn-zst-transmute.stderr b/tests/ui/self/dispatch-from-dyn-zst-transmute.stderr index 5a8ae88b5f1..cc8be45e99d 100644 --- a/tests/ui/self/dispatch-from-dyn-zst-transmute.stderr +++ b/tests/ui/self/dispatch-from-dyn-zst-transmute.stderr @@ -1,4 +1,4 @@ -error[E0378]: implementing the `DispatchFromDyn` trait requires multiple coercions +error[E0375]: implementing `DispatchFromDyn` does not allow multiple fields to be coerced --> $DIR/dispatch-from-dyn-zst-transmute.rs:17:1 | LL | / impl<'a, T, U> DispatchFromDyn<Foo<'a, U>> for Foo<'a, T> @@ -8,9 +8,14 @@ LL | | T: Unsize<U> + ?Sized, LL | | U: ?Sized {} | |_____________^ | - = note: the trait `DispatchFromDyn` may only be implemented for a coercion between structures with a single field being coerced - = note: currently, 2 fields need coercions: `token` (`IsSendToken<T>` to `IsSendToken<U>`), `ptr` (`&'a T` to `&'a U`) +note: the trait `DispatchFromDyn` may only be implemented when a single field is being coerced + --> $DIR/dispatch-from-dyn-zst-transmute.rs:13:5 + | +LL | token: IsSendToken<U>, + | ^^^^^^^^^^^^^^^^^^^^^ +LL | ptr: &'a U, + | ^^^^^^^^^^ error: aborting due to 1 previous error -For more information about this error, try `rustc --explain E0378`. +For more information about this error, try `rustc --explain E0375`. diff --git a/tests/ui/simd/array-trait.rs b/tests/ui/simd/array-trait.rs index 32cbf01428c..26218856771 100644 --- a/tests/ui/simd/array-trait.rs +++ b/tests/ui/simd/array-trait.rs @@ -1,11 +1,11 @@ // Figuring out the size of a vector type that depends on traits doesn't ICE #![allow(dead_code)] - - -#![feature(repr_simd, intrinsics, generic_const_exprs)] +#![feature(repr_simd, core_intrinsics, generic_const_exprs)] #![allow(non_camel_case_types, incomplete_features)] +use std::intrinsics::simd::{simd_extract, simd_insert}; + pub trait Simd { type Lane: Clone + Copy; const SIZE: usize; @@ -24,13 +24,6 @@ pub struct T<S: Simd>([S::Lane; S::SIZE]); //~| ERROR SIMD vector element type should be a primitive scalar //~| ERROR unconstrained generic constant -#[rustc_intrinsic] -unsafe fn simd_insert<T, E>(x: T, idx: u32, y: E) -> T; - -#[rustc_intrinsic] -unsafe fn simd_extract<T, E>(x: T, idx: u32) -> E; - - pub fn main() { let mut t = T::<i32x4>([0; 4]); unsafe { diff --git a/tests/ui/simd/array-type.rs b/tests/ui/simd/array-type.rs index d1de7004416..468e0b2f9b5 100644 --- a/tests/ui/simd/array-type.rs +++ b/tests/ui/simd/array-type.rs @@ -1,8 +1,8 @@ //@ run-pass #![allow(dead_code)] +#![feature(repr_simd, core_intrinsics)] - -#![feature(repr_simd, intrinsics)] +use std::intrinsics::simd::{simd_extract, simd_insert}; #[repr(simd)] #[derive(Copy, Clone)] @@ -12,13 +12,6 @@ struct S([i32; 4]); #[derive(Copy, Clone)] struct T<const N: usize>([i32; N]); -#[rustc_intrinsic] -unsafe fn simd_insert<T, E>(x: T, idx: u32, y: E) -> T; - -#[rustc_intrinsic] -unsafe fn simd_extract<T, E>(x: T, idx: u32) -> E; - - pub fn main() { let mut s = S([0; 4]); diff --git a/tests/ui/simd/const-err-trumps-simd-err.stderr b/tests/ui/simd/const-err-trumps-simd-err.stderr index 11cbcad227f..e88c277885e 100644 --- a/tests/ui/simd/const-err-trumps-simd-err.stderr +++ b/tests/ui/simd/const-err-trumps-simd-err.stderr @@ -2,7 +2,7 @@ error[E0080]: evaluation of `get_elem::<4>::{constant#0}` failed --> $DIR/const-err-trumps-simd-err.rs:16:13 | LL | const { assert!(LANE < 4); } // the error should be here... - | ^^^^^^^^^^^^^^^^^ the evaluated program panicked at 'assertion failed: LANE < 4', $DIR/const-err-trumps-simd-err.rs:16:13 + | ^^^^^^^^^^^^^^^^^ evaluation panicked: assertion failed: LANE < 4 | = note: this error originates in the macro `assert` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/tests/ui/simd/generics.rs b/tests/ui/simd/generics.rs index 453ed86c14a..1ae08fef7cd 100644 --- a/tests/ui/simd/generics.rs +++ b/tests/ui/simd/generics.rs @@ -1,7 +1,8 @@ //@ run-pass #![allow(non_camel_case_types)] -#![feature(repr_simd, intrinsics)] +#![feature(repr_simd, core_intrinsics)] +use std::intrinsics::simd::simd_add; use std::ops; #[repr(simd)] @@ -20,11 +21,7 @@ struct B<T>([T; 4]); #[derive(Copy, Clone)] struct C<T, const N: usize>([T; N]); - -#[rustc_intrinsic] -unsafe fn simd_add<T>(x: T, y: T) -> T; - -fn add<T: ops::Add<Output=T>>(lhs: T, rhs: T) -> T { +fn add<T: ops::Add<Output = T>>(lhs: T, rhs: T) -> T { lhs + rhs } @@ -60,7 +57,6 @@ impl ops::Add for C<f32, 4> { } } - pub fn main() { let x = [1.0f32, 2.0f32, 3.0f32, 4.0f32]; let y = [2.0f32, 4.0f32, 6.0f32, 8.0f32]; diff --git a/tests/ui/simd/intrinsic/float-math-pass.rs b/tests/ui/simd/intrinsic/float-math-pass.rs index 74cb51a0606..4c28568a739 100644 --- a/tests/ui/simd/intrinsic/float-math-pass.rs +++ b/tests/ui/simd/intrinsic/float-math-pass.rs @@ -8,83 +8,30 @@ // Test that the simd floating-point math intrinsics produce correct results. -#![feature(repr_simd, intrinsics)] +#![feature(repr_simd, intrinsics, core_intrinsics)] #![allow(non_camel_case_types)] #[repr(simd)] #[derive(Copy, Clone, PartialEq, Debug)] struct f32x4(pub [f32; 4]); -#[rustc_intrinsic] -unsafe fn simd_fsqrt<T>(x: T) -> T; - -#[rustc_intrinsic] -unsafe fn simd_fabs<T>(x: T) -> T; - -#[rustc_intrinsic] -unsafe fn simd_fsin<T>(x: T) -> T; - -#[rustc_intrinsic] -unsafe fn simd_fcos<T>(x: T) -> T; - -#[rustc_intrinsic] -unsafe fn simd_fexp<T>(x: T) -> T; - -#[rustc_intrinsic] -unsafe fn simd_fexp2<T>(x: T) -> T; - -#[rustc_intrinsic] -unsafe fn simd_fma<T>(x: T, y: T, z: T) -> T; - -#[rustc_intrinsic] -unsafe fn simd_relaxed_fma<T>(x: T, y: T, z: T) -> T; - -#[rustc_intrinsic] -unsafe fn simd_flog<T>(x: T) -> T; - -#[rustc_intrinsic] -unsafe fn simd_flog10<T>(x: T) -> T; - -#[rustc_intrinsic] -unsafe fn simd_flog2<T>(x: T) -> T; - -#[rustc_intrinsic] -unsafe fn simd_fpow<T>(x: T, y: T) -> T; - -#[rustc_intrinsic] -unsafe fn simd_fpowi<T>(x: T, y: i32) -> T; - - -// rounding functions -#[rustc_intrinsic] -unsafe fn simd_ceil<T>(x: T) -> T; - -#[rustc_intrinsic] -unsafe fn simd_floor<T>(x: T) -> T; - -#[rustc_intrinsic] -unsafe fn simd_round<T>(x: T) -> T; - -#[rustc_intrinsic] -unsafe fn simd_trunc<T>(x: T) -> T; - +use std::intrinsics::simd::*; macro_rules! assert_approx_eq_f32 { - ($a:expr, $b:expr) => ({ + ($a:expr, $b:expr) => {{ let (a, b) = (&$a, &$b); - assert!((*a - *b).abs() < 1.0e-6, - "{} is not approximately equal to {}", *a, *b); - }) + assert!((*a - *b).abs() < 1.0e-6, "{} is not approximately equal to {}", *a, *b); + }}; } macro_rules! assert_approx_eq { - ($a:expr, $b:expr) => ({ + ($a:expr, $b:expr) => {{ let a = $a; let b = $b; assert_approx_eq_f32!(a.0[0], b.0[0]); assert_approx_eq_f32!(a.0[1], b.0[1]); assert_approx_eq_f32!(a.0[2], b.0[2]); assert_approx_eq_f32!(a.0[3], b.0[3]); - }) + }}; } fn main() { @@ -125,12 +72,6 @@ fn main() { let r = simd_flog10(x); assert_approx_eq!(z, r); - let r = simd_fpow(h, x); - assert_approx_eq!(h, r); - - let r = simd_fpowi(h, 1); - assert_approx_eq!(h, r); - let r = simd_fsin(z); assert_approx_eq!(z, r); diff --git a/tests/ui/simd/intrinsic/generic-arithmetic-2.rs b/tests/ui/simd/intrinsic/generic-arithmetic-2.rs index 0fcff8584c8..fdf06b7882e 100644 --- a/tests/ui/simd/intrinsic/generic-arithmetic-2.rs +++ b/tests/ui/simd/intrinsic/generic-arithmetic-2.rs @@ -1,7 +1,10 @@ //@ build-fail -#![feature(repr_simd, intrinsics)] +#![feature(repr_simd, core_intrinsics)] #![allow(non_camel_case_types)] + +use std::intrinsics::simd::*; + #[repr(simd)] #[derive(Copy, Clone)] pub struct i32x4(pub [i32; 4]); @@ -14,55 +17,6 @@ pub struct u32x4(pub [u32; 4]); #[derive(Copy, Clone)] pub struct f32x4(pub [f32; 4]); -#[rustc_intrinsic] -unsafe fn simd_add<T>(x: T, y: T) -> T; - -#[rustc_intrinsic] -unsafe fn simd_sub<T>(x: T, y: T) -> T; - -#[rustc_intrinsic] -unsafe fn simd_mul<T>(x: T, y: T) -> T; - -#[rustc_intrinsic] -unsafe fn simd_div<T>(x: T, y: T) -> T; - -#[rustc_intrinsic] -unsafe fn simd_rem<T>(x: T, y: T) -> T; - -#[rustc_intrinsic] -unsafe fn simd_shl<T>(x: T, y: T) -> T; - -#[rustc_intrinsic] -unsafe fn simd_shr<T>(x: T, y: T) -> T; - -#[rustc_intrinsic] -unsafe fn simd_and<T>(x: T, y: T) -> T; - -#[rustc_intrinsic] -unsafe fn simd_or<T>(x: T, y: T) -> T; - -#[rustc_intrinsic] -unsafe fn simd_xor<T>(x: T, y: T) -> T; - - -#[rustc_intrinsic] -unsafe fn simd_neg<T>(x: T) -> T; - -#[rustc_intrinsic] -unsafe fn simd_bswap<T>(x: T) -> T; - -#[rustc_intrinsic] -unsafe fn simd_bitreverse<T>(x: T) -> T; - -#[rustc_intrinsic] -unsafe fn simd_ctlz<T>(x: T) -> T; - -#[rustc_intrinsic] -unsafe fn simd_ctpop<T>(x: T) -> T; - -#[rustc_intrinsic] -unsafe fn simd_cttz<T>(x: T) -> T; - fn main() { let x = i32x4([0, 0, 0, 0]); let y = u32x4([0, 0, 0, 0]); diff --git a/tests/ui/simd/intrinsic/generic-arithmetic-2.stderr b/tests/ui/simd/intrinsic/generic-arithmetic-2.stderr index e67de2fe903..76db6d5328f 100644 --- a/tests/ui/simd/intrinsic/generic-arithmetic-2.stderr +++ b/tests/ui/simd/intrinsic/generic-arithmetic-2.stderr @@ -1,143 +1,143 @@ error[E0511]: invalid monomorphization of `simd_add` intrinsic: expected SIMD input type, found non-SIMD `i32` - --> $DIR/generic-arithmetic-2.rs:110:9 + --> $DIR/generic-arithmetic-2.rs:64:9 | LL | simd_add(0, 0); | ^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_sub` intrinsic: expected SIMD input type, found non-SIMD `i32` - --> $DIR/generic-arithmetic-2.rs:112:9 + --> $DIR/generic-arithmetic-2.rs:66:9 | LL | simd_sub(0, 0); | ^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_mul` intrinsic: expected SIMD input type, found non-SIMD `i32` - --> $DIR/generic-arithmetic-2.rs:114:9 + --> $DIR/generic-arithmetic-2.rs:68:9 | LL | simd_mul(0, 0); | ^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_div` intrinsic: expected SIMD input type, found non-SIMD `i32` - --> $DIR/generic-arithmetic-2.rs:116:9 + --> $DIR/generic-arithmetic-2.rs:70:9 | LL | simd_div(0, 0); | ^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_shl` intrinsic: expected SIMD input type, found non-SIMD `i32` - --> $DIR/generic-arithmetic-2.rs:118:9 + --> $DIR/generic-arithmetic-2.rs:72:9 | LL | simd_shl(0, 0); | ^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_shr` intrinsic: expected SIMD input type, found non-SIMD `i32` - --> $DIR/generic-arithmetic-2.rs:120:9 + --> $DIR/generic-arithmetic-2.rs:74:9 | LL | simd_shr(0, 0); | ^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_and` intrinsic: expected SIMD input type, found non-SIMD `i32` - --> $DIR/generic-arithmetic-2.rs:122:9 + --> $DIR/generic-arithmetic-2.rs:76:9 | LL | simd_and(0, 0); | ^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_or` intrinsic: expected SIMD input type, found non-SIMD `i32` - --> $DIR/generic-arithmetic-2.rs:124:9 + --> $DIR/generic-arithmetic-2.rs:78:9 | LL | simd_or(0, 0); | ^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_xor` intrinsic: expected SIMD input type, found non-SIMD `i32` - --> $DIR/generic-arithmetic-2.rs:126:9 + --> $DIR/generic-arithmetic-2.rs:80:9 | LL | simd_xor(0, 0); | ^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_neg` intrinsic: expected SIMD input type, found non-SIMD `i32` - --> $DIR/generic-arithmetic-2.rs:129:9 + --> $DIR/generic-arithmetic-2.rs:83:9 | LL | simd_neg(0); | ^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_bswap` intrinsic: expected SIMD input type, found non-SIMD `i32` - --> $DIR/generic-arithmetic-2.rs:131:9 + --> $DIR/generic-arithmetic-2.rs:85:9 | LL | simd_bswap(0); | ^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_bitreverse` intrinsic: expected SIMD input type, found non-SIMD `i32` - --> $DIR/generic-arithmetic-2.rs:133:9 + --> $DIR/generic-arithmetic-2.rs:87:9 | LL | simd_bitreverse(0); | ^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_ctlz` intrinsic: expected SIMD input type, found non-SIMD `i32` - --> $DIR/generic-arithmetic-2.rs:135:9 + --> $DIR/generic-arithmetic-2.rs:89:9 | LL | simd_ctlz(0); | ^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_cttz` intrinsic: expected SIMD input type, found non-SIMD `i32` - --> $DIR/generic-arithmetic-2.rs:137:9 + --> $DIR/generic-arithmetic-2.rs:91:9 | LL | simd_cttz(0); | ^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_shl` intrinsic: unsupported operation on `f32x4` with element `f32` - --> $DIR/generic-arithmetic-2.rs:140:9 + --> $DIR/generic-arithmetic-2.rs:94:9 | LL | simd_shl(z, z); | ^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_shr` intrinsic: unsupported operation on `f32x4` with element `f32` - --> $DIR/generic-arithmetic-2.rs:142:9 + --> $DIR/generic-arithmetic-2.rs:96:9 | LL | simd_shr(z, z); | ^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_and` intrinsic: unsupported operation on `f32x4` with element `f32` - --> $DIR/generic-arithmetic-2.rs:144:9 + --> $DIR/generic-arithmetic-2.rs:98:9 | LL | simd_and(z, z); | ^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_or` intrinsic: unsupported operation on `f32x4` with element `f32` - --> $DIR/generic-arithmetic-2.rs:146:9 + --> $DIR/generic-arithmetic-2.rs:100:9 | LL | simd_or(z, z); | ^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_xor` intrinsic: unsupported operation on `f32x4` with element `f32` - --> $DIR/generic-arithmetic-2.rs:148:9 + --> $DIR/generic-arithmetic-2.rs:102:9 | LL | simd_xor(z, z); | ^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_bswap` intrinsic: unsupported operation on `f32x4` with element `f32` - --> $DIR/generic-arithmetic-2.rs:150:9 + --> $DIR/generic-arithmetic-2.rs:104:9 | LL | simd_bswap(z); | ^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_bitreverse` intrinsic: unsupported operation on `f32x4` with element `f32` - --> $DIR/generic-arithmetic-2.rs:152:9 + --> $DIR/generic-arithmetic-2.rs:106:9 | LL | simd_bitreverse(z); | ^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_ctlz` intrinsic: unsupported operation on `f32x4` with element `f32` - --> $DIR/generic-arithmetic-2.rs:154:9 + --> $DIR/generic-arithmetic-2.rs:108:9 | LL | simd_ctlz(z); | ^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_ctpop` intrinsic: unsupported operation on `f32x4` with element `f32` - --> $DIR/generic-arithmetic-2.rs:156:9 + --> $DIR/generic-arithmetic-2.rs:110:9 | LL | simd_ctpop(z); | ^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_cttz` intrinsic: unsupported operation on `f32x4` with element `f32` - --> $DIR/generic-arithmetic-2.rs:158:9 + --> $DIR/generic-arithmetic-2.rs:112:9 | LL | simd_cttz(z); | ^^^^^^^^^^^^ diff --git a/tests/ui/simd/intrinsic/generic-arithmetic-pass.rs b/tests/ui/simd/intrinsic/generic-arithmetic-pass.rs index 4a18c0164e4..3f0325d690b 100644 --- a/tests/ui/simd/intrinsic/generic-arithmetic-pass.rs +++ b/tests/ui/simd/intrinsic/generic-arithmetic-pass.rs @@ -1,7 +1,6 @@ //@ run-pass #![allow(non_camel_case_types)] -//@ ignore-emscripten FIXME(#45351) hits an LLVM assert -#![feature(repr_simd, intrinsics)] +#![feature(repr_simd, core_intrinsics)] #[repr(simd)] #[derive(Copy, Clone)] @@ -23,54 +22,7 @@ macro_rules! all_eq { }}; } -#[rustc_intrinsic] -unsafe fn simd_add<T>(x: T, y: T) -> T; - -#[rustc_intrinsic] -unsafe fn simd_sub<T>(x: T, y: T) -> T; - -#[rustc_intrinsic] -unsafe fn simd_mul<T>(x: T, y: T) -> T; - -#[rustc_intrinsic] -unsafe fn simd_div<T>(x: T, y: T) -> T; - -#[rustc_intrinsic] -unsafe fn simd_rem<T>(x: T, y: T) -> T; - -#[rustc_intrinsic] -unsafe fn simd_shl<T>(x: T, y: T) -> T; - -#[rustc_intrinsic] -unsafe fn simd_shr<T>(x: T, y: T) -> T; - -#[rustc_intrinsic] -unsafe fn simd_and<T>(x: T, y: T) -> T; - -#[rustc_intrinsic] -unsafe fn simd_or<T>(x: T, y: T) -> T; - -#[rustc_intrinsic] -unsafe fn simd_xor<T>(x: T, y: T) -> T; - - -#[rustc_intrinsic] -unsafe fn simd_neg<T>(x: T) -> T; - -#[rustc_intrinsic] -unsafe fn simd_bswap<T>(x: T) -> T; - -#[rustc_intrinsic] -unsafe fn simd_bitreverse<T>(x: T) -> T; - -#[rustc_intrinsic] -unsafe fn simd_ctlz<T>(x: T) -> T; - -#[rustc_intrinsic] -unsafe fn simd_ctpop<T>(x: T) -> T; - -#[rustc_intrinsic] -unsafe fn simd_cttz<T>(x: T) -> T; +use std::intrinsics::simd::*; fn main() { let x1 = i32x4([1, 2, 3, 4]); diff --git a/tests/ui/simd/intrinsic/generic-arithmetic-saturating-2.rs b/tests/ui/simd/intrinsic/generic-arithmetic-saturating-2.rs index 85464402d6a..ca170f2d850 100644 --- a/tests/ui/simd/intrinsic/generic-arithmetic-saturating-2.rs +++ b/tests/ui/simd/intrinsic/generic-arithmetic-saturating-2.rs @@ -1,7 +1,10 @@ //@ build-fail //@ ignore-emscripten -#![feature(repr_simd, intrinsics)] +#![feature(repr_simd, core_intrinsics)] #![allow(non_camel_case_types)] + +use std::intrinsics::simd::{simd_saturating_add, simd_saturating_sub}; + #[repr(simd)] #[derive(Copy, Clone)] pub struct i32x4(pub [i32; 4]); @@ -14,13 +17,6 @@ pub struct x4<T>(pub [T; 4]); #[derive(Copy, Clone)] pub struct f32x4(pub [f32; 4]); -#[rustc_intrinsic] -unsafe fn simd_saturating_add<T>(x: T, y: T) -> T; - -#[rustc_intrinsic] -unsafe fn simd_saturating_sub<T>(x: T, y: T) -> T; - - fn main() { let x = i32x4([0, 0, 0, 0]); let y = x4([0_usize, 0, 0, 0]); diff --git a/tests/ui/simd/intrinsic/generic-arithmetic-saturating-2.stderr b/tests/ui/simd/intrinsic/generic-arithmetic-saturating-2.stderr index cf275db7e43..f7874582340 100644 --- a/tests/ui/simd/intrinsic/generic-arithmetic-saturating-2.stderr +++ b/tests/ui/simd/intrinsic/generic-arithmetic-saturating-2.stderr @@ -1,11 +1,11 @@ error[E0511]: invalid monomorphization of `simd_saturating_add` intrinsic: expected element type `f32` of vector type `f32x4` to be a signed or unsigned integer type - --> $DIR/generic-arithmetic-saturating-2.rs:35:9 + --> $DIR/generic-arithmetic-saturating-2.rs:31:9 | LL | simd_saturating_add(z, z); | ^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_saturating_sub` intrinsic: expected element type `f32` of vector type `f32x4` to be a signed or unsigned integer type - --> $DIR/generic-arithmetic-saturating-2.rs:37:9 + --> $DIR/generic-arithmetic-saturating-2.rs:33:9 | LL | simd_saturating_sub(z, z); | ^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/simd/intrinsic/generic-arithmetic-saturating-pass.rs b/tests/ui/simd/intrinsic/generic-arithmetic-saturating-pass.rs index 5fe65257d15..4d12a312331 100644 --- a/tests/ui/simd/intrinsic/generic-arithmetic-saturating-pass.rs +++ b/tests/ui/simd/intrinsic/generic-arithmetic-saturating-pass.rs @@ -2,7 +2,9 @@ //@ ignore-emscripten #![allow(non_camel_case_types)] -#![feature(repr_simd, intrinsics)] +#![feature(repr_simd, core_intrinsics)] + +use std::intrinsics::simd::{simd_saturating_add, simd_saturating_sub}; #[repr(simd)] #[derive(Copy, Clone, PartialEq, Debug)] @@ -12,13 +14,6 @@ struct u32x4(pub [u32; 4]); #[derive(Copy, Clone)] struct I32<const N: usize>([i32; N]); -#[rustc_intrinsic] -unsafe fn simd_saturating_add<T>(x: T, y: T) -> T; - -#[rustc_intrinsic] -unsafe fn simd_saturating_sub<T>(x: T, y: T) -> T; - - fn main() { // unsigned { diff --git a/tests/ui/simd/intrinsic/generic-as.rs b/tests/ui/simd/intrinsic/generic-as.rs index 124ca56bc88..da53211cbc7 100644 --- a/tests/ui/simd/intrinsic/generic-as.rs +++ b/tests/ui/simd/intrinsic/generic-as.rs @@ -1,10 +1,8 @@ //@ run-pass -#![feature(repr_simd, intrinsics)] +#![feature(repr_simd, core_intrinsics)] - -#[rustc_intrinsic] -unsafe fn simd_as<T, U>(x: T) -> U; +use std::intrinsics::simd::simd_as; #[derive(Copy, Clone)] #[repr(simd)] diff --git a/tests/ui/simd/intrinsic/generic-bitmask-pass.rs b/tests/ui/simd/intrinsic/generic-bitmask-pass.rs index 08526991fbe..cb3221e21d5 100644 --- a/tests/ui/simd/intrinsic/generic-bitmask-pass.rs +++ b/tests/ui/simd/intrinsic/generic-bitmask-pass.rs @@ -1,13 +1,12 @@ //@ run-pass #![allow(non_camel_case_types)] - //@ ignore-emscripten //@ ignore-endian-big behavior of simd_bitmask is endian-specific // Test that the simd_bitmask intrinsic produces correct results. +#![feature(repr_simd, core_intrinsics)] -#![feature(repr_simd, intrinsics)] -#[allow(non_camel_case_types)] +use std::intrinsics::simd::simd_bitmask; #[repr(simd)] #[derive(Copy, Clone, PartialEq, Debug)] @@ -21,9 +20,6 @@ struct u8x4(pub [u8; 4]); #[derive(Copy, Clone, PartialEq, Debug)] struct Tx4<T>(pub [T; 4]); -#[rustc_intrinsic] -unsafe fn simd_bitmask<T, U>(x: T) -> U; - fn main() { let z = u32x4([0, 0, 0, 0]); let ez = 0_u8; @@ -56,6 +52,5 @@ fn main() { let r: u8 = simd_bitmask(msize); assert_eq!(r, e); - } } diff --git a/tests/ui/simd/intrinsic/generic-bitmask.rs b/tests/ui/simd/intrinsic/generic-bitmask.rs index 49589d22bbf..9f5e806337e 100644 --- a/tests/ui/simd/intrinsic/generic-bitmask.rs +++ b/tests/ui/simd/intrinsic/generic-bitmask.rs @@ -3,9 +3,11 @@ // Test that the simd_bitmask intrinsic produces ok-ish error // messages when misused. -#![feature(repr_simd, intrinsics)] +#![feature(repr_simd, core_intrinsics)] #![allow(non_camel_case_types)] +use std::intrinsics::simd::simd_bitmask; + #[repr(simd)] #[derive(Copy, Clone)] pub struct u32x2([u32; 2]); @@ -30,9 +32,6 @@ struct u8x32([u8; 32]); #[derive(Copy, Clone)] struct u8x64([u8; 64]); -#[rustc_intrinsic] -unsafe fn simd_bitmask<T, U>(x: T) -> U; - fn main() { let m2 = u32x2([0; 2]); let m4 = u32x4([0; 4]); @@ -63,6 +62,5 @@ fn main() { let _: u128 = simd_bitmask(m64); //~^ ERROR invalid monomorphization of `simd_bitmask` intrinsic - - } + } } diff --git a/tests/ui/simd/intrinsic/generic-bitmask.stderr b/tests/ui/simd/intrinsic/generic-bitmask.stderr index c217bb2d8f1..3c4878f39cc 100644 --- a/tests/ui/simd/intrinsic/generic-bitmask.stderr +++ b/tests/ui/simd/intrinsic/generic-bitmask.stderr @@ -1,29 +1,29 @@ error[E0511]: invalid monomorphization of `simd_bitmask` intrinsic: cannot return `u16`, expected `u8` or `[u8; 1]` - --> $DIR/generic-bitmask.rs:52:22 + --> $DIR/generic-bitmask.rs:51:22 | LL | let _: u16 = simd_bitmask(m2); | ^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_bitmask` intrinsic: cannot return `u16`, expected `u8` or `[u8; 1]` - --> $DIR/generic-bitmask.rs:55:22 + --> $DIR/generic-bitmask.rs:54:22 | LL | let _: u16 = simd_bitmask(m8); | ^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_bitmask` intrinsic: cannot return `u32`, expected `u16` or `[u8; 2]` - --> $DIR/generic-bitmask.rs:58:22 + --> $DIR/generic-bitmask.rs:57:22 | LL | let _: u32 = simd_bitmask(m16); | ^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_bitmask` intrinsic: cannot return `u64`, expected `u32` or `[u8; 4]` - --> $DIR/generic-bitmask.rs:61:22 + --> $DIR/generic-bitmask.rs:60:22 | LL | let _: u64 = simd_bitmask(m32); | ^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_bitmask` intrinsic: cannot return `u128`, expected `u64` or `[u8; 8]` - --> $DIR/generic-bitmask.rs:64:23 + --> $DIR/generic-bitmask.rs:63:23 | LL | let _: u128 = simd_bitmask(m64); | ^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/simd/intrinsic/generic-bswap-byte.rs b/tests/ui/simd/intrinsic/generic-bswap-byte.rs index 4521573636c..903a07656a7 100644 --- a/tests/ui/simd/intrinsic/generic-bswap-byte.rs +++ b/tests/ui/simd/intrinsic/generic-bswap-byte.rs @@ -1,7 +1,9 @@ //@ run-pass -#![feature(repr_simd, intrinsics)] +#![feature(repr_simd, core_intrinsics)] #![allow(non_camel_case_types)] +use std::intrinsics::simd::simd_bswap; + #[repr(simd)] #[derive(Copy, Clone)] struct i8x4([i8; 4]); @@ -10,9 +12,6 @@ struct i8x4([i8; 4]); #[derive(Copy, Clone)] struct u8x4([u8; 4]); -#[rustc_intrinsic] -unsafe fn simd_bswap<T>(x: T) -> T; - fn main() { unsafe { assert_eq!(simd_bswap(i8x4([0, 1, 2, 3])).0, [0, 1, 2, 3]); diff --git a/tests/ui/simd/intrinsic/generic-cast-pass.rs b/tests/ui/simd/intrinsic/generic-cast-pass.rs index 2155d845864..7a4663bcad2 100644 --- a/tests/ui/simd/intrinsic/generic-cast-pass.rs +++ b/tests/ui/simd/intrinsic/generic-cast-pass.rs @@ -1,11 +1,8 @@ //@ run-pass -//@ ignore-emscripten FIXME(#45351) hits an LLVM assert -#![feature(repr_simd, intrinsics)] +#![feature(repr_simd, core_intrinsics)] - -#[rustc_intrinsic] -unsafe fn simd_cast<T, U>(x: T) -> U; +use std::intrinsics::simd::simd_cast; use std::cmp::{max, min}; diff --git a/tests/ui/simd/intrinsic/generic-cast-pointer-width.rs b/tests/ui/simd/intrinsic/generic-cast-pointer-width.rs index 9f28898654f..ea34e9ffeb8 100644 --- a/tests/ui/simd/intrinsic/generic-cast-pointer-width.rs +++ b/tests/ui/simd/intrinsic/generic-cast-pointer-width.rs @@ -1,8 +1,7 @@ //@ run-pass -#![feature(repr_simd, intrinsics)] +#![feature(repr_simd, core_intrinsics)] -#[rustc_intrinsic] -unsafe fn simd_cast<T, U>(x: T) -> U; +use std::intrinsics::simd::simd_cast; #[derive(Copy, Clone)] #[repr(simd)] diff --git a/tests/ui/simd/intrinsic/generic-cast.rs b/tests/ui/simd/intrinsic/generic-cast.rs index 7f398804eb4..4b13a93f323 100644 --- a/tests/ui/simd/intrinsic/generic-cast.rs +++ b/tests/ui/simd/intrinsic/generic-cast.rs @@ -1,6 +1,8 @@ //@ build-fail -#![feature(repr_simd, intrinsics)] +#![feature(repr_simd, core_intrinsics)] + +use std::intrinsics::simd::simd_cast; #[repr(simd)] #[derive(Copy, Clone)] @@ -20,10 +22,6 @@ struct f32x4([f32; 4]); #[allow(non_camel_case_types)] struct f32x8([f32; 8]); - -#[rustc_intrinsic] -unsafe fn simd_cast<T, U>(x: T) -> U; - fn main() { let x = i32x4([0, 0, 0, 0]); @@ -35,6 +33,6 @@ fn main() { simd_cast::<i32x4, i32>(x); //~^ ERROR expected SIMD return type, found non-SIMD `i32` simd_cast::<_, i32x8>(x); -//~^ ERROR return type with length 4 (same as input type `i32x4`), found `i32x8` with length 8 + //~^ ERROR return type with length 4 (same as input type `i32x4`), found `i32x8` with length 8 } } diff --git a/tests/ui/simd/intrinsic/generic-cast.stderr b/tests/ui/simd/intrinsic/generic-cast.stderr index 1b6ac03f8c9..192aa13216b 100644 --- a/tests/ui/simd/intrinsic/generic-cast.stderr +++ b/tests/ui/simd/intrinsic/generic-cast.stderr @@ -1,23 +1,23 @@ error[E0511]: invalid monomorphization of `simd_cast` intrinsic: expected SIMD input type, found non-SIMD `i32` - --> $DIR/generic-cast.rs:31:9 + --> $DIR/generic-cast.rs:29:9 | LL | simd_cast::<i32, i32>(0); | ^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_cast` intrinsic: expected SIMD input type, found non-SIMD `i32` - --> $DIR/generic-cast.rs:33:9 + --> $DIR/generic-cast.rs:31:9 | LL | simd_cast::<i32, i32x4>(0); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_cast` intrinsic: expected SIMD return type, found non-SIMD `i32` - --> $DIR/generic-cast.rs:35:9 + --> $DIR/generic-cast.rs:33:9 | LL | simd_cast::<i32x4, i32>(x); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_cast` intrinsic: expected return type with length 4 (same as input type `i32x4`), found `i32x8` with length 8 - --> $DIR/generic-cast.rs:37:9 + --> $DIR/generic-cast.rs:35:9 | LL | simd_cast::<_, i32x8>(x); | ^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/simd/intrinsic/generic-comparison-pass.rs b/tests/ui/simd/intrinsic/generic-comparison-pass.rs index 68f98372e1d..2ee164cdfd8 100644 --- a/tests/ui/simd/intrinsic/generic-comparison-pass.rs +++ b/tests/ui/simd/intrinsic/generic-comparison-pass.rs @@ -1,9 +1,10 @@ //@ run-pass -//@ ignore-emscripten FIXME(#45351) hits an LLVM assert -#![feature(repr_simd, intrinsics, concat_idents)] +#![feature(repr_simd, core_intrinsics, concat_idents)] #![allow(non_camel_case_types)] +use std::intrinsics::simd::{simd_eq, simd_ge, simd_gt, simd_le, simd_lt, simd_ne}; + #[repr(simd)] #[derive(Copy, Clone)] struct i32x4([i32; 4]); @@ -14,36 +15,17 @@ struct u32x4(pub [u32; 4]); #[derive(Copy, Clone)] struct f32x4(pub [f32; 4]); - -#[rustc_intrinsic] -unsafe fn simd_eq<T, U>(x: T, y: T) -> U; - -#[rustc_intrinsic] -unsafe fn simd_ne<T, U>(x: T, y: T) -> U; - -#[rustc_intrinsic] -unsafe fn simd_lt<T, U>(x: T, y: T) -> U; - -#[rustc_intrinsic] -unsafe fn simd_le<T, U>(x: T, y: T) -> U; - -#[rustc_intrinsic] -unsafe fn simd_gt<T, U>(x: T, y: T) -> U; - -#[rustc_intrinsic] -unsafe fn simd_ge<T, U>(x: T, y: T) -> U; - macro_rules! cmp { ($method: ident($lhs: expr, $rhs: expr)) => {{ let lhs = $lhs; let rhs = $rhs; let e: u32x4 = concat_idents!(simd_, $method)($lhs, $rhs); // assume the scalar version is correct/the behaviour we want. - assert!((e.0[0] != 0) == lhs.0[0] .$method(&rhs.0[0])); - assert!((e.0[1] != 0) == lhs.0[1] .$method(&rhs.0[1])); - assert!((e.0[2] != 0) == lhs.0[2] .$method(&rhs.0[2])); - assert!((e.0[3] != 0) == lhs.0[3] .$method(&rhs.0[3])); - }} + assert!((e.0[0] != 0) == lhs.0[0].$method(&rhs.0[0])); + assert!((e.0[1] != 0) == lhs.0[1].$method(&rhs.0[1])); + assert!((e.0[2] != 0) == lhs.0[2].$method(&rhs.0[2])); + assert!((e.0[3] != 0) == lhs.0[3].$method(&rhs.0[3])); + }}; } macro_rules! tests { ($($lhs: ident, $rhs: ident;)*) => {{ @@ -75,9 +57,9 @@ fn main() { let i2 = i32x4([5, -5, 20, -100]); let i3 = i32x4([10, -11, 20, -100]); - let u1 = u32x4([10, !11+1, 12, 13]); - let u2 = u32x4([5, !5+1, 20, !100+1]); - let u3 = u32x4([10, !11+1, 20, !100+1]); + let u1 = u32x4([10, !11 + 1, 12, 13]); + let u2 = u32x4([5, !5 + 1, 20, !100 + 1]); + let u3 = u32x4([10, !11 + 1, 20, !100 + 1]); let f1 = f32x4([10.0, -11.0, 12.0, 13.0]); let f2 = f32x4([5.0, -5.0, 20.0, -100.0]); diff --git a/tests/ui/simd/intrinsic/generic-comparison.rs b/tests/ui/simd/intrinsic/generic-comparison.rs index e5adb49f6a3..ebd1f629be4 100644 --- a/tests/ui/simd/intrinsic/generic-comparison.rs +++ b/tests/ui/simd/intrinsic/generic-comparison.rs @@ -1,6 +1,6 @@ //@ build-fail -#![feature(repr_simd, intrinsics)] +#![feature(repr_simd, core_intrinsics)] #[repr(simd)] #[derive(Copy, Clone)] @@ -11,24 +11,7 @@ struct i32x4([i32; 4]); #[allow(non_camel_case_types)] struct i16x8([i16; 8]); - -#[rustc_intrinsic] -unsafe fn simd_eq<T, U>(x: T, y: T) -> U; - -#[rustc_intrinsic] -unsafe fn simd_ne<T, U>(x: T, y: T) -> U; - -#[rustc_intrinsic] -unsafe fn simd_lt<T, U>(x: T, y: T) -> U; - -#[rustc_intrinsic] -unsafe fn simd_le<T, U>(x: T, y: T) -> U; - -#[rustc_intrinsic] -unsafe fn simd_gt<T, U>(x: T, y: T) -> U; - -#[rustc_intrinsic] -unsafe fn simd_ge<T, U>(x: T, y: T) -> U; +use std::intrinsics::simd::{simd_eq, simd_ge, simd_gt, simd_le, simd_lt, simd_ne}; fn main() { let x = i32x4([0, 0, 0, 0]); @@ -61,16 +44,16 @@ fn main() { //~^ ERROR expected SIMD return type, found non-SIMD `i32` simd_eq::<_, i16x8>(x, x); -//~^ ERROR return type with length 4 (same as input type `i32x4`), found `i16x8` with length 8 + //~^ ERROR return type with length 4 (same as input type `i32x4`), found `i16x8` with length 8 simd_ne::<_, i16x8>(x, x); -//~^ ERROR return type with length 4 (same as input type `i32x4`), found `i16x8` with length 8 + //~^ ERROR return type with length 4 (same as input type `i32x4`), found `i16x8` with length 8 simd_lt::<_, i16x8>(x, x); -//~^ ERROR return type with length 4 (same as input type `i32x4`), found `i16x8` with length 8 + //~^ ERROR return type with length 4 (same as input type `i32x4`), found `i16x8` with length 8 simd_le::<_, i16x8>(x, x); -//~^ ERROR return type with length 4 (same as input type `i32x4`), found `i16x8` with length 8 + //~^ ERROR return type with length 4 (same as input type `i32x4`), found `i16x8` with length 8 simd_gt::<_, i16x8>(x, x); -//~^ ERROR return type with length 4 (same as input type `i32x4`), found `i16x8` with length 8 + //~^ ERROR return type with length 4 (same as input type `i32x4`), found `i16x8` with length 8 simd_ge::<_, i16x8>(x, x); -//~^ ERROR return type with length 4 (same as input type `i32x4`), found `i16x8` with length 8 + //~^ ERROR return type with length 4 (same as input type `i32x4`), found `i16x8` with length 8 } } diff --git a/tests/ui/simd/intrinsic/generic-comparison.stderr b/tests/ui/simd/intrinsic/generic-comparison.stderr index cc66d2ce40a..a6e91bf6a36 100644 --- a/tests/ui/simd/intrinsic/generic-comparison.stderr +++ b/tests/ui/simd/intrinsic/generic-comparison.stderr @@ -1,107 +1,107 @@ error[E0511]: invalid monomorphization of `simd_eq` intrinsic: expected SIMD input type, found non-SIMD `i32` - --> $DIR/generic-comparison.rs:37:9 + --> $DIR/generic-comparison.rs:20:9 | LL | simd_eq::<i32, i32>(0, 0); | ^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_ne` intrinsic: expected SIMD input type, found non-SIMD `i32` - --> $DIR/generic-comparison.rs:39:9 + --> $DIR/generic-comparison.rs:22:9 | LL | simd_ne::<i32, i32>(0, 0); | ^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_lt` intrinsic: expected SIMD input type, found non-SIMD `i32` - --> $DIR/generic-comparison.rs:41:9 + --> $DIR/generic-comparison.rs:24:9 | LL | simd_lt::<i32, i32>(0, 0); | ^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_le` intrinsic: expected SIMD input type, found non-SIMD `i32` - --> $DIR/generic-comparison.rs:43:9 + --> $DIR/generic-comparison.rs:26:9 | LL | simd_le::<i32, i32>(0, 0); | ^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_gt` intrinsic: expected SIMD input type, found non-SIMD `i32` - --> $DIR/generic-comparison.rs:45:9 + --> $DIR/generic-comparison.rs:28:9 | LL | simd_gt::<i32, i32>(0, 0); | ^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_ge` intrinsic: expected SIMD input type, found non-SIMD `i32` - --> $DIR/generic-comparison.rs:47:9 + --> $DIR/generic-comparison.rs:30:9 | LL | simd_ge::<i32, i32>(0, 0); | ^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_eq` intrinsic: expected SIMD return type, found non-SIMD `i32` - --> $DIR/generic-comparison.rs:50:9 + --> $DIR/generic-comparison.rs:33:9 | LL | simd_eq::<_, i32>(x, x); | ^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_ne` intrinsic: expected SIMD return type, found non-SIMD `i32` - --> $DIR/generic-comparison.rs:52:9 + --> $DIR/generic-comparison.rs:35:9 | LL | simd_ne::<_, i32>(x, x); | ^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_lt` intrinsic: expected SIMD return type, found non-SIMD `i32` - --> $DIR/generic-comparison.rs:54:9 + --> $DIR/generic-comparison.rs:37:9 | LL | simd_lt::<_, i32>(x, x); | ^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_le` intrinsic: expected SIMD return type, found non-SIMD `i32` - --> $DIR/generic-comparison.rs:56:9 + --> $DIR/generic-comparison.rs:39:9 | LL | simd_le::<_, i32>(x, x); | ^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_gt` intrinsic: expected SIMD return type, found non-SIMD `i32` - --> $DIR/generic-comparison.rs:58:9 + --> $DIR/generic-comparison.rs:41:9 | LL | simd_gt::<_, i32>(x, x); | ^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_ge` intrinsic: expected SIMD return type, found non-SIMD `i32` - --> $DIR/generic-comparison.rs:60:9 + --> $DIR/generic-comparison.rs:43:9 | LL | simd_ge::<_, i32>(x, x); | ^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_eq` intrinsic: expected return type with length 4 (same as input type `i32x4`), found `i16x8` with length 8 - --> $DIR/generic-comparison.rs:63:9 + --> $DIR/generic-comparison.rs:46:9 | LL | simd_eq::<_, i16x8>(x, x); | ^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_ne` intrinsic: expected return type with length 4 (same as input type `i32x4`), found `i16x8` with length 8 - --> $DIR/generic-comparison.rs:65:9 + --> $DIR/generic-comparison.rs:48:9 | LL | simd_ne::<_, i16x8>(x, x); | ^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_lt` intrinsic: expected return type with length 4 (same as input type `i32x4`), found `i16x8` with length 8 - --> $DIR/generic-comparison.rs:67:9 + --> $DIR/generic-comparison.rs:50:9 | LL | simd_lt::<_, i16x8>(x, x); | ^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_le` intrinsic: expected return type with length 4 (same as input type `i32x4`), found `i16x8` with length 8 - --> $DIR/generic-comparison.rs:69:9 + --> $DIR/generic-comparison.rs:52:9 | LL | simd_le::<_, i16x8>(x, x); | ^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_gt` intrinsic: expected return type with length 4 (same as input type `i32x4`), found `i16x8` with length 8 - --> $DIR/generic-comparison.rs:71:9 + --> $DIR/generic-comparison.rs:54:9 | LL | simd_gt::<_, i16x8>(x, x); | ^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_ge` intrinsic: expected return type with length 4 (same as input type `i32x4`), found `i16x8` with length 8 - --> $DIR/generic-comparison.rs:73:9 + --> $DIR/generic-comparison.rs:56:9 | LL | simd_ge::<_, i16x8>(x, x); | ^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/simd/intrinsic/generic-elements-pass.rs b/tests/ui/simd/intrinsic/generic-elements-pass.rs index 8cb600bc9e4..4dc2e4d5a80 100644 --- a/tests/ui/simd/intrinsic/generic-elements-pass.rs +++ b/tests/ui/simd/intrinsic/generic-elements-pass.rs @@ -1,7 +1,8 @@ //@ run-pass -//@ ignore-emscripten FIXME(#45351) hits an LLVM assert -#![feature(repr_simd, intrinsics)] +#![feature(repr_simd, core_intrinsics)] + +use std::intrinsics::simd::{simd_extract, simd_insert, simd_shuffle}; #[repr(simd)] #[derive(Copy, Clone, Debug, PartialEq)] @@ -16,16 +17,6 @@ struct i32x4([i32; 4]); #[allow(non_camel_case_types)] struct i32x8([i32; 8]); -#[rustc_intrinsic] -unsafe fn simd_insert<T, E>(x: T, idx: u32, y: E) -> T; - -#[rustc_intrinsic] -unsafe fn simd_extract<T, E>(x: T, idx: u32) -> E; - - -#[rustc_intrinsic] -unsafe fn simd_shuffle<T, I, U>(x: T, y: T, idx: I) -> U; - #[repr(simd)] struct SimdShuffleIdx<const LEN: usize>([u32; LEN]); diff --git a/tests/ui/simd/intrinsic/generic-elements.rs b/tests/ui/simd/intrinsic/generic-elements.rs index 4be6645f029..905299a9289 100644 --- a/tests/ui/simd/intrinsic/generic-elements.rs +++ b/tests/ui/simd/intrinsic/generic-elements.rs @@ -1,8 +1,20 @@ //@ build-fail -#![feature(repr_simd, intrinsics, rustc_attrs, adt_const_params, unsized_const_params)] +#![feature( + repr_simd, + intrinsics, + core_intrinsics, + rustc_attrs, + adt_const_params, + unsized_const_params +)] #![allow(incomplete_features)] +use std::intrinsics::simd::{simd_extract, simd_insert, simd_shuffle}; + +#[rustc_intrinsic] +unsafe fn simd_shuffle_const_generic<T, U, const IDX: &'static [u32]>(x: T, y: T) -> U; + #[repr(simd)] #[derive(Copy, Clone)] #[allow(non_camel_case_types)] @@ -29,21 +41,6 @@ struct f32x4([f32; 4]); #[allow(non_camel_case_types)] struct f32x8([f32; 8]); - -#[rustc_intrinsic] -unsafe fn simd_insert<T, E>(x: T, idx: u32, y: E) -> T; - -#[rustc_intrinsic] -unsafe fn simd_extract<T, E>(x: T, idx: u32) -> E; - - -#[rustc_intrinsic] -unsafe fn simd_shuffle<T, I, U>(x: T, y: T, idx: I) -> U; - -#[rustc_intrinsic] -unsafe fn simd_shuffle_generic<T, U, const IDX: &'static [u32]>(x: T, y: T) -> U; - - #[repr(simd)] struct SimdShuffleIdx<const LEN: usize>([u32; LEN]); @@ -83,27 +80,27 @@ fn main() { //~^ ERROR expected return type of length 8, found `i32x2` with length 2 const I2: &[u32] = &[0; 2]; - simd_shuffle_generic::<i32, i32, I2>(0, 0); + simd_shuffle_const_generic::<i32, i32, I2>(0, 0); //~^ ERROR expected SIMD input type, found non-SIMD `i32` const I4: &[u32] = &[0; 4]; - simd_shuffle_generic::<i32, i32, I4>(0, 0); + simd_shuffle_const_generic::<i32, i32, I4>(0, 0); //~^ ERROR expected SIMD input type, found non-SIMD `i32` const I8: &[u32] = &[0; 8]; - simd_shuffle_generic::<i32, i32, I8>(0, 0); + simd_shuffle_const_generic::<i32, i32, I8>(0, 0); //~^ ERROR expected SIMD input type, found non-SIMD `i32` - simd_shuffle_generic::<_, f32x2, I2>(x, x); + simd_shuffle_const_generic::<_, f32x2, I2>(x, x); //~^ ERROR element type `i32` (element of input `i32x4`), found `f32x2` with element type `f32` - simd_shuffle_generic::<_, f32x4, I4>(x, x); + simd_shuffle_const_generic::<_, f32x4, I4>(x, x); //~^ ERROR element type `i32` (element of input `i32x4`), found `f32x4` with element type `f32` - simd_shuffle_generic::<_, f32x8, I8>(x, x); + simd_shuffle_const_generic::<_, f32x8, I8>(x, x); //~^ ERROR element type `i32` (element of input `i32x4`), found `f32x8` with element type `f32` - simd_shuffle_generic::<_, i32x8, I2>(x, x); + simd_shuffle_const_generic::<_, i32x8, I2>(x, x); //~^ ERROR expected return type of length 2, found `i32x8` with length 8 - simd_shuffle_generic::<_, i32x8, I4>(x, x); + simd_shuffle_const_generic::<_, i32x8, I4>(x, x); //~^ ERROR expected return type of length 4, found `i32x8` with length 8 - simd_shuffle_generic::<_, i32x2, I8>(x, x); + simd_shuffle_const_generic::<_, i32x2, I8>(x, x); //~^ ERROR expected return type of length 8, found `i32x2` with length 2 } } diff --git a/tests/ui/simd/intrinsic/generic-elements.stderr b/tests/ui/simd/intrinsic/generic-elements.stderr index 8104c3ba5a2..3779aa86cee 100644 --- a/tests/ui/simd/intrinsic/generic-elements.stderr +++ b/tests/ui/simd/intrinsic/generic-elements.stderr @@ -1,128 +1,128 @@ error[E0511]: invalid monomorphization of `simd_insert` intrinsic: expected SIMD input type, found non-SIMD `i32` - --> $DIR/generic-elements.rs:54:9 + --> $DIR/generic-elements.rs:51:9 | LL | simd_insert(0, 0, 0); | ^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_insert` intrinsic: expected inserted type `i32` (element of input `i32x4`), found `f64` - --> $DIR/generic-elements.rs:56:9 + --> $DIR/generic-elements.rs:53:9 | LL | simd_insert(x, 0, 1.0); | ^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_extract` intrinsic: expected return type `i32` (element of input `i32x4`), found `f32` - --> $DIR/generic-elements.rs:58:9 + --> $DIR/generic-elements.rs:55:9 | LL | simd_extract::<_, f32>(x, 0); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_shuffle` intrinsic: expected SIMD input type, found non-SIMD `i32` - --> $DIR/generic-elements.rs:62:9 + --> $DIR/generic-elements.rs:59:9 | LL | simd_shuffle::<i32, _, i32>(0, 0, IDX2); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_shuffle` intrinsic: expected SIMD input type, found non-SIMD `i32` - --> $DIR/generic-elements.rs:65:9 + --> $DIR/generic-elements.rs:62:9 | LL | simd_shuffle::<i32, _, i32>(0, 0, IDX4); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_shuffle` intrinsic: expected SIMD input type, found non-SIMD `i32` - --> $DIR/generic-elements.rs:68:9 + --> $DIR/generic-elements.rs:65:9 | LL | simd_shuffle::<i32, _, i32>(0, 0, IDX8); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_shuffle` intrinsic: expected return element type `i32` (element of input `i32x4`), found `f32x2` with element type `f32` - --> $DIR/generic-elements.rs:71:9 + --> $DIR/generic-elements.rs:68:9 | LL | simd_shuffle::<_, _, f32x2>(x, x, IDX2); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_shuffle` intrinsic: expected return element type `i32` (element of input `i32x4`), found `f32x4` with element type `f32` - --> $DIR/generic-elements.rs:73:9 + --> $DIR/generic-elements.rs:70:9 | LL | simd_shuffle::<_, _, f32x4>(x, x, IDX4); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_shuffle` intrinsic: expected return element type `i32` (element of input `i32x4`), found `f32x8` with element type `f32` - --> $DIR/generic-elements.rs:75:9 + --> $DIR/generic-elements.rs:72:9 | LL | simd_shuffle::<_, _, f32x8>(x, x, IDX8); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_shuffle` intrinsic: expected return type of length 2, found `i32x8` with length 8 - --> $DIR/generic-elements.rs:78:9 + --> $DIR/generic-elements.rs:75:9 | LL | simd_shuffle::<_, _, i32x8>(x, x, IDX2); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_shuffle` intrinsic: expected return type of length 4, found `i32x8` with length 8 - --> $DIR/generic-elements.rs:80:9 + --> $DIR/generic-elements.rs:77:9 | LL | simd_shuffle::<_, _, i32x8>(x, x, IDX4); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_shuffle` intrinsic: expected return type of length 8, found `i32x2` with length 2 - --> $DIR/generic-elements.rs:82:9 + --> $DIR/generic-elements.rs:79:9 | LL | simd_shuffle::<_, _, i32x2>(x, x, IDX8); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error[E0511]: invalid monomorphization of `simd_shuffle_generic` intrinsic: expected SIMD input type, found non-SIMD `i32` +error[E0511]: invalid monomorphization of `simd_shuffle_const_generic` intrinsic: expected SIMD input type, found non-SIMD `i32` + --> $DIR/generic-elements.rs:83:9 + | +LL | simd_shuffle_const_generic::<i32, i32, I2>(0, 0); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error[E0511]: invalid monomorphization of `simd_shuffle_const_generic` intrinsic: expected SIMD input type, found non-SIMD `i32` --> $DIR/generic-elements.rs:86:9 | -LL | simd_shuffle_generic::<i32, i32, I2>(0, 0); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | simd_shuffle_const_generic::<i32, i32, I4>(0, 0); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error[E0511]: invalid monomorphization of `simd_shuffle_generic` intrinsic: expected SIMD input type, found non-SIMD `i32` +error[E0511]: invalid monomorphization of `simd_shuffle_const_generic` intrinsic: expected SIMD input type, found non-SIMD `i32` --> $DIR/generic-elements.rs:89:9 | -LL | simd_shuffle_generic::<i32, i32, I4>(0, 0); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | simd_shuffle_const_generic::<i32, i32, I8>(0, 0); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error[E0511]: invalid monomorphization of `simd_shuffle_generic` intrinsic: expected SIMD input type, found non-SIMD `i32` +error[E0511]: invalid monomorphization of `simd_shuffle_const_generic` intrinsic: expected return element type `i32` (element of input `i32x4`), found `f32x2` with element type `f32` --> $DIR/generic-elements.rs:92:9 | -LL | simd_shuffle_generic::<i32, i32, I8>(0, 0); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | simd_shuffle_const_generic::<_, f32x2, I2>(x, x); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error[E0511]: invalid monomorphization of `simd_shuffle_generic` intrinsic: expected return element type `i32` (element of input `i32x4`), found `f32x2` with element type `f32` - --> $DIR/generic-elements.rs:95:9 +error[E0511]: invalid monomorphization of `simd_shuffle_const_generic` intrinsic: expected return element type `i32` (element of input `i32x4`), found `f32x4` with element type `f32` + --> $DIR/generic-elements.rs:94:9 | -LL | simd_shuffle_generic::<_, f32x2, I2>(x, x); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | simd_shuffle_const_generic::<_, f32x4, I4>(x, x); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error[E0511]: invalid monomorphization of `simd_shuffle_generic` intrinsic: expected return element type `i32` (element of input `i32x4`), found `f32x4` with element type `f32` - --> $DIR/generic-elements.rs:97:9 +error[E0511]: invalid monomorphization of `simd_shuffle_const_generic` intrinsic: expected return element type `i32` (element of input `i32x4`), found `f32x8` with element type `f32` + --> $DIR/generic-elements.rs:96:9 | -LL | simd_shuffle_generic::<_, f32x4, I4>(x, x); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | simd_shuffle_const_generic::<_, f32x8, I8>(x, x); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error[E0511]: invalid monomorphization of `simd_shuffle_generic` intrinsic: expected return element type `i32` (element of input `i32x4`), found `f32x8` with element type `f32` +error[E0511]: invalid monomorphization of `simd_shuffle_const_generic` intrinsic: expected return type of length 2, found `i32x8` with length 8 --> $DIR/generic-elements.rs:99:9 | -LL | simd_shuffle_generic::<_, f32x8, I8>(x, x); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -error[E0511]: invalid monomorphization of `simd_shuffle_generic` intrinsic: expected return type of length 2, found `i32x8` with length 8 - --> $DIR/generic-elements.rs:102:9 - | -LL | simd_shuffle_generic::<_, i32x8, I2>(x, x); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | simd_shuffle_const_generic::<_, i32x8, I2>(x, x); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error[E0511]: invalid monomorphization of `simd_shuffle_generic` intrinsic: expected return type of length 4, found `i32x8` with length 8 - --> $DIR/generic-elements.rs:104:9 +error[E0511]: invalid monomorphization of `simd_shuffle_const_generic` intrinsic: expected return type of length 4, found `i32x8` with length 8 + --> $DIR/generic-elements.rs:101:9 | -LL | simd_shuffle_generic::<_, i32x8, I4>(x, x); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | simd_shuffle_const_generic::<_, i32x8, I4>(x, x); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error[E0511]: invalid monomorphization of `simd_shuffle_generic` intrinsic: expected return type of length 8, found `i32x2` with length 2 - --> $DIR/generic-elements.rs:106:9 +error[E0511]: invalid monomorphization of `simd_shuffle_const_generic` intrinsic: expected return type of length 8, found `i32x2` with length 2 + --> $DIR/generic-elements.rs:103:9 | -LL | simd_shuffle_generic::<_, i32x2, I8>(x, x); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | simd_shuffle_const_generic::<_, i32x2, I8>(x, x); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 21 previous errors diff --git a/tests/ui/simd/intrinsic/generic-gather-pass.rs b/tests/ui/simd/intrinsic/generic-gather-pass.rs index 0b2cf47e989..b98d4d6575b 100644 --- a/tests/ui/simd/intrinsic/generic-gather-pass.rs +++ b/tests/ui/simd/intrinsic/generic-gather-pass.rs @@ -3,19 +3,15 @@ // Test that the simd_{gather,scatter} intrinsics produce the correct results. -#![feature(repr_simd, intrinsics)] +#![feature(repr_simd, core_intrinsics)] #![allow(non_camel_case_types)] +use std::intrinsics::simd::{simd_gather, simd_scatter}; + #[repr(simd)] #[derive(Copy, Clone, PartialEq, Debug)] struct x4<T>(pub [T; 4]); -#[rustc_intrinsic] -unsafe fn simd_gather<T, U, V>(x: T, y: U, z: V) -> T; - -#[rustc_intrinsic] -unsafe fn simd_scatter<T, U, V>(x: T, y: U, z: V) -> (); - fn main() { let mut x = [0_f32, 1., 2., 3., 4., 5., 6., 7.]; @@ -26,12 +22,8 @@ fn main() { // reading from *const unsafe { let pointer = x.as_ptr(); - let pointers = x4([ - pointer.offset(0), - pointer.offset(2), - pointer.offset(4), - pointer.offset(6) - ]); + let pointers = + x4([pointer.offset(0), pointer.offset(2), pointer.offset(4), pointer.offset(6)]); let r_strided = simd_gather(default, pointers, mask); @@ -41,12 +33,8 @@ fn main() { // reading from *mut unsafe { let pointer = x.as_mut_ptr(); - let pointers = x4([ - pointer.offset(0), - pointer.offset(2), - pointer.offset(4), - pointer.offset(6) - ]); + let pointers = + x4([pointer.offset(0), pointer.offset(2), pointer.offset(4), pointer.offset(6)]); let r_strided = simd_gather(default, pointers, mask); @@ -56,12 +44,8 @@ fn main() { // writing to *mut unsafe { let pointer = x.as_mut_ptr(); - let pointers = x4([ - pointer.offset(0), - pointer.offset(2), - pointer.offset(4), - pointer.offset(6) - ]); + let pointers = + x4([pointer.offset(0), pointer.offset(2), pointer.offset(4), pointer.offset(6)]); let values = x4([42_f32, 43_f32, 44_f32, 45_f32]); simd_scatter(values, pointers, mask); @@ -78,7 +62,7 @@ fn main() { &x[4] as *const f32, &x[5] as *const f32, &x[6] as *const f32, - &x[7] as *const f32 + &x[7] as *const f32, ]; let default = x4([y[0], y[0], y[0], y[0]]); @@ -87,12 +71,8 @@ fn main() { // reading from *const unsafe { let pointer = y.as_ptr(); - let pointers = x4([ - pointer.offset(0), - pointer.offset(2), - pointer.offset(4), - pointer.offset(6) - ]); + let pointers = + x4([pointer.offset(0), pointer.offset(2), pointer.offset(4), pointer.offset(6)]); let r_strided = simd_gather(default, pointers, mask); @@ -102,12 +82,8 @@ fn main() { // reading from *mut unsafe { let pointer = y.as_mut_ptr(); - let pointers = x4([ - pointer.offset(0), - pointer.offset(2), - pointer.offset(4), - pointer.offset(6) - ]); + let pointers = + x4([pointer.offset(0), pointer.offset(2), pointer.offset(4), pointer.offset(6)]); let r_strided = simd_gather(default, pointers, mask); @@ -117,12 +93,8 @@ fn main() { // writing to *mut unsafe { let pointer = y.as_mut_ptr(); - let pointers = x4([ - pointer.offset(0), - pointer.offset(2), - pointer.offset(4), - pointer.offset(6) - ]); + let pointers = + x4([pointer.offset(0), pointer.offset(2), pointer.offset(4), pointer.offset(6)]); let values = x4([y[7], y[6], y[5], y[1]]); simd_scatter(values, pointers, mask); @@ -135,7 +107,7 @@ fn main() { &x[4] as *const f32, &x[5] as *const f32, &x[1] as *const f32, - &x[7] as *const f32 + &x[7] as *const f32, ]; assert_eq!(y, s); } diff --git a/tests/ui/simd/intrinsic/generic-gather.rs b/tests/ui/simd/intrinsic/generic-gather.rs new file mode 100644 index 00000000000..118d8029483 --- /dev/null +++ b/tests/ui/simd/intrinsic/generic-gather.rs @@ -0,0 +1,52 @@ +//@ build-fail +//@ ignore-emscripten + +// Test that the simd_{gather,scatter} intrinsics produce ok-ish error +// messages when misused. + +#![feature(repr_simd, core_intrinsics)] +#![allow(non_camel_case_types)] + +use std::intrinsics::simd::{simd_gather, simd_scatter}; + +#[repr(simd)] +#[derive(Copy, Clone, PartialEq, Debug)] +struct x4<T>(pub [T; 4]); + +fn main() { + let mut x = [0_f32, 1., 2., 3., 4., 5., 6., 7.]; + + let default = x4([-3_f32, -3., -3., -3.]); + let s_strided = x4([0_f32, 2., -3., 6.]); + + let mask = x4([-1_i32, -1, 0, -1]); + let umask = x4([0u16; 4]); + let fmask = x4([0_f32; 4]); + + let pointer = x.as_mut_ptr(); + let pointers = + unsafe { x4([pointer.offset(0), pointer.offset(2), pointer.offset(4), pointer.offset(6)]) }; + + unsafe { + simd_gather(default, mask, mask); + //~^ ERROR expected element type `i32` of second argument `x4<i32>` to be a pointer to the element type `f32` + + simd_gather(default, pointers, umask); + //~^ ERROR expected element type `u16` of third argument `x4<u16>` to be a signed integer type + + simd_gather(default, pointers, fmask); + //~^ ERROR expected element type `f32` of third argument `x4<f32>` to be a signed integer type + } + + unsafe { + let values = x4([42_f32, 43_f32, 44_f32, 45_f32]); + simd_scatter(values, mask, mask); + //~^ ERROR expected element type `i32` of second argument `x4<i32>` to be a pointer to the element type `f32` of the first argument `x4<f32>`, found `i32` != `*mut f32` + + simd_scatter(values, pointers, umask); + //~^ ERROR expected element type `u16` of third argument `x4<u16>` to be a signed integer type + + simd_scatter(values, pointers, fmask); + //~^ ERROR expected element type `f32` of third argument `x4<f32>` to be a signed integer type + } +} diff --git a/tests/ui/simd/intrinsic/generic-gather.stderr b/tests/ui/simd/intrinsic/generic-gather.stderr new file mode 100644 index 00000000000..81e10fc9875 --- /dev/null +++ b/tests/ui/simd/intrinsic/generic-gather.stderr @@ -0,0 +1,39 @@ +error[E0511]: invalid monomorphization of `simd_gather` intrinsic: expected element type `i32` of second argument `x4<i32>` to be a pointer to the element type `f32` of the first argument `x4<f32>`, found `i32` != `*_ f32` + --> $DIR/generic-gather.rs:31:9 + | +LL | simd_gather(default, mask, mask); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error[E0511]: invalid monomorphization of `simd_gather` intrinsic: expected element type `u16` of third argument `x4<u16>` to be a signed integer type + --> $DIR/generic-gather.rs:34:9 + | +LL | simd_gather(default, pointers, umask); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error[E0511]: invalid monomorphization of `simd_gather` intrinsic: expected element type `f32` of third argument `x4<f32>` to be a signed integer type + --> $DIR/generic-gather.rs:37:9 + | +LL | simd_gather(default, pointers, fmask); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error[E0511]: invalid monomorphization of `simd_scatter` intrinsic: expected element type `i32` of second argument `x4<i32>` to be a pointer to the element type `f32` of the first argument `x4<f32>`, found `i32` != `*mut f32` + --> $DIR/generic-gather.rs:43:9 + | +LL | simd_scatter(values, mask, mask); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error[E0511]: invalid monomorphization of `simd_scatter` intrinsic: expected element type `u16` of third argument `x4<u16>` to be a signed integer type + --> $DIR/generic-gather.rs:46:9 + | +LL | simd_scatter(values, pointers, umask); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error[E0511]: invalid monomorphization of `simd_scatter` intrinsic: expected element type `f32` of third argument `x4<f32>` to be a signed integer type + --> $DIR/generic-gather.rs:49:9 + | +LL | simd_scatter(values, pointers, fmask); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to 6 previous errors + +For more information about this error, try `rustc --explain E0511`. diff --git a/tests/ui/simd/intrinsic/generic-reduction-pass.rs b/tests/ui/simd/intrinsic/generic-reduction-pass.rs index 8408d0f203b..2d5d75447b6 100644 --- a/tests/ui/simd/intrinsic/generic-reduction-pass.rs +++ b/tests/ui/simd/intrinsic/generic-reduction-pass.rs @@ -1,12 +1,11 @@ //@ run-pass #![allow(non_camel_case_types)] - //@ ignore-emscripten // Test that the simd_reduce_{op} intrinsics produce the correct results. +#![feature(repr_simd, core_intrinsics)] -#![feature(repr_simd, intrinsics)] -#[allow(non_camel_case_types)] +use std::intrinsics::simd::*; #[repr(simd)] #[derive(Copy, Clone)] @@ -24,39 +23,6 @@ struct f32x4(pub [f32; 4]); #[derive(Copy, Clone)] struct b8x4(pub [i8; 4]); -#[rustc_intrinsic] -unsafe fn simd_reduce_add_unordered<T, U>(x: T) -> U; - -#[rustc_intrinsic] -unsafe fn simd_reduce_mul_unordered<T, U>(x: T) -> U; - -#[rustc_intrinsic] -unsafe fn simd_reduce_add_ordered<T, U>(x: T, acc: U) -> U; - -#[rustc_intrinsic] -unsafe fn simd_reduce_mul_ordered<T, U>(x: T, acc: U) -> U; - -#[rustc_intrinsic] -unsafe fn simd_reduce_min<T, U>(x: T) -> U; - -#[rustc_intrinsic] -unsafe fn simd_reduce_max<T, U>(x: T) -> U; - -#[rustc_intrinsic] -unsafe fn simd_reduce_and<T, U>(x: T) -> U; - -#[rustc_intrinsic] -unsafe fn simd_reduce_or<T, U>(x: T) -> U; - -#[rustc_intrinsic] -unsafe fn simd_reduce_xor<T, U>(x: T) -> U; - -#[rustc_intrinsic] -unsafe fn simd_reduce_all<T>(x: T) -> bool; - -#[rustc_intrinsic] -unsafe fn simd_reduce_any<T>(x: T) -> bool; - fn main() { unsafe { let x = i32x4([1, -2, 3, 4]); diff --git a/tests/ui/simd/intrinsic/generic-reduction.rs b/tests/ui/simd/intrinsic/generic-reduction.rs index ead13250643..49a33ac35e7 100644 --- a/tests/ui/simd/intrinsic/generic-reduction.rs +++ b/tests/ui/simd/intrinsic/generic-reduction.rs @@ -4,9 +4,11 @@ // Test that the simd_reduce_{op} intrinsics produce ok-ish error // messages when misused. -#![feature(repr_simd, intrinsics)] +#![feature(repr_simd, core_intrinsics)] #![allow(non_camel_case_types)] +use std::intrinsics::simd::*; + #[repr(simd)] #[derive(Copy, Clone)] pub struct f32x4(pub [f32; 4]); @@ -15,27 +17,6 @@ pub struct f32x4(pub [f32; 4]); #[derive(Copy, Clone)] pub struct u32x4(pub [u32; 4]); -#[rustc_intrinsic] -unsafe fn simd_reduce_add_ordered<T, U>(x: T, y: U) -> U; - -#[rustc_intrinsic] -unsafe fn simd_reduce_mul_ordered<T, U>(x: T, y: U) -> U; - -#[rustc_intrinsic] -unsafe fn simd_reduce_and<T, U>(x: T) -> U; - -#[rustc_intrinsic] -unsafe fn simd_reduce_or<T, U>(x: T) -> U; - -#[rustc_intrinsic] -unsafe fn simd_reduce_xor<T, U>(x: T) -> U; - -#[rustc_intrinsic] -unsafe fn simd_reduce_all<T>(x: T) -> bool; - -#[rustc_intrinsic] -unsafe fn simd_reduce_any<T>(x: T) -> bool; - fn main() { let x = u32x4([0, 0, 0, 0]); let z = f32x4([0.0, 0.0, 0.0, 0.0]); diff --git a/tests/ui/simd/intrinsic/generic-reduction.stderr b/tests/ui/simd/intrinsic/generic-reduction.stderr index 302b9ae1d77..eaa7b8d48eb 100644 --- a/tests/ui/simd/intrinsic/generic-reduction.stderr +++ b/tests/ui/simd/intrinsic/generic-reduction.stderr @@ -1,59 +1,59 @@ error[E0511]: invalid monomorphization of `simd_reduce_add_ordered` intrinsic: expected return type `f32` (element of input `f32x4`), found `i32` - --> $DIR/generic-reduction.rs:44:9 + --> $DIR/generic-reduction.rs:25:9 | LL | simd_reduce_add_ordered(z, 0); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_reduce_mul_ordered` intrinsic: expected return type `f32` (element of input `f32x4`), found `i32` - --> $DIR/generic-reduction.rs:46:9 + --> $DIR/generic-reduction.rs:27:9 | LL | simd_reduce_mul_ordered(z, 1); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_reduce_and` intrinsic: expected return type `u32` (element of input `u32x4`), found `f32` - --> $DIR/generic-reduction.rs:49:22 + --> $DIR/generic-reduction.rs:30:22 | LL | let _: f32 = simd_reduce_and(x); | ^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_reduce_or` intrinsic: expected return type `u32` (element of input `u32x4`), found `f32` - --> $DIR/generic-reduction.rs:51:22 + --> $DIR/generic-reduction.rs:32:22 | LL | let _: f32 = simd_reduce_or(x); | ^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_reduce_xor` intrinsic: expected return type `u32` (element of input `u32x4`), found `f32` - --> $DIR/generic-reduction.rs:53:22 + --> $DIR/generic-reduction.rs:34:22 | LL | let _: f32 = simd_reduce_xor(x); | ^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_reduce_and` intrinsic: unsupported simd_reduce_and from `f32x4` with element `f32` to `f32` - --> $DIR/generic-reduction.rs:56:22 + --> $DIR/generic-reduction.rs:37:22 | LL | let _: f32 = simd_reduce_and(z); | ^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_reduce_or` intrinsic: unsupported simd_reduce_or from `f32x4` with element `f32` to `f32` - --> $DIR/generic-reduction.rs:58:22 + --> $DIR/generic-reduction.rs:39:22 | LL | let _: f32 = simd_reduce_or(z); | ^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_reduce_xor` intrinsic: unsupported simd_reduce_xor from `f32x4` with element `f32` to `f32` - --> $DIR/generic-reduction.rs:60:22 + --> $DIR/generic-reduction.rs:41:22 | LL | let _: f32 = simd_reduce_xor(z); | ^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_reduce_all` intrinsic: unsupported simd_reduce_all from `f32x4` with element `f32` to `bool` - --> $DIR/generic-reduction.rs:63:23 + --> $DIR/generic-reduction.rs:44:23 | LL | let _: bool = simd_reduce_all(z); | ^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_reduce_any` intrinsic: unsupported simd_reduce_any from `f32x4` with element `f32` to `bool` - --> $DIR/generic-reduction.rs:65:23 + --> $DIR/generic-reduction.rs:46:23 | LL | let _: bool = simd_reduce_any(z); | ^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/simd/intrinsic/generic-select-pass.rs b/tests/ui/simd/intrinsic/generic-select-pass.rs index 6b1b6cb79db..0e5f7c4902f 100644 --- a/tests/ui/simd/intrinsic/generic-select-pass.rs +++ b/tests/ui/simd/intrinsic/generic-select-pass.rs @@ -1,13 +1,12 @@ //@ run-pass #![allow(non_camel_case_types)] - //@ ignore-emscripten //@ ignore-endian-big behavior of simd_select_bitmask is endian-specific // Test that the simd_select intrinsics produces correct results. +#![feature(repr_simd, core_intrinsics)] -#![feature(repr_simd, intrinsics)] -#[allow(non_camel_case_types)] +use std::intrinsics::simd::{simd_select, simd_select_bitmask}; #[repr(simd)] #[derive(Copy, Clone, PartialEq, Debug)] @@ -29,13 +28,6 @@ struct f32x4(pub [f32; 4]); #[derive(Copy, Clone, PartialEq, Debug)] struct b8x4(pub [i8; 4]); -#[rustc_intrinsic] -unsafe fn simd_select<T, U>(x: T, a: U, b: U) -> U; - -#[rustc_intrinsic] -unsafe fn simd_select_bitmask<T, U>(x: T, a: U, b: U) -> U; - - fn main() { let m0 = b8x4([!0, !0, !0, !0]); let m1 = b8x4([0, 0, 0, 0]); diff --git a/tests/ui/simd/intrinsic/generic-select.rs b/tests/ui/simd/intrinsic/generic-select.rs index 340fe3f3592..db14032f1f2 100644 --- a/tests/ui/simd/intrinsic/generic-select.rs +++ b/tests/ui/simd/intrinsic/generic-select.rs @@ -3,9 +3,11 @@ // Test that the simd_select intrinsic produces ok-ish error // messages when misused. -#![feature(repr_simd, intrinsics)] +#![feature(repr_simd, core_intrinsics)] #![allow(non_camel_case_types)] +use std::intrinsics::simd::{simd_select, simd_select_bitmask}; + #[repr(simd)] #[derive(Copy, Clone)] pub struct f32x4(pub [f32; 4]); @@ -22,14 +24,6 @@ struct b8x4(pub [i8; 4]); #[derive(Copy, Clone, PartialEq)] struct b8x8(pub [i8; 8]); - -#[rustc_intrinsic] -unsafe fn simd_select<T, U>(x: T, a: U, b: U) -> U; - -#[rustc_intrinsic] -unsafe fn simd_select_bitmask<T, U>(x: T, a: U, b: U) -> U; - - fn main() { let m4 = b8x4([0, 0, 0, 0]); let m8 = b8x8([0, 0, 0, 0, 0, 0, 0, 0]); @@ -43,10 +37,10 @@ fn main() { //~^ ERROR mismatched lengths: mask length `8` != other vector length `4` simd_select(x, x, x); - //~^ ERROR mask element type is `u32`, expected `i_` + //~^ ERROR mask element type is `u32`, expected a signed integer type simd_select(z, z, z); - //~^ ERROR mask element type is `f32`, expected `i_` + //~^ ERROR mask element type is `f32`, expected a signed integer type simd_select(m4, 0u32, 1u32); //~^ ERROR found non-SIMD `u32` diff --git a/tests/ui/simd/intrinsic/generic-select.stderr b/tests/ui/simd/intrinsic/generic-select.stderr index a97fc91f951..b9af86515fd 100644 --- a/tests/ui/simd/intrinsic/generic-select.stderr +++ b/tests/ui/simd/intrinsic/generic-select.stderr @@ -1,47 +1,51 @@ error[E0511]: invalid monomorphization of `simd_select` intrinsic: mismatched lengths: mask length `8` != other vector length `4` - --> $DIR/generic-select.rs:42:9 + --> $DIR/generic-select.rs:36:9 | LL | simd_select(m8, x, x); | ^^^^^^^^^^^^^^^^^^^^^ -error[E0511]: invalid monomorphization of `simd_select` intrinsic: mask element type is `u32`, expected `i_` - --> $DIR/generic-select.rs:45:9 +error[E0511]: invalid monomorphization of `simd_select` intrinsic: found mask element type is `u32`, expected a signed integer type + --> $DIR/generic-select.rs:39:9 | LL | simd_select(x, x, x); | ^^^^^^^^^^^^^^^^^^^^ + | + = note: the mask may be widened, which only has the correct behavior for signed integers -error[E0511]: invalid monomorphization of `simd_select` intrinsic: mask element type is `f32`, expected `i_` - --> $DIR/generic-select.rs:48:9 +error[E0511]: invalid monomorphization of `simd_select` intrinsic: found mask element type is `f32`, expected a signed integer type + --> $DIR/generic-select.rs:42:9 | LL | simd_select(z, z, z); | ^^^^^^^^^^^^^^^^^^^^ + | + = note: the mask may be widened, which only has the correct behavior for signed integers error[E0511]: invalid monomorphization of `simd_select` intrinsic: expected SIMD argument type, found non-SIMD `u32` - --> $DIR/generic-select.rs:51:9 + --> $DIR/generic-select.rs:45:9 | LL | simd_select(m4, 0u32, 1u32); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_select_bitmask` intrinsic: invalid bitmask `u16`, expected `u8` or `[u8; 1]` - --> $DIR/generic-select.rs:54:9 + --> $DIR/generic-select.rs:48:9 | LL | simd_select_bitmask(0u16, x, x); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_select_bitmask` intrinsic: expected SIMD argument type, found non-SIMD `u32` - --> $DIR/generic-select.rs:57:9 + --> $DIR/generic-select.rs:51:9 | LL | simd_select_bitmask(0u8, 1u32, 2u32); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_select_bitmask` intrinsic: invalid bitmask `f32`, expected `u8` or `[u8; 1]` - --> $DIR/generic-select.rs:60:9 + --> $DIR/generic-select.rs:54:9 | LL | simd_select_bitmask(0.0f32, x, x); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_select_bitmask` intrinsic: invalid bitmask `&str`, expected `u8` or `[u8; 1]` - --> $DIR/generic-select.rs:63:9 + --> $DIR/generic-select.rs:57:9 | LL | simd_select_bitmask("x", x, x); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/simd/intrinsic/generic-shuffle.rs b/tests/ui/simd/intrinsic/generic-shuffle.rs index 1223b8ebe19..7cfd764f5d5 100644 --- a/tests/ui/simd/intrinsic/generic-shuffle.rs +++ b/tests/ui/simd/intrinsic/generic-shuffle.rs @@ -3,16 +3,14 @@ // Test that the simd_shuffle intrinsic produces ok-ish error // messages when misused. -#![feature(repr_simd, intrinsics)] +#![feature(repr_simd, core_intrinsics)] + +use std::intrinsics::simd::simd_shuffle; #[repr(simd)] #[derive(Copy, Clone)] pub struct Simd<T, const N: usize>([T; N]); -#[rustc_intrinsic] -unsafe fn simd_shuffle<T, I, U>(a: T, b: T, i: I) -> U; - - fn main() { const I: Simd<u32, 2> = Simd([0; 2]); const I2: Simd<f32, 2> = Simd([0.; 2]); diff --git a/tests/ui/simd/intrinsic/generic-shuffle.stderr b/tests/ui/simd/intrinsic/generic-shuffle.stderr index 7e6d51a5f65..e8cd528b702 100644 --- a/tests/ui/simd/intrinsic/generic-shuffle.stderr +++ b/tests/ui/simd/intrinsic/generic-shuffle.stderr @@ -1,23 +1,23 @@ error[E0511]: invalid monomorphization of `simd_shuffle` intrinsic: simd_shuffle index must be a SIMD vector of `u32`, got `[u32; 2]` - --> $DIR/generic-shuffle.rs:24:31 + --> $DIR/generic-shuffle.rs:22:31 | LL | let _: Simd<u32, 2> = simd_shuffle(v, v, const { [0u32; 2] }); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_shuffle` intrinsic: expected return type of length 2, found `Simd<u32, 4>` with length 4 - --> $DIR/generic-shuffle.rs:27:31 + --> $DIR/generic-shuffle.rs:25:31 | LL | let _: Simd<u32, 4> = simd_shuffle(v, v, I); | ^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_shuffle` intrinsic: expected return element type `u32` (element of input `Simd<u32, 4>`), found `Simd<f32, 2>` with element type `f32` - --> $DIR/generic-shuffle.rs:30:31 + --> $DIR/generic-shuffle.rs:28:31 | LL | let _: Simd<f32, 2> = simd_shuffle(v, v, I); | ^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_shuffle` intrinsic: simd_shuffle index must be a SIMD vector of `u32`, got `Simd<f32, 2>` - --> $DIR/generic-shuffle.rs:33:31 + --> $DIR/generic-shuffle.rs:31:31 | LL | let _: Simd<u32, 2> = simd_shuffle(v, v, I2); | ^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/simd/intrinsic/inlining-issue67557-ice.rs b/tests/ui/simd/intrinsic/inlining-issue67557-ice.rs index b324ac40749..49a26ff5734 100644 --- a/tests/ui/simd/intrinsic/inlining-issue67557-ice.rs +++ b/tests/ui/simd/intrinsic/inlining-issue67557-ice.rs @@ -3,10 +3,9 @@ // //@ run-pass //@ compile-flags: -Zmir-opt-level=4 -#![feature(intrinsics, repr_simd)] +#![feature(core_intrinsics, repr_simd)] -#[rustc_intrinsic] -unsafe fn simd_shuffle<T, I, U>(x: T, y: T, idx: I) -> U; +use std::intrinsics::simd::simd_shuffle; #[repr(simd)] #[derive(Debug, PartialEq)] diff --git a/tests/ui/simd/intrinsic/inlining-issue67557.rs b/tests/ui/simd/intrinsic/inlining-issue67557.rs index 319bb15c015..13e7266b2a5 100644 --- a/tests/ui/simd/intrinsic/inlining-issue67557.rs +++ b/tests/ui/simd/intrinsic/inlining-issue67557.rs @@ -3,10 +3,9 @@ // //@ run-pass //@ compile-flags: -Zmir-opt-level=4 -#![feature(intrinsics, repr_simd)] +#![feature(core_intrinsics, repr_simd)] -#[rustc_intrinsic] -unsafe fn simd_shuffle<T, I, U>(x: T, y: T, idx: I) -> U; +use std::intrinsics::simd::simd_shuffle; #[repr(simd)] #[derive(Debug, PartialEq)] @@ -36,7 +35,6 @@ fn assert_10_13(x: Simd2) { assert_eq!(x, Simd2([10, 13])); } - #[inline(always)] unsafe fn inline_me() -> Simd2 { const IDX: SimdShuffleIdx<2> = SimdShuffleIdx([0, 3]); diff --git a/tests/ui/simd/intrinsic/issue-85855.rs b/tests/ui/simd/intrinsic/issue-85855.rs index daeea793d1b..cbaa8f046be 100644 --- a/tests/ui/simd/intrinsic/issue-85855.rs +++ b/tests/ui/simd/intrinsic/issue-85855.rs @@ -3,8 +3,7 @@ // that no ICE occurs in these cases. #![feature(intrinsics)] -#![crate_type="lib"] - +#![crate_type = "lib"] #[rustc_intrinsic] unsafe fn simd_saturating_add<'a, T: 'a>(x: T, y: T); diff --git a/tests/ui/simd/intrinsic/issue-85855.stderr b/tests/ui/simd/intrinsic/issue-85855.stderr index b91a606ba68..af61c6fcdc1 100644 --- a/tests/ui/simd/intrinsic/issue-85855.stderr +++ b/tests/ui/simd/intrinsic/issue-85855.stderr @@ -1,17 +1,17 @@ error[E0094]: intrinsic has wrong number of lifetime parameters: found 1, expected 0 - --> $DIR/issue-85855.rs:10:30 + --> $DIR/issue-85855.rs:9:30 | LL | unsafe fn simd_saturating_add<'a, T: 'a>(x: T, y: T); | ^^^^^^^^^^^ expected 0 lifetime parameters error[E0094]: intrinsic has wrong number of type parameters: found 2, expected 1 - --> $DIR/issue-85855.rs:17:19 + --> $DIR/issue-85855.rs:16:19 | LL | unsafe fn simd_sub<T, U>(x: T, y: U); | ^^^^^^ expected 1 type parameter error[E0094]: intrinsic has wrong number of const parameters: found 1, expected 0 - --> $DIR/issue-85855.rs:21:19 + --> $DIR/issue-85855.rs:20:19 | LL | unsafe fn simd_mul<T, const N: usize>(x: T, y: T); | ^^^^^^^^^^^^^^^^^^^ expected 0 const parameters diff --git a/tests/ui/simd/intrinsic/ptr-cast.rs b/tests/ui/simd/intrinsic/ptr-cast.rs index 559b8ba1b5c..3a73c0273e1 100644 --- a/tests/ui/simd/intrinsic/ptr-cast.rs +++ b/tests/ui/simd/intrinsic/ptr-cast.rs @@ -1,16 +1,8 @@ //@ run-pass -#![feature(repr_simd, intrinsics)] +#![feature(repr_simd, core_intrinsics)] - -#[rustc_intrinsic] -unsafe fn simd_cast_ptr<T, U>(x: T) -> U; - -#[rustc_intrinsic] -unsafe fn simd_expose_provenance<T, U>(x: T) -> U; - -#[rustc_intrinsic] -unsafe fn simd_with_exposed_provenance<T, U>(x: T) -> U; +use std::intrinsics::simd::{simd_cast_ptr, simd_expose_provenance, simd_with_exposed_provenance}; #[derive(Copy, Clone)] #[repr(simd)] diff --git a/tests/ui/simd/issue-105439.rs b/tests/ui/simd/issue-105439.rs index 108bb282df2..0a44f36fb2e 100644 --- a/tests/ui/simd/issue-105439.rs +++ b/tests/ui/simd/issue-105439.rs @@ -1,17 +1,13 @@ //@ run-pass //@ compile-flags: -O -Zverify-llvm-ir -#![feature(repr_simd)] -#![feature(intrinsics)] +#![feature(repr_simd, core_intrinsics)] #[allow(non_camel_case_types)] #[derive(Clone, Copy)] #[repr(simd)] struct i32x4([i32; 4]); -#[rustc_intrinsic] -pub(crate) unsafe fn simd_add<T>(x: T, y: T) -> T; - #[inline(always)] fn to_array(a: i32x4) -> [i32; 4] { a.0 @@ -19,6 +15,6 @@ fn to_array(a: i32x4) -> [i32; 4] { fn main() { let a = i32x4([1, 2, 3, 4]); - let b = unsafe { simd_add(a, a) }; + let b = unsafe { std::intrinsics::simd::simd_add(a, a) }; assert_eq!(to_array(b), [2, 4, 6, 8]); } diff --git a/tests/ui/simd/issue-32947.rs b/tests/ui/simd/issue-32947.rs index dc5e7a4ec91..b34484b2d3b 100644 --- a/tests/ui/simd/issue-32947.rs +++ b/tests/ui/simd/issue-32947.rs @@ -1,5 +1,4 @@ //@ run-pass -//@ ignore-emscripten FIXME(#45351) #![feature(repr_simd, test)] @@ -15,9 +14,7 @@ fn main() { // non-optimized builds unsafe { let memory = &mut [0u64; 8] as *mut _ as *mut u8; - let misaligned_ptr: &mut [u8; 32] = { - std::mem::transmute(memory.offset(1)) - }; + let misaligned_ptr: &mut [u8; 32] = { std::mem::transmute(memory.offset(1)) }; *misaligned_ptr = std::mem::transmute(Mu64([1, 1, 1, 1])); test::black_box(memory); } diff --git a/tests/ui/simd/issue-39720.rs b/tests/ui/simd/issue-39720.rs index 8d7666faaf9..db441e55167 100644 --- a/tests/ui/simd/issue-39720.rs +++ b/tests/ui/simd/issue-39720.rs @@ -1,7 +1,6 @@ //@ run-pass -//@ ignore-emscripten FIXME(#45351) -#![feature(repr_simd, intrinsics)] +#![feature(repr_simd, core_intrinsics)] #[repr(simd)] #[derive(Copy, Clone, Debug)] @@ -11,11 +10,8 @@ pub struct Char3(pub [i8; 3]); #[derive(Copy, Clone, Debug)] pub struct Short3(pub [i16; 3]); -#[rustc_intrinsic] -unsafe fn simd_cast<T, U>(x: T) -> U; - fn main() { - let cast: Short3 = unsafe { simd_cast(Char3([10, -3, -9])) }; + let cast: Short3 = unsafe { std::intrinsics::simd::simd_cast(Char3([10, -3, -9])) }; println!("{:?}", cast); } diff --git a/tests/ui/simd/issue-85915-simd-ptrs.rs b/tests/ui/simd/issue-85915-simd-ptrs.rs index 2e7baf48ee3..4e2379d0525 100644 --- a/tests/ui/simd/issue-85915-simd-ptrs.rs +++ b/tests/ui/simd/issue-85915-simd-ptrs.rs @@ -3,9 +3,11 @@ // Short form of the generic gather/scatter tests, // verifying simd([*const T; N]) and simd([*mut T; N]) pass typeck and work. -#![feature(repr_simd, intrinsics)] +#![feature(repr_simd, core_intrinsics)] #![allow(non_camel_case_types)] +use std::intrinsics::simd::{simd_gather, simd_scatter}; + #[repr(simd)] #[derive(Copy, Clone, PartialEq, Debug)] struct cptrx4<T>([*const T; 4]); @@ -22,13 +24,6 @@ struct f32x4([f32; 4]); #[derive(Copy, Clone, PartialEq, Debug)] struct i32x4([i32; 4]); - -#[rustc_intrinsic] -unsafe fn simd_gather<T, U, V>(x: T, y: U, z: V) -> T; - -#[rustc_intrinsic] -unsafe fn simd_scatter<T, U, V>(x: T, y: U, z: V) -> (); - fn main() { let mut x = [0_f32, 1., 2., 3., 4., 5., 6., 7.]; @@ -39,11 +34,11 @@ fn main() { // reading from *const unsafe { let pointer = &x as *const f32; - let pointers = cptrx4([ + let pointers = cptrx4([ pointer.offset(0) as *const f32, pointer.offset(2), pointer.offset(4), - pointer.offset(6) + pointer.offset(6), ]); let r_strided = simd_gather(default, pointers, mask); @@ -58,7 +53,7 @@ fn main() { pointer.offset(0) as *mut f32, pointer.offset(2), pointer.offset(4), - pointer.offset(6) + pointer.offset(6), ]); let values = f32x4([42_f32, 43_f32, 44_f32, 45_f32]); diff --git a/tests/ui/simd/issue-89193.rs b/tests/ui/simd/issue-89193.rs index 4b4fb9d9169..a6c3017572a 100644 --- a/tests/ui/simd/issue-89193.rs +++ b/tests/ui/simd/issue-89193.rs @@ -3,16 +3,15 @@ // Test that simd gather instructions on slice of usize don't cause crash // See issue #89183 - https://github.com/rust-lang/rust/issues/89193 -#![feature(repr_simd, intrinsics)] +#![feature(repr_simd, core_intrinsics)] #![allow(non_camel_case_types)] +use std::intrinsics::simd::simd_gather; + #[repr(simd)] #[derive(Copy, Clone, PartialEq, Debug)] struct x4<T>(pub [T; 4]); -#[rustc_intrinsic] -unsafe fn simd_gather<T, U, V>(x: T, y: U, z: V) -> T; - fn main() { let x: [usize; 4] = [10, 11, 12, 13]; let default = x4([0_usize, 1, 2, 3]); @@ -22,12 +21,8 @@ fn main() { unsafe { let pointer = x.as_ptr(); - let pointers = x4([ - pointer.offset(0), - pointer.offset(1), - pointer.offset(2), - pointer.offset(3) - ]); + let pointers = + x4([pointer.offset(0), pointer.offset(1), pointer.offset(2), pointer.offset(3)]); let result = simd_gather(default, pointers, mask); assert_eq!(result, expected); } @@ -39,12 +34,8 @@ fn main() { unsafe { let pointer = x.as_ptr(); - let pointers = x4([ - pointer.offset(0), - pointer.offset(1), - pointer.offset(2), - pointer.offset(3) - ]); + let pointers = + x4([pointer.offset(0), pointer.offset(1), pointer.offset(2), pointer.offset(3)]); let result = simd_gather(default, pointers, mask); assert_eq!(result, expected); } diff --git a/tests/ui/simd/masked-load-store-build-fail.rs b/tests/ui/simd/masked-load-store-build-fail.rs index b8742184eb0..ad2de556103 100644 --- a/tests/ui/simd/masked-load-store-build-fail.rs +++ b/tests/ui/simd/masked-load-store-build-fail.rs @@ -1,12 +1,7 @@ //@ build-fail -#![feature(repr_simd, intrinsics)] +#![feature(repr_simd, core_intrinsics)] - -#[rustc_intrinsic] -unsafe fn simd_masked_load<M, P, T>(mask: M, pointer: P, values: T) -> T; - -#[rustc_intrinsic] -unsafe fn simd_masked_store<M, P, T>(mask: M, pointer: P, values: T) -> (); +use std::intrinsics::simd::{simd_masked_load, simd_masked_store}; #[derive(Copy, Clone)] #[repr(simd)] @@ -17,60 +12,28 @@ fn main() { let mut arr = [4u8, 5, 6, 7]; let default = Simd::<u8, 4>([9; 4]); - simd_masked_load( - Simd::<i8, 8>([-1, 0, -1, -1, 0, 0, 0, 0]), - arr.as_ptr(), - default - ); - //~^^^^^ ERROR expected third argument with length 8 (same as input type `Simd<i8, 8>`), found `Simd<u8, 4>` with length 4 + simd_masked_load(Simd::<i8, 8>([-1, 0, -1, -1, 0, 0, 0, 0]), arr.as_ptr(), default); + //~^ ERROR expected third argument with length 8 (same as input type `Simd<i8, 8>`), found `Simd<u8, 4>` with length 4 - simd_masked_load( - Simd::<i8, 4>([-1, 0, -1, -1]), - arr.as_ptr() as *const i8, - default - ); - //~^^^^^ ERROR expected element type `u8` of second argument `*const i8` to be a pointer to the element type `u8` of the first argument `Simd<u8, 4>`, found `u8` != `*_ u8` + simd_masked_load(Simd::<i8, 4>([-1, 0, -1, -1]), arr.as_ptr() as *const i8, default); + //~^ ERROR expected element type `u8` of second argument `*const i8` to be a pointer to the element type `u8` of the first argument `Simd<u8, 4>`, found `u8` != `*_ u8` - simd_masked_load( - Simd::<i8, 4>([-1, 0, -1, -1]), - arr.as_ptr(), - Simd::<u32, 4>([9; 4]) - ); - //~^^^^^ ERROR expected element type `u32` of second argument `*const u8` to be a pointer to the element type `u32` of the first argument `Simd<u32, 4>`, found `u32` != `*_ u32` + simd_masked_load(Simd::<i8, 4>([-1, 0, -1, -1]), arr.as_ptr(), Simd::<u32, 4>([9; 4])); + //~^ ERROR expected element type `u32` of second argument `*const u8` to be a pointer to the element type `u32` of the first argument `Simd<u32, 4>`, found `u32` != `*_ u32` - simd_masked_load( - Simd::<u8, 4>([1, 0, 1, 1]), - arr.as_ptr(), - default - ); - //~^^^^^ ERROR expected element type `u8` of third argument `Simd<u8, 4>` to be a signed integer type + simd_masked_load(Simd::<u8, 4>([1, 0, 1, 1]), arr.as_ptr(), default); + //~^ ERROR expected element type `u8` of third argument `Simd<u8, 4>` to be a signed integer type - simd_masked_store( - Simd([-1i8; 4]), - arr.as_ptr(), - Simd([5u32; 4]) - ); - //~^^^^^ ERROR expected element type `u32` of second argument `*const u8` to be a pointer to the element type `u32` of the first argument `Simd<u32, 4>`, found `u32` != `*mut u32` + simd_masked_store(Simd([-1i8; 4]), arr.as_ptr(), Simd([5u32; 4])); + //~^ ERROR expected element type `u32` of second argument `*const u8` to be a pointer to the element type `u32` of the first argument `Simd<u32, 4>`, found `u32` != `*mut u32` - simd_masked_store( - Simd([-1i8; 4]), - arr.as_ptr(), - Simd([5u8; 4]) - ); - //~^^^^^ ERROR expected element type `u8` of second argument `*const u8` to be a pointer to the element type `u8` of the first argument `Simd<u8, 4>`, found `u8` != `*mut u8` + simd_masked_store(Simd([-1i8; 4]), arr.as_ptr(), Simd([5u8; 4])); + //~^ ERROR expected element type `u8` of second argument `*const u8` to be a pointer to the element type `u8` of the first argument `Simd<u8, 4>`, found `u8` != `*mut u8` - simd_masked_store( - Simd([-1i8; 4]), - arr.as_mut_ptr(), - Simd([5u8; 2]) - ); - //~^^^^^ ERROR expected third argument with length 4 (same as input type `Simd<i8, 4>`), found `Simd<u8, 2>` with length 2 + simd_masked_store(Simd([-1i8; 4]), arr.as_mut_ptr(), Simd([5u8; 2])); + //~^ ERROR expected third argument with length 4 (same as input type `Simd<i8, 4>`), found `Simd<u8, 2>` with length 2 - simd_masked_store( - Simd([1u32; 4]), - arr.as_mut_ptr(), - Simd([5u8; 4]) - ); - //~^^^^^ ERROR expected element type `u8` of third argument `Simd<u32, 4>` to be a signed integer type + simd_masked_store(Simd([1u32; 4]), arr.as_mut_ptr(), Simd([5u8; 4])); + //~^ ERROR expected element type `u8` of third argument `Simd<u32, 4>` to be a signed integer type } } diff --git a/tests/ui/simd/masked-load-store-build-fail.stderr b/tests/ui/simd/masked-load-store-build-fail.stderr index 8a8d8eb99e2..d57e0aa539f 100644 --- a/tests/ui/simd/masked-load-store-build-fail.stderr +++ b/tests/ui/simd/masked-load-store-build-fail.stderr @@ -1,82 +1,50 @@ error[E0511]: invalid monomorphization of `simd_masked_load` intrinsic: expected third argument with length 8 (same as input type `Simd<i8, 8>`), found `Simd<u8, 4>` with length 4 - --> $DIR/masked-load-store-build-fail.rs:20:9 + --> $DIR/masked-load-store-build-fail.rs:15:9 | -LL | / simd_masked_load( -LL | | Simd::<i8, 8>([-1, 0, -1, -1, 0, 0, 0, 0]), -LL | | arr.as_ptr(), -LL | | default -LL | | ); - | |_________^ +LL | simd_masked_load(Simd::<i8, 8>([-1, 0, -1, -1, 0, 0, 0, 0]), arr.as_ptr(), default); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_masked_load` intrinsic: expected element type `u8` of second argument `*const i8` to be a pointer to the element type `u8` of the first argument `Simd<u8, 4>`, found `u8` != `*_ u8` - --> $DIR/masked-load-store-build-fail.rs:27:9 + --> $DIR/masked-load-store-build-fail.rs:18:9 | -LL | / simd_masked_load( -LL | | Simd::<i8, 4>([-1, 0, -1, -1]), -LL | | arr.as_ptr() as *const i8, -LL | | default -LL | | ); - | |_________^ +LL | simd_masked_load(Simd::<i8, 4>([-1, 0, -1, -1]), arr.as_ptr() as *const i8, default); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_masked_load` intrinsic: expected element type `u32` of second argument `*const u8` to be a pointer to the element type `u32` of the first argument `Simd<u32, 4>`, found `u32` != `*_ u32` - --> $DIR/masked-load-store-build-fail.rs:34:9 + --> $DIR/masked-load-store-build-fail.rs:21:9 | -LL | / simd_masked_load( -LL | | Simd::<i8, 4>([-1, 0, -1, -1]), -LL | | arr.as_ptr(), -LL | | Simd::<u32, 4>([9; 4]) -LL | | ); - | |_________^ +LL | simd_masked_load(Simd::<i8, 4>([-1, 0, -1, -1]), arr.as_ptr(), Simd::<u32, 4>([9; 4])); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_masked_load` intrinsic: expected element type `u8` of third argument `Simd<u8, 4>` to be a signed integer type - --> $DIR/masked-load-store-build-fail.rs:41:9 + --> $DIR/masked-load-store-build-fail.rs:24:9 | -LL | / simd_masked_load( -LL | | Simd::<u8, 4>([1, 0, 1, 1]), -LL | | arr.as_ptr(), -LL | | default -LL | | ); - | |_________^ +LL | simd_masked_load(Simd::<u8, 4>([1, 0, 1, 1]), arr.as_ptr(), default); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_masked_store` intrinsic: expected element type `u32` of second argument `*const u8` to be a pointer to the element type `u32` of the first argument `Simd<u32, 4>`, found `u32` != `*mut u32` - --> $DIR/masked-load-store-build-fail.rs:48:9 + --> $DIR/masked-load-store-build-fail.rs:27:9 | -LL | / simd_masked_store( -LL | | Simd([-1i8; 4]), -LL | | arr.as_ptr(), -LL | | Simd([5u32; 4]) -LL | | ); - | |_________^ +LL | simd_masked_store(Simd([-1i8; 4]), arr.as_ptr(), Simd([5u32; 4])); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_masked_store` intrinsic: expected element type `u8` of second argument `*const u8` to be a pointer to the element type `u8` of the first argument `Simd<u8, 4>`, found `u8` != `*mut u8` - --> $DIR/masked-load-store-build-fail.rs:55:9 + --> $DIR/masked-load-store-build-fail.rs:30:9 | -LL | / simd_masked_store( -LL | | Simd([-1i8; 4]), -LL | | arr.as_ptr(), -LL | | Simd([5u8; 4]) -LL | | ); - | |_________^ +LL | simd_masked_store(Simd([-1i8; 4]), arr.as_ptr(), Simd([5u8; 4])); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_masked_store` intrinsic: expected third argument with length 4 (same as input type `Simd<i8, 4>`), found `Simd<u8, 2>` with length 2 - --> $DIR/masked-load-store-build-fail.rs:62:9 + --> $DIR/masked-load-store-build-fail.rs:33:9 | -LL | / simd_masked_store( -LL | | Simd([-1i8; 4]), -LL | | arr.as_mut_ptr(), -LL | | Simd([5u8; 2]) -LL | | ); - | |_________^ +LL | simd_masked_store(Simd([-1i8; 4]), arr.as_mut_ptr(), Simd([5u8; 2])); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_masked_store` intrinsic: expected element type `u8` of third argument `Simd<u32, 4>` to be a signed integer type - --> $DIR/masked-load-store-build-fail.rs:69:9 + --> $DIR/masked-load-store-build-fail.rs:36:9 | -LL | / simd_masked_store( -LL | | Simd([1u32; 4]), -LL | | arr.as_mut_ptr(), -LL | | Simd([5u8; 4]) -LL | | ); - | |_________^ +LL | simd_masked_store(Simd([1u32; 4]), arr.as_mut_ptr(), Simd([5u8; 4])); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 8 previous errors diff --git a/tests/ui/simd/masked-load-store-check-fail.rs b/tests/ui/simd/masked-load-store-check-fail.rs index 0f36bf6443f..3ed47cd9ed4 100644 --- a/tests/ui/simd/masked-load-store-check-fail.rs +++ b/tests/ui/simd/masked-load-store-check-fail.rs @@ -1,11 +1,7 @@ //@ check-fail -#![feature(repr_simd, intrinsics)] +#![feature(repr_simd, core_intrinsics)] -#[rustc_intrinsic] -unsafe fn simd_masked_load<M, P, T>(mask: M, pointer: P, values: T) -> T; - -#[rustc_intrinsic] -unsafe fn simd_masked_store<M, P, T>(mask: M, pointer: P, values: T) -> (); +use std::intrinsics::simd::{simd_masked_load, simd_masked_store}; #[derive(Copy, Clone)] #[repr(simd)] @@ -16,18 +12,11 @@ fn main() { let mut arr = [4u8, 5, 6, 7]; let default = Simd::<u8, 4>([9; 4]); - let _x: Simd<u8, 2> = simd_masked_load( - Simd::<i8, 4>([-1, 0, -1, -1]), - arr.as_ptr(), - Simd::<u8, 4>([9; 4]) - ); - //~^^ ERROR mismatched types + let _x: Simd<u8, 2> = + simd_masked_load(Simd::<i8, 4>([-1, 0, -1, -1]), arr.as_ptr(), Simd::<u8, 4>([9; 4])); + //~^ ERROR mismatched types - let _x: Simd<u32, 4> = simd_masked_load( - Simd::<u8, 4>([1, 0, 1, 1]), - arr.as_ptr(), - default - ); - //~^^ ERROR mismatched types + let _x: Simd<u32, 4> = simd_masked_load(Simd::<u8, 4>([1, 0, 1, 1]), arr.as_ptr(), default); + //~^ ERROR mismatched types } } diff --git a/tests/ui/simd/masked-load-store-check-fail.stderr b/tests/ui/simd/masked-load-store-check-fail.stderr index fa65798fc94..1c9f9d246df 100644 --- a/tests/ui/simd/masked-load-store-check-fail.stderr +++ b/tests/ui/simd/masked-load-store-check-fail.stderr @@ -1,58 +1,38 @@ error[E0308]: mismatched types - --> $DIR/masked-load-store-check-fail.rs:22:13 + --> $DIR/masked-load-store-check-fail.rs:16:76 | -LL | let _x: Simd<u8, 2> = simd_masked_load( - | ---------------- arguments to this function are incorrect -... -LL | Simd::<u8, 4>([9; 4]) - | ^^^^^^^^^^^^^^^^^^^^^ expected `2`, found `4` +LL | simd_masked_load(Simd::<i8, 4>([-1, 0, -1, -1]), arr.as_ptr(), Simd::<u8, 4>([9; 4])); + | ---------------- arguments to this function are incorrect ^^^^^^^^^^^^^^^^^^^^^ expected `2`, found `4` | = note: expected struct `Simd<_, 2>` found struct `Simd<_, 4>` help: the return type of this call is `Simd<u8, 4>` due to the type of the argument passed - --> $DIR/masked-load-store-check-fail.rs:19:31 + --> $DIR/masked-load-store-check-fail.rs:16:13 | -LL | let _x: Simd<u8, 2> = simd_masked_load( - | _______________________________^ -LL | | Simd::<i8, 4>([-1, 0, -1, -1]), -LL | | arr.as_ptr(), -LL | | Simd::<u8, 4>([9; 4]) - | | --------------------- this argument influences the return type of `simd_masked_load` -LL | | ); - | |_________^ +LL | simd_masked_load(Simd::<i8, 4>([-1, 0, -1, -1]), arr.as_ptr(), Simd::<u8, 4>([9; 4])); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^---------------------^ + | | + | this argument influences the return type of `simd_masked_load` note: function defined here - --> $DIR/masked-load-store-check-fail.rs:5:11 - | -LL | unsafe fn simd_masked_load<M, P, T>(mask: M, pointer: P, values: T) -> T; - | ^^^^^^^^^^^^^^^^ --------- + --> $SRC_DIR/core/src/intrinsics/simd.rs:LL:COL error[E0308]: mismatched types - --> $DIR/masked-load-store-check-fail.rs:29:13 + --> $DIR/masked-load-store-check-fail.rs:19:92 | -LL | let _x: Simd<u32, 4> = simd_masked_load( - | ---------------- arguments to this function are incorrect -... -LL | default - | ^^^^^^^ expected `Simd<u32, 4>`, found `Simd<u8, 4>` +LL | let _x: Simd<u32, 4> = simd_masked_load(Simd::<u8, 4>([1, 0, 1, 1]), arr.as_ptr(), default); + | ---------------- arguments to this function are incorrect ^^^^^^^ expected `Simd<u32, 4>`, found `Simd<u8, 4>` | = note: expected struct `Simd<u32, _>` found struct `Simd<u8, _>` help: the return type of this call is `Simd<u8, 4>` due to the type of the argument passed - --> $DIR/masked-load-store-check-fail.rs:26:32 + --> $DIR/masked-load-store-check-fail.rs:19:32 | -LL | let _x: Simd<u32, 4> = simd_masked_load( - | ________________________________^ -LL | | Simd::<u8, 4>([1, 0, 1, 1]), -LL | | arr.as_ptr(), -LL | | default - | | ------- this argument influences the return type of `simd_masked_load` -LL | | ); - | |_________^ +LL | let _x: Simd<u32, 4> = simd_masked_load(Simd::<u8, 4>([1, 0, 1, 1]), arr.as_ptr(), default); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-------^ + | | + | this argument influences the return type of `simd_masked_load` note: function defined here - --> $DIR/masked-load-store-check-fail.rs:5:11 - | -LL | unsafe fn simd_masked_load<M, P, T>(mask: M, pointer: P, values: T) -> T; - | ^^^^^^^^^^^^^^^^ --------- + --> $SRC_DIR/core/src/intrinsics/simd.rs:LL:COL error: aborting due to 2 previous errors diff --git a/tests/ui/simd/masked-load-store.rs b/tests/ui/simd/masked-load-store.rs index 4b4195f51f1..69ea76581ee 100644 --- a/tests/ui/simd/masked-load-store.rs +++ b/tests/ui/simd/masked-load-store.rs @@ -1,11 +1,7 @@ //@ run-pass -#![feature(repr_simd, intrinsics)] +#![feature(repr_simd, core_intrinsics)] -#[rustc_intrinsic] -unsafe fn simd_masked_load<M, P, T>(mask: M, pointer: P, values: T) -> T; - -#[rustc_intrinsic] -unsafe fn simd_masked_store<M, P, T>(mask: M, pointer: P, values: T) -> (); +use std::intrinsics::simd::{simd_masked_load, simd_masked_store}; #[derive(Copy, Clone)] #[repr(simd)] @@ -16,11 +12,8 @@ fn main() { let a = Simd::<u8, 4>([0, 1, 2, 3]); let b_src = [4u8, 5, 6, 7]; let b_default = Simd::<u8, 4>([9; 4]); - let b: Simd::<u8, 4> = simd_masked_load( - Simd::<i8, 4>([-1, 0, -1, -1]), - b_src.as_ptr(), - b_default - ); + let b: Simd<u8, 4> = + simd_masked_load(Simd::<i8, 4>([-1, 0, -1, -1]), b_src.as_ptr(), b_default); assert_eq!(&b.0, &[4, 9, 6, 7]); diff --git a/tests/ui/simd/monomorphize-shuffle-index.generic.stderr b/tests/ui/simd/monomorphize-shuffle-index.generic.stderr index b0a8da59fac..b0742bc5ef8 100644 --- a/tests/ui/simd/monomorphize-shuffle-index.generic.stderr +++ b/tests/ui/simd/monomorphize-shuffle-index.generic.stderr @@ -1,10 +1,10 @@ error: overly complex generic constant - --> $DIR/monomorphize-shuffle-index.rs:32:45 + --> $DIR/monomorphize-shuffle-index.rs:36:51 | -LL | return simd_shuffle_generic::<_, _, { &Self::I.0 }>(a, b); - | ^^----------^^ - | | - | pointer casts are not allowed in generic constants +LL | return simd_shuffle_const_generic::<_, _, { &Self::I.0 }>(a, b); + | ^^----------^^ + | | + | pointer casts are not allowed in generic constants | = help: consider moving this anonymous constant into a `const` function diff --git a/tests/ui/simd/monomorphize-shuffle-index.rs b/tests/ui/simd/monomorphize-shuffle-index.rs index 01926408a2c..3a074dfd432 100644 --- a/tests/ui/simd/monomorphize-shuffle-index.rs +++ b/tests/ui/simd/monomorphize-shuffle-index.rs @@ -1,18 +1,22 @@ +//@ revisions: old generic generic_with_fn //@[old]run-pass //@[generic_with_fn]run-pass -//@ revisions: old generic generic_with_fn -#![feature(repr_simd, intrinsics, adt_const_params, unsized_const_params, generic_const_exprs)] +#![feature( + repr_simd, + core_intrinsics, + intrinsics, + adt_const_params, + unsized_const_params, + generic_const_exprs +)] #![allow(incomplete_features)] - -#[rustc_intrinsic] #[cfg(old)] -unsafe fn simd_shuffle<T, I, U>(a: T, b: T, i: I) -> U; +use std::intrinsics::simd::simd_shuffle; -#[rustc_intrinsic] #[cfg(any(generic, generic_with_fn))] -unsafe fn simd_shuffle_generic<T, U, const I: &'static [u32]>(a: T, b: T) -> U; - +#[rustc_intrinsic] +unsafe fn simd_shuffle_const_generic<T, U, const I: &'static [u32]>(a: T, b: T) -> U; #[derive(Copy, Clone)] #[repr(simd)] @@ -29,10 +33,10 @@ trait Shuffle<const N: usize> { #[cfg(old)] return simd_shuffle(a, b, Self::I); #[cfg(generic)] - return simd_shuffle_generic::<_, _, { &Self::I.0 }>(a, b); + return simd_shuffle_const_generic::<_, _, { &Self::I.0 }>(a, b); //[generic]~^ overly complex generic constant #[cfg(generic_with_fn)] - return simd_shuffle_generic::<_, _, { Self::J }>(a, b); + return simd_shuffle_const_generic::<_, _, { Self::J }>(a, b); } } diff --git a/tests/ui/simd/repr_packed.rs b/tests/ui/simd/repr_packed.rs index a666892226e..cc54477ae71 100644 --- a/tests/ui/simd/repr_packed.rs +++ b/tests/ui/simd/repr_packed.rs @@ -1,8 +1,10 @@ //@ run-pass -#![feature(repr_simd, intrinsics)] +#![feature(repr_simd, core_intrinsics)] #![allow(non_camel_case_types)] +use std::intrinsics::simd::simd_add; + #[repr(simd, packed)] struct Simd<T, const N: usize>([T; N]); @@ -22,9 +24,6 @@ fn check_ty<T>() { check_size_align::<T, 15>(); } -#[rustc_intrinsic] -unsafe fn simd_add<T>(a: T, b: T) -> T; - fn main() { check_ty::<u8>(); check_ty::<i16>(); diff --git a/tests/ui/simd/shuffle.rs b/tests/ui/simd/shuffle.rs index 2cae5a1e7de..cd270edcf00 100644 --- a/tests/ui/simd/shuffle.rs +++ b/tests/ui/simd/shuffle.rs @@ -2,14 +2,13 @@ //@ revisions: opt noopt //@[noopt] compile-flags: -Copt-level=0 //@[opt] compile-flags: -O -#![feature(repr_simd, intrinsics)] +#![feature(repr_simd, core_intrinsics)] #![allow(incomplete_features)] #![feature(adt_const_params)] use std::marker::ConstParamTy; -#[rustc_intrinsic] -unsafe fn simd_shuffle<T, I, U>(a: T, b: T, i: I) -> U; +use std::intrinsics::simd::simd_shuffle; #[derive(Copy, Clone, ConstParamTy, PartialEq, Eq)] #[repr(simd)] diff --git a/tests/ui/simd/simd-bitmask-notpow2.rs b/tests/ui/simd/simd-bitmask-notpow2.rs index d7572ef4a2a..4935097065e 100644 --- a/tests/ui/simd/simd-bitmask-notpow2.rs +++ b/tests/ui/simd/simd-bitmask-notpow2.rs @@ -2,14 +2,9 @@ // FIXME: broken codegen on big-endian (https://github.com/rust-lang/rust/issues/127205) // This should be merged into `simd-bitmask` once that's fixed. //@ ignore-endian-big -#![feature(repr_simd, intrinsics)] - -#[rustc_intrinsic] -unsafe fn simd_bitmask<T, U>(v: T) -> U; - -#[rustc_intrinsic] -unsafe fn simd_select_bitmask<T, U>(m: T, a: U, b: U) -> U; +#![feature(repr_simd, core_intrinsics)] +use std::intrinsics::simd::{simd_bitmask, simd_select_bitmask}; fn main() { // Non-power-of-2 multi-byte mask. diff --git a/tests/ui/simd/simd-bitmask.rs b/tests/ui/simd/simd-bitmask.rs index 4275ab0f40c..6fcceeaa24b 100644 --- a/tests/ui/simd/simd-bitmask.rs +++ b/tests/ui/simd/simd-bitmask.rs @@ -1,12 +1,7 @@ //@run-pass -#![feature(repr_simd, intrinsics)] - -#[rustc_intrinsic] -unsafe fn simd_bitmask<T, U>(v: T) -> U; - -#[rustc_intrinsic] -unsafe fn simd_select_bitmask<T, U>(m: T, a: U, b: U) -> U; +#![feature(repr_simd, core_intrinsics)] +use std::intrinsics::simd::{simd_bitmask, simd_select_bitmask}; #[derive(Copy, Clone)] #[repr(simd)] diff --git a/tests/ui/sized/coinductive-1.rs b/tests/ui/sized/coinductive-1.rs index 3c1ee557af7..42dd8d1f604 100644 --- a/tests/ui/sized/coinductive-1.rs +++ b/tests/ui/sized/coinductive-1.rs @@ -1,4 +1,7 @@ //@ check-pass +//@ revisions: current next +//@ ignore-compare-mode-next-solver (explicit revisions) +//@[next] compile-flags: -Znext-solver struct Node<C: Trait<Self>>(C::Assoc); trait Trait<T> { diff --git a/tests/ui/specialization/defaultimpl/validation.rs b/tests/ui/specialization/defaultimpl/validation.rs index 4049c4ea14c..14771be8982 100644 --- a/tests/ui/specialization/defaultimpl/validation.rs +++ b/tests/ui/specialization/defaultimpl/validation.rs @@ -6,12 +6,17 @@ struct Z; default impl S {} //~ ERROR inherent impls cannot be `default` -default unsafe impl Send for S {} //~ ERROR impls of auto traits cannot be default -//~^ ERROR `S` cannot be sent between threads safely -default impl !Send for Z {} //~ ERROR impls of auto traits cannot be default - //~^ ERROR negative impls cannot be default impls +default unsafe impl Send for S {} +//~^ ERROR impls of auto traits cannot be default + +default impl !Send for Z {} +//~^ ERROR impls of auto traits cannot be default +//~| ERROR negative impls cannot be default impls +//~| ERROR `!Send` impl requires `Z: Send` but the struct it is implemented for does not trait Tr {} -default impl !Tr for S {} //~ ERROR negative impls cannot be default impls + +default impl !Tr for S {} +//~^ ERROR negative impls cannot be default impls fn main() {} diff --git a/tests/ui/specialization/defaultimpl/validation.stderr b/tests/ui/specialization/defaultimpl/validation.stderr index f56f16162a2..d034386b842 100644 --- a/tests/ui/specialization/defaultimpl/validation.stderr +++ b/tests/ui/specialization/defaultimpl/validation.stderr @@ -26,22 +26,20 @@ LL | default unsafe impl Send for S {} | | | default because of this -error[E0277]: `S` cannot be sent between threads safely - --> $DIR/validation.rs:9:1 +error[E0367]: `!Send` impl requires `Z: Send` but the struct it is implemented for does not + --> $DIR/validation.rs:12:1 | -LL | default unsafe impl Send for S {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `S` cannot be sent between threads safely - | - = help: the trait `Send` is not implemented for `S` - = help: the trait `Send` is implemented for `S` - = help: see issue #48214 -help: add `#![feature(trivial_bounds)]` to the crate attributes to enable +LL | default impl !Send for Z {} + | ^^^^^^^^^^^^^^^^^^^^^^^^ | -LL + #![feature(trivial_bounds)] +note: the implementor must specify the same requirement + --> $DIR/validation.rs:5:1 | +LL | struct Z; + | ^^^^^^^^ error: impls of auto traits cannot be default - --> $DIR/validation.rs:11:15 + --> $DIR/validation.rs:12:15 | LL | default impl !Send for Z {} | ------- ^^^^ auto trait @@ -49,18 +47,18 @@ LL | default impl !Send for Z {} | default because of this error[E0750]: negative impls cannot be default impls - --> $DIR/validation.rs:11:1 + --> $DIR/validation.rs:12:1 | LL | default impl !Send for Z {} | ^^^^^^^ ^ error[E0750]: negative impls cannot be default impls - --> $DIR/validation.rs:15:1 + --> $DIR/validation.rs:19:1 | LL | default impl !Tr for S {} | ^^^^^^^ ^ error: aborting due to 6 previous errors; 1 warning emitted -Some errors have detailed explanations: E0277, E0750. -For more information about an error, try `rustc --explain E0277`. +Some errors have detailed explanations: E0367, E0750. +For more information about an error, try `rustc --explain E0367`. diff --git a/tests/ui/specialization/specialization-overlap-negative.rs b/tests/ui/specialization/specialization-overlap-negative.rs index 550d3708295..244f21c7ba9 100644 --- a/tests/ui/specialization/specialization-overlap-negative.rs +++ b/tests/ui/specialization/specialization-overlap-negative.rs @@ -6,6 +6,8 @@ trait MyTrait {} struct TestType<T>(::std::marker::PhantomData<T>); unsafe impl<T: Clone> Send for TestType<T> {} -impl<T: MyTrait> !Send for TestType<T> {} //~ ERROR E0751 +impl<T: MyTrait> !Send for TestType<T> {} +//~^ ERROR found both positive and negative implementation of trait `Send` for type `TestType<_>` +//~| ERROR `!Send` impl requires `T: MyTrait` but the struct it is implemented for does not fn main() {} diff --git a/tests/ui/specialization/specialization-overlap-negative.stderr b/tests/ui/specialization/specialization-overlap-negative.stderr index a8e99953e2b..4874e897726 100644 --- a/tests/ui/specialization/specialization-overlap-negative.stderr +++ b/tests/ui/specialization/specialization-overlap-negative.stderr @@ -16,6 +16,19 @@ LL | unsafe impl<T: Clone> Send for TestType<T> {} LL | impl<T: MyTrait> !Send for TestType<T> {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ negative implementation here -error: aborting due to 1 previous error; 1 warning emitted +error[E0367]: `!Send` impl requires `T: MyTrait` but the struct it is implemented for does not + --> $DIR/specialization-overlap-negative.rs:9:9 + | +LL | impl<T: MyTrait> !Send for TestType<T> {} + | ^^^^^^^ + | +note: the implementor must specify the same requirement + --> $DIR/specialization-overlap-negative.rs:6:1 + | +LL | struct TestType<T>(::std::marker::PhantomData<T>); + | ^^^^^^^^^^^^^^^^^^ + +error: aborting due to 2 previous errors; 1 warning emitted -For more information about this error, try `rustc --explain E0751`. +Some errors have detailed explanations: E0367, E0751. +For more information about an error, try `rustc --explain E0367`. diff --git a/tests/ui/stability-attribute/stability-attribute-sanity.rs b/tests/ui/stability-attribute/stability-attribute-sanity.rs index 7857a0603bd..f46e35e1a72 100644 --- a/tests/ui/stability-attribute/stability-attribute-sanity.rs +++ b/tests/ui/stability-attribute/stability-attribute-sanity.rs @@ -8,16 +8,16 @@ mod bogus_attribute_types_1 { #[stable(feature = "a", since = "4.4.4", reason)] //~ ERROR unknown meta item 'reason' [E0541] fn f1() { } - #[stable(feature = "a", since)] //~ ERROR incorrect meta item [E0539] + #[stable(feature = "a", since)] //~ ERROR expected a quoted string literal [E0539] fn f2() { } - #[stable(feature, since = "3.3.3")] //~ ERROR incorrect meta item [E0539] + #[stable(feature, since = "3.3.3")] //~ ERROR expected a quoted string literal [E0539] fn f3() { } - #[stable(feature = "a", since(b))] //~ ERROR incorrect meta item [E0539] + #[stable(feature = "a", since(b))] //~ ERROR expected a quoted string literal [E0539] fn f5() { } - #[stable(feature(b), since = "3.3.3")] //~ ERROR incorrect meta item [E0539] + #[stable(feature(b), since = "3.3.3")] //~ ERROR expected a quoted string literal [E0539] fn f6() { } } diff --git a/tests/ui/stability-attribute/stability-attribute-sanity.stderr b/tests/ui/stability-attribute/stability-attribute-sanity.stderr index c614fc2b9f7..2e2b5b509c8 100644 --- a/tests/ui/stability-attribute/stability-attribute-sanity.stderr +++ b/tests/ui/stability-attribute/stability-attribute-sanity.stderr @@ -1,40 +1,28 @@ -error: multiple `deprecated` attributes - --> $DIR/stability-attribute-sanity.rs:62:1 - | -LL | #[deprecated(since = "5.5.5", note = "text")] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute - | -note: attribute also specified here - --> $DIR/stability-attribute-sanity.rs:61:1 - | -LL | #[deprecated(since = "5.5.5", note = "text")] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - error[E0541]: unknown meta item 'reason' --> $DIR/stability-attribute-sanity.rs:8:46 | LL | #[stable(feature = "a", since = "4.4.4", reason)] | ^^^^^^ expected one of `feature`, `since` -error[E0539]: incorrect meta item +error[E0539]: expected a quoted string literal --> $DIR/stability-attribute-sanity.rs:11:29 | LL | #[stable(feature = "a", since)] | ^^^^^ -error[E0539]: incorrect meta item +error[E0539]: expected a quoted string literal --> $DIR/stability-attribute-sanity.rs:14:14 | LL | #[stable(feature, since = "3.3.3")] | ^^^^^^^ -error[E0539]: incorrect meta item +error[E0539]: expected a quoted string literal --> $DIR/stability-attribute-sanity.rs:17:29 | LL | #[stable(feature = "a", since(b))] | ^^^^^^^^ -error[E0539]: incorrect meta item +error[E0539]: expected a quoted string literal --> $DIR/stability-attribute-sanity.rs:20:14 | LL | #[stable(feature(b), since = "3.3.3")] @@ -100,6 +88,18 @@ error: 'since' must be a Rust version number, such as "1.31.0" LL | #[stable(feature = "e", since = "b")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +error: multiple `deprecated` attributes + --> $DIR/stability-attribute-sanity.rs:62:1 + | +LL | #[deprecated(since = "5.5.5", note = "text")] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute + | +note: attribute also specified here + --> $DIR/stability-attribute-sanity.rs:61:1 + | +LL | #[deprecated(since = "5.5.5", note = "text")] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + error[E0544]: multiple stability levels --> $DIR/stability-attribute-sanity.rs:64:1 | diff --git a/tests/ui/static/issue-24446.stderr b/tests/ui/static/issue-24446.stderr index 033caf07d8e..0e6e338c5ef 100644 --- a/tests/ui/static/issue-24446.stderr +++ b/tests/ui/static/issue-24446.stderr @@ -14,6 +14,7 @@ LL | static foo: dyn Fn() -> u32 = || -> u32 { | ^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | = help: the trait `Sized` is not implemented for `(dyn Fn() -> u32 + 'static)` + = note: statics and constants must have a statically known size error[E0308]: mismatched types --> $DIR/issue-24446.rs:2:35 diff --git a/tests/ui/static/static_sized_requirement.rs b/tests/ui/static/static_sized_requirement.rs index 80f93dea054..25e1359607c 100644 --- a/tests/ui/static/static_sized_requirement.rs +++ b/tests/ui/static/static_sized_requirement.rs @@ -1,11 +1,12 @@ -//@ build-pass (FIXME(62277): could be check-pass?) +//@ add-core-stubs +//@ check-pass #![feature(no_core, lang_items)] #![no_core] #![crate_type = "lib"] -#[lang = "sized"] -trait Sized {} +extern crate minicore; +use minicore::*; extern "C" { pub static A: u32; diff --git a/tests/ui/statics/unsized_type2.stderr b/tests/ui/statics/unsized_type2.stderr index ffbbe218c87..3f9b0879c16 100644 --- a/tests/ui/statics/unsized_type2.stderr +++ b/tests/ui/statics/unsized_type2.stderr @@ -10,6 +10,7 @@ note: required because it appears within the type `Foo` | LL | pub struct Foo { | ^^^ + = note: statics and constants must have a statically known size error[E0308]: mismatched types --> $DIR/unsized_type2.rs:14:45 diff --git a/tests/ui/stats/input-stats.stderr b/tests/ui/stats/input-stats.stderr index 9b1568fa116..dbc9e7d254c 100644 --- a/tests/ui/stats/input-stats.stderr +++ b/tests/ui/stats/input-stats.stderr @@ -8,8 +8,8 @@ ast-stats-1 ExprField 48 ( 0.7%) 1 48 ast-stats-1 Attribute 64 ( 1.0%) 2 32 ast-stats-1 - DocComment 32 ( 0.5%) 1 ast-stats-1 - Normal 32 ( 0.5%) 1 -ast-stats-1 WherePredicate 64 ( 1.0%) 1 64 -ast-stats-1 - BoundPredicate 64 ( 1.0%) 1 +ast-stats-1 WherePredicate 72 ( 1.1%) 1 72 +ast-stats-1 - BoundPredicate 72 ( 1.1%) 1 ast-stats-1 Local 80 ( 1.2%) 1 80 ast-stats-1 ForeignItem 88 ( 1.3%) 1 88 ast-stats-1 - Fn 88 ( 1.3%) 1 @@ -37,14 +37,14 @@ ast-stats-1 Expr 576 ( 8.6%) 8 72 ast-stats-1 - Match 72 ( 1.1%) 1 ast-stats-1 - Path 72 ( 1.1%) 1 ast-stats-1 - Struct 72 ( 1.1%) 1 -ast-stats-1 - Lit 144 ( 2.2%) 2 +ast-stats-1 - Lit 144 ( 2.1%) 2 ast-stats-1 - Block 216 ( 3.2%) 3 ast-stats-1 PathSegment 744 (11.1%) 31 24 ast-stats-1 Ty 896 (13.4%) 14 64 ast-stats-1 - Ptr 64 ( 1.0%) 1 ast-stats-1 - Ref 64 ( 1.0%) 1 ast-stats-1 - ImplicitSelf 128 ( 1.9%) 2 -ast-stats-1 - Path 640 ( 9.6%) 10 +ast-stats-1 - Path 640 ( 9.5%) 10 ast-stats-1 Item 1_224 (18.3%) 9 136 ast-stats-1 - Enum 136 ( 2.0%) 1 ast-stats-1 - ForeignMod 136 ( 2.0%) 1 @@ -53,7 +53,7 @@ ast-stats-1 - Trait 136 ( 2.0%) 1 ast-stats-1 - Fn 272 ( 4.1%) 2 ast-stats-1 - Use 408 ( 6.1%) 3 ast-stats-1 ---------------------------------------------------------------- -ast-stats-1 Total 6_696 116 +ast-stats-1 Total 6_704 116 ast-stats-1 ast-stats-2 POST EXPANSION AST STATS ast-stats-2 Name Accumulated Size Count Item Size @@ -62,8 +62,8 @@ ast-stats-2 Crate 40 ( 0.5%) 1 40 ast-stats-2 GenericArgs 40 ( 0.5%) 1 40 ast-stats-2 - AngleBracketed 40 ( 0.5%) 1 ast-stats-2 ExprField 48 ( 0.7%) 1 48 -ast-stats-2 WherePredicate 64 ( 0.9%) 1 64 -ast-stats-2 - BoundPredicate 64 ( 0.9%) 1 +ast-stats-2 WherePredicate 72 ( 1.0%) 1 72 +ast-stats-2 - BoundPredicate 72 ( 1.0%) 1 ast-stats-2 Local 80 ( 1.1%) 1 80 ast-stats-2 ForeignItem 88 ( 1.2%) 1 88 ast-stats-2 - Fn 88 ( 1.2%) 1 @@ -104,16 +104,16 @@ ast-stats-2 - Ptr 64 ( 0.9%) 1 ast-stats-2 - Ref 64 ( 0.9%) 1 ast-stats-2 - ImplicitSelf 128 ( 1.7%) 2 ast-stats-2 - Path 640 ( 8.7%) 10 -ast-stats-2 Item 1_496 (20.4%) 11 136 -ast-stats-2 - Enum 136 ( 1.9%) 1 -ast-stats-2 - ExternCrate 136 ( 1.9%) 1 -ast-stats-2 - ForeignMod 136 ( 1.9%) 1 -ast-stats-2 - Impl 136 ( 1.9%) 1 -ast-stats-2 - Trait 136 ( 1.9%) 1 +ast-stats-2 Item 1_496 (20.3%) 11 136 +ast-stats-2 - Enum 136 ( 1.8%) 1 +ast-stats-2 - ExternCrate 136 ( 1.8%) 1 +ast-stats-2 - ForeignMod 136 ( 1.8%) 1 +ast-stats-2 - Impl 136 ( 1.8%) 1 +ast-stats-2 - Trait 136 ( 1.8%) 1 ast-stats-2 - Fn 272 ( 3.7%) 2 ast-stats-2 - Use 544 ( 7.4%) 4 ast-stats-2 ---------------------------------------------------------------- -ast-stats-2 Total 7_344 127 +ast-stats-2 Total 7_352 127 ast-stats-2 hir-stats HIR STATS hir-stats Name Accumulated Size Count Item Size diff --git a/tests/ui/structs/default-field-values/do-not-ice-on-invalid-lifetime.rs b/tests/ui/structs/default-field-values/do-not-ice-on-invalid-lifetime.rs index 71d90ddd935..ba99b03539c 100644 --- a/tests/ui/structs/default-field-values/do-not-ice-on-invalid-lifetime.rs +++ b/tests/ui/structs/default-field-values/do-not-ice-on-invalid-lifetime.rs @@ -1,5 +1,5 @@ #![feature(default_field_values)] -struct A<'a> { //~ ERROR lifetime parameter `'a` is never used +struct A<'a> { x: Vec<A> = Vec::new(), //~ ERROR missing lifetime specifier } diff --git a/tests/ui/structs/default-field-values/do-not-ice-on-invalid-lifetime.stderr b/tests/ui/structs/default-field-values/do-not-ice-on-invalid-lifetime.stderr index 20b9afe80cd..7100efc695c 100644 --- a/tests/ui/structs/default-field-values/do-not-ice-on-invalid-lifetime.stderr +++ b/tests/ui/structs/default-field-values/do-not-ice-on-invalid-lifetime.stderr @@ -9,15 +9,6 @@ help: consider using the `'a` lifetime LL | x: Vec<A<'a>> = Vec::new(), | ++++ -error[E0392]: lifetime parameter `'a` is never used - --> $DIR/do-not-ice-on-invalid-lifetime.rs:2:10 - | -LL | struct A<'a> { - | ^^ unused lifetime parameter - | - = help: consider removing `'a`, referring to it in a field, or using a marker such as `PhantomData` - -error: aborting due to 2 previous errors +error: aborting due to 1 previous error -Some errors have detailed explanations: E0106, E0392. -For more information about an error, try `rustc --explain E0106`. +For more information about this error, try `rustc --explain E0106`. diff --git a/tests/ui/structs/default-field-values/failures.rs b/tests/ui/structs/default-field-values/failures.rs index 0ac071d91d6..1e94eecb4f8 100644 --- a/tests/ui/structs/default-field-values/failures.rs +++ b/tests/ui/structs/default-field-values/failures.rs @@ -17,9 +17,9 @@ pub struct Bar { #[derive(Default)] pub struct Qux<const C: i32> { - bar: S = Self::S, //~ ERROR generic `Self` types are currently not permitted in anonymous constants + bar: S = Self::S, baz: i32 = foo(), - bat: i32 = <Qux<{ C }> as T>::K, //~ ERROR generic parameters may not be used in const operations + bat: i32 = <Qux<{ C }> as T>::K, bay: i32 = C, } diff --git a/tests/ui/structs/default-field-values/failures.stderr b/tests/ui/structs/default-field-values/failures.stderr index 65ec100fe2e..50553816462 100644 --- a/tests/ui/structs/default-field-values/failures.stderr +++ b/tests/ui/structs/default-field-values/failures.stderr @@ -6,27 +6,12 @@ LL | Variant {} | = help: consider a manual implementation of `Default` -error: generic parameters may not be used in const operations - --> $DIR/failures.rs:22:23 - | -LL | bat: i32 = <Qux<{ C }> as T>::K, - | ^ cannot perform const operation using `C` - | - = help: const parameters may only be used as standalone arguments, i.e. `C` - = help: add `#![feature(generic_const_exprs)]` to allow generic const expressions - error: default fields are not supported in tuple structs --> $DIR/failures.rs:26:22 | LL | pub struct Rak(i32 = 42); | ^^ default fields are only supported on structs -error: generic `Self` types are currently not permitted in anonymous constants - --> $DIR/failures.rs:20:14 - | -LL | bar: S = Self::S, - | ^^^^ - error[E0277]: the trait bound `S: Default` is not satisfied --> $DIR/failures.rs:14:5 | @@ -112,7 +97,7 @@ LL - let _ = Rak(.., 0); LL + let _ = Rak(0); | -error: aborting due to 9 previous errors +error: aborting due to 7 previous errors Some errors have detailed explanations: E0061, E0277, E0308. For more information about an error, try `rustc --explain E0061`. diff --git a/tests/ui/structs/default-field-values/field-references-param.rs b/tests/ui/structs/default-field-values/field-references-param.rs new file mode 100644 index 00000000000..ecee37edd42 --- /dev/null +++ b/tests/ui/structs/default-field-values/field-references-param.rs @@ -0,0 +1,29 @@ +//@ build-pass + +#![feature(default_field_values)] + +struct W<const X: usize>; + +impl<const X: usize> W<X> { + const fn new() -> Self { W } +} + +struct Z<const X: usize> { + // No inference. + one: W<X> = W::<X>::new(), + + // Inference works too. + two: W<X> = W::new(), + + // An anon const that is too generic before substitution. + too_generic: usize = X + 1, +} + +fn use_generically<const X: usize>() { + let x: Z<X> = Z { .. }; +} + +fn main() { + let x: Z<0> = Z { .. }; + use_generically::<0>(); +} diff --git a/tests/ui/structs/default-field-values/invalid-const.stderr b/tests/ui/structs/default-field-values/invalid-const.stderr index f4a3437031b..56d20d8d711 100644 --- a/tests/ui/structs/default-field-values/invalid-const.stderr +++ b/tests/ui/structs/default-field-values/invalid-const.stderr @@ -2,7 +2,7 @@ error[E0080]: evaluation of constant value failed --> $DIR/invalid-const.rs:5:19 | LL | pub bax: u8 = panic!("asdf"), - | ^^^^^^^^^^^^^^ the evaluated program panicked at 'asdf', $DIR/invalid-const.rs:5:19 + | ^^^^^^^^^^^^^^ evaluation panicked: asdf | = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/tests/ui/structs/default-field-values/post-mono.direct.stderr b/tests/ui/structs/default-field-values/post-mono.direct.stderr new file mode 100644 index 00000000000..cdd80620c48 --- /dev/null +++ b/tests/ui/structs/default-field-values/post-mono.direct.stderr @@ -0,0 +1,23 @@ +error[E0080]: evaluation of `Z::<1>::post_mono::{constant#0}` failed + --> $DIR/post-mono.rs:7:24 + | +LL | post_mono: usize = X / 0, + | ^^^^^ attempt to divide `1_usize` by zero + +note: erroneous constant encountered + --> $DIR/post-mono.rs:17:19 + | +LL | let x: Z<1> = Z { .. }; + | ^^^^^^^^ + +note: erroneous constant encountered + --> $DIR/post-mono.rs:17:19 + | +LL | let x: Z<1> = Z { .. }; + | ^^^^^^^^ + | + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0080`. diff --git a/tests/ui/structs/default-field-values/post-mono.indirect.stderr b/tests/ui/structs/default-field-values/post-mono.indirect.stderr new file mode 100644 index 00000000000..56c27a6e5dc --- /dev/null +++ b/tests/ui/structs/default-field-values/post-mono.indirect.stderr @@ -0,0 +1,29 @@ +error[E0080]: evaluation of `Z::<1>::post_mono::{constant#0}` failed + --> $DIR/post-mono.rs:7:24 + | +LL | post_mono: usize = X / 0, + | ^^^^^ attempt to divide `1_usize` by zero + +note: erroneous constant encountered + --> $DIR/post-mono.rs:12:19 + | +LL | let x: Z<X> = Z { .. }; + | ^^^^^^^^ + +note: erroneous constant encountered + --> $DIR/post-mono.rs:12:19 + | +LL | let x: Z<X> = Z { .. }; + | ^^^^^^^^ + | + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + +note: the above error was encountered while instantiating `fn indirect::<1>` + --> $DIR/post-mono.rs:22:5 + | +LL | indirect::<1>(); + | ^^^^^^^^^^^^^^^ + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0080`. diff --git a/tests/ui/structs/default-field-values/post-mono.rs b/tests/ui/structs/default-field-values/post-mono.rs new file mode 100644 index 00000000000..4de31f6e2fb --- /dev/null +++ b/tests/ui/structs/default-field-values/post-mono.rs @@ -0,0 +1,23 @@ +//@ build-fail +//@ revisions: direct indirect + +#![feature(default_field_values)] + +struct Z<const X: usize> { + post_mono: usize = X / 0, + //~^ ERROR evaluation of `Z::<1>::post_mono::{constant#0}` failed +} + +fn indirect<const X: usize>() { + let x: Z<X> = Z { .. }; +} + +#[cfg(direct)] +fn main() { + let x: Z<1> = Z { .. }; +} + +#[cfg(indirect)] +fn main() { + indirect::<1>(); +} diff --git a/tests/ui/structs/ident-from-macro-expansion.rs b/tests/ui/structs/ident-from-macro-expansion.rs new file mode 100644 index 00000000000..56d31a42561 --- /dev/null +++ b/tests/ui/structs/ident-from-macro-expansion.rs @@ -0,0 +1,19 @@ +struct Foo { + inner: Inner, +} + +struct Inner { + y: i32, +} + +macro_rules! access { + ($expr:expr, $ident:ident) => { + $expr.$ident + } +} + +fn main() { + let k = Foo { inner: Inner { y: 0 } }; + access!(k, y); + //~^ ERROR no field `y` on type `Foo` +} diff --git a/tests/ui/structs/ident-from-macro-expansion.stderr b/tests/ui/structs/ident-from-macro-expansion.stderr new file mode 100644 index 00000000000..be2ab7c2e99 --- /dev/null +++ b/tests/ui/structs/ident-from-macro-expansion.stderr @@ -0,0 +1,14 @@ +error[E0609]: no field `y` on type `Foo` + --> $DIR/ident-from-macro-expansion.rs:17:16 + | +LL | $expr.$ident + | ------ due to this macro variable +... +LL | access!(k, y); + | ^ unknown field + | + = note: available field is: `inner` + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0609`. diff --git a/tests/ui/suggestions/abi-typo.stderr b/tests/ui/suggestions/abi-typo.stderr index 5195c43220b..4d89ac16570 100644 --- a/tests/ui/suggestions/abi-typo.stderr +++ b/tests/ui/suggestions/abi-typo.stderr @@ -2,12 +2,14 @@ error[E0703]: invalid ABI: found `cdedl` --> $DIR/abi-typo.rs:2:8 | LL | extern "cdedl" fn cdedl() {} - | ^^^^^^^ - | | - | invalid ABI - | help: did you mean: `"cdecl"` + | ^^^^^^^ invalid ABI | = note: invoke `rustc --print=calling-conventions` for a full list of supported calling conventions +help: there's a similarly named valid ABI `cdecl` + | +LL - extern "cdedl" fn cdedl() {} +LL + extern "cdecl" fn cdedl() {} + | error: aborting due to 1 previous error diff --git a/tests/ui/suggestions/impl-trait-missing-lifetime-gated.rs b/tests/ui/suggestions/impl-trait-missing-lifetime-gated.rs index daec66709b6..443a7e3835e 100644 --- a/tests/ui/suggestions/impl-trait-missing-lifetime-gated.rs +++ b/tests/ui/suggestions/impl-trait-missing-lifetime-gated.rs @@ -18,7 +18,6 @@ mod elided { // But that lifetime does not participate in resolution. async fn i(mut x: impl Iterator<Item = &()>) -> Option<&()> { x.next() } //~^ ERROR missing lifetime specifier - //~| ERROR lifetime may not live long enough } mod underscore { @@ -37,7 +36,6 @@ mod underscore { // But that lifetime does not participate in resolution. async fn i(mut x: impl Iterator<Item = &'_ ()>) -> Option<&'_ ()> { x.next() } //~^ ERROR missing lifetime specifier - //~| ERROR lifetime may not live long enough } mod alone_in_path { diff --git a/tests/ui/suggestions/impl-trait-missing-lifetime-gated.stderr b/tests/ui/suggestions/impl-trait-missing-lifetime-gated.stderr index 204209179ad..24013c85c87 100644 --- a/tests/ui/suggestions/impl-trait-missing-lifetime-gated.stderr +++ b/tests/ui/suggestions/impl-trait-missing-lifetime-gated.stderr @@ -41,7 +41,7 @@ LL + async fn i(mut x: impl Iterator<Item = &()>) -> Option<()> { x.next() } | error[E0106]: missing lifetime specifier - --> $DIR/impl-trait-missing-lifetime-gated.rs:28:58 + --> $DIR/impl-trait-missing-lifetime-gated.rs:27:58 | LL | fn g(mut x: impl Iterator<Item = &'_ ()>) -> Option<&'_ ()> { x.next() } | ^^ expected named lifetime parameter @@ -64,7 +64,7 @@ LL + fn g(mut x: impl Iterator<Item = &'_ ()>) -> Option<()> { x.next() } | error[E0106]: missing lifetime specifier - --> $DIR/impl-trait-missing-lifetime-gated.rs:38:64 + --> $DIR/impl-trait-missing-lifetime-gated.rs:37:64 | LL | async fn i(mut x: impl Iterator<Item = &'_ ()>) -> Option<&'_ ()> { x.next() } | ^^ expected named lifetime parameter @@ -87,7 +87,7 @@ LL + async fn i(mut x: impl Iterator<Item = &'_ ()>) -> Option<()> { x.next( | error[E0106]: missing lifetime specifier - --> $DIR/impl-trait-missing-lifetime-gated.rs:49:37 + --> $DIR/impl-trait-missing-lifetime-gated.rs:47:37 | LL | fn g(mut x: impl Foo) -> Option<&()> { x.next() } | ^ expected named lifetime parameter @@ -108,7 +108,7 @@ LL + fn g(mut x: impl Foo) -> Option<()> { x.next() } | error[E0106]: missing lifetime specifier - --> $DIR/impl-trait-missing-lifetime-gated.rs:60:41 + --> $DIR/impl-trait-missing-lifetime-gated.rs:58:41 | LL | fn g(mut x: impl Foo<()>) -> Option<&()> { x.next() } | ^ expected named lifetime parameter @@ -129,7 +129,7 @@ LL + fn g(mut x: impl Foo<()>) -> Option<()> { x.next() } | warning: elided lifetime has a name - --> $DIR/impl-trait-missing-lifetime-gated.rs:66:57 + --> $DIR/impl-trait-missing-lifetime-gated.rs:64:57 | LL | fn resolved_anonymous<'a, T: 'a>(f: impl Fn(&'a str) -> &T) { | -- lifetime `'a` declared here ^ this elided lifetime gets resolved as `'a` @@ -162,16 +162,8 @@ help: consider introducing a named lifetime parameter LL | fn g<'a>(mut x: impl Iterator<Item = &'a ()>) -> Option<&()> { x.next() } | ++++ ++ -error: lifetime may not live long enough - --> $DIR/impl-trait-missing-lifetime-gated.rs:19:67 - | -LL | async fn i(mut x: impl Iterator<Item = &()>) -> Option<&()> { x.next() } - | ----------------------------------------------------------- ^^^^^^^^ returning this value requires that `'1` must outlive `'static` - | | - | return type `impl Future<Output = Option<&'static ()>>` contains a lifetime `'1` - error[E0658]: anonymous lifetimes in `impl Trait` are unstable - --> $DIR/impl-trait-missing-lifetime-gated.rs:25:35 + --> $DIR/impl-trait-missing-lifetime-gated.rs:24:35 | LL | fn f(_: impl Iterator<Item = &'_ ()>) {} | ^^ expected named lifetime parameter @@ -185,7 +177,7 @@ LL + fn f<'a>(_: impl Iterator<Item = &'a ()>) {} | error[E0658]: anonymous lifetimes in `impl Trait` are unstable - --> $DIR/impl-trait-missing-lifetime-gated.rs:28:39 + --> $DIR/impl-trait-missing-lifetime-gated.rs:27:39 | LL | fn g(mut x: impl Iterator<Item = &'_ ()>) -> Option<&'_ ()> { x.next() } | ^^ expected named lifetime parameter @@ -198,16 +190,8 @@ LL - fn g(mut x: impl Iterator<Item = &'_ ()>) -> Option<&'_ ()> { x.next() LL + fn g<'a>(mut x: impl Iterator<Item = &'a ()>) -> Option<&'_ ()> { x.next() } | -error: lifetime may not live long enough - --> $DIR/impl-trait-missing-lifetime-gated.rs:38:73 - | -LL | async fn i(mut x: impl Iterator<Item = &'_ ()>) -> Option<&'_ ()> { x.next() } - | ----------------------------------------------------------------- ^^^^^^^^ returning this value requires that `'1` must outlive `'static` - | | - | return type `impl Future<Output = Option<&'static ()>>` contains a lifetime `'1` - error[E0658]: anonymous lifetimes in `impl Trait` are unstable - --> $DIR/impl-trait-missing-lifetime-gated.rs:46:18 + --> $DIR/impl-trait-missing-lifetime-gated.rs:44:18 | LL | fn f(_: impl Foo) {} | ^^^ expected named lifetime parameter @@ -220,7 +204,7 @@ LL | fn f<'a>(_: impl Foo<'a>) {} | ++++ ++++ error[E0658]: anonymous lifetimes in `impl Trait` are unstable - --> $DIR/impl-trait-missing-lifetime-gated.rs:49:22 + --> $DIR/impl-trait-missing-lifetime-gated.rs:47:22 | LL | fn g(mut x: impl Foo) -> Option<&()> { x.next() } | ^^^ expected named lifetime parameter @@ -233,7 +217,7 @@ LL | fn g<'a>(mut x: impl Foo<'a>) -> Option<&()> { x.next() } | ++++ ++++ error[E0658]: anonymous lifetimes in `impl Trait` are unstable - --> $DIR/impl-trait-missing-lifetime-gated.rs:57:22 + --> $DIR/impl-trait-missing-lifetime-gated.rs:55:22 | LL | fn f(_: impl Foo<()>) {} | ^ expected named lifetime parameter @@ -246,7 +230,7 @@ LL | fn f<'a>(_: impl Foo<'a, ()>) {} | ++++ +++ error[E0658]: anonymous lifetimes in `impl Trait` are unstable - --> $DIR/impl-trait-missing-lifetime-gated.rs:60:26 + --> $DIR/impl-trait-missing-lifetime-gated.rs:58:26 | LL | fn g(mut x: impl Foo<()>) -> Option<&()> { x.next() } | ^ expected named lifetime parameter @@ -258,7 +242,7 @@ help: consider introducing a named lifetime parameter LL | fn g<'a>(mut x: impl Foo<'a, ()>) -> Option<&()> { x.next() } | ++++ +++ -error: aborting due to 16 previous errors; 1 warning emitted +error: aborting due to 14 previous errors; 1 warning emitted Some errors have detailed explanations: E0106, E0658. For more information about an error, try `rustc --explain E0106`. diff --git a/tests/ui/suggestions/impl-trait-missing-lifetime.rs b/tests/ui/suggestions/impl-trait-missing-lifetime.rs index 12dc0e8216b..27f03431d09 100644 --- a/tests/ui/suggestions/impl-trait-missing-lifetime.rs +++ b/tests/ui/suggestions/impl-trait-missing-lifetime.rs @@ -8,7 +8,6 @@ fn f(_: impl Iterator<Item = &'_ ()>) {} // But that lifetime does not participate in resolution. fn g(mut x: impl Iterator<Item = &'_ ()>) -> Option<&'_ ()> { x.next() } //~^ ERROR missing lifetime specifier -//~| ERROR lifetime may not live long enough // This is understood as `fn foo<'_1>(_: impl Iterator<Item = &'_1 ()>) {}`. async fn h(_: impl Iterator<Item = &'_ ()>) {} @@ -16,6 +15,5 @@ async fn h(_: impl Iterator<Item = &'_ ()>) {} // But that lifetime does not participate in resolution. async fn i(mut x: impl Iterator<Item = &'_ ()>) -> Option<&'_ ()> { x.next() } //~^ ERROR missing lifetime specifier -//~| ERROR lifetime may not live long enough fn main() {} diff --git a/tests/ui/suggestions/impl-trait-missing-lifetime.stderr b/tests/ui/suggestions/impl-trait-missing-lifetime.stderr index dfbc883680b..c09c575c147 100644 --- a/tests/ui/suggestions/impl-trait-missing-lifetime.stderr +++ b/tests/ui/suggestions/impl-trait-missing-lifetime.stderr @@ -22,7 +22,7 @@ LL + fn g(mut x: impl Iterator<Item = &'_ ()>) -> Option<()> { x.next() } | error[E0106]: missing lifetime specifier - --> $DIR/impl-trait-missing-lifetime.rs:17:60 + --> $DIR/impl-trait-missing-lifetime.rs:16:60 | LL | async fn i(mut x: impl Iterator<Item = &'_ ()>) -> Option<&'_ ()> { x.next() } | ^^ expected named lifetime parameter @@ -44,20 +44,6 @@ LL - async fn i(mut x: impl Iterator<Item = &'_ ()>) -> Option<&'_ ()> { x.next( LL + async fn i(mut x: impl Iterator<Item = &'_ ()>) -> Option<()> { x.next() } | -error: lifetime may not live long enough - --> $DIR/impl-trait-missing-lifetime.rs:17:69 - | -LL | async fn i(mut x: impl Iterator<Item = &'_ ()>) -> Option<&'_ ()> { x.next() } - | ----------------------------------------------------------------- ^^^^^^^^ returning this value requires that `'1` must outlive `'static` - | | - | return type `impl Future<Output = Option<&'static ()>>` contains a lifetime `'1` - -error: lifetime may not live long enough - --> $DIR/impl-trait-missing-lifetime.rs:9:63 - | -LL | fn g(mut x: impl Iterator<Item = &'_ ()>) -> Option<&'_ ()> { x.next() } - | ----- has type `x` ^^^^^^^^ returning this value requires that `'1` must outlive `'static` - -error: aborting due to 4 previous errors +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0106`. diff --git a/tests/ui/suggestions/issue-104328.rs b/tests/ui/suggestions/issue-104328.rs deleted file mode 100644 index 2b0fbdb8d35..00000000000 --- a/tests/ui/suggestions/issue-104328.rs +++ /dev/null @@ -1,12 +0,0 @@ -#![feature(dyn_compatible_for_dispatch)] - -trait Foo { - fn f() {} -} - -impl Foo for dyn Sized {} - -fn main() { - Foo::f(); - //~^ ERROR cannot call associated function on trait without specifying the corresponding `impl` type -} diff --git a/tests/ui/suggestions/issue-104328.stderr b/tests/ui/suggestions/issue-104328.stderr deleted file mode 100644 index 3c5e6f16289..00000000000 --- a/tests/ui/suggestions/issue-104328.stderr +++ /dev/null @@ -1,17 +0,0 @@ -error[E0790]: cannot call associated function on trait without specifying the corresponding `impl` type - --> $DIR/issue-104328.rs:10:5 - | -LL | fn f() {} - | --------- `Foo::f` defined here -... -LL | Foo::f(); - | ^^^^^^^^ cannot call associated function of trait - | -help: use the fully-qualified path to the only available implementation - | -LL | <(dyn Sized + 'static) as Foo>::f(); - | +++++++++++++++++++++++++ + - -error: aborting due to 1 previous error - -For more information about this error, try `rustc --explain E0790`. diff --git a/tests/ui/suggestions/let-binding-init-expr-as-ty.stderr b/tests/ui/suggestions/let-binding-init-expr-as-ty.stderr index 83a5441e3c0..19a0e4b17d0 100644 --- a/tests/ui/suggestions/let-binding-init-expr-as-ty.stderr +++ b/tests/ui/suggestions/let-binding-init-expr-as-ty.stderr @@ -10,11 +10,16 @@ error: argument types not allowed with return type notation --> $DIR/let-binding-init-expr-as-ty.rs:2:26 | LL | let foo: i32::from_be(num); - | ^^^^^ help: remove the input types: `()` + | ^^^^^ | = note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information = help: add `#![feature(return_type_notation)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date +help: remove the input types + | +LL - let foo: i32::from_be(num); +LL + let foo: i32::from_be(..); + | error: return type notation not allowed in this position yet --> $DIR/let-binding-init-expr-as-ty.rs:2:14 diff --git a/tests/ui/suggestions/missing-lt-for-hrtb.rs b/tests/ui/suggestions/missing-lt-for-hrtb.rs index a48c5665d67..04ea3d831c9 100644 --- a/tests/ui/suggestions/missing-lt-for-hrtb.rs +++ b/tests/ui/suggestions/missing-lt-for-hrtb.rs @@ -8,8 +8,6 @@ fn main() { let x = S(&|x| { println!("hi"); x - //~^ ERROR lifetime may not live long enough - //~| ERROR lifetime may not live long enough }); x.0(&X(&())); } diff --git a/tests/ui/suggestions/missing-lt-for-hrtb.stderr b/tests/ui/suggestions/missing-lt-for-hrtb.stderr index e8c536ac47d..fa515644431 100644 --- a/tests/ui/suggestions/missing-lt-for-hrtb.stderr +++ b/tests/ui/suggestions/missing-lt-for-hrtb.stderr @@ -31,28 +31,6 @@ help: consider using one of the available lifetimes here LL | struct V<'a>(&'a dyn for<'b> Fn(&X) -> &'lifetime X<'lifetime>); | +++++++++ +++++++++++ -error: lifetime may not live long enough - --> $DIR/missing-lt-for-hrtb.rs:10:9 - | -LL | let x = S(&|x| { - | -- return type of closure is &'2 X<'_> - | | - | has type `&'1 X<'_>` -LL | println!("hi"); -LL | x - | ^ returning this value requires that `'1` must outlive `'2` - -error: lifetime may not live long enough - --> $DIR/missing-lt-for-hrtb.rs:10:9 - | -LL | let x = S(&|x| { - | -- return type of closure is &X<'4> - | | - | has type `&X<'3>` -LL | println!("hi"); -LL | x - | ^ returning this value requires that `'3` must outlive `'4` - -error: aborting due to 4 previous errors +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0106`. diff --git a/tests/ui/suggestions/partialeq_suggest_swap_on_e0277.rs b/tests/ui/suggestions/partialeq_suggest_swap_on_e0277.rs new file mode 100644 index 00000000000..2ebbed3c740 --- /dev/null +++ b/tests/ui/suggestions/partialeq_suggest_swap_on_e0277.rs @@ -0,0 +1,11 @@ +struct T(String); + +impl PartialEq<String> for T { + fn eq(&self, other: &String) -> bool { + &self.0 == other + } +} + +fn main() { + String::from("Girls Band Cry") == T(String::from("Girls Band Cry")); //~ can't compare `String` with `T` [E0277] +} diff --git a/tests/ui/suggestions/partialeq_suggest_swap_on_e0277.stderr b/tests/ui/suggestions/partialeq_suggest_swap_on_e0277.stderr new file mode 100644 index 00000000000..ebe103ef19a --- /dev/null +++ b/tests/ui/suggestions/partialeq_suggest_swap_on_e0277.stderr @@ -0,0 +1,24 @@ +error[E0277]: can't compare `String` with `T` + --> $DIR/partialeq_suggest_swap_on_e0277.rs:10:36 + | +LL | String::from("Girls Band Cry") == T(String::from("Girls Band Cry")); + | ^^ no implementation for `String == T` + | + = help: the trait `PartialEq<T>` is not implemented for `String` + = help: the following other types implement trait `PartialEq<Rhs>`: + `String` implements `PartialEq<&str>` + `String` implements `PartialEq<ByteStr>` + `String` implements `PartialEq<ByteString>` + `String` implements `PartialEq<Cow<'_, str>>` + `String` implements `PartialEq<str>` + `String` implements `PartialEq` + = note: `T` implements `PartialEq<String>` +help: consider swapping the equality + | +LL - String::from("Girls Band Cry") == T(String::from("Girls Band Cry")); +LL + T(String::from("Girls Band Cry")) == String::from("Girls Band Cry"); + | + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/suggestions/suggest-struct-or-union-add-generic-impl-trait.rs b/tests/ui/suggestions/suggest-struct-or-union-add-generic-impl-trait.rs new file mode 100644 index 00000000000..9963b5be4f2 --- /dev/null +++ b/tests/ui/suggestions/suggest-struct-or-union-add-generic-impl-trait.rs @@ -0,0 +1,30 @@ +//@ edition:2021 +trait Trait {} + +struct Foo1 { + a: Trait, + //~^ ERROR expected a type, found a trait + b: u32, +} + +struct Foo2 { + a: i32, + b: Trait, + //~^ ERROR expected a type, found a trait +} + + +enum Enum1 { + A(Trait), + //~^ ERROR expected a type, found a trait + B(u32), +} + +enum Enum2 { + A(u32), + B(Trait), + //~^ ERROR expected a type, found a trait +} + + +fn main() {} diff --git a/tests/ui/suggestions/suggest-struct-or-union-add-generic-impl-trait.stderr b/tests/ui/suggestions/suggest-struct-or-union-add-generic-impl-trait.stderr new file mode 100644 index 00000000000..433196919ca --- /dev/null +++ b/tests/ui/suggestions/suggest-struct-or-union-add-generic-impl-trait.stderr @@ -0,0 +1,51 @@ +error[E0782]: expected a type, found a trait + --> $DIR/suggest-struct-or-union-add-generic-impl-trait.rs:5:8 + | +LL | a: Trait, + | ^^^^^ + | +help: you might be missing a type parameter + | +LL ~ struct Foo1<T: Trait> { +LL ~ a: T, + | + +error[E0782]: expected a type, found a trait + --> $DIR/suggest-struct-or-union-add-generic-impl-trait.rs:12:8 + | +LL | b: Trait, + | ^^^^^ + | +help: you can add the `dyn` keyword if you want a trait object + | +LL | b: dyn Trait, + | +++ + +error[E0782]: expected a type, found a trait + --> $DIR/suggest-struct-or-union-add-generic-impl-trait.rs:18:7 + | +LL | A(Trait), + | ^^^^^ + | +help: you might be missing a type parameter + | +LL ~ enum Enum1<T: Trait> { +LL ~ A(T), + | + +error[E0782]: expected a type, found a trait + --> $DIR/suggest-struct-or-union-add-generic-impl-trait.rs:25:7 + | +LL | B(Trait), + | ^^^^^ + | +help: you might be missing a type parameter + | +LL ~ enum Enum2<T: Trait> { +LL | A(u32), +LL ~ B(T), + | + +error: aborting due to 4 previous errors + +For more information about this error, try `rustc --explain E0782`. diff --git a/tests/ui/target-feature/feature-hierarchy.rs b/tests/ui/target-feature/feature-hierarchy.rs index d62b86693c2..315ec983a19 100644 --- a/tests/ui/target-feature/feature-hierarchy.rs +++ b/tests/ui/target-feature/feature-hierarchy.rs @@ -21,10 +21,7 @@ impl Copy for bool {} #[stable(feature = "test", since = "1.0.0")] #[rustc_const_stable(feature = "test", since = "1.0.0")] #[rustc_intrinsic] -#[rustc_intrinsic_must_be_overridden] -const unsafe fn unreachable() -> ! { - loop {} -} +const unsafe fn unreachable() -> !; #[rustc_builtin_macro] macro_rules! cfg { diff --git a/tests/ui/target-feature/no-llvm-leaks.rs b/tests/ui/target-feature/no-llvm-leaks.rs index d4f70fe7069..50544b97a96 100644 --- a/tests/ui/target-feature/no-llvm-leaks.rs +++ b/tests/ui/target-feature/no-llvm-leaks.rs @@ -1,3 +1,4 @@ +//@ add-core-stubs //@ revisions: aarch64 x86-64 //@ [aarch64] compile-flags: -Ctarget-feature=+neon,+fp16,+fhm --target=aarch64-unknown-linux-gnu //@ [aarch64] needs-llvm-components: aarch64 @@ -9,12 +10,8 @@ #![feature(intrinsics, rustc_attrs, no_core, lang_items, staged_api)] #![stable(feature = "test", since = "1.0.0")] -// Supporting minimal rust core code -#[lang = "sized"] -trait Sized {} -#[lang = "copy"] -trait Copy {} -impl Copy for bool {} +extern crate minicore; +use minicore::*; #[stable(feature = "test", since = "1.0.0")] #[rustc_const_stable(feature = "test", since = "1.0.0")] diff --git a/tests/ui/target-feature/tied-features.rs b/tests/ui/target-feature/tied-features.rs index c6cdf21a3e3..9aa5291e68c 100644 --- a/tests/ui/target-feature/tied-features.rs +++ b/tests/ui/target-feature/tied-features.rs @@ -1,10 +1,11 @@ +//@ add-core-stubs //@ compile-flags: --crate-type=rlib --target=aarch64-unknown-linux-gnu //@ needs-llvm-components: aarch64 #![feature(no_core, lang_items)] #![no_core] -#[lang="sized"] -trait Sized {} +extern crate minicore; +use minicore::*; pub fn main() { #[target_feature(enable = "pacg")] diff --git a/tests/ui/target-feature/tied-features.stderr b/tests/ui/target-feature/tied-features.stderr index 8d677735e84..49df4f109ba 100644 --- a/tests/ui/target-feature/tied-features.stderr +++ b/tests/ui/target-feature/tied-features.stderr @@ -1,5 +1,5 @@ error: the target features paca, pacg must all be either enabled or disabled together - --> $DIR/tied-features.rs:10:5 + --> $DIR/tied-features.rs:11:5 | LL | #[target_feature(enable = "pacg")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -7,7 +7,7 @@ LL | #[target_feature(enable = "pacg")] = help: add the missing features in a `target_feature` attribute error: the target features paca, pacg must all be either enabled or disabled together - --> $DIR/tied-features.rs:22:1 + --> $DIR/tied-features.rs:23:1 | LL | #[target_feature(enable = "paca")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -15,7 +15,7 @@ LL | #[target_feature(enable = "paca")] = help: add the missing features in a `target_feature` attribute error: the target features paca, pacg must all be either enabled or disabled together - --> $DIR/tied-features.rs:35:1 + --> $DIR/tied-features.rs:36:1 | LL | #[target_feature(enable = "paca")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/target_modifiers/auxiliary/default_reg_struct_return.rs b/tests/ui/target_modifiers/auxiliary/default_reg_struct_return.rs index 355e7c56e94..2bbdc839211 100644 --- a/tests/ui/target_modifiers/auxiliary/default_reg_struct_return.rs +++ b/tests/ui/target_modifiers/auxiliary/default_reg_struct_return.rs @@ -1,20 +1,7 @@ -//@ compile-flags: --target i686-unknown-linux-gnu -Cpanic=abort -// Auxiliary build problems with aarch64-apple: -// Shared library linking cc seems to convert "-m32" flag into -arch armv4t -// Auxiliary build problems with i686-mingw: linker `cc` not found -//@ only-x86 -//@ ignore-windows -//@ ignore-apple +//@ no-prefer-dynamic +//@ compile-flags: --target i686-unknown-linux-gnu //@ needs-llvm-components: x86 + +#![feature(no_core)] #![crate_type = "rlib"] #![no_core] -#![feature(no_core, lang_items, repr_simd)] - -#[lang = "sized"] -trait Sized {} -#[lang = "copy"] -trait Copy {} - -pub fn somefun() {} - -pub struct S; diff --git a/tests/ui/target_modifiers/auxiliary/wrong_regparm.rs b/tests/ui/target_modifiers/auxiliary/wrong_regparm.rs index 2e16f1ee747..267292faecd 100644 --- a/tests/ui/target_modifiers/auxiliary/wrong_regparm.rs +++ b/tests/ui/target_modifiers/auxiliary/wrong_regparm.rs @@ -1,20 +1,7 @@ -//@ compile-flags: --target i686-unknown-linux-gnu -Zregparm=2 -Cpanic=abort -// Auxiliary build problems with aarch64-apple: -// Shared library linking cc seems to convert "-m32" flag into -arch armv4t -// Auxiliary build problems with i686-mingw: linker `cc` not found -//@ only-x86 -//@ ignore-windows -//@ ignore-apple +//@ no-prefer-dynamic +//@ compile-flags: --target i686-unknown-linux-gnu -Zregparm=2 //@ needs-llvm-components: x86 + +#![feature(no_core)] #![crate_type = "rlib"] #![no_core] -#![feature(no_core, lang_items, repr_simd)] - -#[lang = "sized"] -trait Sized {} -#[lang = "copy"] -trait Copy {} - -pub fn somefun() {} - -pub struct S; diff --git a/tests/ui/target_modifiers/auxiliary/wrong_regparm_and_ret.rs b/tests/ui/target_modifiers/auxiliary/wrong_regparm_and_ret.rs index 39c6be9d589..82ee3e71d16 100644 --- a/tests/ui/target_modifiers/auxiliary/wrong_regparm_and_ret.rs +++ b/tests/ui/target_modifiers/auxiliary/wrong_regparm_and_ret.rs @@ -1,20 +1,7 @@ -//@ compile-flags: --target i686-unknown-linux-gnu -Zregparm=2 -Zreg-struct-return=true -Cpanic=abort -// Auxiliary build problems with aarch64-apple: -// Shared library linking cc seems to convert "-m32" flag into -arch armv4t -// Auxiliary build problems with i686-mingw: linker `cc` not found -//@ only-x86 -//@ ignore-windows -//@ ignore-apple +//@ no-prefer-dynamic +//@ compile-flags: --target i686-unknown-linux-gnu -Zregparm=2 -Zreg-struct-return=true //@ needs-llvm-components: x86 + +#![feature(no_core)] #![crate_type = "rlib"] #![no_core] -#![feature(no_core, lang_items, repr_simd)] - -#[lang = "sized"] -trait Sized {} -#[lang = "copy"] -trait Copy {} - -pub fn somefun() {} - -pub struct S; diff --git a/tests/ui/target_modifiers/defaults_check.error.stderr b/tests/ui/target_modifiers/defaults_check.error.stderr index c545dd71069..4833fe90677 100644 --- a/tests/ui/target_modifiers/defaults_check.error.stderr +++ b/tests/ui/target_modifiers/defaults_check.error.stderr @@ -1,7 +1,7 @@ error: mixing `-Zreg-struct-return` will cause an ABI mismatch in crate `defaults_check` - --> $DIR/defaults_check.rs:20:1 + --> $DIR/defaults_check.rs:15:1 | -LL | #![crate_type = "rlib"] +LL | #![feature(no_core)] | ^ | = help: the `-Zreg-struct-return` flag modifies the ABI so Rust crates compiled with different values of this flag cannot be used together safely diff --git a/tests/ui/target_modifiers/defaults_check.rs b/tests/ui/target_modifiers/defaults_check.rs index b8f4848d3a4..de72acd32bc 100644 --- a/tests/ui/target_modifiers/defaults_check.rs +++ b/tests/ui/target_modifiers/defaults_check.rs @@ -1,27 +1,20 @@ // Tests that default unspecified target modifier value in dependency crate is ok linked // with the same value, explicitly specified -//@ aux-crate:default_reg_struct_return=default_reg_struct_return.rs + +//@ aux-build:default_reg_struct_return.rs //@ compile-flags: --target i686-unknown-linux-gnu -Cpanic=abort -//@ revisions:error ok ok_explicit +//@ needs-llvm-components: x86 + +//@ revisions: ok ok_explicit error //@[ok] compile-flags: //@[ok_explicit] compile-flags: -Zreg-struct-return=false //@[error] compile-flags: -Zreg-struct-return=true +//@[ok] check-pass +//@[ok_explicit] check-pass -// Auxiliary build problems with aarch64-apple: -// Shared library linking cc seems to convert "-m32" flag into -arch armv4t -// Auxiliary build problems with i686-mingw: linker `cc` not found -//@ only-x86 -//@ ignore-windows -//@ ignore-apple -//@ needs-llvm-components: x86 -//@[ok] build-pass -//@[ok_explicit] build-pass - -#![crate_type = "rlib"] +#![feature(no_core)] //[error]~^ ERROR mixing `-Zreg-struct-return` will cause an ABI mismatch in crate `defaults_check` +#![crate_type = "rlib"] #![no_core] -#![feature(no_core, lang_items, repr_simd)] -fn foo() { - default_reg_struct_return::somefun(); -} +extern crate default_reg_struct_return; diff --git a/tests/ui/target_modifiers/incompatible_regparm.error_generated.stderr b/tests/ui/target_modifiers/incompatible_regparm.error_generated.stderr index 692fc7a4e3f..81015694d05 100644 --- a/tests/ui/target_modifiers/incompatible_regparm.error_generated.stderr +++ b/tests/ui/target_modifiers/incompatible_regparm.error_generated.stderr @@ -1,7 +1,7 @@ error: mixing `-Zregparm` will cause an ABI mismatch in crate `incompatible_regparm` - --> $DIR/incompatible_regparm.rs:16:1 + --> $DIR/incompatible_regparm.rs:11:1 | -LL | #![crate_type = "rlib"] +LL | #![feature(no_core)] | ^ | = help: the `-Zregparm` flag modifies the ABI so Rust crates compiled with different values of this flag cannot be used together safely diff --git a/tests/ui/target_modifiers/incompatible_regparm.rs b/tests/ui/target_modifiers/incompatible_regparm.rs index e866c5aa891..befe573b276 100644 --- a/tests/ui/target_modifiers/incompatible_regparm.rs +++ b/tests/ui/target_modifiers/incompatible_regparm.rs @@ -1,23 +1,16 @@ -//@ aux-crate:wrong_regparm=wrong_regparm.rs -//@ compile-flags: --target i686-unknown-linux-gnu -Zregparm=1 -Cpanic=abort -// Auxiliary build problems with aarch64-apple: -// Shared library linking cc seems to convert "-m32" flag into -arch armv4t -// Auxiliary build problems with i686-mingw: linker `cc` not found -//@ only-x86 -//@ ignore-windows -//@ ignore-apple +//@ aux-build:wrong_regparm.rs +//@ compile-flags: --target i686-unknown-linux-gnu -Zregparm=1 //@ needs-llvm-components: x86 -//@ revisions:error_generated allow_regparm_mismatch allow_no_value +//@ revisions:allow_regparm_mismatch allow_no_value error_generated //@[allow_regparm_mismatch] compile-flags: -Cunsafe-allow-abi-mismatch=regparm -//@[allow_regparm_mismatch] build-pass //@[allow_no_value] compile-flags: -Cunsafe-allow-abi-mismatch +//@[error_generated] compile-flags: +//@[allow_regparm_mismatch] check-pass -#![crate_type = "rlib"] +#![feature(no_core)] //[error_generated]~^ ERROR mixing `-Zregparm` will cause an ABI mismatch in crate `incompatible_regparm` +#![crate_type = "rlib"] #![no_core] -#![feature(no_core, lang_items, repr_simd)] -fn foo() { - wrong_regparm::somefun(); -} +extern crate wrong_regparm; diff --git a/tests/ui/target_modifiers/two_flags.rs b/tests/ui/target_modifiers/two_flags.rs index ca17117a267..d5b5a923ca0 100644 --- a/tests/ui/target_modifiers/two_flags.rs +++ b/tests/ui/target_modifiers/two_flags.rs @@ -1,23 +1,15 @@ -//@ aux-crate:wrong_regparm_and_ret=wrong_regparm_and_ret.rs -//@ compile-flags: --target i686-unknown-linux-gnu -Cpanic=abort -// Auxiliary build problems with aarch64-apple: -// Shared library linking cc seems to convert "-m32" flag into -arch armv4t -// Auxiliary build problems with i686-mingw: linker `cc` not found -//@ only-x86 -//@ ignore-windows -//@ ignore-apple +//@ aux-build:wrong_regparm_and_ret.rs +//@ compile-flags: --target i686-unknown-linux-gnu //@ needs-llvm-components: x86 -//@ revisions:two_allowed unknown_allowed +//@ revisions:two_allowed unknown_allowed //@[two_allowed] compile-flags: -Cunsafe-allow-abi-mismatch=regparm,reg-struct-return -//@[two_allowed] build-pass //@[unknown_allowed] compile-flags: -Cunsafe-allow-abi-mismatch=unknown_flag -Zregparm=2 -Zreg-struct-return=true +//@[two_allowed] check-pass -#![crate_type = "rlib"] +#![feature(no_core)] //[unknown_allowed]~^ ERROR unknown target modifier `unknown_flag`, requested by `-Cunsafe-allow-abi-mismatch=unknown_flag` +#![crate_type = "rlib"] #![no_core] -#![feature(no_core, lang_items, repr_simd)] -fn foo() { - wrong_regparm_and_ret::somefun(); -} +extern crate wrong_regparm_and_ret; diff --git a/tests/ui/target_modifiers/two_flags.unknown_allowed.stderr b/tests/ui/target_modifiers/two_flags.unknown_allowed.stderr index c8040c6e389..248bde452f2 100644 --- a/tests/ui/target_modifiers/two_flags.unknown_allowed.stderr +++ b/tests/ui/target_modifiers/two_flags.unknown_allowed.stderr @@ -1,7 +1,7 @@ error: unknown target modifier `unknown_flag`, requested by `-Cunsafe-allow-abi-mismatch=unknown_flag` - --> $DIR/two_flags.rs:16:1 + --> $DIR/two_flags.rs:10:1 | -LL | #![crate_type = "rlib"] +LL | #![feature(no_core)] | ^ error: aborting due to 1 previous error diff --git a/tests/ui/trait-bounds/ice-unsized-tuple-const-issue-121443.stderr b/tests/ui/trait-bounds/ice-unsized-tuple-const-issue-121443.stderr index 76e015a7238..4609e02716f 100644 --- a/tests/ui/trait-bounds/ice-unsized-tuple-const-issue-121443.stderr +++ b/tests/ui/trait-bounds/ice-unsized-tuple-const-issue-121443.stderr @@ -11,6 +11,7 @@ LL | const TEST: Fn = some_fn; | ^^ doesn't have a size known at compile-time | = help: the trait `Sized` is not implemented for `(dyn FnOnce() -> u8 + 'static)` + = note: statics and constants must have a statically known size error[E0277]: the size for values of type `(dyn FnOnce() -> u8 + 'static)` cannot be known at compilation time --> $DIR/ice-unsized-tuple-const-issue-121443.rs:11:14 diff --git a/tests/ui/traits/const-traits/staged-api.rs b/tests/ui/traits/const-traits/staged-api.rs index 9a030dafd6b..8dd7226fc29 100644 --- a/tests/ui/traits/const-traits/staged-api.rs +++ b/tests/ui/traits/const-traits/staged-api.rs @@ -85,4 +85,36 @@ const fn implicitly_stable_const_context() { //~^ ERROR cannot use `#[feature(const_trait_impl)]` } +// check that const stability of impls and traits must match +#[const_trait] +#[rustc_const_unstable(feature = "beef", issue = "none")] +trait U {} + +#[const_trait] +#[rustc_const_stable(since = "0.0.0", feature = "beef2")] +trait S {} + +// implied stable +impl const U for u8 {} +//~^ const stability on the impl does not match the const stability on the trait + +#[rustc_const_stable(since = "0.0.0", feature = "beef2")] +impl const U for u16 {} +//~^ const stability on the impl does not match the const stability on the trait +//~| trait implementations cannot be const stable yet + +#[rustc_const_unstable(feature = "beef", issue = "none")] +impl const U for u32 {} + +// implied stable +impl const S for u8 {} + +#[rustc_const_stable(since = "0.0.0", feature = "beef2")] +impl const S for u16 {} +//~^ trait implementations cannot be const stable yet + +#[rustc_const_unstable(feature = "beef", issue = "none")] +impl const S for u32 {} +//~^ const stability on the impl does not match the const stability on the trait + fn main() {} diff --git a/tests/ui/traits/const-traits/staged-api.stderr b/tests/ui/traits/const-traits/staged-api.stderr index a7a7a1ee721..cdf577287ee 100644 --- a/tests/ui/traits/const-traits/staged-api.stderr +++ b/tests/ui/traits/const-traits/staged-api.stderr @@ -1,3 +1,70 @@ +error: const stability on the impl does not match the const stability on the trait + --> $DIR/staged-api.rs:98:1 + | +LL | impl const U for u8 {} + | ^^^^^^^^^^^^^^^^^^^^^^ + | +note: this impl is (implicitly) stable... + --> $DIR/staged-api.rs:98:1 + | +LL | impl const U for u8 {} + | ^^^^^^^^^^^^^^^^^^^^^^ +note: ...but the trait is unstable + --> $DIR/staged-api.rs:91:7 + | +LL | trait U {} + | ^ + +error: trait implementations cannot be const stable yet + --> $DIR/staged-api.rs:102:1 + | +LL | impl const U for u16 {} + | ^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #67792 <https://github.com/rust-lang/rust/issues/67792> for more information + +error: const stability on the impl does not match the const stability on the trait + --> $DIR/staged-api.rs:102:1 + | +LL | impl const U for u16 {} + | ^^^^^^^^^^^^^^^^^^^^^^^ + | +note: this impl is (implicitly) stable... + --> $DIR/staged-api.rs:102:1 + | +LL | impl const U for u16 {} + | ^^^^^^^^^^^^^^^^^^^^^^^ +note: ...but the trait is unstable + --> $DIR/staged-api.rs:91:7 + | +LL | trait U {} + | ^ + +error: trait implementations cannot be const stable yet + --> $DIR/staged-api.rs:113:1 + | +LL | impl const S for u16 {} + | ^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #67792 <https://github.com/rust-lang/rust/issues/67792> for more information + +error: const stability on the impl does not match the const stability on the trait + --> $DIR/staged-api.rs:117:1 + | +LL | impl const S for u32 {} + | ^^^^^^^^^^^^^^^^^^^^^^^ + | +note: this impl is unstable... + --> $DIR/staged-api.rs:117:1 + | +LL | impl const S for u32 {} + | ^^^^^^^^^^^^^^^^^^^^^^^ +note: ...but the trait is stable + --> $DIR/staged-api.rs:95:7 + | +LL | trait S {} + | ^ + error: const function that might be (indirectly) exposed to stable cannot use `#[feature(const_trait_impl)]` --> $DIR/staged-api.rs:38:5 | @@ -323,5 +390,5 @@ LL + #[rustc_allow_const_fn_unstable(const_trait_impl)] LL | const fn implicitly_stable_const_context() { | -error: aborting due to 19 previous errors +error: aborting due to 24 previous errors diff --git a/tests/ui/traits/const-traits/unconstrained-var-specialization.rs b/tests/ui/traits/const-traits/unconstrained-var-specialization.rs new file mode 100644 index 00000000000..43a33114450 --- /dev/null +++ b/tests/ui/traits/const-traits/unconstrained-var-specialization.rs @@ -0,0 +1,36 @@ +//@ check-pass +//@ compile-flags: --crate-type=lib +#![no_std] +#![allow(internal_features)] +#![feature(rustc_attrs, min_specialization, const_trait_impl)] + +// In the default impl below, `A` is constrained by the projection predicate, and if the host effect +// predicate for `const Foo` doesn't resolve vars, then specialization will fail. + +#[const_trait] +trait Foo {} + +pub trait Iterator { + type Item; +} + +#[rustc_unsafe_specialization_marker] +pub trait MoreSpecificThanIterator: Iterator {} + +pub trait Tr { + fn foo(); +} + +impl<A: const Foo, Iter> Tr for Iter + where + Iter: Iterator<Item = A>, +{ + default fn foo() {} +} + +impl<A: const Foo, Iter> Tr for Iter + where + Iter: MoreSpecificThanIterator<Item = A>, +{ + fn foo() {} +} diff --git a/tests/ui/traits/const-traits/variance.rs b/tests/ui/traits/const-traits/variance.rs new file mode 100644 index 00000000000..90b5c50161d --- /dev/null +++ b/tests/ui/traits/const-traits/variance.rs @@ -0,0 +1,13 @@ +#![feature(rustc_attrs, const_trait_impl)] +#![allow(internal_features)] +#![rustc_variance_of_opaques] + +#[const_trait] +trait Foo {} + +impl const Foo for () {} + +fn foo<'a: 'a>() -> impl const Foo {} +//~^ ERROR ['a: *] + +fn main() {} diff --git a/tests/ui/traits/const-traits/variance.stderr b/tests/ui/traits/const-traits/variance.stderr new file mode 100644 index 00000000000..f5506931184 --- /dev/null +++ b/tests/ui/traits/const-traits/variance.stderr @@ -0,0 +1,8 @@ +error: ['a: *] + --> $DIR/variance.rs:10:21 + | +LL | fn foo<'a: 'a>() -> impl const Foo {} + | ^^^^^^^^^^^^^^ + +error: aborting due to 1 previous error + diff --git a/tests/ui/traits/issue-78372.stderr b/tests/ui/traits/issue-78372.stderr index d4dfba4f039..fbc60ce5d83 100644 --- a/tests/ui/traits/issue-78372.stderr +++ b/tests/ui/traits/issue-78372.stderr @@ -65,7 +65,7 @@ LL | fn foo(self: Smaht<Self, T>); = note: type of `self` must be `Self` or a type that dereferences to it = help: consider changing to `self`, `&self`, `&mut self`, `self: Box<Self>`, `self: Rc<Self>`, `self: Arc<Self>`, or `self: Pin<P>` (where P is one of the previous types except `Self`) -error[E0378]: the trait `DispatchFromDyn` may only be implemented for a coercion between structures +error[E0377]: the trait `DispatchFromDyn` may only be implemented for a coercion between structures --> $DIR/issue-78372.rs:3:1 | LL | impl<T> DispatchFromDyn<Smaht<U, MISC>> for T {} @@ -73,5 +73,5 @@ LL | impl<T> DispatchFromDyn<Smaht<U, MISC>> for T {} error: aborting due to 7 previous errors -Some errors have detailed explanations: E0307, E0378, E0412, E0658. +Some errors have detailed explanations: E0307, E0377, E0412, E0658. For more information about an error, try `rustc --explain E0307`. diff --git a/tests/ui/traits/negative-impls/negated-auto-traits-validity-error.rs b/tests/ui/traits/negative-impls/negated-auto-traits-validity-error.rs new file mode 100644 index 00000000000..cd675a5efd1 --- /dev/null +++ b/tests/ui/traits/negative-impls/negated-auto-traits-validity-error.rs @@ -0,0 +1,22 @@ +#![feature(auto_traits, negative_impls)] + +auto trait Foo {} + +struct AdditionalLt<'a, T>(&'a (), T); +impl<'a, T: 'a> !Foo for AdditionalLt<'a, T> {} +//~^ ERROR `!Foo` impl requires `T: 'a` but the struct it is implemented for does not + +struct AdditionalBound<T>(T); +trait Bound {} +impl<T: Bound> !Foo for AdditionalBound<T> {} +//~^ ERROR `!Foo` impl requires `T: Bound` but the struct it is implemented for does not + +struct TwoParam<T, U>(T, U); +impl<T> !Foo for TwoParam<T, T> {} +//~^ ERROR `!Foo` impls cannot be specialized + +struct ConcreteParam<T>(T); +impl !Foo for ConcreteParam<i32> {} +//~^ ERROR `!Foo` impls cannot be specialized + +fn main() {} diff --git a/tests/ui/traits/negative-impls/negated-auto-traits-validity-error.stderr b/tests/ui/traits/negative-impls/negated-auto-traits-validity-error.stderr new file mode 100644 index 00000000000..ef783e90155 --- /dev/null +++ b/tests/ui/traits/negative-impls/negated-auto-traits-validity-error.stderr @@ -0,0 +1,54 @@ +error[E0367]: `!Foo` impl requires `T: 'a` but the struct it is implemented for does not + --> $DIR/negated-auto-traits-validity-error.rs:6:13 + | +LL | impl<'a, T: 'a> !Foo for AdditionalLt<'a, T> {} + | ^^ + | +note: the implementor must specify the same requirement + --> $DIR/negated-auto-traits-validity-error.rs:5:1 + | +LL | struct AdditionalLt<'a, T>(&'a (), T); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error[E0367]: `!Foo` impl requires `T: Bound` but the struct it is implemented for does not + --> $DIR/negated-auto-traits-validity-error.rs:11:9 + | +LL | impl<T: Bound> !Foo for AdditionalBound<T> {} + | ^^^^^ + | +note: the implementor must specify the same requirement + --> $DIR/negated-auto-traits-validity-error.rs:9:1 + | +LL | struct AdditionalBound<T>(T); + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + +error[E0366]: `!Foo` impls cannot be specialized + --> $DIR/negated-auto-traits-validity-error.rs:15:1 + | +LL | impl<T> !Foo for TwoParam<T, T> {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: `T` is mentioned multiple times +note: use the same sequence of generic lifetime, type and const parameters as the struct definition + --> $DIR/negated-auto-traits-validity-error.rs:14:1 + | +LL | struct TwoParam<T, U>(T, U); + | ^^^^^^^^^^^^^^^^^^^^^ + +error[E0366]: `!Foo` impls cannot be specialized + --> $DIR/negated-auto-traits-validity-error.rs:19:1 + | +LL | impl !Foo for ConcreteParam<i32> {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: `i32` is not a generic parameter +note: use the same sequence of generic lifetime, type and const parameters as the struct definition + --> $DIR/negated-auto-traits-validity-error.rs:18:1 + | +LL | struct ConcreteParam<T>(T); + | ^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to 4 previous errors + +Some errors have detailed explanations: E0366, E0367. +For more information about an error, try `rustc --explain E0366`. diff --git a/tests/ui/traits/negative-impls/negated-auto-traits-validity.rs b/tests/ui/traits/negative-impls/negated-auto-traits-validity.rs new file mode 100644 index 00000000000..76996b5593e --- /dev/null +++ b/tests/ui/traits/negative-impls/negated-auto-traits-validity.rs @@ -0,0 +1,22 @@ +//@ check-pass + +#![feature(auto_traits, negative_impls)] + +auto trait Foo {} +auto trait Bar {} + +struct NeedsOutlives<'a, T>(&'a T); + +impl<'a, T: 'a> !Foo for NeedsOutlives<'a, T> {} + +// Leaving out the lifetime bound +impl<'a, T> !Bar for NeedsOutlives<'a, T> {} + +struct NeedsSend<T: Send>(T); + +impl<T: Send> !Foo for NeedsSend<T> {} + +// Leaving off the trait bound +impl<T> !Bar for NeedsSend<T> {} + +fn main() {} diff --git a/tests/ui/traits/next-solver/cycles/coinduction/item-bound-via-impl-where-clause.current.stderr b/tests/ui/traits/next-solver/cycles/coinduction/item-bound-via-impl-where-clause.current.stderr new file mode 100644 index 00000000000..dd9f7d89aa1 --- /dev/null +++ b/tests/ui/traits/next-solver/cycles/coinduction/item-bound-via-impl-where-clause.current.stderr @@ -0,0 +1,23 @@ +error[E0275]: overflow evaluating the requirement `Vec<u8>: Trait<String>` + --> $DIR/item-bound-via-impl-where-clause.rs:31:21 + | +LL | let s: String = transmute::<_, String>(vec![65_u8, 66, 67]); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +note: required for `Vec<u8>` to implement `Trait<String>` + --> $DIR/item-bound-via-impl-where-clause.rs:22:12 + | +LL | impl<L, R> Trait<R> for L + | ^^^^^^^^ ^ +LL | where +LL | L: Trait<R>, + | -------- unsatisfied trait bound introduced here +note: required by a bound in `transmute` + --> $DIR/item-bound-via-impl-where-clause.rs:29:17 + | +LL | fn transmute<L: Trait<R>, R>(r: L) -> <L::Proof as Trait<R>>::Proof { r } + | ^^^^^^^^ required by this bound in `transmute` + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0275`. diff --git a/tests/ui/traits/next-solver/cycles/coinduction/item-bound-via-impl-where-clause.next.stderr b/tests/ui/traits/next-solver/cycles/coinduction/item-bound-via-impl-where-clause.next.stderr new file mode 100644 index 00000000000..451c1442ed2 --- /dev/null +++ b/tests/ui/traits/next-solver/cycles/coinduction/item-bound-via-impl-where-clause.next.stderr @@ -0,0 +1,49 @@ +error[E0275]: overflow evaluating the requirement `Vec<u8>: Trait<String>` + --> $DIR/item-bound-via-impl-where-clause.rs:31:33 + | +LL | let s: String = transmute::<_, String>(vec![65_u8, 66, 67]); + | ^ + | +note: required by a bound in `transmute` + --> $DIR/item-bound-via-impl-where-clause.rs:29:17 + | +LL | fn transmute<L: Trait<R>, R>(r: L) -> <L::Proof as Trait<R>>::Proof { r } + | ^^^^^^^^ required by this bound in `transmute` + +error[E0275]: overflow evaluating the requirement `<<Vec<u8> as Trait<String>>::Proof as Trait<String>>::Proof == _` + --> $DIR/item-bound-via-impl-where-clause.rs:31:21 + | +LL | let s: String = transmute::<_, String>(vec![65_u8, 66, 67]); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error[E0275]: overflow evaluating the requirement `<<Vec<u8> as Trait<String>>::Proof as Trait<String>>::Proof == String` + --> $DIR/item-bound-via-impl-where-clause.rs:31:21 + | +LL | let s: String = transmute::<_, String>(vec![65_u8, 66, 67]); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error[E0275]: overflow evaluating the requirement `<<Vec<u8> as Trait<String>>::Proof as Trait<String>>::Proof: Sized` + --> $DIR/item-bound-via-impl-where-clause.rs:31:21 + | +LL | let s: String = transmute::<_, String>(vec![65_u8, 66, 67]); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: the return type of a function must have a statically known size + +error[E0275]: overflow evaluating the requirement `<<Vec<u8> as Trait<String>>::Proof as Trait<String>>::Proof well-formed` + --> $DIR/item-bound-via-impl-where-clause.rs:31:21 + | +LL | let s: String = transmute::<_, String>(vec![65_u8, 66, 67]); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error[E0275]: overflow evaluating the requirement `<<Vec<u8> as Trait<String>>::Proof as Trait<String>>::Proof == _` + --> $DIR/item-bound-via-impl-where-clause.rs:31:21 + | +LL | let s: String = transmute::<_, String>(vec![65_u8, 66, 67]); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + +error: aborting due to 6 previous errors + +For more information about this error, try `rustc --explain E0275`. diff --git a/tests/ui/traits/next-solver/cycles/coinduction/item-bound-via-impl-where-clause.rs b/tests/ui/traits/next-solver/cycles/coinduction/item-bound-via-impl-where-clause.rs new file mode 100644 index 00000000000..39381d17f7a --- /dev/null +++ b/tests/ui/traits/next-solver/cycles/coinduction/item-bound-via-impl-where-clause.rs @@ -0,0 +1,39 @@ +//@ revisions: current next +//@ ignore-compare-mode-next-solver (explicit revisions) +//@[next] compile-flags: -Znext-solver + +// A variation of #135246 where the cyclic bounds are part of +// the impl instead of the impl associated item. + +trait Trait<R>: Sized { + type Proof: Trait<R, Proof = Self>; +} + +// We need to use indirection here as we otherwise normalize +// `<L::Proof as Trait<R>>::Proof` before recursing into +// `R: Trait<R, Proof = <L::Proof as Trait<R>>::Proof>`. +trait Indir<L: Trait<R>, R>: Trait<R, Proof = <L::Proof as Trait<R>>::Proof> {} +impl<L, R> Indir<L, R> for R +where + L: Trait<R>, + R: Trait<R, Proof = <L::Proof as Trait<R>>::Proof>, +{} + +impl<L, R> Trait<R> for L +where + L: Trait<R>, + R: Indir<L, R>, + { + type Proof = R; +} +fn transmute<L: Trait<R>, R>(r: L) -> <L::Proof as Trait<R>>::Proof { r } +fn main() { + let s: String = transmute::<_, String>(vec![65_u8, 66, 67]); + //~^ ERROR overflow evaluating the requirement `Vec<u8>: Trait<String>` + //[next]~| ERROR overflow evaluating the requirement `<<Vec<u8> as Trait<String>>::Proof as Trait<String>>::Proof == _` + //[next]~| ERROR overflow evaluating the requirement `<<Vec<u8> as Trait<String>>::Proof as Trait<String>>::Proof == String` + //[next]~| ERROR overflow evaluating the requirement `<<Vec<u8> as Trait<String>>::Proof as Trait<String>>::Proof: Sized` + //[next]~| ERROR overflow evaluating the requirement `<<Vec<u8> as Trait<String>>::Proof as Trait<String>>::Proof well-formed` + //[next]~| ERROR overflow evaluating the requirement `<<Vec<u8> as Trait<String>>::Proof as Trait<String>>::Proof == _` + println!("{}", s); // ABC +} diff --git a/tests/ui/traits/next-solver/cycles/coinduction/only-one-coinductive-step-needed-trait.current.stderr b/tests/ui/traits/next-solver/cycles/coinduction/only-one-coinductive-step-needed-trait.current.stderr new file mode 100644 index 00000000000..89b8b53c3f4 --- /dev/null +++ b/tests/ui/traits/next-solver/cycles/coinduction/only-one-coinductive-step-needed-trait.current.stderr @@ -0,0 +1,22 @@ +error[E0275]: overflow evaluating the requirement `u32: SendIndir<Foo<u32>>` + --> $DIR/only-one-coinductive-step-needed-trait.rs:24:5 + | +LL | is_send::<Foo<u32>>(); + | ^^^^^^^^^^^^^^^^^^^^^ + | +note: required for `Foo<u32>` to implement `Send` + --> $DIR/only-one-coinductive-step-needed-trait.rs:17:35 + | +LL | unsafe impl<T: SendIndir<Foo<T>>> Send for Foo<T> {} + | ----------------- ^^^^ ^^^^^^ + | | + | unsatisfied trait bound introduced here +note: required by a bound in `is_send` + --> $DIR/only-one-coinductive-step-needed-trait.rs:22:15 + | +LL | fn is_send<T: Send>() {} + | ^^^^ required by this bound in `is_send` + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0275`. diff --git a/tests/ui/traits/next-solver/cycles/coinduction/only-one-coinductive-step-needed-trait.rs b/tests/ui/traits/next-solver/cycles/coinduction/only-one-coinductive-step-needed-trait.rs new file mode 100644 index 00000000000..29415686928 --- /dev/null +++ b/tests/ui/traits/next-solver/cycles/coinduction/only-one-coinductive-step-needed-trait.rs @@ -0,0 +1,26 @@ +//@ revisions: current next +//@ ignore-compare-mode-next-solver (explicit revisions) +//@[next] compile-flags: -Znext-solver +//@[next] check-pass + +// #136824 changed cycles to be coinductive if they have at least +// one productive step, causing this test to pass with the new solver. +// +// The cycle in the test is the following: +// - `Foo<T>: Send`, impl requires +// - `T: SendIndir<Foo<T>>`, impl requires +// - `Foo<T>: Send` cycle +// +// The old solver treats this cycle as inductive due to the `T: SendIndir` step. + +struct Foo<T>(T); +unsafe impl<T: SendIndir<Foo<T>>> Send for Foo<T> {} + +trait SendIndir<T> {} +impl<T, U: Send> SendIndir<U> for T {} + +fn is_send<T: Send>() {} +fn main() { + is_send::<Foo<u32>>(); + //[current]~^ ERROR overflow evaluating the requirement `u32: SendIndir<Foo<u32>>` +} diff --git a/tests/ui/traits/next-solver/cycles/coinduction/only-one-coinductive-step-needed.current.stderr b/tests/ui/traits/next-solver/cycles/coinduction/only-one-coinductive-step-needed.current.stderr new file mode 100644 index 00000000000..ec219878058 --- /dev/null +++ b/tests/ui/traits/next-solver/cycles/coinduction/only-one-coinductive-step-needed.current.stderr @@ -0,0 +1,17 @@ +error[E0275]: overflow evaluating the requirement `Foo<T>: SendIndir` + --> $DIR/only-one-coinductive-step-needed.rs:17:15 + | +LL | struct Foo<T>(<Foo<T> as Trait>::Assoc); + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | +note: required for `Foo<T>` to implement `Trait` + --> $DIR/only-one-coinductive-step-needed.rs:26:20 + | +LL | impl<T: SendIndir> Trait for T { + | --------- ^^^^^ ^ + | | + | unsatisfied trait bound introduced here + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0275`. diff --git a/tests/ui/traits/next-solver/cycles/coinduction/only-one-coinductive-step-needed.rs b/tests/ui/traits/next-solver/cycles/coinduction/only-one-coinductive-step-needed.rs new file mode 100644 index 00000000000..e41f7d7f3ce --- /dev/null +++ b/tests/ui/traits/next-solver/cycles/coinduction/only-one-coinductive-step-needed.rs @@ -0,0 +1,34 @@ +//@ revisions: current next +//@ ignore-compare-mode-next-solver (explicit revisions) +//@[next] compile-flags: -Znext-solver +//@[next] check-pass + +// #136824 changed cycles to be coinductive if they have at least +// one productive step, causing this test to pass with the new solver. +// +// The cycle in the test is the following: +// - `Foo<T>: Send`, builtin auto-trait impl requires +// - `<Foo<T> as Trait>::Assoc: Send`, requires normalizing self type via impl, requires +// - `Foo<T>: SendIndir`, via impl requires +// - `Foo<T>: Send` cycle +// +// The old solver treats this cycle as inductive due to the `Foo<T>: SendIndir` step. + +struct Foo<T>(<Foo<T> as Trait>::Assoc); +//[current]~^ ERROR overflow evaluating the requirement `Foo<T>: SendIndir` + +trait SendIndir {} +impl<T: Send> SendIndir for T {} + +trait Trait { + type Assoc; +} +impl<T: SendIndir> Trait for T { + type Assoc = (); +} + +fn is_send<T: Send>() {} + +fn main() { + is_send::<Foo<u32>>(); +} diff --git a/tests/ui/traits/next-solver/cycles/double-cycle-inductive-coinductive.rs b/tests/ui/traits/next-solver/cycles/double-cycle-inductive-coinductive.rs deleted file mode 100644 index 0d387214208..00000000000 --- a/tests/ui/traits/next-solver/cycles/double-cycle-inductive-coinductive.rs +++ /dev/null @@ -1,37 +0,0 @@ -//@ compile-flags: -Znext-solver -#![feature(rustc_attrs)] - -// Test that having both an inductive and a coinductive cycle -// is handled correctly. - -#[rustc_coinductive] -trait Trait {} -impl<T: Inductive + Coinductive> Trait for T {} - -trait Inductive {} -impl<T: Trait> Inductive for T {} -#[rustc_coinductive] -trait Coinductive {} -impl<T: Trait> Coinductive for T {} - -fn impls_trait<T: Trait>() {} - -#[rustc_coinductive] -trait TraitRev {} -impl<T: CoinductiveRev + InductiveRev> TraitRev for T {} - -trait InductiveRev {} -impl<T: TraitRev> InductiveRev for T {} -#[rustc_coinductive] -trait CoinductiveRev {} -impl<T: TraitRev> CoinductiveRev for T {} - -fn impls_trait_rev<T: TraitRev>() {} - -fn main() { - impls_trait::<()>(); - //~^ ERROR overflow evaluating the requirement - - impls_trait_rev::<()>(); - //~^ ERROR overflow evaluating the requirement -} diff --git a/tests/ui/traits/next-solver/cycles/double-cycle-inductive-coinductive.stderr b/tests/ui/traits/next-solver/cycles/double-cycle-inductive-coinductive.stderr deleted file mode 100644 index 7cedb4d36c9..00000000000 --- a/tests/ui/traits/next-solver/cycles/double-cycle-inductive-coinductive.stderr +++ /dev/null @@ -1,27 +0,0 @@ -error[E0275]: overflow evaluating the requirement `(): Trait` - --> $DIR/double-cycle-inductive-coinductive.rs:32:19 - | -LL | impls_trait::<()>(); - | ^^ - | -note: required by a bound in `impls_trait` - --> $DIR/double-cycle-inductive-coinductive.rs:17:19 - | -LL | fn impls_trait<T: Trait>() {} - | ^^^^^ required by this bound in `impls_trait` - -error[E0275]: overflow evaluating the requirement `(): TraitRev` - --> $DIR/double-cycle-inductive-coinductive.rs:35:23 - | -LL | impls_trait_rev::<()>(); - | ^^ - | -note: required by a bound in `impls_trait_rev` - --> $DIR/double-cycle-inductive-coinductive.rs:29:23 - | -LL | fn impls_trait_rev<T: TraitRev>() {} - | ^^^^^^^^ required by this bound in `impls_trait_rev` - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0275`. diff --git a/tests/ui/traits/next-solver/cycles/inductive-not-on-stack.rs b/tests/ui/traits/next-solver/cycles/inductive-not-on-stack.rs deleted file mode 100644 index 78683372580..00000000000 --- a/tests/ui/traits/next-solver/cycles/inductive-not-on-stack.rs +++ /dev/null @@ -1,46 +0,0 @@ -//@ compile-flags: -Znext-solver -#![feature(rustc_attrs, trivial_bounds)] - -// We have to be careful here: -// -// We either have the provisional result of `A -> B -> A` on the -// stack, which is a fully coinductive cycle. Accessing the -// provisional result for `B` as part of the `A -> C -> B -> A` cycle -// has to make sure we don't just use the result of `A -> B -> A` as the -// new cycle is inductive. -// -// Alternatively, if we have `A -> C -> A` first, then `A -> B -> A` has -// a purely inductive stack, so something could also go wrong here. - -#[rustc_coinductive] -trait A {} -#[rustc_coinductive] -trait B {} -trait C {} - -impl<T: B + C> A for T {} -impl<T: A> B for T {} -impl<T: B> C for T {} - -fn impls_a<T: A>() {} - -// The same test with reordered where clauses to make sure we're actually testing anything. -#[rustc_coinductive] -trait AR {} -#[rustc_coinductive] -trait BR {} -trait CR {} - -impl<T: CR + BR> AR for T {} -impl<T: AR> BR for T {} -impl<T: BR> CR for T {} - -fn impls_ar<T: AR>() {} - -fn main() { - impls_a::<()>(); - //~^ ERROR overflow evaluating the requirement `(): A` - - impls_ar::<()>(); - //~^ ERROR overflow evaluating the requirement `(): AR` -} diff --git a/tests/ui/traits/next-solver/cycles/inductive-not-on-stack.stderr b/tests/ui/traits/next-solver/cycles/inductive-not-on-stack.stderr deleted file mode 100644 index e9cc6bc6c81..00000000000 --- a/tests/ui/traits/next-solver/cycles/inductive-not-on-stack.stderr +++ /dev/null @@ -1,27 +0,0 @@ -error[E0275]: overflow evaluating the requirement `(): A` - --> $DIR/inductive-not-on-stack.rs:41:15 - | -LL | impls_a::<()>(); - | ^^ - | -note: required by a bound in `impls_a` - --> $DIR/inductive-not-on-stack.rs:25:15 - | -LL | fn impls_a<T: A>() {} - | ^ required by this bound in `impls_a` - -error[E0275]: overflow evaluating the requirement `(): AR` - --> $DIR/inductive-not-on-stack.rs:44:16 - | -LL | impls_ar::<()>(); - | ^^ - | -note: required by a bound in `impls_ar` - --> $DIR/inductive-not-on-stack.rs:38:16 - | -LL | fn impls_ar<T: AR>() {} - | ^^ required by this bound in `impls_ar` - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0275`. diff --git a/tests/ui/traits/next-solver/cycles/mixed-cycles-1.rs b/tests/ui/traits/next-solver/cycles/mixed-cycles-1.rs deleted file mode 100644 index 6d75d241864..00000000000 --- a/tests/ui/traits/next-solver/cycles/mixed-cycles-1.rs +++ /dev/null @@ -1,39 +0,0 @@ -//@ compile-flags: -Znext-solver -#![feature(rustc_attrs)] - -// A test intended to check how we handle provisional results -// for a goal computed with an inductive and a coinductive stack. -// -// Unfortunately this doesn't really detect whether we've done -// something wrong but instead only showcases that we thought of -// this. -// -// FIXME(-Znext-solver=coinductive): With the new coinduction approach -// the same goal stack can be both inductive and coinductive, depending -// on why we're proving a specific nested goal. Rewrite this test -// at that point instead of relying on `BInd`. - - -#[rustc_coinductive] -trait A {} - -#[rustc_coinductive] -trait B {} -trait BInd {} -impl<T: ?Sized + B> BInd for T {} - -#[rustc_coinductive] -trait C {} -trait CInd {} -impl<T: ?Sized + C> CInd for T {} - -impl<T: ?Sized + BInd + C> A for T {} -impl<T: ?Sized + CInd + C> B for T {} -impl<T: ?Sized + B + A> C for T {} - -fn impls_a<T: A>() {} - -fn main() { - impls_a::<()>(); - //~^ ERROR overflow evaluating the requirement `(): A` -} diff --git a/tests/ui/traits/next-solver/cycles/mixed-cycles-1.stderr b/tests/ui/traits/next-solver/cycles/mixed-cycles-1.stderr deleted file mode 100644 index 17544eb1da5..00000000000 --- a/tests/ui/traits/next-solver/cycles/mixed-cycles-1.stderr +++ /dev/null @@ -1,15 +0,0 @@ -error[E0275]: overflow evaluating the requirement `(): A` - --> $DIR/mixed-cycles-1.rs:37:15 - | -LL | impls_a::<()>(); - | ^^ - | -note: required by a bound in `impls_a` - --> $DIR/mixed-cycles-1.rs:34:15 - | -LL | fn impls_a<T: A>() {} - | ^ required by this bound in `impls_a` - -error: aborting due to 1 previous error - -For more information about this error, try `rustc --explain E0275`. diff --git a/tests/ui/traits/next-solver/cycles/mixed-cycles-2.rs b/tests/ui/traits/next-solver/cycles/mixed-cycles-2.rs deleted file mode 100644 index c939a6e5ef2..00000000000 --- a/tests/ui/traits/next-solver/cycles/mixed-cycles-2.rs +++ /dev/null @@ -1,32 +0,0 @@ -//@ compile-flags: -Znext-solver -#![feature(rustc_attrs)] - -// A test showcasing that the solver may need to -// compute a goal which is already in the provisional -// cache. -// -// However, given that `(): BInd` and `(): B` are currently distinct -// goals, this is actually not possible right now. -// -// FIXME(-Znext-solver=coinductive): With the new coinduction approach -// the same goal stack can be both inductive and coinductive, depending -// on why we're proving a specific nested goal. Rewrite this test -// at that point. - -#[rustc_coinductive] -trait A {} - -#[rustc_coinductive] -trait B {} -trait BInd {} -impl<T: ?Sized + B> BInd for T {} - -impl<T: ?Sized + BInd + B> A for T {} -impl<T: ?Sized + BInd> B for T {} - -fn impls_a<T: A>() {} - -fn main() { - impls_a::<()>(); - //~^ ERROR overflow evaluating the requirement `(): A` -} diff --git a/tests/ui/traits/next-solver/cycles/mixed-cycles-2.stderr b/tests/ui/traits/next-solver/cycles/mixed-cycles-2.stderr deleted file mode 100644 index a9be1016c74..00000000000 --- a/tests/ui/traits/next-solver/cycles/mixed-cycles-2.stderr +++ /dev/null @@ -1,15 +0,0 @@ -error[E0275]: overflow evaluating the requirement `(): A` - --> $DIR/mixed-cycles-2.rs:30:15 - | -LL | impls_a::<()>(); - | ^^ - | -note: required by a bound in `impls_a` - --> $DIR/mixed-cycles-2.rs:27:15 - | -LL | fn impls_a<T: A>() {} - | ^ required by this bound in `impls_a` - -error: aborting due to 1 previous error - -For more information about this error, try `rustc --explain E0275`. diff --git a/tests/ui/traits/next-solver/unsize-good.rs b/tests/ui/traits/next-solver/unsize-good.rs index 4456e4f2188..f3d8b08e693 100644 --- a/tests/ui/traits/next-solver/unsize-good.rs +++ b/tests/ui/traits/next-solver/unsize-good.rs @@ -1,8 +1,6 @@ //@ compile-flags: -Znext-solver //@ check-pass -#![feature(unsized_tuple_coercion)] - trait Foo {} impl Foo for i32 {} @@ -15,10 +13,6 @@ fn main() { let y = [1, 2, 3]; let _: &[i32] = &y; - // Tuple unsizing - let hi = (1i32,); - let _: &(dyn Foo,) = &hi; - // Dropping auto traits let a: &(dyn Foo + Send) = &1; let _: &dyn Foo = a; diff --git a/tests/ui/traits/on_unimplemented_long_types.rs b/tests/ui/traits/on_unimplemented_long_types.rs index c652b71e51a..d6c3e8ef75f 100644 --- a/tests/ui/traits/on_unimplemented_long_types.rs +++ b/tests/ui/traits/on_unimplemented_long_types.rs @@ -1,6 +1,4 @@ //@ compile-flags: --diagnostic-width=60 -Z write-long-types-to-disk=yes -// The regex below normalizes the long type file name to make it suitable for compare-modes. -//@ normalize-stderr: "'\$TEST_BUILD_DIR/.*\.long-type-\d+.txt'" -> "'$$TEST_BUILD_DIR/$$FILE.long-type-hash.txt'" pub fn foo() -> impl std::fmt::Display { //~^ ERROR doesn't implement `std::fmt::Display` diff --git a/tests/ui/traits/on_unimplemented_long_types.stderr b/tests/ui/traits/on_unimplemented_long_types.stderr index 2705d7c501e..1628466e081 100644 --- a/tests/ui/traits/on_unimplemented_long_types.stderr +++ b/tests/ui/traits/on_unimplemented_long_types.stderr @@ -1,5 +1,5 @@ error[E0277]: `Option<Option<Option<...>>>` doesn't implement `std::fmt::Display` - --> $DIR/on_unimplemented_long_types.rs:5:17 + --> $DIR/on_unimplemented_long_types.rs:3:17 | LL | pub fn foo() -> impl std::fmt::Display { | ^^^^^^^^^^^^^^^^^^^^^^ `Option<Option<Option<...>>>` cannot be formatted with the default formatter @@ -15,7 +15,7 @@ LL | | ))))))))))) | = help: the trait `std::fmt::Display` is not implemented for `Option<Option<Option<...>>>` = note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead - = note: the full name for the type has been written to '$TEST_BUILD_DIR/$FILE.long-type-hash.txt' + = note: the full name for the type has been written to '$TEST_BUILD_DIR/on_unimplemented_long_types.long-type-$LONG_TYPE_HASH.txt' = note: consider using `--verbose` to print the full type name to the console error: aborting due to 1 previous error diff --git a/tests/ui/traits/solver-cycles/129541-recursive-enum-and-array-impl.stderr b/tests/ui/traits/solver-cycles/129541-recursive-enum-and-array-impl.current.stderr index 50dcea0bfac..50dcea0bfac 100644 --- a/tests/ui/traits/solver-cycles/129541-recursive-enum-and-array-impl.stderr +++ b/tests/ui/traits/solver-cycles/129541-recursive-enum-and-array-impl.current.stderr diff --git a/tests/ui/traits/solver-cycles/129541-recursive-enum-and-array-impl.next.stderr b/tests/ui/traits/solver-cycles/129541-recursive-enum-and-array-impl.next.stderr new file mode 100644 index 00000000000..50dcea0bfac --- /dev/null +++ b/tests/ui/traits/solver-cycles/129541-recursive-enum-and-array-impl.next.stderr @@ -0,0 +1,10 @@ +error[E0391]: cycle detected when computing layout of `<[Hello] as Normalize>::Assoc` + | + = note: ...which requires computing layout of `Hello`... + = note: ...which again requires computing layout of `<[Hello] as Normalize>::Assoc`, completing the cycle + = note: cycle used when computing layout of `Hello` + = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0391`. diff --git a/tests/ui/traits/solver-cycles/129541-recursive-enum-and-array-impl.rs b/tests/ui/traits/solver-cycles/129541-recursive-enum-and-array-impl.rs index 197207dfb4b..5b7bf5f3404 100644 --- a/tests/ui/traits/solver-cycles/129541-recursive-enum-and-array-impl.rs +++ b/tests/ui/traits/solver-cycles/129541-recursive-enum-and-array-impl.rs @@ -1,6 +1,10 @@ // Regression test for #129541 //~^ ERROR cycle detected when computing layout of `<[Hello] as Normalize>::Assoc` [E0391] +//@ revisions: current next +//@ ignore-compare-mode-next-solver (explicit revisions) +//@[next] compile-flags: -Znext-solver + trait Bound {} trait Normalize { type Assoc; diff --git a/tests/ui/traits/solver-cycles/129541-recursive-struct.multiple_curr.stderr b/tests/ui/traits/solver-cycles/129541-recursive-struct.multiple_curr.stderr new file mode 100644 index 00000000000..93b064cdce2 --- /dev/null +++ b/tests/ui/traits/solver-cycles/129541-recursive-struct.multiple_curr.stderr @@ -0,0 +1,6 @@ +error: reached the recursion limit finding the struct tail for `<[Hello] as Normalize>::Assoc` + | + = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` + +error: aborting due to 1 previous error + diff --git a/tests/ui/traits/solver-cycles/129541-recursive-struct.multiple_next.stderr b/tests/ui/traits/solver-cycles/129541-recursive-struct.multiple_next.stderr new file mode 100644 index 00000000000..93b064cdce2 --- /dev/null +++ b/tests/ui/traits/solver-cycles/129541-recursive-struct.multiple_next.stderr @@ -0,0 +1,6 @@ +error: reached the recursion limit finding the struct tail for `<[Hello] as Normalize>::Assoc` + | + = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` + +error: aborting due to 1 previous error + diff --git a/tests/ui/traits/solver-cycles/129541-recursive-struct.rs b/tests/ui/traits/solver-cycles/129541-recursive-struct.rs index 4fbcbefec91..1f5d0a772a2 100644 --- a/tests/ui/traits/solver-cycles/129541-recursive-struct.rs +++ b/tests/ui/traits/solver-cycles/129541-recursive-struct.rs @@ -1,14 +1,17 @@ // Regression test for #129541 -//@ revisions: unique multiple -//@ check-pass +//@ revisions: unique_curr unique_next multiple_curr multiple_next +//@ ignore-compare-mode-next-solver (explicit revisions) +//@[unique_next] compile-flags: -Znext-solver +//@[multiple_next] compile-flags: -Znext-solver +//@ error-pattern: reached the recursion limit finding the struct tail for `<[Hello] as Normalize>::Assoc` trait Bound {} trait Normalize { type Assoc; } -#[cfg(multiple)] +#[cfg(any(multiple_curr, multiple_next))] impl<T: Bound> Normalize for T { type Assoc = T; } diff --git a/tests/ui/traits/solver-cycles/129541-recursive-struct.unique_curr.stderr b/tests/ui/traits/solver-cycles/129541-recursive-struct.unique_curr.stderr new file mode 100644 index 00000000000..93b064cdce2 --- /dev/null +++ b/tests/ui/traits/solver-cycles/129541-recursive-struct.unique_curr.stderr @@ -0,0 +1,6 @@ +error: reached the recursion limit finding the struct tail for `<[Hello] as Normalize>::Assoc` + | + = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` + +error: aborting due to 1 previous error + diff --git a/tests/ui/traits/solver-cycles/129541-recursive-struct.unique_next.stderr b/tests/ui/traits/solver-cycles/129541-recursive-struct.unique_next.stderr new file mode 100644 index 00000000000..93b064cdce2 --- /dev/null +++ b/tests/ui/traits/solver-cycles/129541-recursive-struct.unique_next.stderr @@ -0,0 +1,6 @@ +error: reached the recursion limit finding the struct tail for `<[Hello] as Normalize>::Assoc` + | + = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` + +error: aborting due to 1 previous error + diff --git a/tests/ui/traits/trait-upcasting/dyn-to-dyn-star.rs b/tests/ui/traits/trait-upcasting/dyn-to-dyn-star.rs new file mode 100644 index 00000000000..5936c93efad --- /dev/null +++ b/tests/ui/traits/trait-upcasting/dyn-to-dyn-star.rs @@ -0,0 +1,19 @@ +// While somewhat nonsensical, this is a cast from a wide pointer to a thin pointer. +// Thus, we don't need to check an unsize goal here; there isn't any vtable casting +// happening at all. + +// Regression test for <https://github.com/rust-lang/rust/issues/137579>. + +//@ check-pass + +#![allow(incomplete_features)] +#![feature(dyn_star)] + +trait Foo {} +trait Bar {} + +fn cast(x: *const dyn Foo) { + x as *const dyn* Bar; +} + +fn main() {} diff --git a/tests/ui/traits/trivial_impl_sized.rs b/tests/ui/traits/trivial_impl_sized.rs index 501a3405090..59cc079c268 100644 --- a/tests/ui/traits/trivial_impl_sized.rs +++ b/tests/ui/traits/trivial_impl_sized.rs @@ -1,5 +1,5 @@ -//! This test checks that we currently need to implement -//! members, even if their where bounds don't hold for the impl type. +//! This test checks that we do not need to implement +//! members, whose `where Self: Sized` bounds don't hold for the impl type. trait Foo { fn foo() @@ -15,12 +15,28 @@ impl Foo for () { impl Foo for i32 {} //~^ ERROR: not all trait items implemented, missing: `foo` -// Should be allowed impl Foo for dyn std::fmt::Debug {} -//~^ ERROR: not all trait items implemented, missing: `foo` +#[deny(dead_code)] impl Foo for dyn std::fmt::Display { fn foo() {} + //~^ ERROR this item cannot be used as its where bounds are not satisfied +} + +struct Struct { + i: i32, + tail: [u8], } +impl Foo for Struct {} + +// Ensure we only allow known-unsized types to be skipped +trait Trait { + fn foo(self) + where + Self: Sized; +} +impl<T: ?Sized> Trait for T {} +//~^ ERROR: not all trait items implemented, missing: `foo` + fn main() {} diff --git a/tests/ui/traits/trivial_impl_sized.stderr b/tests/ui/traits/trivial_impl_sized.stderr index ebf6dfc9dd2..95cab337182 100644 --- a/tests/ui/traits/trivial_impl_sized.stderr +++ b/tests/ui/traits/trivial_impl_sized.stderr @@ -9,17 +9,29 @@ LL | | Self: Sized; LL | impl Foo for i32 {} | ^^^^^^^^^^^^^^^^ missing `foo` in implementation +error: this item cannot be used as its where bounds are not satisfied for the `Self` type + --> $DIR/trivial_impl_sized.rs:22:5 + | +LL | fn foo() {} + | ^^^^^^^^ + | +note: the lint level is defined here + --> $DIR/trivial_impl_sized.rs:20:8 + | +LL | #[deny(dead_code)] + | ^^^^^^^^^ + error[E0046]: not all trait items implemented, missing: `foo` - --> $DIR/trivial_impl_sized.rs:19:1 + --> $DIR/trivial_impl_sized.rs:39:1 | -LL | / fn foo() +LL | / fn foo(self) LL | | where LL | | Self: Sized; | |____________________- `foo` from trait -... -LL | impl Foo for dyn std::fmt::Debug {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `foo` in implementation +LL | } +LL | impl<T: ?Sized> Trait for T {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `foo` in implementation -error: aborting due to 2 previous errors +error: aborting due to 3 previous errors For more information about this error, try `rustc --explain E0046`. diff --git a/tests/ui/transmutability/uninhabited.stderr b/tests/ui/transmutability/uninhabited.stderr index b8b7b67f781..39f8bf19c36 100644 --- a/tests/ui/transmutability/uninhabited.stderr +++ b/tests/ui/transmutability/uninhabited.stderr @@ -2,7 +2,7 @@ error[E0080]: evaluation of constant value failed --> $DIR/uninhabited.rs:41:9 | LL | assert!(false); - | ^^^^^^^^^^^^^^ the evaluated program panicked at 'assertion failed: false', $DIR/uninhabited.rs:41:9 + | ^^^^^^^^^^^^^^ evaluation panicked: assertion failed: false | = note: this error originates in the macro `assert` (in Nightly builds, run with -Z macro-backtrace for more info) @@ -10,7 +10,7 @@ error[E0080]: evaluation of constant value failed --> $DIR/uninhabited.rs:63:9 | LL | assert!(false); - | ^^^^^^^^^^^^^^ the evaluated program panicked at 'assertion failed: false', $DIR/uninhabited.rs:63:9 + | ^^^^^^^^^^^^^^ evaluation panicked: assertion failed: false | = note: this error originates in the macro `assert` (in Nightly builds, run with -Z macro-backtrace for more info) @@ -18,7 +18,7 @@ error[E0080]: evaluation of constant value failed --> $DIR/uninhabited.rs:87:9 | LL | assert!(false); - | ^^^^^^^^^^^^^^ the evaluated program panicked at 'assertion failed: false', $DIR/uninhabited.rs:87:9 + | ^^^^^^^^^^^^^^ evaluation panicked: assertion failed: false | = note: this error originates in the macro `assert` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/tests/ui/type-alias-impl-trait/implied_lifetime_wf_check3.stderr b/tests/ui/type-alias-impl-trait/implied_lifetime_wf_check3.stderr index b7c9c131c7d..c9af4bda572 100644 --- a/tests/ui/type-alias-impl-trait/implied_lifetime_wf_check3.stderr +++ b/tests/ui/type-alias-impl-trait/implied_lifetime_wf_check3.stderr @@ -28,7 +28,7 @@ error[E0310]: the parameter type `A` may not live long enough --> $DIR/implied_lifetime_wf_check3.rs:52:5 | LL | test_type_param::assert_static::<A>() - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | | | the parameter type `A` must be valid for the static lifetime... | ...so that the type `A` will meet its required lifetime bounds diff --git a/tests/ui/type-alias-impl-trait/implied_lifetime_wf_check4_static.stderr b/tests/ui/type-alias-impl-trait/implied_lifetime_wf_check4_static.stderr index f23b978d0b6..060d68eb632 100644 --- a/tests/ui/type-alias-impl-trait/implied_lifetime_wf_check4_static.stderr +++ b/tests/ui/type-alias-impl-trait/implied_lifetime_wf_check4_static.stderr @@ -21,7 +21,7 @@ error[E0310]: the parameter type `A` may not live long enough --> $DIR/implied_lifetime_wf_check4_static.rs:17:5 | LL | assert_static::<A>() - | ^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^ | | | the parameter type `A` must be valid for the static lifetime... | ...so that the type `A` will meet its required lifetime bounds diff --git a/tests/ui/type-alias-impl-trait/issue-53092-2.rs b/tests/ui/type-alias-impl-trait/issue-53092-2.rs index 2383008d042..43df49adc42 100644 --- a/tests/ui/type-alias-impl-trait/issue-53092-2.rs +++ b/tests/ui/type-alias-impl-trait/issue-53092-2.rs @@ -2,10 +2,12 @@ #![allow(dead_code)] type Bug<T, U> = impl Fn(T) -> U + Copy; +//~^ ERROR cycle detected const CONST_BUG: Bug<u8, ()> = unsafe { std::mem::transmute(|_: u8| ()) }; -//~^ ERROR cycle detected -//~| ERROR: non-defining opaque type use +//~^ ERROR item does not constrain `Bug::{opaque#0}`, but has it in its signature +//~| ERROR item does not constrain `Bug::{opaque#0}`, but has it in its signature +//~| ERROR non-defining opaque type use in defining scope fn make_bug<T, U: From<T>>() -> Bug<T, U> { |x| x.into() diff --git a/tests/ui/type-alias-impl-trait/issue-53092-2.stderr b/tests/ui/type-alias-impl-trait/issue-53092-2.stderr index ac580866704..678b0c84f78 100644 --- a/tests/ui/type-alias-impl-trait/issue-53092-2.stderr +++ b/tests/ui/type-alias-impl-trait/issue-53092-2.stderr @@ -1,5 +1,5 @@ error[E0792]: non-defining opaque type use in defining scope - --> $DIR/issue-53092-2.rs:6:18 + --> $DIR/issue-53092-2.rs:7:18 | LL | const CONST_BUG: Bug<u8, ()> = unsafe { std::mem::transmute(|_: u8| ()) }; | ^^^^^^^^^^^ argument `u8` is not a generic parameter @@ -10,33 +10,59 @@ note: for this opaque type LL | type Bug<T, U> = impl Fn(T) -> U + Copy; | ^^^^^^^^^^^^^^^^^^^^^^ -error[E0391]: cycle detected when type-checking `CONST_BUG` - --> $DIR/issue-53092-2.rs:6:1 +error[E0391]: cycle detected when computing type of `Bug::{opaque#0}` + --> $DIR/issue-53092-2.rs:4:18 + | +LL | type Bug<T, U> = impl Fn(T) -> U + Copy; + | ^^^^^^^^^^^^^^^^^^^^^^ + | +note: ...which requires computing type of opaque `Bug::{opaque#0}`... + --> $DIR/issue-53092-2.rs:4:18 + | +LL | type Bug<T, U> = impl Fn(T) -> U + Copy; + | ^^^^^^^^^^^^^^^^^^^^^^ +note: ...which requires type-checking `CONST_BUG`... + --> $DIR/issue-53092-2.rs:7:1 | LL | const CONST_BUG: Bug<u8, ()> = unsafe { std::mem::transmute(|_: u8| ()) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | = note: ...which requires computing layout of `Bug<u8, ()>`... = note: ...which requires normalizing `Bug<u8, ()>`... -note: ...which requires computing type of `Bug::{opaque#0}`... + = note: ...which again requires computing type of `Bug::{opaque#0}`, completing the cycle +note: cycle used when checking that `Bug::{opaque#0}` is well-formed --> $DIR/issue-53092-2.rs:4:18 | LL | type Bug<T, U> = impl Fn(T) -> U + Copy; | ^^^^^^^^^^^^^^^^^^^^^^ -note: ...which requires computing type of opaque `Bug::{opaque#0}`... + = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information + +error: item does not constrain `Bug::{opaque#0}`, but has it in its signature + --> $DIR/issue-53092-2.rs:7:7 + | +LL | const CONST_BUG: Bug<u8, ()> = unsafe { std::mem::transmute(|_: u8| ()) }; + | ^^^^^^^^^ + | + = note: consider moving the opaque type's declaration and defining uses into a separate module +note: this opaque type is in the signature --> $DIR/issue-53092-2.rs:4:18 | LL | type Bug<T, U> = impl Fn(T) -> U + Copy; | ^^^^^^^^^^^^^^^^^^^^^^ - = note: ...which again requires type-checking `CONST_BUG`, completing the cycle -note: cycle used when checking that `CONST_BUG` is well-formed - --> $DIR/issue-53092-2.rs:6:1 + +error: item does not constrain `Bug::{opaque#0}`, but has it in its signature + --> $DIR/issue-53092-2.rs:7:61 | LL | const CONST_BUG: Bug<u8, ()> = unsafe { std::mem::transmute(|_: u8| ()) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information + | ^^^^^^^ + | + = note: consider moving the opaque type's declaration and defining uses into a separate module +note: this opaque type is in the signature + --> $DIR/issue-53092-2.rs:4:18 + | +LL | type Bug<T, U> = impl Fn(T) -> U + Copy; + | ^^^^^^^^^^^^^^^^^^^^^^ -error: aborting due to 2 previous errors +error: aborting due to 4 previous errors Some errors have detailed explanations: E0391, E0792. For more information about an error, try `rustc --explain E0391`. diff --git a/tests/ui/type/pattern_types/nested.rs b/tests/ui/type/pattern_types/nested.rs index 9ca9c7923de..0d8cd22190e 100644 --- a/tests/ui/type/pattern_types/nested.rs +++ b/tests/ui/type/pattern_types/nested.rs @@ -18,10 +18,12 @@ const BAD_NESTING2: pattern_type!(pattern_type!(i32 is 1..) is ..=-1) = todo!(); const BAD_NESTING3: pattern_type!(pattern_type!(i32 is 1..) is ..0) = todo!(); //~^ ERROR: not a valid base type for range patterns +//~| ERROR: not a valid base type for range patterns //~| ERROR: mismatched types const BAD_NESTING4: pattern_type!(() is ..0) = todo!(); //~^ ERROR: not a valid base type for range patterns +//~| ERROR: not a valid base type for range patterns //~| ERROR: mismatched types const BAD_NESTING5: pattern_type!(f32 is 1.0 .. 2.0) = todo!(); diff --git a/tests/ui/type/pattern_types/nested.stderr b/tests/ui/type/pattern_types/nested.stderr index b753b0a9c9b..f79d12bc3f3 100644 --- a/tests/ui/type/pattern_types/nested.stderr +++ b/tests/ui/type/pattern_types/nested.stderr @@ -1,96 +1,184 @@ -error: `(u32) is 1..=` is not a valid base type for range patterns - --> $DIR/nested.rs:10:34 +error[E0308]: mismatched types + --> $DIR/nested.rs:10:63 | LL | const BAD_NESTING: pattern_type!(pattern_type!(u32 is 1..) is 0..) = todo!(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^ expected `(u32) is 1..`, found integer | -note: range patterns only support integers - --> $DIR/nested.rs:10:63 + = note: expected pattern type `(u32) is 1..` + found type `{integer}` + +error[E0277]: `(u32) is 1..` is not a valid base type for range patterns + --> $DIR/nested.rs:10:34 | LL | const BAD_NESTING: pattern_type!(pattern_type!(u32 is 1..) is 0..) = todo!(); - | ^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^ only integer types and `char` are supported + | + = help: the trait `core::pat::RangePattern` is not implemented for `(u32) is 1..` + = help: the following other types implement trait `core::pat::RangePattern`: + char + i128 + i16 + i32 + i64 + i8 + isize + u128 + and 5 others -error: `(i32) is 1..=` is not a valid base type for range patterns +error[E0277]: `(i32) is 1..` is not a valid base type for range patterns --> $DIR/nested.rs:15:35 | LL | const BAD_NESTING2: pattern_type!(pattern_type!(i32 is 1..) is ..=-1) = todo!(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^ - | -note: range patterns only support integers - --> $DIR/nested.rs:15:64 + | ^^^^^^^^^^^^^^^^^^^^^^^^^ only integer types and `char` are supported + | + = help: the trait `core::pat::RangePattern` is not implemented for `(i32) is 1..` + = help: the following other types implement trait `core::pat::RangePattern`: + char + i128 + i16 + i32 + i64 + i8 + isize + u128 + and 5 others + +error[E0308]: mismatched types + --> $DIR/nested.rs:15:67 | LL | const BAD_NESTING2: pattern_type!(pattern_type!(i32 is 1..) is ..=-1) = todo!(); - | ^^^^^ + | ^^ expected `(i32) is 1..`, found integer + | + = note: expected pattern type `(i32) is 1..` + found type `{integer}` -error: `(i32) is 1..=` is not a valid base type for range patterns +error[E0277]: `(i32) is 1..` is not a valid base type for range patterns --> $DIR/nested.rs:19:35 | LL | const BAD_NESTING3: pattern_type!(pattern_type!(i32 is 1..) is ..0) = todo!(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^ - | -note: range patterns only support integers - --> $DIR/nested.rs:19:64 - | -LL | const BAD_NESTING3: pattern_type!(pattern_type!(i32 is 1..) is ..0) = todo!(); - | ^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^ only integer types and `char` are supported + | + = help: the trait `core::pat::RangePattern` is not implemented for `(i32) is 1..` + = help: the following other types implement trait `core::pat::RangePattern`: + char + i128 + i16 + i32 + i64 + i8 + isize + u128 + and 5 others -error: `()` is not a valid base type for range patterns - --> $DIR/nested.rs:23:35 +error[E0308]: mismatched types + --> $DIR/nested.rs:19:66 | -LL | const BAD_NESTING4: pattern_type!(() is ..0) = todo!(); - | ^^ +LL | const BAD_NESTING3: pattern_type!(pattern_type!(i32 is 1..) is ..0) = todo!(); + | ^ + | | + | expected `(i32) is 1..`, found integer + | arguments to this function are incorrect | -note: range patterns only support integers - --> $DIR/nested.rs:23:41 + = note: expected pattern type `(i32) is 1..` + found type `{integer}` +help: the return type of this call is `{integer}` due to the type of the argument passed + --> $DIR/nested.rs:19:66 | -LL | const BAD_NESTING4: pattern_type!(() is ..0) = todo!(); - | ^^^ +LL | const BAD_NESTING3: pattern_type!(pattern_type!(i32 is 1..) is ..0) = todo!(); + | ^ this argument influences the return type of `RangeSub` +note: method defined here + --> $SRC_DIR/core/src/pat.rs:LL:COL -error: `f32` is not a valid base type for range patterns - --> $DIR/nested.rs:27:35 - | -LL | const BAD_NESTING5: pattern_type!(f32 is 1.0 .. 2.0) = todo!(); - | ^^^ - | -note: range patterns only support integers - --> $DIR/nested.rs:27:42 +error[E0277]: `(i32) is 1..` is not a valid base type for range patterns + --> $DIR/nested.rs:19:66 | -LL | const BAD_NESTING5: pattern_type!(f32 is 1.0 .. 2.0) = todo!(); - | ^^^^^^^^^^ +LL | const BAD_NESTING3: pattern_type!(pattern_type!(i32 is 1..) is ..0) = todo!(); + | ^ only integer types and `char` are supported + | + = help: the trait `core::pat::RangePattern` is not implemented for `(i32) is 1..` + = help: the following other types implement trait `core::pat::RangePattern`: + char + i128 + i16 + i32 + i64 + i8 + isize + u128 + and 5 others -error[E0308]: mismatched types - --> $DIR/nested.rs:10:63 +error[E0277]: `()` is not a valid base type for range patterns + --> $DIR/nested.rs:24:35 | -LL | const BAD_NESTING: pattern_type!(pattern_type!(u32 is 1..) is 0..) = todo!(); - | ^ expected `(u32) is 1..=`, found integer - | - = note: expected pattern type `(u32) is 1..=` - found type `{integer}` +LL | const BAD_NESTING4: pattern_type!(() is ..0) = todo!(); + | ^^ only integer types and `char` are supported + | + = help: the trait `core::pat::RangePattern` is not implemented for `()` + = help: the following other types implement trait `core::pat::RangePattern`: + char + i128 + i16 + i32 + i64 + i8 + isize + u128 + and 5 others error[E0308]: mismatched types - --> $DIR/nested.rs:15:67 - | -LL | const BAD_NESTING2: pattern_type!(pattern_type!(i32 is 1..) is ..=-1) = todo!(); - | ^^ expected `(i32) is 1..=`, found integer + --> $DIR/nested.rs:24:43 | - = note: expected pattern type `(i32) is 1..=` - found type `{integer}` - -error[E0308]: mismatched types - --> $DIR/nested.rs:19:66 +LL | const BAD_NESTING4: pattern_type!(() is ..0) = todo!(); + | ^ + | | + | expected `()`, found integer + | arguments to this function are incorrect | -LL | const BAD_NESTING3: pattern_type!(pattern_type!(i32 is 1..) is ..0) = todo!(); - | ^ expected `(i32) is 1..=`, found integer +help: the return type of this call is `{integer}` due to the type of the argument passed + --> $DIR/nested.rs:24:43 | - = note: expected pattern type `(i32) is 1..=` - found type `{integer}` +LL | const BAD_NESTING4: pattern_type!(() is ..0) = todo!(); + | ^ this argument influences the return type of `RangeSub` +note: method defined here + --> $SRC_DIR/core/src/pat.rs:LL:COL -error[E0308]: mismatched types - --> $DIR/nested.rs:23:43 +error[E0277]: `()` is not a valid base type for range patterns + --> $DIR/nested.rs:24:43 | LL | const BAD_NESTING4: pattern_type!(() is ..0) = todo!(); - | ^ expected `()`, found integer + | ^ only integer types and `char` are supported + | + = help: the trait `core::pat::RangePattern` is not implemented for `()` + = help: the following other types implement trait `core::pat::RangePattern`: + char + i128 + i16 + i32 + i64 + i8 + isize + u128 + and 5 others + +error[E0277]: `f32` is not a valid base type for range patterns + --> $DIR/nested.rs:29:49 + | +LL | const BAD_NESTING5: pattern_type!(f32 is 1.0 .. 2.0) = todo!(); + | ^^^ only integer types and `char` are supported + | + = help: the trait `core::pat::RangePattern` is not implemented for `f32` + = help: the following other types implement trait `core::pat::RangePattern`: + i128 + i16 + i32 + i64 + i8 + isize + u128 + u16 + and 4 others -error: aborting due to 9 previous errors +error: aborting due to 11 previous errors -For more information about this error, try `rustc --explain E0308`. +Some errors have detailed explanations: E0277, E0308. +For more information about an error, try `rustc --explain E0277`. diff --git a/tests/ui/type/pattern_types/range_patterns.stderr b/tests/ui/type/pattern_types/range_patterns.stderr index 690592ba0b8..cb24a303404 100644 --- a/tests/ui/type/pattern_types/range_patterns.stderr +++ b/tests/ui/type/pattern_types/range_patterns.stderr @@ -4,7 +4,7 @@ error: layout_of(NonZero<u32>) = Layout { abi: Align(4 bytes), pref: $SOME_ALIGN, }, - abi: Scalar( + backend_repr: Scalar( Initialized { value: Int( I32, @@ -44,13 +44,13 @@ error: layout_of(NonZero<u32>) = Layout { LL | type X = std::num::NonZeroU32; | ^^^^^^ -error: layout_of((u32) is 1..=) = Layout { +error: layout_of((u32) is 1..) = Layout { size: Size(4 bytes), align: AbiAndPrefAlign { abi: Align(4 bytes), pref: $SOME_ALIGN, }, - abi: Scalar( + backend_repr: Scalar( Initialized { value: Int( I32, @@ -83,13 +83,13 @@ error: layout_of((u32) is 1..=) = Layout { LL | type Y = pattern_type!(u32 is 1..); | ^^^^^^ -error: layout_of(Option<(u32) is 1..=>) = Layout { +error: layout_of(Option<(u32) is 1..>) = Layout { size: Size(4 bytes), align: AbiAndPrefAlign { abi: Align(4 bytes), pref: $SOME_ALIGN, }, - abi: Scalar( + backend_repr: Scalar( Initialized { value: Int( I32, @@ -129,7 +129,7 @@ error: layout_of(Option<(u32) is 1..=>) = Layout { abi: Align(1 bytes), pref: $SOME_ALIGN, }, - abi: Memory { + backend_repr: Memory { sized: true, }, fields: Arbitrary { @@ -151,7 +151,7 @@ error: layout_of(Option<(u32) is 1..=>) = Layout { abi: Align(4 bytes), pref: $SOME_ALIGN, }, - abi: Scalar( + backend_repr: Scalar( Initialized { value: Int( I32, @@ -203,7 +203,7 @@ error: layout_of(Option<NonZero<u32>>) = Layout { abi: Align(4 bytes), pref: $SOME_ALIGN, }, - abi: Scalar( + backend_repr: Scalar( Initialized { value: Int( I32, @@ -243,7 +243,7 @@ error: layout_of(Option<NonZero<u32>>) = Layout { abi: Align(1 bytes), pref: $SOME_ALIGN, }, - abi: Memory { + backend_repr: Memory { sized: true, }, fields: Arbitrary { @@ -265,7 +265,7 @@ error: layout_of(Option<NonZero<u32>>) = Layout { abi: Align(4 bytes), pref: $SOME_ALIGN, }, - abi: Scalar( + backend_repr: Scalar( Initialized { value: Int( I32, @@ -317,7 +317,7 @@ error: layout_of(NonZeroU32New) = Layout { abi: Align(4 bytes), pref: $SOME_ALIGN, }, - abi: Scalar( + backend_repr: Scalar( Initialized { value: Int( I32, diff --git a/tests/ui/type/pattern_types/range_patterns_unusable.stderr b/tests/ui/type/pattern_types/range_patterns_unusable.stderr index 8377d417452..7daa41d7081 100644 --- a/tests/ui/type/pattern_types/range_patterns_unusable.stderr +++ b/tests/ui/type/pattern_types/range_patterns_unusable.stderr @@ -4,7 +4,7 @@ error[E0512]: cannot transmute between types of different sizes, or dependently- LL | let _: Option<u32> = unsafe { std::mem::transmute(z) }; | ^^^^^^^^^^^^^^^^^^^ | - = note: source type: `Option<(u32) is 1..=>` (32 bits) + = note: source type: `Option<(u32) is 1..>` (32 bits) = note: target type: `Option<u32>` (64 bits) error: aborting due to 1 previous error diff --git a/tests/ui/type/pattern_types/range_patterns_unusable_math.rs b/tests/ui/type/pattern_types/range_patterns_unusable_math.rs index ece4009e1e7..6125063699b 100644 --- a/tests/ui/type/pattern_types/range_patterns_unusable_math.rs +++ b/tests/ui/type/pattern_types/range_patterns_unusable_math.rs @@ -11,5 +11,5 @@ type Z = Option<pattern_type!(u32 is 1..)>; fn main() { let x: Y = unsafe { std::mem::transmute(42_u32) }; - let x = x + 1_u32; //~ ERROR cannot add `u32` to `(u32) is 1..=` + let x = x + 1_u32; //~ ERROR cannot add `u32` to `(u32) is 1..` } diff --git a/tests/ui/type/pattern_types/range_patterns_unusable_math.stderr b/tests/ui/type/pattern_types/range_patterns_unusable_math.stderr index 373615e3714..a64f1db3176 100644 --- a/tests/ui/type/pattern_types/range_patterns_unusable_math.stderr +++ b/tests/ui/type/pattern_types/range_patterns_unusable_math.stderr @@ -1,10 +1,10 @@ -error[E0369]: cannot add `u32` to `(u32) is 1..=` +error[E0369]: cannot add `u32` to `(u32) is 1..` --> $DIR/range_patterns_unusable_math.rs:14:15 | LL | let x = x + 1_u32; | - ^ ----- u32 | | - | (u32) is 1..= + | (u32) is 1.. error: aborting due to 1 previous error diff --git a/tests/ui/type/pattern_types/reverse_range.rs b/tests/ui/type/pattern_types/reverse_range.rs index 6a245615f1a..e698e9dd541 100644 --- a/tests/ui/type/pattern_types/reverse_range.rs +++ b/tests/ui/type/pattern_types/reverse_range.rs @@ -1,14 +1,11 @@ //! Check that the range start must be smaller than the range end -//@ known-bug: unknown -//@ failure-status: 101 -//@ normalize-stderr: "note: .*\n\n" -> "" -//@ normalize-stderr: "thread 'rustc' panicked.*\n" -> "" -//@ normalize-stderr: "(error: internal compiler error: [^:]+):\d+:\d+: " -> "$1:LL:CC: " -//@ rustc-env:RUST_BACKTRACE=0 - -#![feature(pattern_types)] +#![feature(pattern_types, const_trait_impl, pattern_type_range_trait)] #![feature(pattern_type_macro)] use std::pat::pattern_type; const NONE: pattern_type!(u8 is 1..0) = unsafe { std::mem::transmute(3_u8) }; +//~^ NOTE: exclusive range end at minimum value of type +//~| ERROR: evaluation of constant value failed + +fn main() {} diff --git a/tests/ui/type/pattern_types/reverse_range.stderr b/tests/ui/type/pattern_types/reverse_range.stderr index b714ca7d9ab..90f8ef3261a 100644 --- a/tests/ui/type/pattern_types/reverse_range.stderr +++ b/tests/ui/type/pattern_types/reverse_range.stderr @@ -1,17 +1,9 @@ -error[E0601]: `main` function not found in crate `reverse_range` - --> $DIR/reverse_range.rs:14:78 +error[E0080]: evaluation of constant value failed + --> $DIR/reverse_range.rs:7:36 | LL | const NONE: pattern_type!(u8 is 1..0) = unsafe { std::mem::transmute(3_u8) }; - | ^ consider adding a `main` function to `$DIR/reverse_range.rs` + | ^ evaluation panicked: exclusive range end at minimum value of type - -assertion failed: end <= max_value -error: the compiler unexpectedly panicked. this is a bug. - -query stack during panic: -#0 [eval_to_allocation_raw] const-evaluating + checking `NONE` -#1 [eval_to_const_value_raw] simplifying constant for the type system `NONE` -... and 1 other queries... use `env RUST_BACKTRACE=1` to see the full query stack error: aborting due to 1 previous error -For more information about this error, try `rustc --explain E0601`. +For more information about this error, try `rustc --explain E0080`. diff --git a/tests/ui/type/pattern_types/validity.rs b/tests/ui/type/pattern_types/validity.rs index 77a4e72f675..5a6a688e1b3 100644 --- a/tests/ui/type/pattern_types/validity.rs +++ b/tests/ui/type/pattern_types/validity.rs @@ -1,6 +1,6 @@ //! Check that pattern types have their validity checked -#![feature(pattern_types)] +#![feature(pattern_types, const_trait_impl, pattern_type_range_trait)] #![feature(pattern_type_macro)] use std::pat::pattern_type; diff --git a/tests/ui/type/type-check/missing_trait_impl.stderr b/tests/ui/type/type-check/missing_trait_impl.stderr index 033b42e6736..28ffae2d5e5 100644 --- a/tests/ui/type/type-check/missing_trait_impl.stderr +++ b/tests/ui/type/type-check/missing_trait_impl.stderr @@ -50,7 +50,7 @@ error[E0614]: type `T` cannot be dereferenced --> $DIR/missing_trait_impl.rs:15:13 | LL | let y = *x; - | ^^ + | ^^ can't be dereferenced error: aborting due to 5 previous errors diff --git a/tests/ui/type_length_limit.rs b/tests/ui/type_length_limit.rs index b629455aced..87f5ffd76d7 100644 --- a/tests/ui/type_length_limit.rs +++ b/tests/ui/type_length_limit.rs @@ -2,9 +2,6 @@ //@ compile-flags: -Copt-level=0 -Zenforce-type-length-limit //~^^ ERROR reached the type-length limit -// The regex below normalizes the long type file name to make it suitable for compare-modes. -//@ normalize-stderr: "'\$TEST_BUILD_DIR/.*\.long-type.txt'" -> "'$$TEST_BUILD_DIR/$$FILE.long-type.txt'" - // Test that the type length limit can be changed. // The exact type depends on optimizations, so disable them. diff --git a/tests/ui/type_length_limit.stderr b/tests/ui/type_length_limit.stderr index d913b661c6f..198d133c08c 100644 --- a/tests/ui/type_length_limit.stderr +++ b/tests/ui/type_length_limit.stderr @@ -1,11 +1,11 @@ error: reached the type-length limit while instantiating `std::mem::drop::<Option<((((..., ..., ...), ..., ...), ..., ...), ..., ...)>>` - --> $DIR/type_length_limit.rs:35:5 + --> $DIR/type_length_limit.rs:32:5 | LL | drop::<Option<A>>(None); | ^^^^^^^^^^^^^^^^^^^^^^^ | = help: consider adding a `#![type_length_limit="4010"]` attribute to your crate - = note: the full type name has been written to '$TEST_BUILD_DIR/$FILE.long-type.txt' + = note: the full type name has been written to '$TEST_BUILD_DIR/type_length_limit.long-type.txt' error: reached the type-length limit while instantiating `<{closure@rt::lang_start<()>::{closure#0}} as FnMut<()>>::call_mut` | diff --git a/tests/ui/typeck/auxiliary/derive-demo-issue-136343.rs b/tests/ui/typeck/auxiliary/derive-demo-issue-136343.rs new file mode 100644 index 00000000000..65be439b49a --- /dev/null +++ b/tests/ui/typeck/auxiliary/derive-demo-issue-136343.rs @@ -0,0 +1,7 @@ +extern crate proc_macro; +use proc_macro::TokenStream; + +#[proc_macro_derive(Sample)] +pub fn sample(_: TokenStream) -> TokenStream { + "fn bad<T: Into<U>, U>(a: T) -> U { a }".parse().unwrap() +} diff --git a/tests/ui/typeck/invalid-sugg-for-derive-macro-issue-136343.rs b/tests/ui/typeck/invalid-sugg-for-derive-macro-issue-136343.rs new file mode 100644 index 00000000000..c08030fc5c1 --- /dev/null +++ b/tests/ui/typeck/invalid-sugg-for-derive-macro-issue-136343.rs @@ -0,0 +1,9 @@ +//@ proc-macro: derive-demo-issue-136343.rs + +#[macro_use] +extern crate derive_demo_issue_136343; + +#[derive(Sample)] //~ ERROR mismatched types +struct Test; + +fn main() {} diff --git a/tests/ui/typeck/invalid-sugg-for-derive-macro-issue-136343.stderr b/tests/ui/typeck/invalid-sugg-for-derive-macro-issue-136343.stderr new file mode 100644 index 00000000000..0b9c1d9123a --- /dev/null +++ b/tests/ui/typeck/invalid-sugg-for-derive-macro-issue-136343.stderr @@ -0,0 +1,19 @@ +error[E0308]: mismatched types + --> $DIR/invalid-sugg-for-derive-macro-issue-136343.rs:6:10 + | +LL | #[derive(Sample)] + | ^^^^^^ + | | + | expected type parameter `U`, found type parameter `T` + | expected `U` because of return type + | + = note: expected type parameter `U` + found type parameter `T` + = note: a type parameter was expected, but a different one was found; you might be missing a type parameter or trait bound + = note: for more information, visit https://doc.rust-lang.org/book/ch10-02-traits.html#traits-as-parameters + = note: the caller chooses a type for `U` which can be different from `T` + = note: this error originates in the derive macro `Sample` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/typeck/issue-84768.stderr b/tests/ui/typeck/issue-84768.stderr index 72784ba59c9..8a2200cbf68 100644 --- a/tests/ui/typeck/issue-84768.stderr +++ b/tests/ui/typeck/issue-84768.stderr @@ -20,7 +20,7 @@ help: the return type of this call is `{integer}` due to the type of the argumen LL | <F as FnOnce(&mut u8)>::call_once(f, 1) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-^ | | - | this argument influences the return type of `FnOnce` + | this argument influences the return type of `call_once` note: method defined here --> $SRC_DIR/core/src/ops/function.rs:LL:COL diff --git a/tests/ui/ufcs/ufcs-qpath-self-mismatch.stderr b/tests/ui/ufcs/ufcs-qpath-self-mismatch.stderr index 05071834883..edee7c4f5a1 100644 --- a/tests/ui/ufcs/ufcs-qpath-self-mismatch.stderr +++ b/tests/ui/ufcs/ufcs-qpath-self-mismatch.stderr @@ -25,7 +25,7 @@ help: the return type of this call is `u32` due to the type of the argument pass LL | <i32 as Add<i32>>::add(1u32, 2); | ^^^^^^^^^^^^^^^^^^^^^^^----^^^^ | | - | this argument influences the return type of `Add` + | this argument influences the return type of `add` note: method defined here --> $SRC_DIR/core/src/ops/arith.rs:LL:COL help: change the type of the numeric literal from `u32` to `i32` @@ -48,7 +48,7 @@ help: the return type of this call is `u32` due to the type of the argument pass LL | <i32 as Add<i32>>::add(1, 2u32); | ^^^^^^^^^^^^^^^^^^^^^^^^^^----^ | | - | this argument influences the return type of `Add` + | this argument influences the return type of `add` note: method defined here --> $SRC_DIR/core/src/ops/arith.rs:LL:COL help: change the type of the numeric literal from `u32` to `i32` diff --git a/tests/ui/unpretty/deprecated-attr.rs b/tests/ui/unpretty/deprecated-attr.rs new file mode 100644 index 00000000000..24a32d8a9ac --- /dev/null +++ b/tests/ui/unpretty/deprecated-attr.rs @@ -0,0 +1,19 @@ +//@ compile-flags: -Zunpretty=hir +//@ check-pass + +// FIXME(jdonszelmann): the pretty printing output for deprecated (and possibly more attrs) is +// slightly broken. +#[deprecated] +pub struct PlainDeprecated; + +#[deprecated = "here's why this is deprecated"] +pub struct DirectNote; + +#[deprecated(note = "here's why this is deprecated")] +pub struct ExplicitNote; + +#[deprecated(since = "1.2.3", note = "here's why this is deprecated")] +pub struct SinceAndNote; + +#[deprecated(note = "here's why this is deprecated", since = "1.2.3")] +pub struct FlippedOrder; diff --git a/tests/ui/unpretty/deprecated-attr.stdout b/tests/ui/unpretty/deprecated-attr.stdout new file mode 100644 index 00000000000..675351351a0 --- /dev/null +++ b/tests/ui/unpretty/deprecated-attr.stdout @@ -0,0 +1,28 @@ +#[prelude_import] +use ::std::prelude::rust_2015::*; +#[macro_use] +extern crate std; +//@ compile-flags: -Zunpretty=hir +//@ check-pass + +// FIXME(jdonszelmann): the pretty printing output for deprecated (and possibly more attrs) is +// slightly broken. +#[attr="Deprecation{deprecation: Deprecation{since: Unspecifiednote: +suggestion: }span: }")] +struct PlainDeprecated; + +#[attr="Deprecation{deprecation: Deprecation{since: Unspecifiednote: +here's why this is deprecatedsuggestion: }span: }")] +struct DirectNote; + +#[attr="Deprecation{deprecation: Deprecation{since: Unspecifiednote: +here's why this is deprecatedsuggestion: }span: }")] +struct ExplicitNote; + +#[attr="Deprecation{deprecation: Deprecation{since: NonStandard(1.2.3)note: +here's why this is deprecatedsuggestion: }span: }")] +struct SinceAndNote; + +#[attr="Deprecation{deprecation: Deprecation{since: NonStandard(1.2.3)note: +here's why this is deprecatedsuggestion: }span: }")] +struct FlippedOrder; diff --git a/tests/ui/unpretty/diagnostic-attr.rs b/tests/ui/unpretty/diagnostic-attr.rs new file mode 100644 index 00000000000..27f5b693e69 --- /dev/null +++ b/tests/ui/unpretty/diagnostic-attr.rs @@ -0,0 +1,13 @@ +//@ compile-flags: -Zunpretty=hir +//@ check-pass + +#[diagnostic::on_unimplemented( + message = "My Message for `ImportantTrait<{A}>` implemented for `{Self}`", + label = "My Label", + note = "Note 1", + note = "Note 2" +)] +pub trait ImportantTrait<A> {} + +#[diagnostic::do_not_recommend] +impl<T> ImportantTrait<T> for T where T: Clone {} diff --git a/tests/ui/unpretty/diagnostic-attr.stdout b/tests/ui/unpretty/diagnostic-attr.stdout new file mode 100644 index 00000000000..e8696d04d38 --- /dev/null +++ b/tests/ui/unpretty/diagnostic-attr.stdout @@ -0,0 +1,16 @@ +#[prelude_import] +use ::std::prelude::rust_2015::*; +#[macro_use] +extern crate std; +//@ compile-flags: -Zunpretty=hir +//@ check-pass + +#[diagnostic::on_unimplemented(message = +"My Message for `ImportantTrait<{A}>` implemented for `{Self}`", label = +"My Label", note = "Note 1", note = "Note 2")] +trait ImportantTrait<A> { } + +#[diagnostic::do_not_recommend] +impl <T> ImportantTrait<T> for T where T: Clone + {#![diagnostic::do_not_recommend] +} diff --git a/tests/ui/unsafe-binders/binder-sized-crit.rs b/tests/ui/unsafe-binders/binder-sized-crit.rs new file mode 100644 index 00000000000..37677c0ef69 --- /dev/null +++ b/tests/ui/unsafe-binders/binder-sized-crit.rs @@ -0,0 +1,18 @@ +//@ check-pass + +#![feature(unsafe_binders)] +//~^ WARN the feature `unsafe_binders` is incomplete + +use std::unsafe_binder::wrap_binder; + +struct A { + b: unsafe<> (), +} + +fn main() { + unsafe { + let _ = A { + b: wrap_binder!(()), + }; + } +} diff --git a/tests/ui/unsafe-binders/binder-sized-crit.stderr b/tests/ui/unsafe-binders/binder-sized-crit.stderr new file mode 100644 index 00000000000..3ba6cf2ef8c --- /dev/null +++ b/tests/ui/unsafe-binders/binder-sized-crit.stderr @@ -0,0 +1,11 @@ +warning: the feature `unsafe_binders` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/binder-sized-crit.rs:3:12 + | +LL | #![feature(unsafe_binders)] + | ^^^^^^^^^^^^^^ + | + = note: see issue #130516 <https://github.com/rust-lang/rust/issues/130516> for more information + = note: `#[warn(incomplete_features)]` on by default + +warning: 1 warning emitted + diff --git a/tests/ui/unsafe-binders/type-mismatch.rs b/tests/ui/unsafe-binders/type-mismatch.rs new file mode 100644 index 00000000000..9ac4e817c28 --- /dev/null +++ b/tests/ui/unsafe-binders/type-mismatch.rs @@ -0,0 +1,9 @@ +#![feature(unsafe_binders)] +//~^ WARN the feature `unsafe_binders` is incomplete + +fn main() { + let x: unsafe<> i32 = 0; + //~^ ERROR mismatched types + let x: unsafe<'a> &'a i32 = &0; + //~^ ERROR mismatched types +} diff --git a/tests/ui/unsafe-binders/type-mismatch.stderr b/tests/ui/unsafe-binders/type-mismatch.stderr new file mode 100644 index 00000000000..e694b5d464d --- /dev/null +++ b/tests/ui/unsafe-binders/type-mismatch.stderr @@ -0,0 +1,34 @@ +warning: the feature `unsafe_binders` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/type-mismatch.rs:1:12 + | +LL | #![feature(unsafe_binders)] + | ^^^^^^^^^^^^^^ + | + = note: see issue #130516 <https://github.com/rust-lang/rust/issues/130516> for more information + = note: `#[warn(incomplete_features)]` on by default + +error[E0308]: mismatched types + --> $DIR/type-mismatch.rs:5:27 + | +LL | let x: unsafe<> i32 = 0; + | ------------ ^ expected `unsafe<> i32`, found integer + | | + | expected due to this + | + = note: expected unsafe binder `unsafe<> i32` + found type `{integer}` + +error[E0308]: mismatched types + --> $DIR/type-mismatch.rs:7:33 + | +LL | let x: unsafe<'a> &'a i32 = &0; + | ------------------ ^^ expected `unsafe<'a> &i32`, found `&{integer}` + | | + | expected due to this + | + = note: expected unsafe binder `unsafe<'a> &'a i32` + found reference `&{integer}` + +error: aborting due to 2 previous errors; 1 warning emitted + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/unsafe-fields/unsafe-fields.rs b/tests/ui/unsafe-fields/unsafe-fields.rs index 637471582d7..cb86479bb20 100644 --- a/tests/ui/unsafe-fields/unsafe-fields.rs +++ b/tests/ui/unsafe-fields/unsafe-fields.rs @@ -17,7 +17,7 @@ fn f(a: A) { } struct WithInvalidUnsafeField { - unsafe unsafe_noncopy_field: Vec<u32>, //~ ERROR + unsafe unsafe_noncopy_field: Vec<u32>, } struct WithManuallyDropUnsafeField { diff --git a/tests/ui/unsafe-fields/unsafe-fields.stderr b/tests/ui/unsafe-fields/unsafe-fields.stderr index a1c5d2b44cd..d0e2dc16a13 100644 --- a/tests/ui/unsafe-fields/unsafe-fields.stderr +++ b/tests/ui/unsafe-fields/unsafe-fields.stderr @@ -1,15 +1,3 @@ -error[E0740]: field must implement `Copy` or be wrapped in `ManuallyDrop<...>` to be unsafe - --> $DIR/unsafe-fields.rs:20:5 - | -LL | unsafe unsafe_noncopy_field: Vec<u32>, - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: unsafe fields must not have drop side-effects, which is currently enforced via either `Copy` or `ManuallyDrop<...>` -help: wrap the field type in `ManuallyDrop<...>` - | -LL | unsafe unsafe_noncopy_field: std::mem::ManuallyDrop<Vec<u32>>, - | +++++++++++++++++++++++ + - error[E0133]: use of unsafe field is unsafe and requires unsafe block --> $DIR/unsafe-fields.rs:15:30 | @@ -69,7 +57,6 @@ LL | &raw const self.unsafe_field | = note: unsafe fields may carry library invariants -error: aborting due to 8 previous errors +error: aborting due to 7 previous errors -Some errors have detailed explanations: E0133, E0740. -For more information about an error, try `rustc --explain E0133`. +For more information about this error, try `rustc --explain E0133`. diff --git a/tests/ui/unsized-locals/rust-call.rs b/tests/ui/unsized-locals/rust-call.rs deleted file mode 100644 index ff4075aa4c0..00000000000 --- a/tests/ui/unsized-locals/rust-call.rs +++ /dev/null @@ -1,12 +0,0 @@ -#![feature(unsized_tuple_coercion)] -#![feature(unboxed_closures)] -#![feature(unsized_fn_params)] - -fn bad() -> extern "rust-call" fn(([u8],)) { todo!() } - -fn main() { - let f = bad(); - let slice: Box<([u8],)> = Box::new(([1; 8],)); - f(*slice); - //~^ ERROR the size for values of type `[u8]` cannot be known at compilation time -} diff --git a/tests/ui/unsized-locals/rust-call.stderr b/tests/ui/unsized-locals/rust-call.stderr deleted file mode 100644 index 9eb0f3dabcc..00000000000 --- a/tests/ui/unsized-locals/rust-call.stderr +++ /dev/null @@ -1,13 +0,0 @@ -error[E0277]: the size for values of type `[u8]` cannot be known at compilation time - --> $DIR/rust-call.rs:10:7 - | -LL | f(*slice); - | ^^^^^^ doesn't have a size known at compile-time - | - = help: within `([u8],)`, the trait `Sized` is not implemented for `[u8]` - = note: required because it appears within the type `([u8],)` - = note: argument required to be sized due to `extern "rust-call"` ABI - -error: aborting due to 1 previous error - -For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/unsized-locals/unsized-exprs-rpass.rs b/tests/ui/unsized-locals/unsized-exprs-rpass.rs index a5aada20d3e..861583efc40 100644 --- a/tests/ui/unsized-locals/unsized-exprs-rpass.rs +++ b/tests/ui/unsized-locals/unsized-exprs-rpass.rs @@ -1,6 +1,6 @@ //@ run-pass #![allow(incomplete_features, unused_braces, unused_parens)] -#![feature(unsized_tuple_coercion, unsized_locals, unsized_fn_params)] +#![feature(unsized_locals, unsized_fn_params)] struct A<X: ?Sized>(#[allow(dead_code)] X); @@ -8,9 +8,6 @@ fn udrop<T: ?Sized>(_x: T) {} fn foo() -> Box<[u8]> { Box::new(*b"foo") } -fn tfoo() -> Box<(i32, [u8])> { - Box::new((42, *b"foo")) -} fn afoo() -> Box<A<[u8]>> { Box::new(A(*b"foo")) } @@ -27,7 +24,6 @@ fn main() { udrop::<[u8]>(if true { *foo() } else { *foo() }); udrop::<[u8]>({ *foo() }); udrop::<[u8]>((*foo())); - udrop::<[u8]>((*tfoo()).1); *afoo() + 42; udrop as fn([u8]); } diff --git a/tests/ui/unsized-locals/unsized-exprs.rs b/tests/ui/unsized-locals/unsized-exprs.rs index 1729b9ffa86..8fe5dcba8a9 100644 --- a/tests/ui/unsized-locals/unsized-exprs.rs +++ b/tests/ui/unsized-locals/unsized-exprs.rs @@ -1,4 +1,4 @@ -#![feature(unsized_tuple_coercion, unsized_fn_params)] +#![feature(unsized_fn_params)] struct A<X: ?Sized>(X); @@ -6,9 +6,6 @@ fn udrop<T: ?Sized>(_x: T) {} fn foo() -> Box<[u8]> { Box::new(*b"foo") } -fn tfoo() -> Box<(i32, [u8])> { - Box::new((42, *b"foo")) -} fn afoo() -> Box<A<[u8]>> { Box::new(A(*b"foo")) } @@ -19,8 +16,6 @@ impl std::ops::Add<i32> for A<[u8]> { } fn main() { - udrop::<(i32, [u8])>((42, *foo())); - //~^ERROR E0277 udrop::<A<[u8]>>(A { 0: *foo() }); //~^ERROR E0277 udrop::<A<[u8]>>(A(*foo())); diff --git a/tests/ui/unsized-locals/unsized-exprs.stderr b/tests/ui/unsized-locals/unsized-exprs.stderr index 8a2ecf0f6c3..1b61254870f 100644 --- a/tests/ui/unsized-locals/unsized-exprs.stderr +++ b/tests/ui/unsized-locals/unsized-exprs.stderr @@ -1,15 +1,5 @@ error[E0277]: the size for values of type `[u8]` cannot be known at compilation time - --> $DIR/unsized-exprs.rs:22:26 - | -LL | udrop::<(i32, [u8])>((42, *foo())); - | ^^^^^^^^^^^^ doesn't have a size known at compile-time - | - = help: within `({integer}, [u8])`, the trait `Sized` is not implemented for `[u8]` - = note: required because it appears within the type `({integer}, [u8])` - = note: tuples must have a statically known size to be initialized - -error[E0277]: the size for values of type `[u8]` cannot be known at compilation time - --> $DIR/unsized-exprs.rs:24:22 + --> $DIR/unsized-exprs.rs:19:22 | LL | udrop::<A<[u8]>>(A { 0: *foo() }); | ^^^^^^^^^^^^^^^ doesn't have a size known at compile-time @@ -23,7 +13,7 @@ LL | struct A<X: ?Sized>(X); = note: structs must have a statically known size to be initialized error[E0277]: the size for values of type `[u8]` cannot be known at compilation time - --> $DIR/unsized-exprs.rs:26:22 + --> $DIR/unsized-exprs.rs:21:22 | LL | udrop::<A<[u8]>>(A(*foo())); | ^^^^^^^^^ doesn't have a size known at compile-time @@ -36,6 +26,6 @@ LL | struct A<X: ?Sized>(X); | ^ = note: the return type of a function must have a statically known size -error: aborting due to 3 previous errors +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/unsized-locals/unsized-exprs2.rs b/tests/ui/unsized-locals/unsized-exprs2.rs index 127d8717e58..7706c8b8b8f 100644 --- a/tests/ui/unsized-locals/unsized-exprs2.rs +++ b/tests/ui/unsized-locals/unsized-exprs2.rs @@ -1,4 +1,4 @@ -#![feature(unsized_tuple_coercion, unsized_fn_params)] +#![feature(unsized_fn_params)] struct A<X: ?Sized>(X); @@ -6,9 +6,6 @@ fn udrop<T: ?Sized>(_x: T) {} fn foo() -> Box<[u8]> { Box::new(*b"foo") } -fn tfoo() -> Box<(i32, [u8])> { - Box::new((42, *b"foo")) -} fn afoo() -> Box<A<[u8]>> { Box::new(A(*b"foo")) } diff --git a/tests/ui/unsized-locals/unsized-exprs2.stderr b/tests/ui/unsized-locals/unsized-exprs2.stderr index 47b6d72acc7..79f0d93d421 100644 --- a/tests/ui/unsized-locals/unsized-exprs2.stderr +++ b/tests/ui/unsized-locals/unsized-exprs2.stderr @@ -1,5 +1,5 @@ error[E0508]: cannot move out of type `[u8]`, a non-copy slice - --> $DIR/unsized-exprs2.rs:22:5 + --> $DIR/unsized-exprs2.rs:19:5 | LL | udrop::<[u8]>(foo()[..]); | ^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/unsized/unsized-tuple-impls.rs b/tests/ui/unsized/unsized-tuple-impls.rs deleted file mode 100644 index a76e2df5750..00000000000 --- a/tests/ui/unsized/unsized-tuple-impls.rs +++ /dev/null @@ -1,21 +0,0 @@ -//@ run-pass - -#![feature(unsized_tuple_coercion)] - -use std::collections::HashSet; - -fn main() { - let x : &(i32, i32, [i32]) = &(0, 1, [2, 3]); - let y : &(i32, i32, [i32]) = &(0, 1, [2, 3, 4]); - let mut a = [y, x]; - a.sort(); - assert_eq!(a, [x, y]); - - assert_eq!(&format!("{:?}", a), "[(0, 1, [2, 3]), (0, 1, [2, 3, 4])]"); - - let mut h = HashSet::new(); - h.insert(x); - h.insert(y); - assert!(h.contains(x)); - assert!(h.contains(y)); -} diff --git a/tests/ui/virtual-call-attrs-issue-137646.rs b/tests/ui/virtual-call-attrs-issue-137646.rs new file mode 100644 index 00000000000..e80bd5768a4 --- /dev/null +++ b/tests/ui/virtual-call-attrs-issue-137646.rs @@ -0,0 +1,45 @@ +//! Regression test for https://github.com/rust-lang/rust/issues/137646. +//! The parameter value at all calls to `check` should be `(1, 1, 1)`. + +//@ run-pass + +use std::hint::black_box; + +type T = (i32, i32, i32); + +pub trait Trait { + fn m(&self, _: T, _: T) {} +} + +impl Trait for () { + fn m(&self, mut _v1: T, v2: T) { + _v1 = (0, 0, 0); + check(v2); + } +} + +pub fn run_1(trait_: &dyn Trait) { + let v1 = (1, 1, 1); + let v2 = (1, 1, 1); + trait_.m(v1, v2); +} + +pub fn run_2(trait_: &dyn Trait) { + let v1 = (1, 1, 1); + let v2 = (1, 1, 1); + trait_.m(v1, v2); + check(v1); + check(v2); +} + +#[inline(never)] +fn check(v: T) { + assert_eq!(v, (1, 1, 1)); +} + +fn main() { + black_box(run_1 as fn(&dyn Trait)); + black_box(run_2 as fn(&dyn Trait)); + run_1(&()); + run_2(&()); +} diff --git a/tests/ui/wf/ice-hir-wf-check-anon-const-issue-122989.rs b/tests/ui/wf/ice-hir-wf-check-anon-const-issue-122989.rs index 997bee1e600..89e4b77b6cd 100644 --- a/tests/ui/wf/ice-hir-wf-check-anon-const-issue-122989.rs +++ b/tests/ui/wf/ice-hir-wf-check-anon-const-issue-122989.rs @@ -3,6 +3,7 @@ trait Foo<const N: Bar<2>> { //~^ WARN trait objects without an explicit `dyn` are deprecated //~| WARN this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! //~| ERROR cycle detected when computing type of `Foo::N` + //~| ERROR cycle detected when computing type of `Foo::N` fn func() {} } diff --git a/tests/ui/wf/ice-hir-wf-check-anon-const-issue-122989.stderr b/tests/ui/wf/ice-hir-wf-check-anon-const-issue-122989.stderr index 733b729faf0..a381f2acdce 100644 --- a/tests/ui/wf/ice-hir-wf-check-anon-const-issue-122989.stderr +++ b/tests/ui/wf/ice-hir-wf-check-anon-const-issue-122989.stderr @@ -13,7 +13,7 @@ LL | trait Foo<const N: dyn Bar<2>> { | +++ warning: trait objects without an explicit `dyn` are deprecated - --> $DIR/ice-hir-wf-check-anon-const-issue-122989.rs:9:20 + --> $DIR/ice-hir-wf-check-anon-const-issue-122989.rs:10:20 | LL | trait Bar<const M: Foo<2>> {} | ^^^^^^ @@ -32,7 +32,7 @@ LL | trait Foo<const N: Bar<2>> { | ^^^^^^^^^^^^^^^ | note: ...which requires computing type of `Bar::M`... - --> $DIR/ice-hir-wf-check-anon-const-issue-122989.rs:9:11 + --> $DIR/ice-hir-wf-check-anon-const-issue-122989.rs:10:11 | LL | trait Bar<const M: Foo<2>> {} | ^^^^^^^^^^^^^^^ @@ -44,6 +44,26 @@ LL | trait Foo<const N: Bar<2>> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^ = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information -error: aborting due to 1 previous error; 2 warnings emitted +error[E0391]: cycle detected when computing type of `Foo::N` + --> $DIR/ice-hir-wf-check-anon-const-issue-122989.rs:2:11 + | +LL | trait Foo<const N: Bar<2>> { + | ^^^^^^^^^^^^^^^ + | +note: ...which requires computing type of `Bar::M`... + --> $DIR/ice-hir-wf-check-anon-const-issue-122989.rs:10:11 + | +LL | trait Bar<const M: Foo<2>> {} + | ^^^^^^^^^^^^^^^ + = note: ...which again requires computing type of `Foo::N`, completing the cycle +note: cycle used when computing explicit predicates of trait `Foo` + --> $DIR/ice-hir-wf-check-anon-const-issue-122989.rs:2:1 + | +LL | trait Foo<const N: Bar<2>> { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + +error: aborting due to 2 previous errors; 2 warnings emitted For more information about this error, try `rustc --explain E0391`. diff --git a/tests/ui/wf/wf-convert-dyn-incompat-trait-obj-box.rs b/tests/ui/wf/wf-convert-dyn-incompat-trait-obj-box.rs deleted file mode 100644 index 26292a1d218..00000000000 --- a/tests/ui/wf/wf-convert-dyn-incompat-trait-obj-box.rs +++ /dev/null @@ -1,18 +0,0 @@ -// Check that we do not allow casts or coercions -// to dyn-incompatible trait objects inside a Box - -#![feature(dyn_compatible_for_dispatch)] - -trait Trait: Sized {} - -struct S; - -impl Trait for S {} - -fn takes_box(t: Box<dyn Trait>) {} - -fn main() { - Box::new(S) as Box<dyn Trait>; //~ ERROR E0038 - let t_box: Box<dyn Trait> = Box::new(S); //~ ERROR E0038 - takes_box(Box::new(S)); //~ ERROR E0038 -} diff --git a/tests/ui/wf/wf-convert-dyn-incompat-trait-obj-box.stderr b/tests/ui/wf/wf-convert-dyn-incompat-trait-obj-box.stderr deleted file mode 100644 index f3e4f2a63e9..00000000000 --- a/tests/ui/wf/wf-convert-dyn-incompat-trait-obj-box.stderr +++ /dev/null @@ -1,54 +0,0 @@ -error[E0038]: the trait `Trait` is not dyn compatible - --> $DIR/wf-convert-dyn-incompat-trait-obj-box.rs:16:33 - | -LL | let t_box: Box<dyn Trait> = Box::new(S); - | ^^^^^^^^^^^ `Trait` is not dyn compatible - | -note: for a trait to be dyn compatible it needs to allow building a vtable - for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> - --> $DIR/wf-convert-dyn-incompat-trait-obj-box.rs:6:14 - | -LL | trait Trait: Sized {} - | ----- ^^^^^ ...because it requires `Self: Sized` - | | - | this trait is not dyn compatible... - = help: only type `S` implements `Trait`; consider using it directly instead. - = note: required for the cast from `Box<S>` to `Box<dyn Trait>` - -error[E0038]: the trait `Trait` is not dyn compatible - --> $DIR/wf-convert-dyn-incompat-trait-obj-box.rs:17:15 - | -LL | takes_box(Box::new(S)); - | ^^^^^^^^^^^ `Trait` is not dyn compatible - | -note: for a trait to be dyn compatible it needs to allow building a vtable - for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> - --> $DIR/wf-convert-dyn-incompat-trait-obj-box.rs:6:14 - | -LL | trait Trait: Sized {} - | ----- ^^^^^ ...because it requires `Self: Sized` - | | - | this trait is not dyn compatible... - = help: only type `S` implements `Trait`; consider using it directly instead. - = note: required for the cast from `Box<S>` to `Box<(dyn Trait + 'static)>` - -error[E0038]: the trait `Trait` is not dyn compatible - --> $DIR/wf-convert-dyn-incompat-trait-obj-box.rs:15:5 - | -LL | Box::new(S) as Box<dyn Trait>; - | ^^^^^^^^^^^ `Trait` is not dyn compatible - | -note: for a trait to be dyn compatible it needs to allow building a vtable - for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> - --> $DIR/wf-convert-dyn-incompat-trait-obj-box.rs:6:14 - | -LL | trait Trait: Sized {} - | ----- ^^^^^ ...because it requires `Self: Sized` - | | - | this trait is not dyn compatible... - = help: only type `S` implements `Trait`; consider using it directly instead. - = note: required for the cast from `Box<S>` to `Box<dyn Trait>` - -error: aborting due to 3 previous errors - -For more information about this error, try `rustc --explain E0038`. diff --git a/tests/ui/wf/wf-convert-dyn-incompat-trait-obj.rs b/tests/ui/wf/wf-convert-dyn-incompat-trait-obj.rs deleted file mode 100644 index ec4bb2897f9..00000000000 --- a/tests/ui/wf/wf-convert-dyn-incompat-trait-obj.rs +++ /dev/null @@ -1,18 +0,0 @@ -// Check that we do not allow casts or coercions -// to dyn-incompatible trait objects by ref - -#![feature(dyn_compatible_for_dispatch)] - -trait Trait: Sized {} - -struct S; - -impl Trait for S {} - -fn takes_trait(t: &dyn Trait) {} - -fn main() { - &S as &dyn Trait; //~ ERROR E0038 - let t: &dyn Trait = &S; //~ ERROR E0038 - takes_trait(&S); //~ ERROR E0038 -} diff --git a/tests/ui/wf/wf-convert-dyn-incompat-trait-obj.stderr b/tests/ui/wf/wf-convert-dyn-incompat-trait-obj.stderr deleted file mode 100644 index 716d0e78ff1..00000000000 --- a/tests/ui/wf/wf-convert-dyn-incompat-trait-obj.stderr +++ /dev/null @@ -1,54 +0,0 @@ -error[E0038]: the trait `Trait` is not dyn compatible - --> $DIR/wf-convert-dyn-incompat-trait-obj.rs:16:25 - | -LL | let t: &dyn Trait = &S; - | ^^ `Trait` is not dyn compatible - | -note: for a trait to be dyn compatible it needs to allow building a vtable - for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> - --> $DIR/wf-convert-dyn-incompat-trait-obj.rs:6:14 - | -LL | trait Trait: Sized {} - | ----- ^^^^^ ...because it requires `Self: Sized` - | | - | this trait is not dyn compatible... - = help: only type `S` implements `Trait`; consider using it directly instead. - = note: required for the cast from `&S` to `&dyn Trait` - -error[E0038]: the trait `Trait` is not dyn compatible - --> $DIR/wf-convert-dyn-incompat-trait-obj.rs:17:17 - | -LL | takes_trait(&S); - | ^^ `Trait` is not dyn compatible - | -note: for a trait to be dyn compatible it needs to allow building a vtable - for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> - --> $DIR/wf-convert-dyn-incompat-trait-obj.rs:6:14 - | -LL | trait Trait: Sized {} - | ----- ^^^^^ ...because it requires `Self: Sized` - | | - | this trait is not dyn compatible... - = help: only type `S` implements `Trait`; consider using it directly instead. - = note: required for the cast from `&S` to `&dyn Trait` - -error[E0038]: the trait `Trait` is not dyn compatible - --> $DIR/wf-convert-dyn-incompat-trait-obj.rs:15:5 - | -LL | &S as &dyn Trait; - | ^^ `Trait` is not dyn compatible - | -note: for a trait to be dyn compatible it needs to allow building a vtable - for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> - --> $DIR/wf-convert-dyn-incompat-trait-obj.rs:6:14 - | -LL | trait Trait: Sized {} - | ----- ^^^^^ ...because it requires `Self: Sized` - | | - | this trait is not dyn compatible... - = help: only type `S` implements `Trait`; consider using it directly instead. - = note: required for the cast from `&S` to `&dyn Trait` - -error: aborting due to 3 previous errors - -For more information about this error, try `rustc --explain E0038`. diff --git a/tests/ui/wf/wf-dyn-incompat-trait-obj-match.rs b/tests/ui/wf/wf-dyn-incompat-trait-obj-match.rs deleted file mode 100644 index 6eba6b7abec..00000000000 --- a/tests/ui/wf/wf-dyn-incompat-trait-obj-match.rs +++ /dev/null @@ -1,29 +0,0 @@ -// Check that we do not allow coercions to object -// unsafe trait objects in match arms - -#![feature(dyn_compatible_for_dispatch)] - -trait Trait: Sized {} - -struct S; - -impl Trait for S {} - -struct R; - -impl Trait for R {} - -fn opt() -> Option<()> { - Some(()) -} - -fn main() { - match opt() { - Some(()) => &S, - None => &R, //~ ERROR E0308 - } - let t: &dyn Trait = match opt() { - Some(()) => &S, //~ ERROR E0038 - None => &R, //~ ERROR E0038 - }; -} diff --git a/tests/ui/wf/wf-dyn-incompat-trait-obj-match.stderr b/tests/ui/wf/wf-dyn-incompat-trait-obj-match.stderr deleted file mode 100644 index a7405ce4caa..00000000000 --- a/tests/ui/wf/wf-dyn-incompat-trait-obj-match.stderr +++ /dev/null @@ -1,60 +0,0 @@ -error[E0308]: `match` arms have incompatible types - --> $DIR/wf-dyn-incompat-trait-obj-match.rs:23:17 - | -LL | / match opt() { -LL | | Some(()) => &S, - | | -- this is found to be of type `&S` -LL | | None => &R, - | | ^^ expected `&S`, found `&R` -LL | | } - | |_____- `match` arms have incompatible types - | - = note: expected reference `&S` - found reference `&R` - -error[E0038]: the trait `Trait` is not dyn compatible - --> $DIR/wf-dyn-incompat-trait-obj-match.rs:26:21 - | -LL | Some(()) => &S, - | ^^ `Trait` is not dyn compatible - | -note: for a trait to be dyn compatible it needs to allow building a vtable - for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> - --> $DIR/wf-dyn-incompat-trait-obj-match.rs:6:14 - | -LL | trait Trait: Sized {} - | ----- ^^^^^ ...because it requires `Self: Sized` - | | - | this trait is not dyn compatible... - = help: the following types implement `Trait`: - S - R - consider defining an enum where each variant holds one of these types, - implementing `Trait` for this new enum and using it instead - = note: required for the cast from `&S` to `&dyn Trait` - -error[E0038]: the trait `Trait` is not dyn compatible - --> $DIR/wf-dyn-incompat-trait-obj-match.rs:27:17 - | -LL | None => &R, - | ^^ `Trait` is not dyn compatible - | -note: for a trait to be dyn compatible it needs to allow building a vtable - for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> - --> $DIR/wf-dyn-incompat-trait-obj-match.rs:6:14 - | -LL | trait Trait: Sized {} - | ----- ^^^^^ ...because it requires `Self: Sized` - | | - | this trait is not dyn compatible... - = help: the following types implement `Trait`: - S - R - consider defining an enum where each variant holds one of these types, - implementing `Trait` for this new enum and using it instead - = note: required for the cast from `&R` to `&dyn Trait` - -error: aborting due to 3 previous errors - -Some errors have detailed explanations: E0038, E0308. -For more information about an error, try `rustc --explain E0038`. diff --git a/tests/ui/wf/wf-normalization-sized.next.stderr b/tests/ui/wf/wf-normalization-sized.next.stderr index 83b56bb6b19..66c4f214415 100644 --- a/tests/ui/wf/wf-normalization-sized.next.stderr +++ b/tests/ui/wf/wf-normalization-sized.next.stderr @@ -7,16 +7,6 @@ LL | const _: <[[[[[[u8]]]]]] as WellUnformed>::RequestNormalize = (); = help: the trait `Sized` is not implemented for `[[[[[u8]]]]]` = note: slice and array elements must have `Sized` type -error[E0277]: the size for values of type `[[[[[u8]]]]]` cannot be known at compilation time - --> $DIR/wf-normalization-sized.rs:19:11 - | -LL | const _: <[[[[[[u8]]]]]] as WellUnformed>::RequestNormalize = (); - | ^^^^^^^^^^^^^^ doesn't have a size known at compile-time - | - = help: the trait `Sized` is not implemented for `[[[[[u8]]]]]` - = note: slice and array elements must have `Sized` type - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` - error[E0277]: the size for values of type `str` cannot be known at compilation time --> $DIR/wf-normalization-sized.rs:22:11 | @@ -27,6 +17,16 @@ LL | const _: <Vec<str> as WellUnformed>::RequestNormalize = (); note: required by an implicit `Sized` bound in `Vec` --> $SRC_DIR/alloc/src/vec/mod.rs:LL:COL +error[E0277]: the size for values of type `[[[[[u8]]]]]` cannot be known at compilation time + --> $DIR/wf-normalization-sized.rs:19:11 + | +LL | const _: <[[[[[[u8]]]]]] as WellUnformed>::RequestNormalize = (); + | ^^^^^^^^^^^^^^ doesn't have a size known at compile-time + | + = help: the trait `Sized` is not implemented for `[[[[[u8]]]]]` + = note: slice and array elements must have `Sized` type + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + error[E0277]: the size for values of type `str` cannot be known at compilation time --> $DIR/wf-normalization-sized.rs:22:11 | diff --git a/tests/ui/where-clauses/cfg_attribute.a.stderr b/tests/ui/where-clauses/cfg_attribute.a.stderr new file mode 100644 index 00000000000..0ede890eb44 --- /dev/null +++ b/tests/ui/where-clauses/cfg_attribute.a.stderr @@ -0,0 +1,288 @@ +error: expected non-macro attribute, found attribute macro `derive` + --> $DIR/cfg_attribute.rs:32:7 + | +LL | #[derive(Clone)] ():, + | ^^^^^^ not a non-macro attribute + +error: expected non-macro attribute, found attribute macro `derive` + --> $DIR/cfg_attribute.rs:43:11 + | +LL | #[derive(Clone)] ():, + | ^^^^^^ not a non-macro attribute + +error: expected non-macro attribute, found attribute macro `derive` + --> $DIR/cfg_attribute.rs:54:11 + | +LL | #[derive(Clone)] ():, + | ^^^^^^ not a non-macro attribute + +error: expected non-macro attribute, found attribute macro `derive` + --> $DIR/cfg_attribute.rs:66:7 + | +LL | #[derive(Clone)] ():, + | ^^^^^^ not a non-macro attribute + +error: expected non-macro attribute, found attribute macro `derive` + --> $DIR/cfg_attribute.rs:76:11 + | +LL | #[derive(Clone)] ():, + | ^^^^^^ not a non-macro attribute + +error: expected non-macro attribute, found attribute macro `derive` + --> $DIR/cfg_attribute.rs:87:11 + | +LL | #[derive(Clone)] ():, + | ^^^^^^ not a non-macro attribute + +error: expected non-macro attribute, found attribute macro `derive` + --> $DIR/cfg_attribute.rs:100:7 + | +LL | #[derive(Clone)] ():, + | ^^^^^^ not a non-macro attribute + +error: expected non-macro attribute, found attribute macro `derive` + --> $DIR/cfg_attribute.rs:114:7 + | +LL | #[derive(Clone)] ():, + | ^^^^^^ not a non-macro attribute + +error: expected non-macro attribute, found attribute macro `derive` + --> $DIR/cfg_attribute.rs:129:7 + | +LL | #[derive(Clone)] ():, + | ^^^^^^ not a non-macro attribute + +error: expected non-macro attribute, found attribute macro `derive` + --> $DIR/cfg_attribute.rs:144:7 + | +LL | #[derive(Clone)] ():, + | ^^^^^^ not a non-macro attribute + +error: expected non-macro attribute, found attribute macro `derive` + --> $DIR/cfg_attribute.rs:155:7 + | +LL | #[derive(Clone)] ():, + | ^^^^^^ not a non-macro attribute + +error: expected non-macro attribute, found attribute macro `derive` + --> $DIR/cfg_attribute.rs:165:11 + | +LL | #[derive(Clone)] ():, + | ^^^^^^ not a non-macro attribute + +error: expected non-macro attribute, found attribute macro `derive` + --> $DIR/cfg_attribute.rs:178:7 + | +LL | #[derive(Clone)] ():, + | ^^^^^^ not a non-macro attribute + +error: most attributes are not supported in `where` clauses + --> $DIR/cfg_attribute.rs:32:5 + | +LL | #[derive(Clone)] ():, + | ^^^^^^^^^^^^^^^^ + | + = help: only `#[cfg]` and `#[cfg_attr]` are supported + +error: most attributes are not supported in `where` clauses + --> $DIR/cfg_attribute.rs:35:5 + | +LL | #[rustfmt::skip] ():, + | ^^^^^^^^^^^^^^^^ + | + = help: only `#[cfg]` and `#[cfg_attr]` are supported + +error: most attributes are not supported in `where` clauses + --> $DIR/cfg_attribute.rs:66:5 + | +LL | #[derive(Clone)] ():, + | ^^^^^^^^^^^^^^^^ + | + = help: only `#[cfg]` and `#[cfg_attr]` are supported + +error: most attributes are not supported in `where` clauses + --> $DIR/cfg_attribute.rs:69:5 + | +LL | #[rustfmt::skip] ():, + | ^^^^^^^^^^^^^^^^ + | + = help: only `#[cfg]` and `#[cfg_attr]` are supported + +error: most attributes are not supported in `where` clauses + --> $DIR/cfg_attribute.rs:100:5 + | +LL | #[derive(Clone)] ():, + | ^^^^^^^^^^^^^^^^ + | + = help: only `#[cfg]` and `#[cfg_attr]` are supported + +error: most attributes are not supported in `where` clauses + --> $DIR/cfg_attribute.rs:103:5 + | +LL | #[rustfmt::skip] ():, + | ^^^^^^^^^^^^^^^^ + | + = help: only `#[cfg]` and `#[cfg_attr]` are supported + +error: most attributes are not supported in `where` clauses + --> $DIR/cfg_attribute.rs:114:5 + | +LL | #[derive(Clone)] ():, + | ^^^^^^^^^^^^^^^^ + | + = help: only `#[cfg]` and `#[cfg_attr]` are supported + +error: most attributes are not supported in `where` clauses + --> $DIR/cfg_attribute.rs:117:5 + | +LL | #[rustfmt::skip] ():, + | ^^^^^^^^^^^^^^^^ + | + = help: only `#[cfg]` and `#[cfg_attr]` are supported + +error: most attributes are not supported in `where` clauses + --> $DIR/cfg_attribute.rs:129:5 + | +LL | #[derive(Clone)] ():, + | ^^^^^^^^^^^^^^^^ + | + = help: only `#[cfg]` and `#[cfg_attr]` are supported + +error: most attributes are not supported in `where` clauses + --> $DIR/cfg_attribute.rs:132:5 + | +LL | #[rustfmt::skip] ():, + | ^^^^^^^^^^^^^^^^ + | + = help: only `#[cfg]` and `#[cfg_attr]` are supported + +error: most attributes are not supported in `where` clauses + --> $DIR/cfg_attribute.rs:144:5 + | +LL | #[derive(Clone)] ():, + | ^^^^^^^^^^^^^^^^ + | + = help: only `#[cfg]` and `#[cfg_attr]` are supported + +error: most attributes are not supported in `where` clauses + --> $DIR/cfg_attribute.rs:147:5 + | +LL | #[rustfmt::skip] ():, + | ^^^^^^^^^^^^^^^^ + | + = help: only `#[cfg]` and `#[cfg_attr]` are supported + +error: most attributes are not supported in `where` clauses + --> $DIR/cfg_attribute.rs:155:5 + | +LL | #[derive(Clone)] ():, + | ^^^^^^^^^^^^^^^^ + | + = help: only `#[cfg]` and `#[cfg_attr]` are supported + +error: most attributes are not supported in `where` clauses + --> $DIR/cfg_attribute.rs:158:5 + | +LL | #[rustfmt::skip] ():, + | ^^^^^^^^^^^^^^^^ + | + = help: only `#[cfg]` and `#[cfg_attr]` are supported + +error: most attributes are not supported in `where` clauses + --> $DIR/cfg_attribute.rs:178:5 + | +LL | #[derive(Clone)] ():, + | ^^^^^^^^^^^^^^^^ + | + = help: only `#[cfg]` and `#[cfg_attr]` are supported + +error: most attributes are not supported in `where` clauses + --> $DIR/cfg_attribute.rs:181:5 + | +LL | #[rustfmt::skip] ():, + | ^^^^^^^^^^^^^^^^ + | + = help: only `#[cfg]` and `#[cfg_attr]` are supported + +error: most attributes are not supported in `where` clauses + --> $DIR/cfg_attribute.rs:43:9 + | +LL | #[derive(Clone)] ():, + | ^^^^^^^^^^^^^^^^ + | + = help: only `#[cfg]` and `#[cfg_attr]` are supported + +error: most attributes are not supported in `where` clauses + --> $DIR/cfg_attribute.rs:46:9 + | +LL | #[rustfmt::skip] ():; + | ^^^^^^^^^^^^^^^^ + | + = help: only `#[cfg]` and `#[cfg_attr]` are supported + +error: most attributes are not supported in `where` clauses + --> $DIR/cfg_attribute.rs:54:9 + | +LL | #[derive(Clone)] ():, + | ^^^^^^^^^^^^^^^^ + | + = help: only `#[cfg]` and `#[cfg_attr]` are supported + +error: most attributes are not supported in `where` clauses + --> $DIR/cfg_attribute.rs:57:9 + | +LL | #[rustfmt::skip] ():; + | ^^^^^^^^^^^^^^^^ + | + = help: only `#[cfg]` and `#[cfg_attr]` are supported + +error: most attributes are not supported in `where` clauses + --> $DIR/cfg_attribute.rs:76:9 + | +LL | #[derive(Clone)] ():, + | ^^^^^^^^^^^^^^^^ + | + = help: only `#[cfg]` and `#[cfg_attr]` are supported + +error: most attributes are not supported in `where` clauses + --> $DIR/cfg_attribute.rs:79:9 + | +LL | #[rustfmt::skip] ():; + | ^^^^^^^^^^^^^^^^ + | + = help: only `#[cfg]` and `#[cfg_attr]` are supported + +error: most attributes are not supported in `where` clauses + --> $DIR/cfg_attribute.rs:87:9 + | +LL | #[derive(Clone)] ():, + | ^^^^^^^^^^^^^^^^ + | + = help: only `#[cfg]` and `#[cfg_attr]` are supported + +error: most attributes are not supported in `where` clauses + --> $DIR/cfg_attribute.rs:90:9 + | +LL | #[rustfmt::skip] ():, + | ^^^^^^^^^^^^^^^^ + | + = help: only `#[cfg]` and `#[cfg_attr]` are supported + +error: most attributes are not supported in `where` clauses + --> $DIR/cfg_attribute.rs:165:9 + | +LL | #[derive(Clone)] ():, + | ^^^^^^^^^^^^^^^^ + | + = help: only `#[cfg]` and `#[cfg_attr]` are supported + +error: most attributes are not supported in `where` clauses + --> $DIR/cfg_attribute.rs:168:9 + | +LL | #[rustfmt::skip] ():, + | ^^^^^^^^^^^^^^^^ + | + = help: only `#[cfg]` and `#[cfg_attr]` are supported + +error: aborting due to 39 previous errors + diff --git a/tests/ui/where-clauses/cfg_attribute.b.stderr b/tests/ui/where-clauses/cfg_attribute.b.stderr new file mode 100644 index 00000000000..0ede890eb44 --- /dev/null +++ b/tests/ui/where-clauses/cfg_attribute.b.stderr @@ -0,0 +1,288 @@ +error: expected non-macro attribute, found attribute macro `derive` + --> $DIR/cfg_attribute.rs:32:7 + | +LL | #[derive(Clone)] ():, + | ^^^^^^ not a non-macro attribute + +error: expected non-macro attribute, found attribute macro `derive` + --> $DIR/cfg_attribute.rs:43:11 + | +LL | #[derive(Clone)] ():, + | ^^^^^^ not a non-macro attribute + +error: expected non-macro attribute, found attribute macro `derive` + --> $DIR/cfg_attribute.rs:54:11 + | +LL | #[derive(Clone)] ():, + | ^^^^^^ not a non-macro attribute + +error: expected non-macro attribute, found attribute macro `derive` + --> $DIR/cfg_attribute.rs:66:7 + | +LL | #[derive(Clone)] ():, + | ^^^^^^ not a non-macro attribute + +error: expected non-macro attribute, found attribute macro `derive` + --> $DIR/cfg_attribute.rs:76:11 + | +LL | #[derive(Clone)] ():, + | ^^^^^^ not a non-macro attribute + +error: expected non-macro attribute, found attribute macro `derive` + --> $DIR/cfg_attribute.rs:87:11 + | +LL | #[derive(Clone)] ():, + | ^^^^^^ not a non-macro attribute + +error: expected non-macro attribute, found attribute macro `derive` + --> $DIR/cfg_attribute.rs:100:7 + | +LL | #[derive(Clone)] ():, + | ^^^^^^ not a non-macro attribute + +error: expected non-macro attribute, found attribute macro `derive` + --> $DIR/cfg_attribute.rs:114:7 + | +LL | #[derive(Clone)] ():, + | ^^^^^^ not a non-macro attribute + +error: expected non-macro attribute, found attribute macro `derive` + --> $DIR/cfg_attribute.rs:129:7 + | +LL | #[derive(Clone)] ():, + | ^^^^^^ not a non-macro attribute + +error: expected non-macro attribute, found attribute macro `derive` + --> $DIR/cfg_attribute.rs:144:7 + | +LL | #[derive(Clone)] ():, + | ^^^^^^ not a non-macro attribute + +error: expected non-macro attribute, found attribute macro `derive` + --> $DIR/cfg_attribute.rs:155:7 + | +LL | #[derive(Clone)] ():, + | ^^^^^^ not a non-macro attribute + +error: expected non-macro attribute, found attribute macro `derive` + --> $DIR/cfg_attribute.rs:165:11 + | +LL | #[derive(Clone)] ():, + | ^^^^^^ not a non-macro attribute + +error: expected non-macro attribute, found attribute macro `derive` + --> $DIR/cfg_attribute.rs:178:7 + | +LL | #[derive(Clone)] ():, + | ^^^^^^ not a non-macro attribute + +error: most attributes are not supported in `where` clauses + --> $DIR/cfg_attribute.rs:32:5 + | +LL | #[derive(Clone)] ():, + | ^^^^^^^^^^^^^^^^ + | + = help: only `#[cfg]` and `#[cfg_attr]` are supported + +error: most attributes are not supported in `where` clauses + --> $DIR/cfg_attribute.rs:35:5 + | +LL | #[rustfmt::skip] ():, + | ^^^^^^^^^^^^^^^^ + | + = help: only `#[cfg]` and `#[cfg_attr]` are supported + +error: most attributes are not supported in `where` clauses + --> $DIR/cfg_attribute.rs:66:5 + | +LL | #[derive(Clone)] ():, + | ^^^^^^^^^^^^^^^^ + | + = help: only `#[cfg]` and `#[cfg_attr]` are supported + +error: most attributes are not supported in `where` clauses + --> $DIR/cfg_attribute.rs:69:5 + | +LL | #[rustfmt::skip] ():, + | ^^^^^^^^^^^^^^^^ + | + = help: only `#[cfg]` and `#[cfg_attr]` are supported + +error: most attributes are not supported in `where` clauses + --> $DIR/cfg_attribute.rs:100:5 + | +LL | #[derive(Clone)] ():, + | ^^^^^^^^^^^^^^^^ + | + = help: only `#[cfg]` and `#[cfg_attr]` are supported + +error: most attributes are not supported in `where` clauses + --> $DIR/cfg_attribute.rs:103:5 + | +LL | #[rustfmt::skip] ():, + | ^^^^^^^^^^^^^^^^ + | + = help: only `#[cfg]` and `#[cfg_attr]` are supported + +error: most attributes are not supported in `where` clauses + --> $DIR/cfg_attribute.rs:114:5 + | +LL | #[derive(Clone)] ():, + | ^^^^^^^^^^^^^^^^ + | + = help: only `#[cfg]` and `#[cfg_attr]` are supported + +error: most attributes are not supported in `where` clauses + --> $DIR/cfg_attribute.rs:117:5 + | +LL | #[rustfmt::skip] ():, + | ^^^^^^^^^^^^^^^^ + | + = help: only `#[cfg]` and `#[cfg_attr]` are supported + +error: most attributes are not supported in `where` clauses + --> $DIR/cfg_attribute.rs:129:5 + | +LL | #[derive(Clone)] ():, + | ^^^^^^^^^^^^^^^^ + | + = help: only `#[cfg]` and `#[cfg_attr]` are supported + +error: most attributes are not supported in `where` clauses + --> $DIR/cfg_attribute.rs:132:5 + | +LL | #[rustfmt::skip] ():, + | ^^^^^^^^^^^^^^^^ + | + = help: only `#[cfg]` and `#[cfg_attr]` are supported + +error: most attributes are not supported in `where` clauses + --> $DIR/cfg_attribute.rs:144:5 + | +LL | #[derive(Clone)] ():, + | ^^^^^^^^^^^^^^^^ + | + = help: only `#[cfg]` and `#[cfg_attr]` are supported + +error: most attributes are not supported in `where` clauses + --> $DIR/cfg_attribute.rs:147:5 + | +LL | #[rustfmt::skip] ():, + | ^^^^^^^^^^^^^^^^ + | + = help: only `#[cfg]` and `#[cfg_attr]` are supported + +error: most attributes are not supported in `where` clauses + --> $DIR/cfg_attribute.rs:155:5 + | +LL | #[derive(Clone)] ():, + | ^^^^^^^^^^^^^^^^ + | + = help: only `#[cfg]` and `#[cfg_attr]` are supported + +error: most attributes are not supported in `where` clauses + --> $DIR/cfg_attribute.rs:158:5 + | +LL | #[rustfmt::skip] ():, + | ^^^^^^^^^^^^^^^^ + | + = help: only `#[cfg]` and `#[cfg_attr]` are supported + +error: most attributes are not supported in `where` clauses + --> $DIR/cfg_attribute.rs:178:5 + | +LL | #[derive(Clone)] ():, + | ^^^^^^^^^^^^^^^^ + | + = help: only `#[cfg]` and `#[cfg_attr]` are supported + +error: most attributes are not supported in `where` clauses + --> $DIR/cfg_attribute.rs:181:5 + | +LL | #[rustfmt::skip] ():, + | ^^^^^^^^^^^^^^^^ + | + = help: only `#[cfg]` and `#[cfg_attr]` are supported + +error: most attributes are not supported in `where` clauses + --> $DIR/cfg_attribute.rs:43:9 + | +LL | #[derive(Clone)] ():, + | ^^^^^^^^^^^^^^^^ + | + = help: only `#[cfg]` and `#[cfg_attr]` are supported + +error: most attributes are not supported in `where` clauses + --> $DIR/cfg_attribute.rs:46:9 + | +LL | #[rustfmt::skip] ():; + | ^^^^^^^^^^^^^^^^ + | + = help: only `#[cfg]` and `#[cfg_attr]` are supported + +error: most attributes are not supported in `where` clauses + --> $DIR/cfg_attribute.rs:54:9 + | +LL | #[derive(Clone)] ():, + | ^^^^^^^^^^^^^^^^ + | + = help: only `#[cfg]` and `#[cfg_attr]` are supported + +error: most attributes are not supported in `where` clauses + --> $DIR/cfg_attribute.rs:57:9 + | +LL | #[rustfmt::skip] ():; + | ^^^^^^^^^^^^^^^^ + | + = help: only `#[cfg]` and `#[cfg_attr]` are supported + +error: most attributes are not supported in `where` clauses + --> $DIR/cfg_attribute.rs:76:9 + | +LL | #[derive(Clone)] ():, + | ^^^^^^^^^^^^^^^^ + | + = help: only `#[cfg]` and `#[cfg_attr]` are supported + +error: most attributes are not supported in `where` clauses + --> $DIR/cfg_attribute.rs:79:9 + | +LL | #[rustfmt::skip] ():; + | ^^^^^^^^^^^^^^^^ + | + = help: only `#[cfg]` and `#[cfg_attr]` are supported + +error: most attributes are not supported in `where` clauses + --> $DIR/cfg_attribute.rs:87:9 + | +LL | #[derive(Clone)] ():, + | ^^^^^^^^^^^^^^^^ + | + = help: only `#[cfg]` and `#[cfg_attr]` are supported + +error: most attributes are not supported in `where` clauses + --> $DIR/cfg_attribute.rs:90:9 + | +LL | #[rustfmt::skip] ():, + | ^^^^^^^^^^^^^^^^ + | + = help: only `#[cfg]` and `#[cfg_attr]` are supported + +error: most attributes are not supported in `where` clauses + --> $DIR/cfg_attribute.rs:165:9 + | +LL | #[derive(Clone)] ():, + | ^^^^^^^^^^^^^^^^ + | + = help: only `#[cfg]` and `#[cfg_attr]` are supported + +error: most attributes are not supported in `where` clauses + --> $DIR/cfg_attribute.rs:168:9 + | +LL | #[rustfmt::skip] ():, + | ^^^^^^^^^^^^^^^^ + | + = help: only `#[cfg]` and `#[cfg_attr]` are supported + +error: aborting due to 39 previous errors + diff --git a/tests/ui/where-clauses/cfg_attribute.rs b/tests/ui/where-clauses/cfg_attribute.rs new file mode 100644 index 00000000000..8cbca0bee75 --- /dev/null +++ b/tests/ui/where-clauses/cfg_attribute.rs @@ -0,0 +1,183 @@ +//@ revisions: a b + +#![crate_type = "lib"] +#![feature(alloc_error_handler)] +#![feature(cfg_accessible)] +#![feature(cfg_eval)] +#![feature(custom_test_frameworks)] +#![feature(derive_const)] +#![feature(where_clause_attrs)] +#![allow(soft_unstable)] + +use std::marker::PhantomData; + +#[cfg(a)] +trait TraitA {} + +#[cfg(b)] +trait TraitB {} + +#[cfg_attr(a, cfg(a))] +trait TraitAA {} + +#[cfg_attr(b, cfg(b))] +trait TraitBB {} + +trait A<T> +where + #[cfg(a)] T: TraitA, + #[cfg(b)] T: TraitB, + #[cfg_attr(a, cfg(a))] T: TraitAA, + #[cfg_attr(b, cfg(b))] T: TraitBB, + #[derive(Clone)] ():, + //~^ ERROR most attributes are not supported in `where` clauses + //~| ERROR expected non-macro attribute, found attribute macro `derive` + #[rustfmt::skip] ():, //~ ERROR most attributes are not supported in `where` clauses +{ + type B<U> + where + #[cfg(a)] U: TraitA, + #[cfg(b)] U: TraitB, + #[cfg_attr(a, cfg(a))] U: TraitAA, + #[cfg_attr(b, cfg(b))] U: TraitBB, + #[derive(Clone)] ():, + //~^ ERROR most attributes are not supported in `where` clauses + //~| ERROR expected non-macro attribute, found attribute macro `derive` + #[rustfmt::skip] ():; //~ ERROR most attributes are not supported in `where` clauses + + fn foo<U>(&self) + where + #[cfg(a)] U: TraitA, + #[cfg(b)] U: TraitB, + #[cfg_attr(a, cfg(a))] U: TraitAA, + #[cfg_attr(b, cfg(b))] U: TraitBB, + #[derive(Clone)] ():, + //~^ ERROR most attributes are not supported in `where` clauses + //~| ERROR expected non-macro attribute, found attribute macro `derive` + #[rustfmt::skip] ():; //~ ERROR most attributes are not supported in `where` clauses +} + +impl<T> A<T> for T +where + #[cfg(a)] T: TraitA, + #[cfg(b)] T: TraitB, + #[cfg_attr(a, cfg(a))] T: TraitAA, + #[cfg_attr(b, cfg(b))] T: TraitBB, + #[derive(Clone)] ():, + //~^ ERROR most attributes are not supported in `where` clauses + //~| ERROR expected non-macro attribute, found attribute macro `derive` + #[rustfmt::skip] ():, //~ ERROR most attributes are not supported in `where` clauses +{ + type B<U> = () where + #[cfg(a)] U: TraitA, + #[cfg(b)] U: TraitB, + #[cfg_attr(a, cfg(a))] U: TraitAA, + #[cfg_attr(b, cfg(b))] U: TraitBB, + #[derive(Clone)] ():, + //~^ ERROR most attributes are not supported in `where` clauses + //~| ERROR expected non-macro attribute, found attribute macro `derive` + #[rustfmt::skip] ():; //~ ERROR most attributes are not supported in `where` clauses + + fn foo<U>(&self) + where + #[cfg(a)] U: TraitA, + #[cfg(b)] U: TraitB, + #[cfg_attr(a, cfg(a))] U: TraitAA, + #[cfg_attr(b, cfg(b))] U: TraitBB, + #[derive(Clone)] ():, + //~^ ERROR most attributes are not supported in `where` clauses + //~| ERROR expected non-macro attribute, found attribute macro `derive` + #[rustfmt::skip] ():, //~ ERROR most attributes are not supported in `where` clauses + {} +} + +struct C<T> +where + #[cfg(a)] T: TraitA, + #[cfg(b)] T: TraitB, + #[cfg_attr(a, cfg(a))] T: TraitAA, + #[cfg_attr(b, cfg(b))] T: TraitBB, + #[derive(Clone)] ():, + //~^ ERROR most attributes are not supported in `where` clauses + //~| ERROR expected non-macro attribute, found attribute macro `derive` + #[rustfmt::skip] ():, //~ ERROR most attributes are not supported in `where` clauses +{ + _t: PhantomData<T>, +} + +union D<T> +where + #[cfg(a)] T: TraitA, + #[cfg(b)] T: TraitB, + #[cfg_attr(a, cfg(a))] T: TraitAA, + #[cfg_attr(b, cfg(b))] T: TraitBB, + #[derive(Clone)] ():, + //~^ ERROR most attributes are not supported in `where` clauses + //~| ERROR expected non-macro attribute, found attribute macro `derive` + #[rustfmt::skip] ():, //~ ERROR most attributes are not supported in `where` clauses +{ + + _t: PhantomData<T>, +} + +enum E<T> +where + #[cfg(a)] T: TraitA, + #[cfg(b)] T: TraitB, + #[cfg_attr(a, cfg(a))] T: TraitAA, + #[cfg_attr(b, cfg(b))] T: TraitBB, + #[derive(Clone)] ():, + //~^ ERROR most attributes are not supported in `where` clauses + //~| ERROR expected non-macro attribute, found attribute macro `derive` + #[rustfmt::skip] ():, //~ ERROR most attributes are not supported in `where` clauses +{ + E(PhantomData<T>), +} + +#[allow(type_alias_bounds)] +type F<T> +where + #[cfg(a)] T: TraitA, + #[cfg(b)] T: TraitB, + #[cfg_attr(a, cfg(a))] T: TraitAA, + #[cfg_attr(b, cfg(b))] T: TraitBB, + #[derive(Clone)] ():, + //~^ ERROR most attributes are not supported in `where` clauses + //~| ERROR expected non-macro attribute, found attribute macro `derive` + #[rustfmt::skip] ():, //~ ERROR most attributes are not supported in `where` clauses += T; + +impl<T> C<T> where + #[cfg(a)] T: TraitA, + #[cfg(b)] T: TraitB, + #[cfg_attr(a, cfg(a))] T: TraitAA, + #[cfg_attr(b, cfg(b))] T: TraitBB, + #[derive(Clone)] ():, + //~^ ERROR most attributes are not supported in `where` clauses + //~| ERROR expected non-macro attribute, found attribute macro `derive` + #[rustfmt::skip] ():, //~ ERROR most attributes are not supported in `where` clauses +{ + fn new<U>() where + #[cfg(a)] U: TraitA, + #[cfg(b)] U: TraitB, + #[cfg_attr(a, cfg(a))] U: TraitAA, + #[cfg_attr(b, cfg(b))] U: TraitBB, + #[derive(Clone)] ():, + //~^ ERROR most attributes are not supported in `where` clauses + //~| ERROR expected non-macro attribute, found attribute macro `derive` + #[rustfmt::skip] ():, //~ ERROR most attributes are not supported in `where` clauses + {} +} + +fn foo<T>() +where + #[cfg(a)] T: TraitA, + #[cfg(b)] T: TraitB, + #[cfg_attr(a, cfg(a))] T: TraitAA, + #[cfg_attr(b, cfg(b))] T: TraitBB, + #[derive(Clone)] ():, + //~^ ERROR most attributes are not supported in `where` clauses + //~| ERROR expected non-macro attribute, found attribute macro `derive` + #[rustfmt::skip] ():, //~ ERROR most attributes are not supported in `where` clauses +{ +} diff --git a/tests/ui/where-clauses/unsupported_attribute.rs b/tests/ui/where-clauses/unsupported_attribute.rs new file mode 100644 index 00000000000..33128b383b9 --- /dev/null +++ b/tests/ui/where-clauses/unsupported_attribute.rs @@ -0,0 +1,36 @@ +#![crate_type = "lib"] +#![feature(alloc_error_handler)] +#![feature(cfg_accessible)] +#![feature(cfg_eval)] +#![feature(custom_test_frameworks)] +#![feature(derive_const)] +#![feature(where_clause_attrs)] +#![allow(soft_unstable)] + +trait Trait {} + +fn foo<'a, T>() +where + #[doc = "doc"] T: Trait, //~ ERROR most attributes are not supported in `where` clauses + #[doc = "doc"] 'a: 'static, //~ ERROR most attributes are not supported in `where` clauses + #[ignore] T: Trait, //~ ERROR most attributes are not supported in `where` clauses + #[ignore] 'a: 'static, //~ ERROR most attributes are not supported in `where` clauses + #[should_panic] T: Trait, //~ ERROR most attributes are not supported in `where` clauses + #[should_panic] 'a: 'static, //~ ERROR most attributes are not supported in `where` clauses + #[macro_use] T: Trait, //~ ERROR most attributes are not supported in `where` clauses + #[macro_use] 'a: 'static, //~ ERROR most attributes are not supported in `where` clauses + #[allow(unused)] T: Trait, //~ ERROR most attributes are not supported in `where` clauses + #[allow(unused)] 'a: 'static, //~ ERROR most attributes are not supported in `where` clauses + #[deprecated] T: Trait, //~ ERROR most attributes are not supported in `where` clauses + #[deprecated] 'a: 'static, //~ ERROR most attributes are not supported in `where` clauses + #[automatically_derived] T: Trait, //~ ERROR most attributes are not supported in `where` clauses + #[automatically_derived] 'a: 'static, //~ ERROR most attributes are not supported in `where` clauses + #[derive(Clone)] T: Trait, + //~^ ERROR most attributes are not supported in `where` clauses + //~| ERROR expected non-macro attribute, found attribute macro `derive` + #[derive(Clone)] 'a: 'static, + //~^ ERROR most attributes are not supported in `where` clauses + //~| ERROR expected non-macro attribute, found attribute macro `derive` + #[rustfmt::skip] T: Trait, //~ ERROR most attributes are not supported in `where` clauses + #[rustfmt::skip] 'a: 'static, //~ ERROR most attributes are not supported in `where` clauses +{} diff --git a/tests/ui/where-clauses/unsupported_attribute.stderr b/tests/ui/where-clauses/unsupported_attribute.stderr new file mode 100644 index 00000000000..ecb28039f88 --- /dev/null +++ b/tests/ui/where-clauses/unsupported_attribute.stderr @@ -0,0 +1,158 @@ +error: expected non-macro attribute, found attribute macro `derive` + --> $DIR/unsupported_attribute.rs:28:7 + | +LL | #[derive(Clone)] T: Trait, + | ^^^^^^ not a non-macro attribute + +error: expected non-macro attribute, found attribute macro `derive` + --> $DIR/unsupported_attribute.rs:31:7 + | +LL | #[derive(Clone)] 'a: 'static, + | ^^^^^^ not a non-macro attribute + +error: most attributes are not supported in `where` clauses + --> $DIR/unsupported_attribute.rs:14:5 + | +LL | #[doc = "doc"] T: Trait, + | ^^^^^^^^^^^^^^ + | + = help: only `#[cfg]` and `#[cfg_attr]` are supported + +error: most attributes are not supported in `where` clauses + --> $DIR/unsupported_attribute.rs:15:5 + | +LL | #[doc = "doc"] 'a: 'static, + | ^^^^^^^^^^^^^^ + | + = help: only `#[cfg]` and `#[cfg_attr]` are supported + +error: most attributes are not supported in `where` clauses + --> $DIR/unsupported_attribute.rs:16:5 + | +LL | #[ignore] T: Trait, + | ^^^^^^^^^ + | + = help: only `#[cfg]` and `#[cfg_attr]` are supported + +error: most attributes are not supported in `where` clauses + --> $DIR/unsupported_attribute.rs:17:5 + | +LL | #[ignore] 'a: 'static, + | ^^^^^^^^^ + | + = help: only `#[cfg]` and `#[cfg_attr]` are supported + +error: most attributes are not supported in `where` clauses + --> $DIR/unsupported_attribute.rs:18:5 + | +LL | #[should_panic] T: Trait, + | ^^^^^^^^^^^^^^^ + | + = help: only `#[cfg]` and `#[cfg_attr]` are supported + +error: most attributes are not supported in `where` clauses + --> $DIR/unsupported_attribute.rs:19:5 + | +LL | #[should_panic] 'a: 'static, + | ^^^^^^^^^^^^^^^ + | + = help: only `#[cfg]` and `#[cfg_attr]` are supported + +error: most attributes are not supported in `where` clauses + --> $DIR/unsupported_attribute.rs:20:5 + | +LL | #[macro_use] T: Trait, + | ^^^^^^^^^^^^ + | + = help: only `#[cfg]` and `#[cfg_attr]` are supported + +error: most attributes are not supported in `where` clauses + --> $DIR/unsupported_attribute.rs:21:5 + | +LL | #[macro_use] 'a: 'static, + | ^^^^^^^^^^^^ + | + = help: only `#[cfg]` and `#[cfg_attr]` are supported + +error: most attributes are not supported in `where` clauses + --> $DIR/unsupported_attribute.rs:22:5 + | +LL | #[allow(unused)] T: Trait, + | ^^^^^^^^^^^^^^^^ + | + = help: only `#[cfg]` and `#[cfg_attr]` are supported + +error: most attributes are not supported in `where` clauses + --> $DIR/unsupported_attribute.rs:23:5 + | +LL | #[allow(unused)] 'a: 'static, + | ^^^^^^^^^^^^^^^^ + | + = help: only `#[cfg]` and `#[cfg_attr]` are supported + +error: most attributes are not supported in `where` clauses + --> $DIR/unsupported_attribute.rs:24:5 + | +LL | #[deprecated] T: Trait, + | ^^^^^^^^^^^^^ + | + = help: only `#[cfg]` and `#[cfg_attr]` are supported + +error: most attributes are not supported in `where` clauses + --> $DIR/unsupported_attribute.rs:25:5 + | +LL | #[deprecated] 'a: 'static, + | ^^^^^^^^^^^^^ + | + = help: only `#[cfg]` and `#[cfg_attr]` are supported + +error: most attributes are not supported in `where` clauses + --> $DIR/unsupported_attribute.rs:26:5 + | +LL | #[automatically_derived] T: Trait, + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: only `#[cfg]` and `#[cfg_attr]` are supported + +error: most attributes are not supported in `where` clauses + --> $DIR/unsupported_attribute.rs:27:5 + | +LL | #[automatically_derived] 'a: 'static, + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: only `#[cfg]` and `#[cfg_attr]` are supported + +error: most attributes are not supported in `where` clauses + --> $DIR/unsupported_attribute.rs:28:5 + | +LL | #[derive(Clone)] T: Trait, + | ^^^^^^^^^^^^^^^^ + | + = help: only `#[cfg]` and `#[cfg_attr]` are supported + +error: most attributes are not supported in `where` clauses + --> $DIR/unsupported_attribute.rs:31:5 + | +LL | #[derive(Clone)] 'a: 'static, + | ^^^^^^^^^^^^^^^^ + | + = help: only `#[cfg]` and `#[cfg_attr]` are supported + +error: most attributes are not supported in `where` clauses + --> $DIR/unsupported_attribute.rs:34:5 + | +LL | #[rustfmt::skip] T: Trait, + | ^^^^^^^^^^^^^^^^ + | + = help: only `#[cfg]` and `#[cfg_attr]` are supported + +error: most attributes are not supported in `where` clauses + --> $DIR/unsupported_attribute.rs:35:5 + | +LL | #[rustfmt::skip] 'a: 'static, + | ^^^^^^^^^^^^^^^^ + | + = help: only `#[cfg]` and `#[cfg_attr]` are supported + +error: aborting due to 20 previous errors + |
