diff options
Diffstat (limited to 'tests')
1248 files changed, 13632 insertions, 4344 deletions
diff --git a/tests/assembly-llvm/asm/mips-types.rs b/tests/assembly-llvm/asm/mips-types.rs index 00e8ce0b874..1dd345ff8fe 100644 --- a/tests/assembly-llvm/asm/mips-types.rs +++ b/tests/assembly-llvm/asm/mips-types.rs @@ -94,7 +94,6 @@ check!(reg_f32, f32, freg, "mov.s"); // CHECK: #APP // CHECK: mov.s $f0, $f0 // CHECK: #NO_APP -#[no_mangle] check_reg!(f0_f32, f32, "$f0", "mov.s"); // CHECK-LABEL: reg_f32_64: @@ -107,21 +106,18 @@ check!(reg_f32_64, f32, freg, "mov.d"); // CHECK: #APP // CHECK: mov.d $f0, $f0 // CHECK: #NO_APP -#[no_mangle] check_reg!(f0_f32_64, f32, "$f0", "mov.d"); // CHECK-LABEL: reg_f64: // CHECK: #APP // CHECK: mov.d $f{{[0-9]+}}, $f{{[0-9]+}} // CHECK: #NO_APP -#[no_mangle] check!(reg_f64, f64, freg, "mov.d"); // CHECK-LABEL: f0_f64: // CHECK: #APP // CHECK: mov.d $f0, $f0 // CHECK: #NO_APP -#[no_mangle] check_reg!(f0_f64, f64, "$f0", "mov.d"); // CHECK-LABEL: reg_ptr: diff --git a/tests/assembly-llvm/force-target-feature.rs b/tests/assembly-llvm/force-target-feature.rs new file mode 100644 index 00000000000..c11060d8d6d --- /dev/null +++ b/tests/assembly-llvm/force-target-feature.rs @@ -0,0 +1,33 @@ +//@ only-x86_64 +//@ assembly-output: emit-asm +//@ compile-flags: -C opt-level=3 -C target-feature=-avx2 +//@ ignore-sgx Tests incompatible with LVI mitigations + +#![feature(effective_target_features)] + +use std::arch::x86_64::{__m256i, _mm256_add_epi32, _mm256_setzero_si256}; +use std::ops::Add; + +#[derive(Clone, Copy)] +struct AvxU32(__m256i); + +impl Add<AvxU32> for AvxU32 { + type Output = Self; + + #[no_mangle] + #[inline(never)] + #[unsafe(force_target_feature(enable = "avx2"))] + fn add(self, oth: AvxU32) -> AvxU32 { + // CHECK-LABEL: add: + // CHECK-NOT: callq + // CHECK: vpaddd + // CHECK: retq + Self(_mm256_add_epi32(self.0, oth.0)) + } +} + +fn main() { + assert!(is_x86_feature_detected!("avx2")); + let v = AvxU32(unsafe { _mm256_setzero_si256() }); + v + v; +} diff --git a/tests/assembly-llvm/reg-struct-return.rs b/tests/assembly-llvm/reg-struct-return.rs new file mode 100644 index 00000000000..b251d791d51 --- /dev/null +++ b/tests/assembly-llvm/reg-struct-return.rs @@ -0,0 +1,143 @@ +//! Tests that -Zreg-struct-return changes ABI for small struct returns +//! from hidden-pointer convention to register-return on x86_32. +//! This test covers: +//! * Callee side, verifying that the structs are correctly loaded into registers when +//! `-Zreg-struct-return` is activated +//! * Caller side, verifying callers do receive returned structs in registers when +//! `-Zreg-struct-return` is activated +//@ add-core-stubs +//@ assembly-output: emit-asm +//@ compile-flags: -O --target=i686-unknown-linux-gnu -Crelocation-model=static +//@ revisions: WITH WITHOUT +//@[WITH] compile-flags: -Zreg-struct-return +//@ needs-llvm-components: x86 + +#![feature(no_core)] +#![no_std] +#![no_core] +#![crate_type = "lib"] + +extern crate minicore; +use minicore::*; + +// Verifies ABI changes for small structs, where both fields fit into one register. +// WITH is expected to use register return, WITHOUT should use hidden pointer. +mod Small { + struct SmallStruct { + a: i8, + b: i8, + } + + unsafe extern "C" { + fn small() -> SmallStruct; + } + + #[unsafe(no_mangle)] + pub unsafe extern "C" fn small_callee() -> SmallStruct { + // (42 << 8) | 42 = 10794 + + // WITH-LABEL: small_callee + // WITH: movw $10794, %ax + // WITH: retl + + // WITHOUT-LABEL: small_callee + // WITHOUT: movl 4(%esp), %e{{.*}} + // WITHOUT: movw $10794, (%e{{.*}}) + // WITHOUT: retl $4 + SmallStruct { a: 42, b: 42 } + } + + #[unsafe(no_mangle)] + pub unsafe extern "C" fn small_caller(dst: &mut SmallStruct) { + // WITH-LABEL: small_caller + // WITH: calll small + // WITH: movw %ax, (%e{{.*}}) + + // WITHOUT-LABEL: small_caller + // WITHOUT: calll small + // WITHOUT: movzwl {{.*}}(%esp), %e[[TMP:..]] + // WITHOUT: movw %[[TMP]], (%e{{..}}) + *dst = small(); + } +} + +// Verifies ABI changes for a struct of size 8, which is the maximum size +// for reg-struct-return. +// WITH is expected to still use register return, WITHOUT should use hidden +// pointer. +mod Pivot { + struct PivotStruct { + a: i32, + b: i32, + } + + unsafe extern "C" { + fn pivot() -> PivotStruct; + } + + #[unsafe(no_mangle)] + pub unsafe extern "C" fn pivot_callee() -> PivotStruct { + // WITH-LABEL: pivot_callee + // WITH: movl $42, %e{{.*}} + // WITH: movl $42, %e{{.*}} + // WITH: retl + + // WITHOUT-LABEL: pivot_callee + // WITHOUT: movl 4(%esp), %e{{.*}} + // WITHOUT-DAG: movl $42, (%e{{.*}}) + // WITHOUT-DAG: movl $42, 4(%e{{.*}}) + // WITHOUT: retl $4 + PivotStruct { a: 42, b: 42 } + } + + #[unsafe(no_mangle)] + pub unsafe extern "C" fn pivot_caller(dst: &mut PivotStruct) { + // WITH-LABEL: pivot_caller + // WITH: calll pivot + // WITH-DAG: movl %e{{.*}}, 4(%e{{.*}}) + // WITH-DAG: movl %e{{.*}}, (%e{{.*}}) + + // WITHOUT-LABEL: pivot_caller + // WITHOUT: calll pivot + // WITHOUT: movsd {{.*}}(%esp), %[[TMP:xmm.]] + // WITHOUT: movsd %[[TMP]], (%e{{..}}) + *dst = pivot(); + } +} + +// Verifies ABI changes for a struct of size 12, which is larger than the +// maximum size for reg-struct-return (8 bytes). +// Here, the hidden pointer convention should be used even when `-Zreg-struct-return` is set. +mod Large { + struct LargeStruct { + a: i32, + b: i32, + c: i32, + } + + unsafe extern "C" { + fn large() -> LargeStruct; + } + + #[unsafe(no_mangle)] + pub unsafe extern "C" fn large_callee() -> LargeStruct { + // CHECK-LABEL: large_callee + // CHECK: movl 4(%esp), %e{{.*}} + // CHECK-DAG: movl $42, (%e{{.*}}) + // CHECK-DAG: movl $42, 4(%e{{.*}}) + // CHECK-DAG: movl $42, 8(%e{{.*}}) + // CHECK: retl $4 + LargeStruct { a: 42, b: 42, c: 42 } + } + + #[unsafe(no_mangle)] + pub unsafe extern "C" fn large_caller(dst: &mut LargeStruct) { + // CHECK-LABEL: large_caller + // CHECK: calll large + // CHECK-DAG: movl {{.*}}(%esp), %[[TMP1:e..]] + // CHECK-DAG: movl %[[TMP1]], {{.*}}(%e{{..}}) + // CHECK-DAG: movsd {{.*}}(%esp), %[[TMP2:xmm.]] + // CHECK-DAG: movsd %[[TMP2]], {{.*}}(%e{{..}}) + *dst = large(); + } +} diff --git a/tests/assembly-llvm/regparm-module-flag.rs b/tests/assembly-llvm/regparm-module-flag.rs new file mode 100644 index 00000000000..67ef44285ea --- /dev/null +++ b/tests/assembly-llvm/regparm-module-flag.rs @@ -0,0 +1,70 @@ +// Test the regparm ABI with builtin and non-builtin calls +// Issue: https://github.com/rust-lang/rust/issues/145271 +//@ add-core-stubs +//@ assembly-output: emit-asm +//@ compile-flags: -O --target=i686-unknown-linux-gnu -Crelocation-model=static +//@ revisions: REGPARM1 REGPARM2 REGPARM3 +//@[REGPARM1] compile-flags: -Zregparm=1 +//@[REGPARM2] compile-flags: -Zregparm=2 +//@[REGPARM3] compile-flags: -Zregparm=3 +//@ needs-llvm-components: x86 +#![feature(no_core)] +#![no_std] +#![no_core] +#![crate_type = "lib"] + +extern crate minicore; +use minicore::*; + +unsafe extern "C" { + fn memset(p: *mut c_void, val: i32, len: usize) -> *mut c_void; + fn non_builtin_memset(p: *mut c_void, val: i32, len: usize) -> *mut c_void; +} + +#[unsafe(no_mangle)] +pub unsafe extern "C" fn entrypoint(len: usize, ptr: *mut c_void, val: i32) -> *mut c_void { + // REGPARM1-LABEL: entrypoint + // REGPARM1: movl %e{{.*}}, %ecx + // REGPARM1: pushl + // REGPARM1: pushl + // REGPARM1: calll memset + + // REGPARM2-LABEL: entrypoint + // REGPARM2: movl 16(%esp), %edx + // REGPARM2: movl %e{{.*}}, (%esp) + // REGPARM2: movl %e{{.*}}, %eax + // REGPARM2: calll memset + + // REGPARM3-LABEL: entrypoint + // REGPARM3: movl %e{{.*}}, %esi + // REGPARM3: movl %e{{.*}}, %eax + // REGPARM3: movl %e{{.*}}, %ecx + // REGPARM3: jmp memset + unsafe { memset(ptr, val, len) } +} + +#[unsafe(no_mangle)] +pub unsafe extern "C" fn non_builtin_entrypoint( + len: usize, + ptr: *mut c_void, + val: i32, +) -> *mut c_void { + // REGPARM1-LABEL: non_builtin_entrypoint + // REGPARM1: movl %e{{.*}}, %ecx + // REGPARM1: pushl + // REGPARM1: pushl + // REGPARM1: calll non_builtin_memset + + // REGPARM2-LABEL: non_builtin_entrypoint + // REGPARM2: movl 16(%esp), %edx + // REGPARM2: movl %e{{.*}}, (%esp) + // REGPARM2: movl %e{{.*}}, %eax + // REGPARM2: calll non_builtin_memset + + // REGPARM3-LABEL: non_builtin_entrypoint + // REGPARM3: movl %e{{.*}}, %esi + // REGPARM3: movl %e{{.*}}, %eax + // REGPARM3: movl %e{{.*}}, %ecx + // REGPARM3: jmp non_builtin_memset + unsafe { non_builtin_memset(ptr, val, len) } +} diff --git a/tests/assembly-llvm/s390x-vector-abi.rs b/tests/assembly-llvm/s390x-vector-abi.rs index fcf42664034..c9c3266a18f 100644 --- a/tests/assembly-llvm/s390x-vector-abi.rs +++ b/tests/assembly-llvm/s390x-vector-abi.rs @@ -1,4 +1,5 @@ //@ revisions: z10 z10_vector z13 z13_no_vector +//@ add-core-stubs // ignore-tidy-linelength //@ assembly-output: emit-asm //@ compile-flags: -Copt-level=3 -Z merge-functions=disabled @@ -18,24 +19,8 @@ // Cases where vector feature is disabled are rejected. // See tests/ui/simd-abi-checks-s390x.rs for test for them. -#[lang = "pointee_sized"] -pub trait PointeeSized {} - -#[lang = "meta_sized"] -pub trait MetaSized: PointeeSized {} - -#[lang = "sized"] -pub trait Sized: MetaSized {} -#[lang = "copy"] -pub trait Copy {} -#[lang = "freeze"] -pub trait Freeze {} - -impl<T: Copy, const N: usize> Copy for [T; N] {} - -#[lang = "phantom_data"] -pub struct PhantomData<T: ?Sized>; -impl<T: ?Sized> Copy for PhantomData<T> {} +extern crate minicore; +use minicore::*; #[repr(simd)] pub struct i8x8([i8; 8]); @@ -52,8 +37,6 @@ pub struct WrapperWithZst<T>(T, PhantomData<()>); #[repr(transparent)] pub struct TransparentWrapper<T>(T); -impl Copy for i8 {} -impl Copy for i64 {} impl Copy for i8x8 {} impl Copy for i8x16 {} impl Copy for i8x32 {} @@ -221,7 +204,7 @@ unsafe extern "C" fn vector_transparent_wrapper_ret_large( #[cfg_attr(no_vector, target_feature(enable = "vector"))] #[no_mangle] unsafe extern "C" fn vector_arg_small(x: i8x8) -> i64 { - unsafe { *(&x as *const i8x8 as *const i64) } + unsafe { *(&raw const x as *const i64) } } // CHECK-LABEL: vector_arg: // CHECK: vlgvg %r2, %v24, 0 @@ -229,7 +212,7 @@ unsafe extern "C" fn vector_arg_small(x: i8x8) -> i64 { #[cfg_attr(no_vector, target_feature(enable = "vector"))] #[no_mangle] unsafe extern "C" fn vector_arg(x: i8x16) -> i64 { - unsafe { *(&x as *const i8x16 as *const i64) } + unsafe { *(&raw const x as *const i64) } } // CHECK-LABEL: vector_arg_large: // CHECK: lg %r2, 0(%r2) @@ -237,7 +220,7 @@ unsafe extern "C" fn vector_arg(x: i8x16) -> i64 { #[cfg_attr(no_vector, target_feature(enable = "vector"))] #[no_mangle] unsafe extern "C" fn vector_arg_large(x: i8x32) -> i64 { - unsafe { *(&x as *const i8x32 as *const i64) } + unsafe { *(&raw const x as *const i64) } } // CHECK-LABEL: vector_wrapper_arg_small: @@ -246,7 +229,7 @@ unsafe extern "C" fn vector_arg_large(x: i8x32) -> i64 { #[cfg_attr(no_vector, target_feature(enable = "vector"))] #[no_mangle] unsafe extern "C" fn vector_wrapper_arg_small(x: Wrapper<i8x8>) -> i64 { - unsafe { *(&x as *const Wrapper<i8x8> as *const i64) } + unsafe { *(&raw const x as *const i64) } } // CHECK-LABEL: vector_wrapper_arg: // CHECK: vlgvg %r2, %v24, 0 @@ -254,7 +237,7 @@ unsafe extern "C" fn vector_wrapper_arg_small(x: Wrapper<i8x8>) -> i64 { #[cfg_attr(no_vector, target_feature(enable = "vector"))] #[no_mangle] unsafe extern "C" fn vector_wrapper_arg(x: Wrapper<i8x16>) -> i64 { - unsafe { *(&x as *const Wrapper<i8x16> as *const i64) } + unsafe { *(&raw const x as *const i64) } } // CHECK-LABEL: vector_wrapper_arg_large: // CHECK: lg %r2, 0(%r2) @@ -262,7 +245,7 @@ unsafe extern "C" fn vector_wrapper_arg(x: Wrapper<i8x16>) -> i64 { #[cfg_attr(no_vector, target_feature(enable = "vector"))] #[no_mangle] unsafe extern "C" fn vector_wrapper_arg_large(x: Wrapper<i8x32>) -> i64 { - unsafe { *(&x as *const Wrapper<i8x32> as *const i64) } + unsafe { *(&raw const x as *const i64) } } // https://github.com/rust-lang/rust/pull/131586#discussion_r1837071121 @@ -272,7 +255,7 @@ unsafe extern "C" fn vector_wrapper_arg_large(x: Wrapper<i8x32>) -> i64 { #[cfg_attr(no_vector, target_feature(enable = "vector"))] #[no_mangle] unsafe extern "C" fn vector_wrapper_padding_arg(x: WrapperAlign16<i8x8>) -> i64 { - unsafe { *(&x as *const WrapperAlign16<i8x8> as *const i64) } + unsafe { *(&raw const x as *const i64) } } // CHECK-LABEL: vector_wrapper_with_zst_arg_small: @@ -282,7 +265,7 @@ unsafe extern "C" fn vector_wrapper_padding_arg(x: WrapperAlign16<i8x8>) -> i64 #[cfg_attr(no_vector, target_feature(enable = "vector"))] #[no_mangle] unsafe extern "C" fn vector_wrapper_with_zst_arg_small(x: WrapperWithZst<i8x8>) -> i64 { - unsafe { *(&x as *const WrapperWithZst<i8x8> as *const i64) } + unsafe { *(&raw const x as *const i64) } } // CHECK-LABEL: vector_wrapper_with_zst_arg: // CHECK: lg %r2, 0(%r2) @@ -290,7 +273,7 @@ unsafe extern "C" fn vector_wrapper_with_zst_arg_small(x: WrapperWithZst<i8x8>) #[cfg_attr(no_vector, target_feature(enable = "vector"))] #[no_mangle] unsafe extern "C" fn vector_wrapper_with_zst_arg(x: WrapperWithZst<i8x16>) -> i64 { - unsafe { *(&x as *const WrapperWithZst<i8x16> as *const i64) } + unsafe { *(&raw const x as *const i64) } } // CHECK-LABEL: vector_wrapper_with_zst_arg_large: // CHECK: lg %r2, 0(%r2) @@ -298,7 +281,7 @@ unsafe extern "C" fn vector_wrapper_with_zst_arg(x: WrapperWithZst<i8x16>) -> i6 #[cfg_attr(no_vector, target_feature(enable = "vector"))] #[no_mangle] unsafe extern "C" fn vector_wrapper_with_zst_arg_large(x: WrapperWithZst<i8x32>) -> i64 { - unsafe { *(&x as *const WrapperWithZst<i8x32> as *const i64) } + unsafe { *(&raw const x as *const i64) } } // CHECK-LABEL: vector_transparent_wrapper_arg_small: @@ -307,7 +290,7 @@ unsafe extern "C" fn vector_wrapper_with_zst_arg_large(x: WrapperWithZst<i8x32>) #[cfg_attr(no_vector, target_feature(enable = "vector"))] #[no_mangle] unsafe extern "C" fn vector_transparent_wrapper_arg_small(x: TransparentWrapper<i8x8>) -> i64 { - unsafe { *(&x as *const TransparentWrapper<i8x8> as *const i64) } + unsafe { *(&raw const x as *const i64) } } // CHECK-LABEL: vector_transparent_wrapper_arg: // CHECK: vlgvg %r2, %v24, 0 @@ -315,7 +298,7 @@ unsafe extern "C" fn vector_transparent_wrapper_arg_small(x: TransparentWrapper< #[cfg_attr(no_vector, target_feature(enable = "vector"))] #[no_mangle] unsafe extern "C" fn vector_transparent_wrapper_arg(x: TransparentWrapper<i8x16>) -> i64 { - unsafe { *(&x as *const TransparentWrapper<i8x16> as *const i64) } + unsafe { *(&raw const x as *const i64) } } // CHECK-LABEL: vector_transparent_wrapper_arg_large: // CHECK: lg %r2, 0(%r2) @@ -323,5 +306,5 @@ unsafe extern "C" fn vector_transparent_wrapper_arg(x: TransparentWrapper<i8x16> #[cfg_attr(no_vector, target_feature(enable = "vector"))] #[no_mangle] unsafe extern "C" fn vector_transparent_wrapper_arg_large(x: TransparentWrapper<i8x32>) -> i64 { - unsafe { *(&x as *const TransparentWrapper<i8x32> as *const i64) } + unsafe { *(&raw const x as *const i64) } } diff --git a/tests/assembly-llvm/targets/targets-elf.rs b/tests/assembly-llvm/targets/targets-elf.rs index a1d759ede2b..c935a75a690 100644 --- a/tests/assembly-llvm/targets/targets-elf.rs +++ b/tests/assembly-llvm/targets/targets-elf.rs @@ -1,12 +1,18 @@ //@ add-core-stubs //@ assembly-output: emit-asm // ignore-tidy-linelength +//@ revisions: aarch64_be_unknown_hermit +//@ [aarch64_be_unknown_hermit] compile-flags: --target aarch64_be-unknown-hermit +//@ [aarch64_be_unknown_hermit] needs-llvm-components: aarch64 //@ revisions: aarch64_be_unknown_linux_gnu //@ [aarch64_be_unknown_linux_gnu] compile-flags: --target aarch64_be-unknown-linux-gnu //@ [aarch64_be_unknown_linux_gnu] needs-llvm-components: aarch64 //@ revisions: aarch64_be_unknown_linux_gnu_ilp32 //@ [aarch64_be_unknown_linux_gnu_ilp32] compile-flags: --target aarch64_be-unknown-linux-gnu_ilp32 //@ [aarch64_be_unknown_linux_gnu_ilp32] needs-llvm-components: aarch64 +//@ revisions: aarch64_be_unknown_linux_musl +//@ [aarch64_be_unknown_linux_musl] compile-flags: --target aarch64_be-unknown-linux-musl +//@ [aarch64_be_unknown_linux_musl] needs-llvm-components: aarch64 //@ revisions: aarch64_be_unknown_netbsd //@ [aarch64_be_unknown_netbsd] compile-flags: --target aarch64_be-unknown-netbsd //@ [aarch64_be_unknown_netbsd] needs-llvm-components: aarch64 @@ -478,6 +484,9 @@ //@ revisions: riscv64gc_unknown_linux_gnu //@ [riscv64gc_unknown_linux_gnu] compile-flags: --target riscv64gc-unknown-linux-gnu //@ [riscv64gc_unknown_linux_gnu] needs-llvm-components: riscv +//@ revisions: riscv64a23_unknown_linux_gnu +//@ [riscv64a23_unknown_linux_gnu] compile-flags: --target riscv64a23-unknown-linux-gnu +//@ [riscv64a23_unknown_linux_gnu] needs-llvm-components: riscv //@ revisions: riscv64gc_unknown_linux_musl //@ [riscv64gc_unknown_linux_musl] compile-flags: --target riscv64gc-unknown-linux-musl //@ [riscv64gc_unknown_linux_musl] needs-llvm-components: riscv diff --git a/tests/assembly-llvm/x86_64-indirect-branch-cs-prefix.rs b/tests/assembly-llvm/x86_64-indirect-branch-cs-prefix.rs new file mode 100644 index 00000000000..8e4470ee451 --- /dev/null +++ b/tests/assembly-llvm/x86_64-indirect-branch-cs-prefix.rs @@ -0,0 +1,27 @@ +// Test that the `cs` prefix is (not) added into a `call` and a `jmp` to the +// indirect thunk when the `-Zindirect-branch-cs-prefix` flag is (not) set. + +//@ revisions: unset set +//@ assembly-output: emit-asm +//@ compile-flags: -Copt-level=3 -Cunsafe-allow-abi-mismatch=retpoline,retpoline-external-thunk,indirect-branch-cs-prefix -Zretpoline-external-thunk +//@ [set] compile-flags: -Zindirect-branch-cs-prefix +//@ only-x86_64 +//@ ignore-apple Symbol is called `___x86_indirect_thunk` (Darwin's extra underscore) + +#![crate_type = "lib"] + +// CHECK-LABEL: foo: +#[no_mangle] +pub fn foo(g: fn()) { + // unset-NOT: cs + // unset: callq {{__x86_indirect_thunk.*}} + // set: cs + // set-NEXT: callq {{__x86_indirect_thunk.*}} + g(); + + // unset-NOT: cs + // unset: jmp {{__x86_indirect_thunk.*}} + // set: cs + // set-NEXT: jmp {{__x86_indirect_thunk.*}} + g(); +} diff --git a/tests/assembly-llvm/x86_64-mcount.rs b/tests/assembly-llvm/x86_64-mcount.rs new file mode 100644 index 00000000000..0428272cfc5 --- /dev/null +++ b/tests/assembly-llvm/x86_64-mcount.rs @@ -0,0 +1,24 @@ +//@ assembly-output: emit-asm +//@ compile-flags: -Zinstrument-mcount=y -Cllvm-args=-x86-asm-syntax=intel + +//@ revisions: x86_64-linux +//@[x86_64-linux] compile-flags: --target=x86_64-unknown-linux-gnu +//@[x86_64-linux] needs-llvm-components: x86 +//@[x86_64-linux] only-x86_64-unknown-linux-gnu + +//@ revisions: x86_64-darwin +//@[x86_64-darwin] compile-flags: --target=x86_64-apple-darwin +//@[x86_64-darwin] needs-llvm-components: x86 +//@[x86_64-darwin] only-x86_64-apple-darwin + +#![crate_type = "lib"] + +// CHECK-LABEL: mcount_func: +#[no_mangle] +pub fn mcount_func() { + // CHECK: call mcount + + std::hint::black_box(()); + + // CHECK: ret +} diff --git a/tests/auxiliary/minicore.rs b/tests/auxiliary/minicore.rs index 47dadd51ce0..da880100a10 100644 --- a/tests/auxiliary/minicore.rs +++ b/tests/auxiliary/minicore.rs @@ -225,3 +225,10 @@ pub mod mem { #[rustc_intrinsic] pub unsafe fn transmute<Src, Dst>(src: Src) -> Dst; } + +#[lang = "c_void"] +#[repr(u8)] +pub enum c_void { + __variant1, + __variant2, +} diff --git a/tests/codegen-llvm/abi-x86-interrupt.rs b/tests/codegen-llvm/abi-x86-interrupt.rs index 9a1ded2c9e3..b5c495803d8 100644 --- a/tests/codegen-llvm/abi-x86-interrupt.rs +++ b/tests/codegen-llvm/abi-x86-interrupt.rs @@ -15,4 +15,4 @@ use minicore::*; // CHECK: define x86_intrcc void @has_x86_interrupt_abi #[no_mangle] -pub extern "x86-interrupt" fn has_x86_interrupt_abi() {} +pub extern "x86-interrupt" fn has_x86_interrupt_abi(_p: *const u8) {} diff --git a/tests/codegen-llvm/addr-of-mutate.rs b/tests/codegen-llvm/addr-of-mutate.rs index 71669065289..36d6bf555d1 100644 --- a/tests/codegen-llvm/addr-of-mutate.rs +++ b/tests/codegen-llvm/addr-of-mutate.rs @@ -5,7 +5,7 @@ // Test for the absence of `readonly` on the argument when it is mutated via `&raw const`. // See <https://github.com/rust-lang/rust/issues/111502>. -// CHECK: i8 @foo(ptr{{( dead_on_return)?}} noalias{{( nocapture)?}} noundef align 1{{( captures\(none\))?}} dereferenceable(128) %x) +// CHECK: i8 @foo(ptr{{( dead_on_return)?}} noalias noundef align 1{{( captures\(address\))?}} dereferenceable(128) %x) #[no_mangle] pub fn foo(x: [u8; 128]) -> u8 { let ptr = core::ptr::addr_of!(x).cast_mut(); @@ -15,7 +15,7 @@ pub fn foo(x: [u8; 128]) -> u8 { x[0] } -// CHECK: i1 @second(ptr{{( dead_on_return)?}} noalias{{( nocapture)?}} noundef align {{[0-9]+}}{{( captures\(none\))?}} dereferenceable({{[0-9]+}}) %a_ptr_and_b) +// CHECK: i1 @second(ptr{{( dead_on_return)?}} noalias noundef align {{[0-9]+}}{{( captures\(address\))?}} dereferenceable({{[0-9]+}}) %a_ptr_and_b) #[no_mangle] pub unsafe fn second(a_ptr_and_b: (*mut (i32, bool), (i64, bool))) -> bool { let b_bool_ptr = core::ptr::addr_of!(a_ptr_and_b.1.1).cast_mut(); @@ -24,7 +24,7 @@ pub unsafe fn second(a_ptr_and_b: (*mut (i32, bool), (i64, bool))) -> bool { } // If going through a deref (and there are no other mutating accesses), then `readonly` is fine. -// CHECK: i1 @third(ptr{{( dead_on_return)?}} noalias{{( nocapture)?}} noundef readonly align {{[0-9]+}}{{( captures\(none\))?}} dereferenceable({{[0-9]+}}) %a_ptr_and_b) +// CHECK: i1 @third(ptr{{( dead_on_return)?}} noalias noundef readonly align {{[0-9]+}}{{( captures\(address\))?}} dereferenceable({{[0-9]+}}) %a_ptr_and_b) #[no_mangle] pub unsafe fn third(a_ptr_and_b: (*mut (i32, bool), (i64, bool))) -> bool { let b_bool_ptr = core::ptr::addr_of!((*a_ptr_and_b.0).1).cast_mut(); diff --git a/tests/codegen-llvm/atomicptr.rs b/tests/codegen-llvm/atomicptr.rs index ce6c4aa0d2b..9d5e618fe76 100644 --- a/tests/codegen-llvm/atomicptr.rs +++ b/tests/codegen-llvm/atomicptr.rs @@ -6,7 +6,6 @@ //@ compile-flags: -Copt-level=3 -Cno-prepopulate-passes #![crate_type = "lib"] -#![feature(strict_provenance_atomic_ptr)] use std::ptr::without_provenance_mut; use std::sync::atomic::AtomicPtr; diff --git a/tests/codegen-llvm/binary-search-index-no-bound-check.rs b/tests/codegen-llvm/binary-search-index-no-bound-check.rs index d59c0beec64..8322c4179bd 100644 --- a/tests/codegen-llvm/binary-search-index-no-bound-check.rs +++ b/tests/codegen-llvm/binary-search-index-no-bound-check.rs @@ -8,8 +8,7 @@ #[no_mangle] pub fn binary_search_index_no_bounds_check(s: &[u8]) -> u8 { // CHECK-NOT: panic - // CHECK-NOT: slice_start_index_len_fail - // CHECK-NOT: slice_end_index_len_fail + // CHECK-NOT: slice_index_fail // CHECK-NOT: panic_bounds_check if let Ok(idx) = s.binary_search(&b'\\') { s[idx] } else { 42 } } diff --git a/tests/codegen-llvm/enum/enum-aggregate.rs b/tests/codegen-llvm/enum/enum-aggregate.rs index 0161e5f3fa1..f58d7ef12b6 100644 --- a/tests/codegen-llvm/enum/enum-aggregate.rs +++ b/tests/codegen-llvm/enum/enum-aggregate.rs @@ -27,7 +27,7 @@ fn make_none_bool() -> Option<bool> { #[no_mangle] fn make_some_ordering(x: Ordering) -> Option<Ordering> { - // CHECK-LABEL: i8 @make_some_ordering(i8 %x) + // CHECK-LABEL: i8 @make_some_ordering(i8{{( signext)?}} %x) // CHECK-NEXT: start: // CHECK-NEXT: ret i8 %x Some(x) @@ -35,7 +35,7 @@ fn make_some_ordering(x: Ordering) -> Option<Ordering> { #[no_mangle] fn make_some_u16(x: u16) -> Option<u16> { - // CHECK-LABEL: { i16, i16 } @make_some_u16(i16 %x) + // CHECK-LABEL: { i16, i16 } @make_some_u16(i16{{( zeroext)?}} %x) // CHECK-NEXT: start: // CHECK-NEXT: %0 = insertvalue { i16, i16 } { i16 1, i16 poison }, i16 %x, 1 // CHECK-NEXT: ret { i16, i16 } %0 @@ -52,7 +52,7 @@ fn make_none_u16() -> Option<u16> { #[no_mangle] fn make_some_nzu32(x: NonZero<u32>) -> Option<NonZero<u32>> { - // CHECK-LABEL: i32 @make_some_nzu32(i32 %x) + // CHECK-LABEL: i32 @make_some_nzu32(i32{{( signext)?}} %x) // CHECK-NEXT: start: // CHECK-NEXT: ret i32 %x Some(x) @@ -114,7 +114,7 @@ fn make_uninhabited_err_indirectly(n: Never) -> Result<u32, Never> { fn make_fully_uninhabited_result(v: u32, n: Never) -> Result<(u32, Never), (Never, u32)> { // Actually reaching this would be UB, so we don't actually build a result. - // CHECK-LABEL: { i32, i32 } @make_fully_uninhabited_result(i32 %v) + // CHECK-LABEL: { i32, i32 } @make_fully_uninhabited_result(i32{{( signext)?}} %v) // CHECK-NEXT: start: // CHECK-NEXT: call void @llvm.trap() // CHECK-NEXT: call void @llvm.trap() diff --git a/tests/codegen-llvm/enum/enum-match.rs b/tests/codegen-llvm/enum/enum-match.rs index 091c4e9adf4..20e2006e3eb 100644 --- a/tests/codegen-llvm/enum/enum-match.rs +++ b/tests/codegen-llvm/enum/enum-match.rs @@ -739,7 +739,7 @@ pub enum Tricky { const _: () = assert!(std::intrinsics::discriminant_value(&Tricky::V100) == 100); -// CHECK-LABEL: define noundef{{( range\(i8 [0-9]+, [0-9]+\))?}} i8 @discriminant6(i8 noundef %e) +// CHECK-LABEL: define noundef{{( range\(i8 [0-9]+, [0-9]+\))?}} i8 @discriminant6(i8 noundef{{( zeroext)?}} %e) // CHECK-NEXT: start: // CHECK-NEXT: %[[REL_VAR:.+]] = add i8 %e, -66 // CHECK-NEXT: %[[IS_NICHE:.+]] = icmp ult i8 %[[REL_VAR]], -56 diff --git a/tests/codegen-llvm/enum/enum-transparent-extract.rs b/tests/codegen-llvm/enum/enum-transparent-extract.rs index c5efb8d472b..1435e6ec802 100644 --- a/tests/codegen-llvm/enum/enum-transparent-extract.rs +++ b/tests/codegen-llvm/enum/enum-transparent-extract.rs @@ -9,7 +9,7 @@ pub enum Never {} #[no_mangle] pub fn make_unmake_result_never(x: i32) -> i32 { - // CHECK-LABEL: define i32 @make_unmake_result_never(i32 %x) + // CHECK-LABEL: define i32 @make_unmake_result_never(i32{{( signext)?}} %x) // CHECK: start: // CHECK-NEXT: ret i32 %x diff --git a/tests/codegen-llvm/function-arguments.rs b/tests/codegen-llvm/function-arguments.rs index a3fafbe6f82..a0744e44c61 100644 --- a/tests/codegen-llvm/function-arguments.rs +++ b/tests/codegen-llvm/function-arguments.rs @@ -80,7 +80,7 @@ pub fn option_nonzero_int(x: Option<NonZero<u64>>) -> Option<NonZero<u64>> { x } -// CHECK: @readonly_borrow(ptr noalias noundef readonly align 4 dereferenceable(4) %_1) +// CHECK: @readonly_borrow(ptr noalias noundef readonly align 4{{( captures\(address, read_provenance\))?}} dereferenceable(4) %_1) // FIXME #25759 This should also have `nocapture` #[no_mangle] pub fn readonly_borrow(_: &i32) {} @@ -91,12 +91,12 @@ pub fn readonly_borrow_ret() -> &'static i32 { loop {} } -// CHECK: @static_borrow(ptr noalias noundef readonly align 4 dereferenceable(4) %_1) +// CHECK: @static_borrow(ptr noalias noundef readonly align 4{{( captures\(address, read_provenance\))?}} dereferenceable(4) %_1) // static borrow may be captured #[no_mangle] pub fn static_borrow(_: &'static i32) {} -// CHECK: @named_borrow(ptr noalias noundef readonly align 4 dereferenceable(4) %_1) +// CHECK: @named_borrow(ptr noalias noundef readonly align 4{{( captures\(address, read_provenance\))?}} dereferenceable(4) %_1) // borrow with named lifetime may be captured #[no_mangle] pub fn named_borrow<'r>(_: &'r i32) {} @@ -129,21 +129,21 @@ pub fn mutable_borrow_ret() -> &'static mut i32 { // <https://github.com/rust-lang/unsafe-code-guidelines/issues/381>. pub fn mutable_notunpin_borrow(_: &mut NotUnpin) {} -// CHECK: @notunpin_borrow(ptr noalias noundef readonly align 4 dereferenceable(4) %_1) +// CHECK: @notunpin_borrow(ptr noalias noundef readonly align 4{{( captures\(address, read_provenance\))?}} dereferenceable(4) %_1) // But `&NotUnpin` behaves perfectly normal. #[no_mangle] pub fn notunpin_borrow(_: &NotUnpin) {} -// CHECK: @indirect_struct(ptr{{( dead_on_return)?}} noalias{{( nocapture)?}} noundef readonly align 4{{( captures\(none\))?}} dereferenceable(32) %_1) +// CHECK: @indirect_struct(ptr{{( dead_on_return)?}} noalias noundef readonly align 4{{( captures\(address\))?}} dereferenceable(32) %_1) #[no_mangle] pub fn indirect_struct(_: S) {} -// CHECK: @borrowed_struct(ptr noalias noundef readonly align 4 dereferenceable(32) %_1) +// CHECK: @borrowed_struct(ptr noalias noundef readonly align 4{{( captures\(address, read_provenance\))?}} dereferenceable(32) %_1) // FIXME #25759 This should also have `nocapture` #[no_mangle] pub fn borrowed_struct(_: &S) {} -// CHECK: @option_borrow(ptr noalias noundef readonly align 4 dereferenceable_or_null(4) %_x) +// CHECK: @option_borrow(ptr noalias noundef readonly align 4{{( captures\(address, read_provenance\))?}} dereferenceable_or_null(4) %_x) #[no_mangle] pub fn option_borrow(_x: Option<&i32>) {} @@ -185,7 +185,7 @@ pub fn _box(x: Box<i32>) -> Box<i32> { // With a custom allocator, it should *not* have `noalias`. (See // <https://github.com/rust-lang/miri/issues/3341> for why.) The second argument is the allocator, // which is a reference here that still carries `noalias` as usual. -// CHECK: @_box_custom(ptr noundef nonnull align 4 %x.0, ptr noalias noundef nonnull readonly align 1 %x.1) +// CHECK: @_box_custom(ptr noundef nonnull align 4 %x.0, ptr noalias noundef nonnull readonly align 1{{( captures\(address, read_provenance\))?}} %x.1) #[no_mangle] pub fn _box_custom(x: Box<i32, &std::alloc::Global>) { drop(x) @@ -197,7 +197,7 @@ pub fn notunpin_box(x: Box<NotUnpin>) -> Box<NotUnpin> { x } -// CHECK: @struct_return(ptr{{( dead_on_unwind)?}} noalias{{( nocapture)?}} noundef{{( writable)?}} sret([32 x i8]) align 4{{( captures\(none\))?}} dereferenceable(32){{( %_0)?}}) +// CHECK: @struct_return(ptr{{( dead_on_unwind)?}} noalias noundef{{( writable)?}} sret([32 x i8]) align 4{{( captures\(address\))?}} dereferenceable(32){{( %_0)?}}) #[no_mangle] pub fn struct_return() -> S { S { _field: [0, 0, 0, 0, 0, 0, 0, 0] } @@ -208,7 +208,7 @@ pub fn struct_return() -> S { #[no_mangle] pub fn helper(_: usize) {} -// CHECK: @slice(ptr noalias noundef nonnull readonly align 1 %_1.0, [[USIZE]] noundef %_1.1) +// CHECK: @slice(ptr noalias noundef nonnull readonly align 1{{( captures\(address, read_provenance\))?}} %_1.0, [[USIZE]] noundef %_1.1) // FIXME #25759 This should also have `nocapture` #[no_mangle] pub fn slice(_: &[u8]) {} @@ -227,7 +227,7 @@ pub fn unsafe_slice(_: &[UnsafeInner]) {} #[no_mangle] pub fn raw_slice(_: *const [u8]) {} -// CHECK: @str(ptr noalias noundef nonnull readonly align 1 %_1.0, [[USIZE]] noundef %_1.1) +// CHECK: @str(ptr noalias noundef nonnull readonly align 1{{( captures\(address, read_provenance\))?}} %_1.0, [[USIZE]] noundef %_1.1) // FIXME #25759 This should also have `nocapture` #[no_mangle] pub fn str(_: &[u8]) {} @@ -259,7 +259,7 @@ pub fn trait_option(x: Option<Box<dyn Drop + Unpin>>) -> Option<Box<dyn Drop + U x } -// CHECK: { ptr, [[USIZE]] } @return_slice(ptr noalias noundef nonnull readonly align 2 %x.0, [[USIZE]] noundef %x.1) +// CHECK: { ptr, [[USIZE]] } @return_slice(ptr noalias noundef nonnull readonly align 2{{( captures\(address, read_provenance\))?}} %x.0, [[USIZE]] noundef %x.1) #[no_mangle] pub fn return_slice(x: &[u16]) -> &[u16] { x diff --git a/tests/codegen-llvm/indirect-branch-cs-prefix.rs b/tests/codegen-llvm/indirect-branch-cs-prefix.rs new file mode 100644 index 00000000000..df25008d5f0 --- /dev/null +++ b/tests/codegen-llvm/indirect-branch-cs-prefix.rs @@ -0,0 +1,18 @@ +// Test that the `indirect_branch_cs_prefix` module attribute is (not) +// emitted when the `-Zindirect-branch-cs-prefix` flag is (not) set. + +//@ add-core-stubs +//@ revisions: unset set +//@ needs-llvm-components: x86 +//@ compile-flags: --target x86_64-unknown-linux-gnu +//@ [set] compile-flags: -Zindirect-branch-cs-prefix + +#![crate_type = "lib"] +#![feature(no_core, lang_items)] +#![no_core] + +extern crate minicore; +use minicore::*; + +// unset-NOT: !{{[0-9]+}} = !{i32 4, !"indirect_branch_cs_prefix", i32 1} +// set: !{{[0-9]+}} = !{i32 4, !"indirect_branch_cs_prefix", i32 1} diff --git a/tests/codegen-llvm/integer-overflow.rs b/tests/codegen-llvm/integer-overflow.rs index 80362247a86..df7845be06d 100644 --- a/tests/codegen-llvm/integer-overflow.rs +++ b/tests/codegen-llvm/integer-overflow.rs @@ -10,7 +10,7 @@ pub struct S1<'a> { // CHECK-LABEL: @slice_no_index_order #[no_mangle] pub fn slice_no_index_order<'a>(s: &'a mut S1, n: usize) -> &'a [u8] { - // CHECK-NOT: slice_index_order_fail + // CHECK-COUNT-1: slice_index_fail let d = &s.data[s.position..s.position + n]; s.position += n; return d; @@ -19,6 +19,6 @@ pub fn slice_no_index_order<'a>(s: &'a mut S1, n: usize) -> &'a [u8] { // CHECK-LABEL: @test_check #[no_mangle] pub fn test_check<'a>(s: &'a mut S1, x: usize, y: usize) -> &'a [u8] { - // CHECK: slice_index_order_fail + // CHECK-COUNT-1: slice_index_fail &s.data[x..y] } diff --git a/tests/codegen-llvm/intrinsics/prefetch.rs b/tests/codegen-llvm/intrinsics/prefetch.rs index 3f9f21c85cb..41877872019 100644 --- a/tests/codegen-llvm/intrinsics/prefetch.rs +++ b/tests/codegen-llvm/intrinsics/prefetch.rs @@ -9,56 +9,48 @@ use std::intrinsics::{ #[no_mangle] pub fn check_prefetch_read_data(data: &[i8]) { - unsafe { - // CHECK: call void @llvm.prefetch{{.*}}({{.*}}, i32 0, i32 0, i32 1) - prefetch_read_data(data.as_ptr(), 0); - // CHECK: call void @llvm.prefetch{{.*}}({{.*}}, i32 0, i32 1, i32 1) - prefetch_read_data(data.as_ptr(), 1); - // CHECK: call void @llvm.prefetch{{.*}}({{.*}}, i32 0, i32 2, i32 1) - prefetch_read_data(data.as_ptr(), 2); - // CHECK: call void @llvm.prefetch{{.*}}({{.*}}, i32 0, i32 3, i32 1) - prefetch_read_data(data.as_ptr(), 3); - } + // CHECK: call void @llvm.prefetch{{.*}}({{.*}}, i32 0, i32 0, i32 1) + prefetch_read_data::<_, 0>(data.as_ptr()); + // CHECK: call void @llvm.prefetch{{.*}}({{.*}}, i32 0, i32 1, i32 1) + prefetch_read_data::<_, 1>(data.as_ptr()); + // CHECK: call void @llvm.prefetch{{.*}}({{.*}}, i32 0, i32 2, i32 1) + prefetch_read_data::<_, 2>(data.as_ptr()); + // CHECK: call void @llvm.prefetch{{.*}}({{.*}}, i32 0, i32 3, i32 1) + prefetch_read_data::<_, 3>(data.as_ptr()); } #[no_mangle] pub fn check_prefetch_write_data(data: &[i8]) { - unsafe { - // CHECK: call void @llvm.prefetch{{.*}}({{.*}}, i32 1, i32 0, i32 1) - prefetch_write_data(data.as_ptr(), 0); - // CHECK: call void @llvm.prefetch{{.*}}({{.*}}, i32 1, i32 1, i32 1) - prefetch_write_data(data.as_ptr(), 1); - // CHECK: call void @llvm.prefetch{{.*}}({{.*}}, i32 1, i32 2, i32 1) - prefetch_write_data(data.as_ptr(), 2); - // CHECK: call void @llvm.prefetch{{.*}}({{.*}}, i32 1, i32 3, i32 1) - prefetch_write_data(data.as_ptr(), 3); - } + // CHECK: call void @llvm.prefetch{{.*}}({{.*}}, i32 1, i32 0, i32 1) + prefetch_write_data::<_, 0>(data.as_ptr()); + // CHECK: call void @llvm.prefetch{{.*}}({{.*}}, i32 1, i32 1, i32 1) + prefetch_write_data::<_, 1>(data.as_ptr()); + // CHECK: call void @llvm.prefetch{{.*}}({{.*}}, i32 1, i32 2, i32 1) + prefetch_write_data::<_, 2>(data.as_ptr()); + // CHECK: call void @llvm.prefetch{{.*}}({{.*}}, i32 1, i32 3, i32 1) + prefetch_write_data::<_, 3>(data.as_ptr()); } #[no_mangle] pub fn check_prefetch_read_instruction(data: &[i8]) { - unsafe { - // CHECK: call void @llvm.prefetch{{.*}}({{.*}}, i32 0, i32 0, i32 0) - prefetch_read_instruction(data.as_ptr(), 0); - // CHECK: call void @llvm.prefetch{{.*}}({{.*}}, i32 0, i32 1, i32 0) - prefetch_read_instruction(data.as_ptr(), 1); - // CHECK: call void @llvm.prefetch{{.*}}({{.*}}, i32 0, i32 2, i32 0) - prefetch_read_instruction(data.as_ptr(), 2); - // CHECK: call void @llvm.prefetch{{.*}}({{.*}}, i32 0, i32 3, i32 0) - prefetch_read_instruction(data.as_ptr(), 3); - } + // CHECK: call void @llvm.prefetch{{.*}}({{.*}}, i32 0, i32 0, i32 0) + prefetch_read_instruction::<_, 0>(data.as_ptr()); + // CHECK: call void @llvm.prefetch{{.*}}({{.*}}, i32 0, i32 1, i32 0) + prefetch_read_instruction::<_, 1>(data.as_ptr()); + // CHECK: call void @llvm.prefetch{{.*}}({{.*}}, i32 0, i32 2, i32 0) + prefetch_read_instruction::<_, 2>(data.as_ptr()); + // CHECK: call void @llvm.prefetch{{.*}}({{.*}}, i32 0, i32 3, i32 0) + prefetch_read_instruction::<_, 3>(data.as_ptr()); } #[no_mangle] pub fn check_prefetch_write_instruction(data: &[i8]) { - unsafe { - // CHECK: call void @llvm.prefetch{{.*}}({{.*}}, i32 1, i32 0, i32 0) - prefetch_write_instruction(data.as_ptr(), 0); - // CHECK: call void @llvm.prefetch{{.*}}({{.*}}, i32 1, i32 1, i32 0) - prefetch_write_instruction(data.as_ptr(), 1); - // CHECK: call void @llvm.prefetch{{.*}}({{.*}}, i32 1, i32 2, i32 0) - prefetch_write_instruction(data.as_ptr(), 2); - // CHECK: call void @llvm.prefetch{{.*}}({{.*}}, i32 1, i32 3, i32 0) - prefetch_write_instruction(data.as_ptr(), 3); - } + // CHECK: call void @llvm.prefetch{{.*}}({{.*}}, i32 1, i32 0, i32 0) + prefetch_write_instruction::<_, 0>(data.as_ptr()); + // CHECK: call void @llvm.prefetch{{.*}}({{.*}}, i32 1, i32 1, i32 0) + prefetch_write_instruction::<_, 1>(data.as_ptr()); + // CHECK: call void @llvm.prefetch{{.*}}({{.*}}, i32 1, i32 2, i32 0) + prefetch_write_instruction::<_, 2>(data.as_ptr()); + // CHECK: call void @llvm.prefetch{{.*}}({{.*}}, i32 1, i32 3, i32 0) + prefetch_write_instruction::<_, 3>(data.as_ptr()); } diff --git a/tests/codegen-llvm/issues/and-masked-comparison-131162.rs b/tests/codegen-llvm/issues/and-masked-comparison-131162.rs new file mode 100644 index 00000000000..bdf021092fd --- /dev/null +++ b/tests/codegen-llvm/issues/and-masked-comparison-131162.rs @@ -0,0 +1,17 @@ +//@ compile-flags: -Copt-level=3 +//@ min-llvm-version: 20 + +#![crate_type = "lib"] + +// CHECK-LABEL: @issue_131162 +#[no_mangle] +pub fn issue_131162(a1: usize, a2: usize) -> bool { + const MASK: usize = 1; + + // CHECK-NOT: xor + // CHECK-NOT: trunc + // CHECK-NOT: and i1 + // CHECK: icmp + // CHECK-NEXT: ret + (a1 & !MASK) == (a2 & !MASK) && (a1 & MASK) == (a2 & MASK) +} diff --git a/tests/codegen-llvm/issues/assert-for-loop-bounds-check-71997.rs b/tests/codegen-llvm/issues/assert-for-loop-bounds-check-71997.rs new file mode 100644 index 00000000000..a0c64d607a8 --- /dev/null +++ b/tests/codegen-llvm/issues/assert-for-loop-bounds-check-71997.rs @@ -0,0 +1,18 @@ +// Tests that there's no bounds check within for-loop after asserting that +// the range start and end are within bounds. + +//@ compile-flags: -Copt-level=3 + +#![crate_type = "lib"] + +// CHECK-LABEL: @no_bounds_check_after_assert +#[no_mangle] +fn no_bounds_check_after_assert(slice: &[u64], start: usize, end: usize) -> u64 { + // CHECK-NOT: panic_bounds_check + let mut total = 0; + assert!(start < end && start < slice.len() && end <= slice.len()); + for i in start..end { + total += slice[i]; + } + total +} diff --git a/tests/codegen-llvm/issues/elided-division-by-zero-check-74917.rs b/tests/codegen-llvm/issues/elided-division-by-zero-check-74917.rs new file mode 100644 index 00000000000..9e890e14852 --- /dev/null +++ b/tests/codegen-llvm/issues/elided-division-by-zero-check-74917.rs @@ -0,0 +1,13 @@ +// Tests that there is no check for dividing by zero since the +// denominator, `(x - y)`, will always be greater than 0 since `x > y`. + +//@ compile-flags: -Copt-level=3 + +#![crate_type = "lib"] + +// CHECK-LABEL: @issue_74917 +#[no_mangle] +pub fn issue_74917(x: u16, y: u16) -> u16 { + // CHECK-NOT: panic + if x > y { 100 / (x - y) } else { 100 } +} diff --git a/tests/codegen-llvm/issues/for-loop-inner-assert-91109.rs b/tests/codegen-llvm/issues/for-loop-inner-assert-91109.rs new file mode 100644 index 00000000000..bffbcd7d069 --- /dev/null +++ b/tests/codegen-llvm/issues/for-loop-inner-assert-91109.rs @@ -0,0 +1,18 @@ +// Tests that there's no bounds check for the inner loop after the assert. + +//@ compile-flags: -Copt-level=3 + +#![crate_type = "lib"] + +// CHECK-LABEL: @zero +#[no_mangle] +pub fn zero(d: &mut [Vec<i32>]) { + // CHECK-NOT: panic_bounds_check + let n = d.len(); + for i in 0..n { + assert!(d[i].len() == n); + for j in 0..n { + d[i][j] = 0; + } + } +} diff --git a/tests/codegen-llvm/issues/issue-113757-bounds-check-after-cmp-max.rs b/tests/codegen-llvm/issues/issue-113757-bounds-check-after-cmp-max.rs index d495adf9980..0db8a5220ec 100644 --- a/tests/codegen-llvm/issues/issue-113757-bounds-check-after-cmp-max.rs +++ b/tests/codegen-llvm/issues/issue-113757-bounds-check-after-cmp-max.rs @@ -5,7 +5,7 @@ use std::cmp::max; // CHECK-LABEL: @foo -// CHECK-NOT: slice_start_index_len_fail +// CHECK-NOT: slice_index_fail // CHECK-NOT: unreachable #[no_mangle] pub fn foo(v: &mut Vec<u8>, size: usize) -> Option<&mut [u8]> { diff --git a/tests/codegen-llvm/issues/issue-122734-match-eq.rs b/tests/codegen-llvm/issues/issue-122734-match-eq.rs new file mode 100644 index 00000000000..89858972677 --- /dev/null +++ b/tests/codegen-llvm/issues/issue-122734-match-eq.rs @@ -0,0 +1,78 @@ +//@ min-llvm-version: 21 +//@ compile-flags: -Copt-level=3 -Zmerge-functions=disabled +//! Tests that matching + eq on `Option<FieldlessEnum>` produces a simple compare with no branching + +#![crate_type = "lib"] + +#[derive(PartialEq)] +pub enum TwoNum { + A, + B, +} + +#[derive(PartialEq)] +pub enum ThreeNum { + A, + B, + C, +} + +// CHECK-LABEL: @match_two +#[no_mangle] +pub fn match_two(a: Option<TwoNum>, b: Option<TwoNum>) -> bool { + // CHECK-NEXT: start: + // CHECK-NEXT: icmp eq i8 + // CHECK-NEXT: ret + match (a, b) { + (Some(x), Some(y)) => x == y, + (Some(_), None) => false, + (None, Some(_)) => false, + (None, None) => true, + } +} + +// CHECK-LABEL: @match_three +#[no_mangle] +pub fn match_three(a: Option<ThreeNum>, b: Option<ThreeNum>) -> bool { + // CHECK-NEXT: start: + // CHECK-NEXT: icmp eq + // CHECK-NEXT: ret + match (a, b) { + (Some(x), Some(y)) => x == y, + (Some(_), None) => false, + (None, Some(_)) => false, + (None, None) => true, + } +} + +// CHECK-LABEL: @match_two_ref +#[no_mangle] +pub fn match_two_ref(a: &Option<TwoNum>, b: &Option<TwoNum>) -> bool { + // CHECK-NEXT: start: + // CHECK-NEXT: load i8 + // CHECK-NEXT: load i8 + // CHECK-NEXT: icmp eq i8 + // CHECK-NEXT: ret + match (a, b) { + (Some(x), Some(y)) => x == y, + (Some(_), None) => false, + (None, Some(_)) => false, + (None, None) => true, + } +} + +// CHECK-LABEL: @match_three_ref +#[no_mangle] +pub fn match_three_ref(a: &Option<ThreeNum>, b: &Option<ThreeNum>) -> bool { + // CHECK-NEXT: start: + // CHECK-NEXT: load i8 + // CHECK-NEXT: load i8 + // CHECK-NEXT: icmp eq + // CHECK-NEXT: ret + match (a, b) { + (Some(x), Some(y)) => x == y, + (Some(_), None) => false, + (None, Some(_)) => false, + (None, None) => true, + } +} diff --git a/tests/codegen-llvm/issues/issue-27130.rs b/tests/codegen-llvm/issues/issue-27130.rs index 594e02af097..3e53c5cffd6 100644 --- a/tests/codegen-llvm/issues/issue-27130.rs +++ b/tests/codegen-llvm/issues/issue-27130.rs @@ -6,7 +6,7 @@ #[no_mangle] pub fn trim_in_place(a: &mut &[u8]) { while a.first() == Some(&42) { - // CHECK-NOT: slice_index_order_fail + // CHECK-NOT: slice_index_fail *a = &a[1..]; } } @@ -15,7 +15,7 @@ pub fn trim_in_place(a: &mut &[u8]) { #[no_mangle] pub fn trim_in_place2(a: &mut &[u8]) { while let Some(&42) = a.first() { - // CHECK-NOT: slice_index_order_fail + // CHECK-COUNT-1: slice_index_fail *a = &a[2..]; } } diff --git a/tests/codegen-llvm/issues/issue-69101-bounds-check.rs b/tests/codegen-llvm/issues/issue-69101-bounds-check.rs index 953b79aa263..f1857a9ce89 100644 --- a/tests/codegen-llvm/issues/issue-69101-bounds-check.rs +++ b/tests/codegen-llvm/issues/issue-69101-bounds-check.rs @@ -10,7 +10,7 @@ // CHECK-LABEL: @already_sliced_no_bounds_check #[no_mangle] pub fn already_sliced_no_bounds_check(a: &[u8], b: &[u8], c: &mut [u8]) { - // CHECK: slice_end_index_len_fail + // CHECK: slice_index_fail // CHECK-NOT: panic_bounds_check let _ = (&a[..2048], &b[..2048], &mut c[..2048]); for i in 0..1024 { @@ -21,7 +21,7 @@ pub fn already_sliced_no_bounds_check(a: &[u8], b: &[u8], c: &mut [u8]) { // CHECK-LABEL: @already_sliced_no_bounds_check_exact #[no_mangle] pub fn already_sliced_no_bounds_check_exact(a: &[u8], b: &[u8], c: &mut [u8]) { - // CHECK: slice_end_index_len_fail + // CHECK: slice_index_fail // CHECK-NOT: panic_bounds_check let _ = (&a[..1024], &b[..1024], &mut c[..1024]); for i in 0..1024 { @@ -33,7 +33,7 @@ pub fn already_sliced_no_bounds_check_exact(a: &[u8], b: &[u8], c: &mut [u8]) { // CHECK-LABEL: @already_sliced_bounds_check #[no_mangle] pub fn already_sliced_bounds_check(a: &[u8], b: &[u8], c: &mut [u8]) { - // CHECK: slice_end_index_len_fail + // CHECK: slice_index_fail // CHECK: panic_bounds_check let _ = (&a[..1023], &b[..2048], &mut c[..2048]); for i in 0..1024 { diff --git a/tests/codegen-llvm/issues/issue-73396-bounds-check-after-position.rs b/tests/codegen-llvm/issues/issue-73396-bounds-check-after-position.rs index 1e2c25babe0..8a2200478aa 100644 --- a/tests/codegen-llvm/issues/issue-73396-bounds-check-after-position.rs +++ b/tests/codegen-llvm/issues/issue-73396-bounds-check-after-position.rs @@ -8,8 +8,7 @@ #[no_mangle] pub fn position_slice_to_no_bounds_check(s: &[u8]) -> &[u8] { // CHECK-NOT: panic - // CHECK-NOT: slice_start_index_len_fail - // CHECK-NOT: slice_end_index_len_fail + // CHECK-NOT: slice_index_fail // CHECK-NOT: panic_bounds_check // CHECK-NOT: unreachable if let Some(idx) = s.iter().position(|b| *b == b'\\') { &s[..idx] } else { s } @@ -19,8 +18,7 @@ pub fn position_slice_to_no_bounds_check(s: &[u8]) -> &[u8] { #[no_mangle] pub fn position_slice_from_no_bounds_check(s: &[u8]) -> &[u8] { // CHECK-NOT: panic - // CHECK-NOT: slice_start_index_len_fail - // CHECK-NOT: slice_end_index_len_fail + // CHECK-NOT: slice_index_fail // CHECK-NOT: panic_bounds_check // CHECK-NOT: unreachable if let Some(idx) = s.iter().position(|b| *b == b'\\') { &s[idx..] } else { s } @@ -30,8 +28,7 @@ pub fn position_slice_from_no_bounds_check(s: &[u8]) -> &[u8] { #[no_mangle] pub fn position_index_no_bounds_check(s: &[u8]) -> u8 { // CHECK-NOT: panic - // CHECK-NOT: slice_start_index_len_fail - // CHECK-NOT: slice_end_index_len_fail + // CHECK-NOT: slice_index_fail // CHECK-NOT: panic_bounds_check // CHECK-NOT: unreachable if let Some(idx) = s.iter().position(|b| *b == b'\\') { s[idx] } else { 42 } @@ -40,8 +37,7 @@ pub fn position_index_no_bounds_check(s: &[u8]) -> u8 { #[no_mangle] pub fn rposition_slice_to_no_bounds_check(s: &[u8]) -> &[u8] { // CHECK-NOT: panic - // CHECK-NOT: slice_start_index_len_fail - // CHECK-NOT: slice_end_index_len_fail + // CHECK-NOT: slice_index_fail // CHECK-NOT: panic_bounds_check // CHECK-NOT: unreachable if let Some(idx) = s.iter().rposition(|b| *b == b'\\') { &s[..idx] } else { s } @@ -51,8 +47,7 @@ pub fn rposition_slice_to_no_bounds_check(s: &[u8]) -> &[u8] { #[no_mangle] pub fn rposition_slice_from_no_bounds_check(s: &[u8]) -> &[u8] { // CHECK-NOT: panic - // CHECK-NOT: slice_start_index_len_fail - // CHECK-NOT: slice_end_index_len_fail + // CHECK-NOT: slice_index_fail // CHECK-NOT: panic_bounds_check // CHECK-NOT: unreachable if let Some(idx) = s.iter().rposition(|b| *b == b'\\') { &s[idx..] } else { s } @@ -62,8 +57,7 @@ pub fn rposition_slice_from_no_bounds_check(s: &[u8]) -> &[u8] { #[no_mangle] pub fn rposition_index_no_bounds_check(s: &[u8]) -> u8 { // CHECK-NOT: panic - // CHECK-NOT: slice_start_index_len_fail - // CHECK-NOT: slice_end_index_len_fail + // CHECK-NOT: slice_index_fail // CHECK-NOT: panic_bounds_check // CHECK-NOT: unreachable if let Some(idx) = s.iter().rposition(|b| *b == b'\\') { s[idx] } else { 42 } diff --git a/tests/codegen-llvm/issues/iter-max-no-unwrap-failed-129583.rs b/tests/codegen-llvm/issues/iter-max-no-unwrap-failed-129583.rs new file mode 100644 index 00000000000..4d3fa4993ef --- /dev/null +++ b/tests/codegen-llvm/issues/iter-max-no-unwrap-failed-129583.rs @@ -0,0 +1,31 @@ +// Tests that `unwrap` is optimized out when the slice has a known length. +// The iterator may unroll for values smaller than a certain threshold so we +// use a larger value to prevent unrolling. + +//@ compile-flags: -Copt-level=3 +//@ min-llvm-version: 20 + +#![crate_type = "lib"] + +// CHECK-LABEL: @infallible_max_not_unrolled +#[no_mangle] +pub fn infallible_max_not_unrolled(x: &[u8; 1024]) -> u8 { + // CHECK-NOT: panic + // CHECK-NOT: unwrap_failed + *x.iter().max().unwrap() +} + +// CHECK-LABEL: @infallible_max_unrolled +#[no_mangle] +pub fn infallible_max_unrolled(x: &[u8; 10]) -> u8 { + // CHECK-NOT: panic + // CHECK-NOT: unwrap_failed + *x.iter().max().unwrap() +} + +// CHECK-LABEL: @may_panic_max +#[no_mangle] +pub fn may_panic_max(x: &[u8]) -> u8 { + // CHECK: unwrap_failed + *x.iter().max().unwrap() +} diff --git a/tests/codegen-llvm/issues/matches-logical-or-141497.rs b/tests/codegen-llvm/issues/matches-logical-or-141497.rs new file mode 100644 index 00000000000..348f62096a5 --- /dev/null +++ b/tests/codegen-llvm/issues/matches-logical-or-141497.rs @@ -0,0 +1,25 @@ +// Tests that `matches!` optimizes the same as +// `f == FrameType::Inter || f == FrameType::Switch`. + +//@ compile-flags: -Copt-level=3 +//@ min-llvm-version: 21 + +#![crate_type = "lib"] + +#[derive(Clone, Copy, PartialEq, Eq)] +pub enum FrameType { + Key = 0, + Inter = 1, + Intra = 2, + Switch = 3, +} + +// CHECK-LABEL: @is_inter_or_switch +#[no_mangle] +pub fn is_inter_or_switch(f: FrameType) -> bool { + // CHECK-NEXT: start: + // CHECK-NEXT: and i8 + // CHECK-NEXT: icmp + // CHECK-NEXT: ret + matches!(f, FrameType::Inter | FrameType::Switch) +} diff --git a/tests/codegen-llvm/issues/no-bounds-check-after-assert-110971.rs b/tests/codegen-llvm/issues/no-bounds-check-after-assert-110971.rs new file mode 100644 index 00000000000..aa4002f176d --- /dev/null +++ b/tests/codegen-llvm/issues/no-bounds-check-after-assert-110971.rs @@ -0,0 +1,14 @@ +// Tests that the slice access for `j` doesn't have a bounds check panic after +// being asserted as less than half of the slice length. + +//@ compile-flags: -Copt-level=3 + +#![crate_type = "lib"] + +// CHECK-LABEL: @check_only_assert_panic +#[no_mangle] +pub fn check_only_assert_panic(arr: &[u32], j: usize) -> u32 { + // CHECK-NOT: panic_bounds_check + assert!(j < arr.len() / 2); + arr[j] +} diff --git a/tests/codegen-llvm/issues/no-panic-for-pop-after-assert-71257.rs b/tests/codegen-llvm/issues/no-panic-for-pop-after-assert-71257.rs new file mode 100644 index 00000000000..68877c28d6c --- /dev/null +++ b/tests/codegen-llvm/issues/no-panic-for-pop-after-assert-71257.rs @@ -0,0 +1,19 @@ +// Tests that the `unwrap` branch is optimized out from the `pop` since the +// length has already been validated. + +//@ compile-flags: -Copt-level=3 + +#![crate_type = "lib"] + +pub enum Foo { + First(usize), + Second(usize), +} + +// CHECK-LABEL: @check_only_one_panic +#[no_mangle] +pub fn check_only_one_panic(v: &mut Vec<Foo>) -> Foo { + // CHECK-COUNT-1: call{{.+}}panic + assert!(v.len() == 1); + v.pop().unwrap() +} diff --git a/tests/codegen-llvm/issues/num-is-digit-to-digit-59352.rs b/tests/codegen-llvm/issues/num-is-digit-to-digit-59352.rs new file mode 100644 index 00000000000..1d23eb2cdf9 --- /dev/null +++ b/tests/codegen-llvm/issues/num-is-digit-to-digit-59352.rs @@ -0,0 +1,14 @@ +// Tests that there's no panic on unwrapping `to_digit` call after checking +// with `is_digit`. + +//@ compile-flags: -Copt-level=3 + +#![crate_type = "lib"] + +// CHECK-LABEL: @num_to_digit_slow +#[no_mangle] +pub fn num_to_digit_slow(num: char) -> u32 { + // CHECK-NOT: br + // CHECK-NOT: panic + if num.is_digit(8) { num.to_digit(8).unwrap() } else { 0 } +} diff --git a/tests/codegen-llvm/issues/slice-index-bounds-check-80075.rs b/tests/codegen-llvm/issues/slice-index-bounds-check-80075.rs new file mode 100644 index 00000000000..ecb5eb787c7 --- /dev/null +++ b/tests/codegen-llvm/issues/slice-index-bounds-check-80075.rs @@ -0,0 +1,13 @@ +// Tests that no bounds check panic is generated for `j` since +// `j <= i < data.len()`. + +//@ compile-flags: -Copt-level=3 + +#![crate_type = "lib"] + +// CHECK-LABEL: @issue_80075 +#[no_mangle] +pub fn issue_80075(data: &[u8], i: usize, j: usize) -> u8 { + // CHECK-NOT: panic_bounds_check + if i < data.len() && j <= i { data[j] } else { 0 } +} diff --git a/tests/codegen-llvm/loongarch-abi/loongarch64-lp64d-abi.rs b/tests/codegen-llvm/loongarch-abi/loongarch64-lp64d-abi.rs index 4666342a16a..7ea08a1a8f7 100644 --- a/tests/codegen-llvm/loongarch-abi/loongarch64-lp64d-abi.rs +++ b/tests/codegen-llvm/loongarch-abi/loongarch64-lp64d-abi.rs @@ -256,11 +256,11 @@ pub struct IntDoubleInt { c: i32, } -// CHECK: define void @f_int_double_int_s_arg(ptr{{( dead_on_return)?}} noalias{{( nocapture)?}} noundef align 8{{( captures\(none\))?}} dereferenceable(24) %a) +// CHECK: define void @f_int_double_int_s_arg(ptr{{( dead_on_return)?}} noalias noundef align 8{{( captures\(address\))?}} dereferenceable(24) %a) #[no_mangle] pub extern "C" fn f_int_double_int_s_arg(a: IntDoubleInt) {} -// CHECK: define void @f_ret_int_double_int_s(ptr{{( dead_on_unwind)?}} noalias{{( nocapture)?}} noundef{{( writable)?}} sret([24 x i8]) align 8{{( captures\(none\))?}} dereferenceable(24) %_0) +// CHECK: define void @f_ret_int_double_int_s(ptr{{( dead_on_unwind)?}} noalias noundef{{( writable)?}} sret([24 x i8]) align 8{{( captures\(address\))?}} dereferenceable(24) %_0) #[no_mangle] pub extern "C" fn f_ret_int_double_int_s() -> IntDoubleInt { IntDoubleInt { a: 1, b: 2., c: 3 } diff --git a/tests/codegen-llvm/naked-asan.rs b/tests/codegen-llvm/naked-asan.rs index 46218cf79d6..a57e55d1366 100644 --- a/tests/codegen-llvm/naked-asan.rs +++ b/tests/codegen-llvm/naked-asan.rs @@ -18,10 +18,10 @@ pub fn caller() { unsafe { asm!("call {}", sym page_fault_handler) } } -// CHECK: declare x86_intrcc void @page_fault_handler(){{.*}}#[[ATTRS:[0-9]+]] +// CHECK: declare x86_intrcc void @page_fault_handler(ptr {{.*}}, i64{{.*}}){{.*}}#[[ATTRS:[0-9]+]] #[unsafe(naked)] #[no_mangle] -pub extern "x86-interrupt" fn page_fault_handler() { +pub extern "x86-interrupt" fn page_fault_handler(_: u64, _: u64) { naked_asm!("ud2") } diff --git a/tests/codegen-llvm/range-attribute.rs b/tests/codegen-llvm/range-attribute.rs index b81ff9ab3e2..865d36d4747 100644 --- a/tests/codegen-llvm/range-attribute.rs +++ b/tests/codegen-llvm/range-attribute.rs @@ -67,7 +67,7 @@ pub fn enum2_value(x: Enum2) -> Enum2 { x } -// CHECK: noundef [[USIZE]] @takes_slice(ptr noalias noundef nonnull readonly align 4 %x.0, [[USIZE]] noundef %x.1) +// CHECK: noundef [[USIZE]] @takes_slice(ptr {{.*}} %x.0, [[USIZE]] noundef %x.1) #[no_mangle] pub fn takes_slice(x: &[i32]) -> usize { x.len() diff --git a/tests/codegen-llvm/read-only-capture-opt.rs b/tests/codegen-llvm/read-only-capture-opt.rs new file mode 100644 index 00000000000..78d56f8efc2 --- /dev/null +++ b/tests/codegen-llvm/read-only-capture-opt.rs @@ -0,0 +1,18 @@ +//@ compile-flags: -C opt-level=3 -Z mir-opt-level=0 +//@ min-llvm-version: 21 + +#![crate_type = "lib"] + +unsafe extern "C" { + safe fn do_something(p: &i32); +} + +#[unsafe(no_mangle)] +pub fn test() -> i32 { + // CHECK-LABEL: @test( + // CHECK: ret i32 0 + let i = 0; + do_something(&i); + do_something(&i); + i +} diff --git a/tests/codegen-llvm/repeat-operand-zero-len.rs b/tests/codegen-llvm/repeat-operand-zero-len.rs index b4cec42a07c..8d2a0e77d60 100644 --- a/tests/codegen-llvm/repeat-operand-zero-len.rs +++ b/tests/codegen-llvm/repeat-operand-zero-len.rs @@ -11,7 +11,7 @@ #[repr(transparent)] pub struct Wrapper<T, const N: usize>([T; N]); -// CHECK-LABEL: define {{.+}}do_repeat{{.+}}(i32 noundef %x) +// CHECK-LABEL: define {{.+}}do_repeat{{.+}}(i32 noundef{{( signext)?}} %x) // CHECK-NEXT: start: // CHECK-NOT: alloca // CHECK-NEXT: ret void @@ -23,6 +23,6 @@ pub fn do_repeat<T: Copy, const N: usize>(x: T) -> Wrapper<T, N> { // CHECK-LABEL: @trigger_repeat_zero_len #[no_mangle] pub fn trigger_repeat_zero_len() -> Wrapper<u32, 0> { - // CHECK: call void {{.+}}do_repeat{{.+}}(i32 noundef 4) + // CHECK: call void {{.+}}do_repeat{{.+}}(i32 noundef{{( signext)?}} 4) do_repeat(4) } diff --git a/tests/codegen-llvm/s390x-simd.rs b/tests/codegen-llvm/s390x-simd.rs index ac39357519e..464c1be11f1 100644 --- a/tests/codegen-llvm/s390x-simd.rs +++ b/tests/codegen-llvm/s390x-simd.rs @@ -6,7 +6,7 @@ #![crate_type = "rlib"] #![feature(no_core, asm_experimental_arch)] -#![feature(s390x_target_feature, simd_ffi, link_llvm_intrinsics, repr_simd)] +#![feature(s390x_target_feature, simd_ffi, intrinsics, repr_simd)] #![no_core] extern crate minicore; @@ -30,16 +30,20 @@ struct f32x4([f32; 4]); #[repr(simd)] struct f64x2([f64; 2]); -#[allow(improper_ctypes)] -extern "C" { - #[link_name = "llvm.smax.v16i8"] - fn vmxb(a: i8x16, b: i8x16) -> i8x16; - #[link_name = "llvm.smax.v8i16"] - fn vmxh(a: i16x8, b: i16x8) -> i16x8; - #[link_name = "llvm.smax.v4i32"] - fn vmxf(a: i32x4, b: i32x4) -> i32x4; - #[link_name = "llvm.smax.v2i64"] - fn vmxg(a: i64x2, b: i64x2) -> i64x2; +impl Copy for i8x16 {} +impl Copy for i16x8 {} +impl Copy for i32x4 {} +impl Copy for i64x2 {} + +#[rustc_intrinsic] +unsafe fn simd_ge<T, U>(x: T, y: T) -> U; + +#[rustc_intrinsic] +unsafe fn simd_select<M, V>(mask: M, a: V, b: V) -> V; + +#[inline(always)] +unsafe fn simd_max<T: Copy>(a: T, b: T) -> T { + simd_select(simd_ge::<T, T>(a, b), a, b) } // CHECK-LABEL: define <16 x i8> @max_i8x16 @@ -48,7 +52,7 @@ extern "C" { #[no_mangle] #[target_feature(enable = "vector")] pub unsafe extern "C" fn max_i8x16(a: i8x16, b: i8x16) -> i8x16 { - vmxb(a, b) + simd_max(a, b) } // CHECK-LABEL: define <8 x i16> @max_i16x8 @@ -57,7 +61,7 @@ pub unsafe extern "C" fn max_i8x16(a: i8x16, b: i8x16) -> i8x16 { #[no_mangle] #[target_feature(enable = "vector")] pub unsafe extern "C" fn max_i16x8(a: i16x8, b: i16x8) -> i16x8 { - vmxh(a, b) + simd_max(a, b) } // CHECK-LABEL: define <4 x i32> @max_i32x4 @@ -66,7 +70,7 @@ pub unsafe extern "C" fn max_i16x8(a: i16x8, b: i16x8) -> i16x8 { #[no_mangle] #[target_feature(enable = "vector")] pub unsafe extern "C" fn max_i32x4(a: i32x4, b: i32x4) -> i32x4 { - vmxf(a, b) + simd_max(a, b) } // CHECK-LABEL: define <2 x i64> @max_i64x2 @@ -75,7 +79,7 @@ pub unsafe extern "C" fn max_i32x4(a: i32x4, b: i32x4) -> i32x4 { #[no_mangle] #[target_feature(enable = "vector")] pub unsafe extern "C" fn max_i64x2(a: i64x2, b: i64x2) -> i64x2 { - vmxg(a, b) + simd_max(a, b) } // CHECK-LABEL: define <4 x float> @choose_f32x4 @@ -108,7 +112,7 @@ pub unsafe extern "C" fn max_wrapper_i8x16(a: Wrapper<i8x16>, b: Wrapper<i8x16>) // CHECK: call <16 x i8> @llvm.smax.v16i8 // CHECK-SAME: <16 x i8> // CHECK-SAME: <16 x i8> - Wrapper(vmxb(a.0, b.0)) + Wrapper(simd_max(a.0, b.0)) } #[no_mangle] @@ -122,7 +126,7 @@ pub unsafe extern "C" fn max_wrapper_i64x2(a: Wrapper<i64x2>, b: Wrapper<i64x2>) // CHECK: call <2 x i64> @llvm.smax.v2i64 // CHECK-SAME: <2 x i64> // CHECK-SAME: <2 x i64> - Wrapper(vmxg(a.0, b.0)) + Wrapper(simd_max(a.0, b.0)) } #[no_mangle] diff --git a/tests/codegen-llvm/sanitizer/cfi/emit-type-checks-attr-no-sanitize.rs b/tests/codegen-llvm/sanitizer/cfi/emit-type-checks-attr-sanitize-off.rs index 71ccdc8ca62..651afb33228 100644 --- a/tests/codegen-llvm/sanitizer/cfi/emit-type-checks-attr-no-sanitize.rs +++ b/tests/codegen-llvm/sanitizer/cfi/emit-type-checks-attr-sanitize-off.rs @@ -4,11 +4,11 @@ //@ compile-flags: -Clto -Cno-prepopulate-passes -Ctarget-feature=-crt-static -Zsanitizer=cfi -Copt-level=0 #![crate_type = "lib"] -#![feature(no_sanitize)] +#![feature(sanitize)] -#[no_sanitize(cfi)] +#[sanitize(cfi = "off")] pub fn foo(f: fn(i32) -> i32, arg: i32) -> i32 { - // CHECK-LABEL: emit_type_checks_attr_no_sanitize::foo + // CHECK-LABEL: emit_type_checks_attr_sanitize_off::foo // CHECK: Function Attrs: {{.*}} // CHECK-LABEL: define{{.*}}foo{{.*}}!type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} // CHECK: start: diff --git a/tests/codegen-llvm/sanitizer/kasan-emits-instrumentation.rs b/tests/codegen-llvm/sanitizer/kasan-emits-instrumentation.rs index 774c9ab53f1..c70aae1703e 100644 --- a/tests/codegen-llvm/sanitizer/kasan-emits-instrumentation.rs +++ b/tests/codegen-llvm/sanitizer/kasan-emits-instrumentation.rs @@ -13,7 +13,7 @@ //@[x86_64] needs-llvm-components: x86 #![crate_type = "rlib"] -#![feature(no_core, no_sanitize, lang_items)] +#![feature(no_core, sanitize, lang_items)] #![no_core] extern crate minicore; @@ -25,7 +25,7 @@ use minicore::*; // CHECK: start: // CHECK-NOT: call void @__asan_report_load // CHECK: } -#[no_sanitize(address)] +#[sanitize(address = "off")] pub fn unsanitized(b: &mut u8) -> u8 { *b } diff --git a/tests/codegen-llvm/sanitizer/kcfi/emit-kcfi-operand-bundle-attr-no-sanitize.rs b/tests/codegen-llvm/sanitizer/kcfi/emit-kcfi-operand-bundle-attr-sanitize-off.rs index 02c31fb8e9b..2581784ce3e 100644 --- a/tests/codegen-llvm/sanitizer/kcfi/emit-kcfi-operand-bundle-attr-no-sanitize.rs +++ b/tests/codegen-llvm/sanitizer/kcfi/emit-kcfi-operand-bundle-attr-sanitize-off.rs @@ -9,15 +9,15 @@ //@ compile-flags: -Cno-prepopulate-passes -Zsanitizer=kcfi -Copt-level=0 #![crate_type = "lib"] -#![feature(no_core, no_sanitize, lang_items)] +#![feature(no_core, sanitize, lang_items)] #![no_core] extern crate minicore; use minicore::*; -#[no_sanitize(kcfi)] +#[sanitize(kcfi = "off")] pub fn foo(f: fn(i32) -> i32, arg: i32) -> i32 { - // CHECK-LABEL: emit_kcfi_operand_bundle_attr_no_sanitize::foo + // CHECK-LABEL: emit_kcfi_operand_bundle_attr_sanitize_off::foo // CHECK: Function Attrs: {{.*}} // CHECK-LABEL: define{{.*}}foo{{.*}}!{{<unknown kind #36>|kcfi_type}} !{{[0-9]+}} // CHECK: start: diff --git a/tests/codegen-llvm/sanitizer/sanitize-off-asan-kasan.rs b/tests/codegen-llvm/sanitizer/sanitize-off-asan-kasan.rs new file mode 100644 index 00000000000..37549aba447 --- /dev/null +++ b/tests/codegen-llvm/sanitizer/sanitize-off-asan-kasan.rs @@ -0,0 +1,42 @@ +// Verifies that the `#[sanitize(address = "off")]` attribute also turns off +// the kernel address sanitizer. +// +//@ add-core-stubs +//@ compile-flags: -Zsanitizer=kernel-address -Ctarget-feature=-crt-static -Copt-level=0 +//@ revisions: aarch64 riscv64imac riscv64gc x86_64 +//@[aarch64] compile-flags: --target aarch64-unknown-none +//@[aarch64] needs-llvm-components: aarch64 +//@[riscv64imac] compile-flags: --target riscv64imac-unknown-none-elf +//@[riscv64imac] needs-llvm-components: riscv +//@[riscv64gc] compile-flags: --target riscv64gc-unknown-none-elf +//@[riscv64gc] needs-llvm-components: riscv +//@[x86_64] compile-flags: --target x86_64-unknown-none +//@[x86_64] needs-llvm-components: x86 + +#![crate_type = "rlib"] +#![feature(no_core, sanitize, lang_items)] +#![no_core] + +extern crate minicore; +use minicore::*; + +// CHECK-LABEL: ; sanitize_off_asan_kasan::unsanitized +// CHECK-NEXT: ; Function Attrs: +// CHECK-NOT: sanitize_address +// CHECK: start: +// CHECK-NOT: call void @__asan_report_load +// CHECK: } +#[sanitize(address = "off")] +pub fn unsanitized(b: &mut u8) -> u8 { + *b +} + +// CHECK-LABEL: ; sanitize_off_asan_kasan::sanitized +// CHECK-NEXT: ; Function Attrs: +// CHECK: sanitize_address +// CHECK: start: +// CHECK: call void @__asan_report_load +// CHECK: } +pub fn sanitized(b: &mut u8) -> u8 { + *b +} diff --git a/tests/codegen-llvm/sanitizer/no-sanitize-inlining.rs b/tests/codegen-llvm/sanitizer/sanitize-off-inlining.rs index 4bd832d2ab1..69771827c3a 100644 --- a/tests/codegen-llvm/sanitizer/no-sanitize-inlining.rs +++ b/tests/codegen-llvm/sanitizer/sanitize-off-inlining.rs @@ -1,4 +1,4 @@ -// Verifies that no_sanitize attribute prevents inlining when +// Verifies that sanitize(xyz = "off") attribute prevents inlining when // given sanitizer is enabled, but has no effect on inlining otherwise. // //@ needs-sanitizer-address @@ -9,7 +9,7 @@ //@[LSAN] compile-flags: -Zsanitizer=leak #![crate_type = "lib"] -#![feature(no_sanitize)] +#![feature(sanitize)] // ASAN-LABEL: define void @test // ASAN: call {{.*}} @random_inline @@ -23,7 +23,7 @@ pub fn test(n: &mut u32) { random_inline(n); } -#[no_sanitize(address)] +#[sanitize(address = "off")] #[inline] #[no_mangle] pub fn random_inline(n: &mut u32) { diff --git a/tests/codegen-llvm/sanitizer/no-sanitize.rs b/tests/codegen-llvm/sanitizer/sanitize-off-kasan-asan.rs index 2a309f6b9c6..94945f2b2e6 100644 --- a/tests/codegen-llvm/sanitizer/no-sanitize.rs +++ b/tests/codegen-llvm/sanitizer/sanitize-off-kasan-asan.rs @@ -1,34 +1,24 @@ -// Verifies that no_sanitize attribute can be used to -// selectively disable sanitizer instrumentation. +// Verifies that the `#[sanitize(kernel_address = "off")]` attribute also turns off +// the address sanitizer. // //@ needs-sanitizer-address //@ compile-flags: -Zsanitizer=address -Ctarget-feature=-crt-static -Copt-level=0 #![crate_type = "lib"] -#![feature(no_sanitize)] +#![feature(sanitize)] -// CHECK: @UNSANITIZED = constant{{.*}} no_sanitize_address -// CHECK-NOT: @__asan_global_UNSANITIZED -#[no_mangle] -#[no_sanitize(address)] -pub static UNSANITIZED: u32 = 0; - -// CHECK: @__asan_global_SANITIZED -#[no_mangle] -pub static SANITIZED: u32 = 0; - -// CHECK-LABEL: ; no_sanitize::unsanitized +// CHECK-LABEL: ; sanitize_off_kasan_asan::unsanitized // CHECK-NEXT: ; Function Attrs: // CHECK-NOT: sanitize_address // CHECK: start: // CHECK-NOT: call void @__asan_report_load // CHECK: } -#[no_sanitize(address)] +#[sanitize(kernel_address = "off")] pub fn unsanitized(b: &mut u8) -> u8 { *b } -// CHECK-LABEL: ; no_sanitize::sanitized +// CHECK-LABEL: ; sanitize_off_kasan_asan::sanitized // CHECK-NEXT: ; Function Attrs: // CHECK: sanitize_address // CHECK: start: diff --git a/tests/codegen-llvm/sanitizer/sanitize-off.rs b/tests/codegen-llvm/sanitizer/sanitize-off.rs new file mode 100644 index 00000000000..9f3f7cd9df7 --- /dev/null +++ b/tests/codegen-llvm/sanitizer/sanitize-off.rs @@ -0,0 +1,138 @@ +// Verifies that the `#[sanitize(address = "off")]` attribute can be used to +// selectively disable sanitizer instrumentation. +// +//@ needs-sanitizer-address +//@ compile-flags: -Zsanitizer=address -Ctarget-feature=-crt-static -Copt-level=0 + +#![crate_type = "lib"] +#![feature(sanitize)] + +// CHECK: @UNSANITIZED = constant{{.*}} no_sanitize_address +// CHECK-NOT: @__asan_global_SANITIZED +#[no_mangle] +#[sanitize(address = "off")] +pub static UNSANITIZED: u32 = 0; + +// CHECK: @__asan_global_SANITIZED +#[no_mangle] +pub static SANITIZED: u32 = 0; + +// CHECK-LABEL: ; sanitize_off::unsanitized +// CHECK-NEXT: ; Function Attrs: +// CHECK-NOT: sanitize_address +// CHECK: start: +// CHECK-NOT: call void @__asan_report_load +// CHECK: } +#[sanitize(address = "off")] +pub fn unsanitized(b: &mut u8) -> u8 { + *b +} + +// CHECK-LABEL: ; sanitize_off::sanitized +// CHECK-NEXT: ; Function Attrs: +// CHECK: sanitize_address +// CHECK: start: +// CHECK: call void @__asan_report_load +// CHECK: } +pub fn sanitized(b: &mut u8) -> u8 { + *b +} + +#[sanitize(address = "off")] +pub mod foo { + // CHECK-LABEL: ; sanitize_off::foo::unsanitized + // CHECK-NEXT: ; Function Attrs: + // CHECK-NOT: sanitize_address + // CHECK: start: + // CHECK-NOT: call void @__asan_report_load + // CHECK: } + pub fn unsanitized(b: &mut u8) -> u8 { + *b + } + + // CHECK-LABEL: ; sanitize_off::foo::sanitized + // CHECK-NEXT: ; Function Attrs: + // CHECK: sanitize_address + // CHECK: start: + // CHECK: call void @__asan_report_load + // CHECK: } + #[sanitize(address = "on")] + pub fn sanitized(b: &mut u8) -> u8 { + *b + } +} + +pub trait MyTrait { + fn unsanitized(&self, b: &mut u8) -> u8; + fn sanitized(&self, b: &mut u8) -> u8; + + // CHECK-LABEL: ; sanitize_off::MyTrait::unsanitized_default + // CHECK-NEXT: ; Function Attrs: + // CHECK-NOT: sanitize_address + // CHECK: start: + // CHECK-NOT: call void @__asan_report_load + // CHECK: } + #[sanitize(address = "off")] + fn unsanitized_default(&self, b: &mut u8) -> u8 { + *b + } + + // CHECK-LABEL: ; sanitize_off::MyTrait::sanitized_default + // CHECK-NEXT: ; Function Attrs: + // CHECK: sanitize_address + // CHECK: start: + // CHECK: call void @__asan_report_load + // CHECK: } + fn sanitized_default(&self, b: &mut u8) -> u8 { + *b + } +} + +#[sanitize(address = "off")] +impl MyTrait for () { + // CHECK-LABEL: ; <() as sanitize_off::MyTrait>::unsanitized + // CHECK-NEXT: ; Function Attrs: + // CHECK-NOT: sanitize_address + // CHECK: start: + // CHECK-NOT: call void @__asan_report_load + // CHECK: } + fn unsanitized(&self, b: &mut u8) -> u8 { + *b + } + + // CHECK-LABEL: ; <() as sanitize_off::MyTrait>::sanitized + // CHECK-NEXT: ; Function Attrs: + // CHECK: sanitize_address + // CHECK: start: + // CHECK: call void @__asan_report_load + // CHECK: } + #[sanitize(address = "on")] + fn sanitized(&self, b: &mut u8) -> u8 { + *b + } +} + +pub fn expose_trait(b: &mut u8) -> u8 { + <() as MyTrait>::unsanitized_default(&(), b); + <() as MyTrait>::sanitized_default(&(), b) +} + +#[sanitize(address = "off")] +pub mod outer { + #[sanitize(thread = "off")] + pub mod inner { + // CHECK-LABEL: ; sanitize_off::outer::inner::unsanitized + // CHECK-NEXT: ; Function Attrs: + // CHECK-NOT: sanitize_address + // CHECK: start: + // CHECK-NOT: call void @__asan_report_load + // CHECK: } + pub fn unsanitized() { + let xs = [0, 1, 2, 3]; + // Avoid optimizing everything out. + let xs = std::hint::black_box(xs.as_ptr()); + let code = unsafe { *xs.offset(4) }; + std::process::exit(code); + } + } +} diff --git a/tests/codegen-llvm/sanitizer/scs-attr-check.rs b/tests/codegen-llvm/sanitizer/scs-attr-check.rs index 6f4cbc2c0a6..f726503503c 100644 --- a/tests/codegen-llvm/sanitizer/scs-attr-check.rs +++ b/tests/codegen-llvm/sanitizer/scs-attr-check.rs @@ -5,7 +5,7 @@ //@ compile-flags: -Zsanitizer=shadow-call-stack #![crate_type = "lib"] -#![feature(no_sanitize)] +#![feature(sanitize)] // CHECK: ; sanitizer_scs_attr_check::scs // CHECK-NEXT: ; Function Attrs:{{.*}}shadowcallstack @@ -13,5 +13,5 @@ pub fn scs() {} // CHECK: ; sanitizer_scs_attr_check::no_scs // CHECK-NOT: ; Function Attrs:{{.*}}shadowcallstack -#[no_sanitize(shadow_call_stack)] +#[sanitize(shadow_call_stack = "off")] pub fn no_scs() {} diff --git a/tests/codegen-llvm/slice-last-elements-optimization.rs b/tests/codegen-llvm/slice-last-elements-optimization.rs index b90f91d7b17..d982cda709d 100644 --- a/tests/codegen-llvm/slice-last-elements-optimization.rs +++ b/tests/codegen-llvm/slice-last-elements-optimization.rs @@ -1,19 +1,18 @@ //@ compile-flags: -Copt-level=3 -//@ only-x86_64 //@ min-llvm-version: 20 #![crate_type = "lib"] // This test verifies that LLVM 20 properly optimizes the bounds check // when accessing the last few elements of a slice with proper conditions. // Previously, this would generate an unreachable branch to -// slice_start_index_len_fail even when the bounds check was provably safe. +// slice_index_fail even when the bounds check was provably safe. // CHECK-LABEL: @last_four_initial( #[no_mangle] pub fn last_four_initial(s: &[u8]) -> &[u8] { - // Previously this would generate a branch to slice_start_index_len_fail + // Previously this would generate a branch to slice_index_fail // that is unreachable. The LLVM 20 fix should eliminate this branch. - // CHECK-NOT: slice_start_index_len_fail + // CHECK-NOT: slice_index_fail // CHECK-NOT: unreachable let start = if s.len() <= 4 { 0 } else { s.len() - 4 }; &s[start..] @@ -23,7 +22,7 @@ pub fn last_four_initial(s: &[u8]) -> &[u8] { #[no_mangle] pub fn last_four_optimized(s: &[u8]) -> &[u8] { // This version was already correctly optimized before the fix in LLVM 20. - // CHECK-NOT: slice_start_index_len_fail + // CHECK-NOT: slice_index_fail // CHECK-NOT: unreachable if s.len() <= 4 { &s[0..] } else { &s[s.len() - 4..] } } @@ -32,6 +31,6 @@ pub fn last_four_optimized(s: &[u8]) -> &[u8] { // CHECK-LABEL: @test_bounds_check_happens( #[no_mangle] pub fn test_bounds_check_happens(s: &[u8], i: usize) -> &[u8] { - // CHECK: slice_start_index_len_fail + // CHECK: slice_index_fail &s[i..] } diff --git a/tests/codegen-llvm/slice-reverse.rs b/tests/codegen-llvm/slice-reverse.rs index e58d1c1d9d8..c31cff5010b 100644 --- a/tests/codegen-llvm/slice-reverse.rs +++ b/tests/codegen-llvm/slice-reverse.rs @@ -8,10 +8,10 @@ #[no_mangle] pub fn slice_reverse_u8(slice: &mut [u8]) { // CHECK-NOT: panic_bounds_check - // CHECK-NOT: slice_end_index_len_fail + // CHECK-NOT: slice_index_fail // CHECK: shufflevector <{{[0-9]+}} x i8> // CHECK-NOT: panic_bounds_check - // CHECK-NOT: slice_end_index_len_fail + // CHECK-NOT: slice_index_fail slice.reverse(); } @@ -19,9 +19,9 @@ pub fn slice_reverse_u8(slice: &mut [u8]) { #[no_mangle] pub fn slice_reverse_i32(slice: &mut [i32]) { // CHECK-NOT: panic_bounds_check - // CHECK-NOT: slice_end_index_len_fail + // CHECK-NOT: slice_index_fail // CHECK: shufflevector <{{[0-9]+}} x i32> // CHECK-NOT: panic_bounds_check - // CHECK-NOT: slice_end_index_len_fail + // CHECK-NOT: slice_index_fail slice.reverse(); } diff --git a/tests/codegen-llvm/transmute-scalar.rs b/tests/codegen-llvm/transmute-scalar.rs index ce1b0558b2e..21f7287047c 100644 --- a/tests/codegen-llvm/transmute-scalar.rs +++ b/tests/codegen-llvm/transmute-scalar.rs @@ -1,8 +1,9 @@ //@ add-core-stubs -//@ compile-flags: -C opt-level=0 -C no-prepopulate-passes +//@ compile-flags: -C opt-level=0 -C no-prepopulate-passes --target=x86_64-unknown-linux-gnu +//@ needs-llvm-components: x86 #![crate_type = "lib"] -#![feature(no_core, repr_simd, arm_target_feature, mips_target_feature, s390x_target_feature)] +#![feature(no_core, repr_simd)] #![no_core] extern crate minicore; @@ -117,11 +118,7 @@ struct S([i64; 1]); // CHECK-NEXT: %[[TEMP:.+]] = load i64, ptr %[[RET]] // CHECK-NEXT: ret i64 %[[TEMP]] #[no_mangle] -#[cfg_attr(target_family = "wasm", target_feature(enable = "simd128"))] -#[cfg_attr(target_arch = "arm", target_feature(enable = "neon"))] #[cfg_attr(target_arch = "x86", target_feature(enable = "sse"))] -#[cfg_attr(target_arch = "mips", target_feature(enable = "msa"))] -#[cfg_attr(target_arch = "s390x", target_feature(enable = "vector"))] pub extern "C" fn single_element_simd_to_scalar(b: S) -> i64 { unsafe { mem::transmute(b) } } @@ -133,11 +130,7 @@ pub extern "C" fn single_element_simd_to_scalar(b: S) -> i64 { // CHECK-NEXT: %[[TEMP:.+]] = load <1 x i64>, ptr %[[RET]] // CHECK-NEXT: ret <1 x i64> %[[TEMP]] #[no_mangle] -#[cfg_attr(target_family = "wasm", target_feature(enable = "simd128"))] -#[cfg_attr(target_arch = "arm", target_feature(enable = "neon"))] #[cfg_attr(target_arch = "x86", target_feature(enable = "sse"))] -#[cfg_attr(target_arch = "mips", target_feature(enable = "msa"))] -#[cfg_attr(target_arch = "s390x", target_feature(enable = "vector"))] pub extern "C" fn scalar_to_single_element_simd(b: i64) -> S { unsafe { mem::transmute(b) } } diff --git a/tests/codegen-llvm/uninhabited-transparent-return-abi.rs b/tests/codegen-llvm/uninhabited-transparent-return-abi.rs index 83d9a7a32ab..507cd7ae2a6 100644 --- a/tests/codegen-llvm/uninhabited-transparent-return-abi.rs +++ b/tests/codegen-llvm/uninhabited-transparent-return-abi.rs @@ -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({{.*}} sret([24 x i8]) {{.*}} %_2, i32 noundef %rsi) #2 + // CHECK-NEXT: call void @opaque_with_arg({{.*}} sret([24 x i8]) {{.*}} %_2, i32 noundef{{( signext)?}} %rsi) #2 // CHECK-NEXT: unreachable unsafe { opaque_with_arg(rsi); diff --git a/tests/codegen-llvm/vec-calloc.rs b/tests/codegen-llvm/vec-calloc.rs index d1c320ead01..15971bbfa00 100644 --- a/tests/codegen-llvm/vec-calloc.rs +++ b/tests/codegen-llvm/vec-calloc.rs @@ -1,4 +1,6 @@ +//@ revisions: normal llvm21 //@ compile-flags: -Copt-level=3 -Z merge-functions=disabled +//@ [llvm21] min-llvm-version: 21 //@ only-x86_64 #![crate_type = "lib"] @@ -176,6 +178,24 @@ pub fn vec_option_i32(n: usize) -> Vec<Option<i32>> { vec![None; n] } +// LLVM21-LABEL: @vec_array +#[cfg(llvm21)] +#[no_mangle] +pub fn vec_array(n: usize) -> Vec<[u32; 1_000_000]> { + // LLVM21-NOT: call {{.*}}alloc::vec::from_elem + // LLVM21-NOT: call {{.*}}reserve + // LLVM21-NOT: call {{.*}}__rust_alloc( + + // LLVM21: call {{.*}}__rust_alloc_zeroed( + + // LLVM21-NOT: call {{.*}}alloc::vec::from_elem + // LLVM21-NOT: call {{.*}}reserve + // LLVM21-NOT: call {{.*}}__rust_alloc( + + // LLVM21: ret void + vec![[0; 1_000_000]; 3] +} + // Ensure that __rust_alloc_zeroed gets the right attributes for LLVM to optimize it away. // CHECK: declare noalias noundef ptr @{{.*}}__rust_alloc_zeroed(i64 noundef, i64 allocalign noundef) unnamed_addr [[RUST_ALLOC_ZEROED_ATTRS:#[0-9]+]] diff --git a/tests/crashes/117629.rs b/tests/crashes/117629.rs deleted file mode 100644 index f63365395c6..00000000000 --- a/tests/crashes/117629.rs +++ /dev/null @@ -1,10 +0,0 @@ -//@ known-bug: #117629 -//@ edition:2021 - -#![feature(const_trait_impl)] - -const trait Tr { - async fn ft1() {} -} - -fn main() {} diff --git a/tests/crashes/120175.rs b/tests/crashes/120175.rs index c6e7203ff98..e441454bed2 100644 --- a/tests/crashes/120175.rs +++ b/tests/crashes/120175.rs @@ -2,8 +2,9 @@ //@ needs-rustc-debug-assertions #![feature(extern_types)] +#![feature(raw_dylib_elf)] -#[link(name = "bar", import_name_type = "decorated", kind = "raw-dylib")] +#[link(name = "bar", kind = "raw-dylib")] extern "C" { pub type CrossCrate; } diff --git a/tests/crashes/124352.rs b/tests/crashes/124352.rs deleted file mode 100644 index e9eb4419e6a..00000000000 --- a/tests/crashes/124352.rs +++ /dev/null @@ -1,4 +0,0 @@ -//@ known-bug: #124352 -#![rustc_never_type_options(: Unsize<U> = "hi")] - -fn main() {} diff --git a/tests/crashes/137580.rs b/tests/crashes/137580.rs deleted file mode 100644 index 246c80ef556..00000000000 --- a/tests/crashes/137580.rs +++ /dev/null @@ -1,4 +0,0 @@ -//@ known-bug: #137580 -fn main() { - println!("%65536$", 1); -} diff --git a/tests/debuginfo/basic-stepping.rs b/tests/debuginfo/basic-stepping.rs index 6e1344d22a5..f6399814a43 100644 --- a/tests/debuginfo/basic-stepping.rs +++ b/tests/debuginfo/basic-stepping.rs @@ -3,6 +3,8 @@ //! Regression test for <https://github.com/rust-lang/rust/issues/33013>. //@ ignore-aarch64: Doesn't work yet. +//@ ignore-loongarch64: Doesn't work yet. +//@ ignore-riscv64: Doesn't work yet. //@ compile-flags: -g // gdb-command: run diff --git a/tests/debuginfo/borrowed-enum.rs b/tests/debuginfo/borrowed-enum.rs index 517b439ff15..893dd777bcd 100644 --- a/tests/debuginfo/borrowed-enum.rs +++ b/tests/debuginfo/borrowed-enum.rs @@ -22,11 +22,11 @@ // lldb-command:run // lldb-command:v *the_a_ref -// lldb-check:(borrowed_enum::ABC) *the_a_ref = { value = { x = 0 y = 8970181431921507452 } $discr$ = 0 } +// lldb-check:(borrowed_enum::ABC) *the_a_ref = { TheA = { x = 0 y = 8970181431921507452 } } // lldb-command:v *the_b_ref -// lldb-check:(borrowed_enum::ABC) *the_b_ref = { value = { 0 = 0 1 = 286331153 2 = 286331153 } $discr$ = 1 } +// lldb-check:(borrowed_enum::ABC) *the_b_ref = { TheB = { 0 = 0 1 = 286331153 2 = 286331153 } } // lldb-command:v *univariant_ref -// lldb-check:(borrowed_enum::Univariant) *univariant_ref = { value = { 0 = 4820353753753434 } } +// lldb-check:(borrowed_enum::Univariant) *univariant_ref = { TheOnlyCase = { 0 = 4820353753753434 } } #![allow(unused_variables)] diff --git a/tests/debuginfo/recursive-struct.rs b/tests/debuginfo/recursive-struct.rs index 5be90992848..427a7100a4f 100644 --- a/tests/debuginfo/recursive-struct.rs +++ b/tests/debuginfo/recursive-struct.rs @@ -62,6 +62,7 @@ use self::Opt::{Empty, Val}; use std::boxed::Box as B; +use std::marker::PhantomData; enum Opt<T> { Empty, @@ -98,6 +99,11 @@ struct LongCycleWithAnonymousTypes { value: usize, } +struct Expanding<T> { + a: PhantomData<T>, + b: *const Expanding<(T, T)>, +} + // This test case makes sure that recursive structs are properly described. The Node structs are // generic so that we can have a new type (that newly needs to be described) for the different // cases. The potential problem with recursive types is that the DI generation algorithm gets @@ -205,6 +211,9 @@ fn main() { value: 30 }))))); + // This type can generate new instances infinitely if not handled properly. + std::hint::black_box(Expanding::<()> { a: PhantomData, b: std::ptr::null() }); + zzz(); // #break } diff --git a/tests/mir-opt/building/async_await.rs b/tests/mir-opt/building/async_await.rs index 6c44570d109..2d14a1fb0c6 100644 --- a/tests/mir-opt/building/async_await.rs +++ b/tests/mir-opt/building/async_await.rs @@ -4,7 +4,7 @@ // related to `yield` are `&mut Context`, and its return type is `Poll`. //@ edition:2018 -//@ compile-flags: -C panic=abort +//@ compile-flags: -Zmir-opt-level=0 -C panic=abort #![crate_type = "lib"] diff --git a/tests/mir-opt/building/dump_mir_cycle.rs b/tests/mir-opt/building/dump_mir_cycle.rs index 8e13420aed7..ab0f2ea6db8 100644 --- a/tests/mir-opt/building/dump_mir_cycle.rs +++ b/tests/mir-opt/building/dump_mir_cycle.rs @@ -1,3 +1,5 @@ +//@ compile-flags: -Zmir-opt-level=0 + #[derive(Debug)] pub struct Thing { pub next: &'static Thing, diff --git a/tests/mir-opt/building/enum_cast.rs b/tests/mir-opt/building/enum_cast.rs index eaf5537e0ab..07025f572ab 100644 --- a/tests/mir-opt/building/enum_cast.rs +++ b/tests/mir-opt/building/enum_cast.rs @@ -1,3 +1,4 @@ +//@ compile-flags: -Zmir-opt-level=0 // skip-filecheck // EMIT_MIR enum_cast.foo.built.after.mir // EMIT_MIR enum_cast.bar.built.after.mir diff --git a/tests/mir-opt/building/eq_never_type.rs b/tests/mir-opt/building/eq_never_type.rs index 90e2e697535..486e2f9fb8d 100644 --- a/tests/mir-opt/building/eq_never_type.rs +++ b/tests/mir-opt/building/eq_never_type.rs @@ -1,3 +1,4 @@ +//@ compile-flags: -Zmir-opt-level=0 // skip-filecheck #![feature(never_type)] #![allow(unreachable_code)] diff --git a/tests/mir-opt/building/index_array_and_slice.rs b/tests/mir-opt/building/index_array_and_slice.rs index f91b37567f7..47d8255ef57 100644 --- a/tests/mir-opt/building/index_array_and_slice.rs +++ b/tests/mir-opt/building/index_array_and_slice.rs @@ -1,36 +1,42 @@ -//@ compile-flags: -C opt-level=0 +//@ compile-flags: -Zmir-opt-level=0 -C opt-level=0 // EMIT_MIR index_array_and_slice.index_array.built.after.mir fn index_array(array: &[i32; 7], index: usize) -> &i32 { // CHECK: bb0: - // CHECK: [[LT:_.+]] = Lt(copy _2, const 7_usize); - // CHECK: assert(move [[LT]], "index out of bounds{{.+}}", const 7_usize, copy _2) -> [success: bb1, unwind + // CHECK: _3 = copy _2; + // CHECK: [[LT:_.+]] = Lt(copy _3, const 7_usize); + // CHECK: assert(move [[LT]], "index out of bounds{{.+}}", const 7_usize, copy _3) -> [success: bb1, unwind // CHECK: bb1: - // CHECK: _0 = &(*_1)[_2]; + // CHECK: _5 = &(*_1)[_3]; + // CHECK: _0 = &(*_5); &array[index] } // EMIT_MIR index_array_and_slice.index_const_generic_array.built.after.mir fn index_const_generic_array<const N: usize>(array: &[i32; N], index: usize) -> &i32 { // CHECK: bb0: - // CHECK: [[LT:_.+]] = Lt(copy _2, const N); - // CHECK: assert(move [[LT]], "index out of bounds{{.+}}", const N, copy _2) -> [success: bb1, unwind + // CHECK: _3 = copy _2; + // CHECK: [[LT:_.+]] = Lt(copy _3, const N); + // CHECK: assert(move [[LT]], "index out of bounds{{.+}}", const N, copy _3) -> [success: bb1, unwind // CHECK: bb1: - // CHECK: _0 = &(*_1)[_2]; + // CHECK: _5 = &(*_1)[_3]; + // CHECK: _0 = &(*_5); &array[index] } // EMIT_MIR index_array_and_slice.index_slice.built.after.mir fn index_slice(slice: &[i32], index: usize) -> &i32 { // CHECK: bb0: + // CHECK: _3 = copy _2; // CHECK: [[LEN:_.+]] = PtrMetadata(copy _1); - // CHECK: [[LT:_.+]] = Lt(copy _2, copy [[LEN]]); - // CHECK: assert(move [[LT]], "index out of bounds{{.+}}", move [[LEN]], copy _2) -> [success: bb1, + // CHECK: [[LT:_.+]] = Lt(copy _3, copy [[LEN]]); + // CHECK: assert(move [[LT]], "index out of bounds{{.+}}", move [[LEN]], copy _3) -> [success: bb1, // CHECK: bb1: - // CHECK: _0 = &(*_1)[_2]; + // CHECK: _6 = &(*_1)[_3]; + // CHECK: _0 = &(*_6); &slice[index] } @@ -40,12 +46,15 @@ fn index_mut_slice(slice: &mut [i32], index: usize) -> &i32 { // This cannot `copy _1` in the *built* MIR, only in the *runtime* MIR. // CHECK: bb0: - // CHECK: [[LEN:_.+]] = PtrMetadata(copy _1); - // CHECK: [[LT:_.+]] = Lt(copy _2, copy [[LEN]]); - // CHECK: assert(move [[LT]], "index out of bounds{{.+}}", move [[LEN]], copy _2) -> [success: bb1, + // CHECK: _3 = copy _2; + // CHECK: _4 = &raw const (fake) (*_1); + // CHECK: [[LEN:_.+]] = PtrMetadata(move _4); + // CHECK: [[LT:_.+]] = Lt(copy _3, copy [[LEN]]); + // CHECK: assert(move [[LT]], "index out of bounds{{.+}}", move [[LEN]], copy _3) -> [success: bb1, // CHECK: bb1: - // CHECK: _0 = &(*_1)[_2]; + // CHECK: _7 = &(*_1)[_3]; + // CHECK: _0 = &(*_7); &slice[index] } @@ -54,13 +63,15 @@ struct WithSliceTail(f64, [i32]); // EMIT_MIR index_array_and_slice.index_custom.built.after.mir fn index_custom(custom: &WithSliceTail, index: usize) -> &i32 { // CHECK: bb0: + // CHECK: _3 = copy _2; // CHECK: [[PTR:_.+]] = &raw const (fake) ((*_1).1: [i32]); // CHECK: [[LEN:_.+]] = PtrMetadata(move [[PTR]]); - // CHECK: [[LT:_.+]] = Lt(copy _2, copy [[LEN]]); - // CHECK: assert(move [[LT]], "index out of bounds{{.+}}", move [[LEN]], copy _2) -> [success: bb1, + // CHECK: [[LT:_.+]] = Lt(copy _3, copy [[LEN]]); + // CHECK: assert(move [[LT]], "index out of bounds{{.+}}", move [[LEN]], copy _3) -> [success: bb1, // CHECK: bb1: - // CHECK: _0 = &((*_1).1: [i32])[_2]; + // CHECK: _7 = &((*_1).1: [i32])[_3]; + // CHECK: _0 = &(*_7); &custom.1[index] } diff --git a/tests/mir-opt/building/issue_101867.main.built.after.mir b/tests/mir-opt/building/issue_101867.main.built.after.mir index 8a36c901eed..fa35658a16d 100644 --- a/tests/mir-opt/building/issue_101867.main.built.after.mir +++ b/tests/mir-opt/building/issue_101867.main.built.after.mir @@ -1,8 +1,8 @@ // MIR for `main` after built | User Type Annotations -| 0: user_ty: Canonical { value: Ty(std::option::Option<u8>), max_universe: U0, variables: [] }, span: $DIR/issue_101867.rs:4:12: 4:22, inferred_ty: std::option::Option<u8> -| 1: user_ty: Canonical { value: Ty(std::option::Option<u8>), max_universe: U0, variables: [] }, span: $DIR/issue_101867.rs:4:12: 4:22, inferred_ty: std::option::Option<u8> +| 0: user_ty: Canonical { value: Ty(std::option::Option<u8>), max_universe: U0, variables: [] }, span: $DIR/issue_101867.rs:5:12: 5:22, inferred_ty: std::option::Option<u8> +| 1: user_ty: Canonical { value: Ty(std::option::Option<u8>), max_universe: U0, variables: [] }, span: $DIR/issue_101867.rs:5:12: 5:22, inferred_ty: std::option::Option<u8> | fn main() -> () { let mut _0: (); diff --git a/tests/mir-opt/building/issue_101867.rs b/tests/mir-opt/building/issue_101867.rs index f8a531e8982..a00bc13b3fe 100644 --- a/tests/mir-opt/building/issue_101867.rs +++ b/tests/mir-opt/building/issue_101867.rs @@ -1,3 +1,4 @@ +//@ compile-flags: -Zmir-opt-level=0 // skip-filecheck // EMIT_MIR issue_101867.main.built.after.mir fn main() { diff --git a/tests/mir-opt/building/issue_110508.rs b/tests/mir-opt/building/issue_110508.rs index e597cd5d06b..aa8a7b1d08f 100644 --- a/tests/mir-opt/building/issue_110508.rs +++ b/tests/mir-opt/building/issue_110508.rs @@ -1,3 +1,4 @@ +//@ compile-flags: -Zmir-opt-level=0 // skip-filecheck // EMIT_MIR issue_110508.{impl#0}-BAR.built.after.mir // EMIT_MIR issue_110508.{impl#0}-SELF_BAR.built.after.mir diff --git a/tests/mir-opt/building/issue_110508.{impl#0}-BAR.built.after.mir b/tests/mir-opt/building/issue_110508.{impl#0}-BAR.built.after.mir index c3d28fae518..0cefb9c8fd1 100644 --- a/tests/mir-opt/building/issue_110508.{impl#0}-BAR.built.after.mir +++ b/tests/mir-opt/building/issue_110508.{impl#0}-BAR.built.after.mir @@ -1,6 +1,6 @@ -// MIR for `<impl at $DIR/issue_110508.rs:9:1: 9:9>::BAR` after built +// MIR for `<impl at $DIR/issue_110508.rs:10:1: 10:9>::BAR` after built -const <impl at $DIR/issue_110508.rs:9:1: 9:9>::BAR: Foo = { +const <impl at $DIR/issue_110508.rs:10:1: 10:9>::BAR: Foo = { let mut _0: Foo; let mut _1: (); diff --git a/tests/mir-opt/building/issue_110508.{impl#0}-SELF_BAR.built.after.mir b/tests/mir-opt/building/issue_110508.{impl#0}-SELF_BAR.built.after.mir index 177518c30af..0e0e9149385 100644 --- a/tests/mir-opt/building/issue_110508.{impl#0}-SELF_BAR.built.after.mir +++ b/tests/mir-opt/building/issue_110508.{impl#0}-SELF_BAR.built.after.mir @@ -1,6 +1,6 @@ -// MIR for `<impl at $DIR/issue_110508.rs:9:1: 9:9>::SELF_BAR` after built +// MIR for `<impl at $DIR/issue_110508.rs:10:1: 10:9>::SELF_BAR` after built -const <impl at $DIR/issue_110508.rs:9:1: 9:9>::SELF_BAR: Foo = { +const <impl at $DIR/issue_110508.rs:10:1: 10:9>::SELF_BAR: Foo = { let mut _0: Foo; let mut _1: (); diff --git a/tests/mir-opt/building/issue_49232.rs b/tests/mir-opt/building/issue_49232.rs index ac06e02778f..f17e3e955a4 100644 --- a/tests/mir-opt/building/issue_49232.rs +++ b/tests/mir-opt/building/issue_49232.rs @@ -1,3 +1,4 @@ +//@ compile-flags: -Zmir-opt-level=0 // skip-filecheck // We must mark a variable whose initialization fails due to an // abort statement as StorageDead. diff --git a/tests/mir-opt/building/logical_or_in_conditional.rs b/tests/mir-opt/building/logical_or_in_conditional.rs index 249ccf72804..d1c1ea2896a 100644 --- a/tests/mir-opt/building/logical_or_in_conditional.rs +++ b/tests/mir-opt/building/logical_or_in_conditional.rs @@ -1,5 +1,5 @@ // skip-filecheck -//@ compile-flags: -Z validate-mir +//@ compile-flags: -Zmir-opt-level=0 -Z validate-mir //@ edition: 2024 struct Droppy(u8); impl Drop for Droppy { diff --git a/tests/mir-opt/building/receiver_ptr_mutability.main.built.after.mir b/tests/mir-opt/building/receiver_ptr_mutability.main.built.after.mir index 744553c7cd2..5cf182c21c3 100644 --- a/tests/mir-opt/building/receiver_ptr_mutability.main.built.after.mir +++ b/tests/mir-opt/building/receiver_ptr_mutability.main.built.after.mir @@ -1,10 +1,10 @@ // MIR for `main` after built | User Type Annotations -| 0: user_ty: Canonical { value: Ty(*mut Test), max_universe: U0, variables: [] }, span: $DIR/receiver_ptr_mutability.rs:15:14: 15:23, inferred_ty: *mut Test -| 1: user_ty: Canonical { value: Ty(*mut Test), max_universe: U0, variables: [] }, span: $DIR/receiver_ptr_mutability.rs:15:14: 15:23, inferred_ty: *mut Test -| 2: user_ty: Canonical { value: Ty(&&&&*mut Test), max_universe: U0, variables: [Region(U0), Region(U0), Region(U0), Region(U0)] }, span: $DIR/receiver_ptr_mutability.rs:19:18: 19:31, inferred_ty: &&&&*mut Test -| 3: user_ty: Canonical { value: Ty(&&&&*mut Test), max_universe: U0, variables: [Region(U0), Region(U0), Region(U0), Region(U0)] }, span: $DIR/receiver_ptr_mutability.rs:19:18: 19:31, inferred_ty: &&&&*mut Test +| 0: user_ty: Canonical { value: Ty(*mut Test), max_universe: U0, variables: [] }, span: $DIR/receiver_ptr_mutability.rs:16:14: 16:23, inferred_ty: *mut Test +| 1: user_ty: Canonical { value: Ty(*mut Test), max_universe: U0, variables: [] }, span: $DIR/receiver_ptr_mutability.rs:16:14: 16:23, inferred_ty: *mut Test +| 2: user_ty: Canonical { value: Ty(&&&&*mut Test), max_universe: U0, variables: [Region(U0), Region(U0), Region(U0), Region(U0)] }, span: $DIR/receiver_ptr_mutability.rs:20:18: 20:31, inferred_ty: &&&&*mut Test +| 3: user_ty: Canonical { value: Ty(&&&&*mut Test), max_universe: U0, variables: [Region(U0), Region(U0), Region(U0), Region(U0)] }, span: $DIR/receiver_ptr_mutability.rs:20:18: 20:31, inferred_ty: &&&&*mut Test | fn main() -> () { let mut _0: (); diff --git a/tests/mir-opt/building/receiver_ptr_mutability.rs b/tests/mir-opt/building/receiver_ptr_mutability.rs index 1ddb8b71a5a..37b142f1d8a 100644 --- a/tests/mir-opt/building/receiver_ptr_mutability.rs +++ b/tests/mir-opt/building/receiver_ptr_mutability.rs @@ -1,3 +1,4 @@ +//@ compile-flags: -Zmir-opt-level=0 // skip-filecheck // EMIT_MIR receiver_ptr_mutability.main.built.after.mir diff --git a/tests/mir-opt/building/shifts.rs b/tests/mir-opt/building/shifts.rs index d7747bb2f78..165b388bc18 100644 --- a/tests/mir-opt/building/shifts.rs +++ b/tests/mir-opt/building/shifts.rs @@ -1,5 +1,5 @@ // skip-filecheck -//@ compile-flags: -C debug-assertions=yes +//@ compile-flags: -Zmir-opt-level=0 -C debug-assertions=yes // EMIT_MIR shifts.shift_signed.built.after.mir fn shift_signed(small: i8, big: u128, a: i8, b: i32, c: i128) -> ([i8; 3], [u128; 3]) { diff --git a/tests/mir-opt/building/storage_live_dead_in_statics.rs b/tests/mir-opt/building/storage_live_dead_in_statics.rs index 7cb74acbf06..868f4a8f559 100644 --- a/tests/mir-opt/building/storage_live_dead_in_statics.rs +++ b/tests/mir-opt/building/storage_live_dead_in_statics.rs @@ -1,3 +1,4 @@ +//@ compile-flags: -Zmir-opt-level=0 // skip-filecheck // Check that when we compile the static `XXX` into MIR, we do not // generate `StorageStart` or `StorageEnd` statements. diff --git a/tests/mir-opt/building/uniform_array_move_out.rs b/tests/mir-opt/building/uniform_array_move_out.rs index aff5996d0b6..36245273fe1 100644 --- a/tests/mir-opt/building/uniform_array_move_out.rs +++ b/tests/mir-opt/building/uniform_array_move_out.rs @@ -1,3 +1,4 @@ +//@ compile-flags: -Zmir-opt-level=0 // skip-filecheck #![feature(liballoc_internals, rustc_attrs)] diff --git a/tests/mir-opt/building/user_type_annotations.let_else.built.after.mir b/tests/mir-opt/building/user_type_annotations.let_else.built.after.mir index 3d26fe24ac9..bbf504d311f 100644 --- a/tests/mir-opt/building/user_type_annotations.let_else.built.after.mir +++ b/tests/mir-opt/building/user_type_annotations.let_else.built.after.mir @@ -1,8 +1,8 @@ // MIR for `let_else` after built | User Type Annotations -| 0: user_ty: Canonical { value: Ty((u32, u64, &'static char)), max_universe: U0, variables: [] }, span: $DIR/user_type_annotations.rs:35:20: 35:45, inferred_ty: (u32, u64, &char) -| 1: user_ty: Canonical { value: Ty((u32, u64, &'static char)), max_universe: U0, variables: [] }, span: $DIR/user_type_annotations.rs:35:20: 35:45, inferred_ty: (u32, u64, &char) +| 0: user_ty: Canonical { value: Ty((u32, u64, &'static char)), max_universe: U0, variables: [] }, span: $DIR/user_type_annotations.rs:36:20: 36:45, inferred_ty: (u32, u64, &char) +| 1: user_ty: Canonical { value: Ty((u32, u64, &'static char)), max_universe: U0, variables: [] }, span: $DIR/user_type_annotations.rs:36:20: 36:45, inferred_ty: (u32, u64, &char) | fn let_else() -> () { let mut _0: (); diff --git a/tests/mir-opt/building/user_type_annotations.let_else_bindless.built.after.mir b/tests/mir-opt/building/user_type_annotations.let_else_bindless.built.after.mir index b2a06ae53a8..7bf2551e99f 100644 --- a/tests/mir-opt/building/user_type_annotations.let_else_bindless.built.after.mir +++ b/tests/mir-opt/building/user_type_annotations.let_else_bindless.built.after.mir @@ -1,8 +1,8 @@ // MIR for `let_else_bindless` after built | User Type Annotations -| 0: user_ty: Canonical { value: Ty((u32, u64, &'static char)), max_universe: U0, variables: [] }, span: $DIR/user_type_annotations.rs:40:20: 40:45, inferred_ty: (u32, u64, &char) -| 1: user_ty: Canonical { value: Ty((u32, u64, &'static char)), max_universe: U0, variables: [] }, span: $DIR/user_type_annotations.rs:40:20: 40:45, inferred_ty: (u32, u64, &char) +| 0: user_ty: Canonical { value: Ty((u32, u64, &'static char)), max_universe: U0, variables: [] }, span: $DIR/user_type_annotations.rs:41:20: 41:45, inferred_ty: (u32, u64, &char) +| 1: user_ty: Canonical { value: Ty((u32, u64, &'static char)), max_universe: U0, variables: [] }, span: $DIR/user_type_annotations.rs:41:20: 41:45, inferred_ty: (u32, u64, &char) | fn let_else_bindless() -> () { let mut _0: (); diff --git a/tests/mir-opt/building/user_type_annotations.let_init.built.after.mir b/tests/mir-opt/building/user_type_annotations.let_init.built.after.mir index d1b8f823e9b..0cf681d8ab2 100644 --- a/tests/mir-opt/building/user_type_annotations.let_init.built.after.mir +++ b/tests/mir-opt/building/user_type_annotations.let_init.built.after.mir @@ -1,8 +1,8 @@ // MIR for `let_init` after built | User Type Annotations -| 0: user_ty: Canonical { value: Ty((u32, u64, &'static char)), max_universe: U0, variables: [] }, span: $DIR/user_type_annotations.rs:25:20: 25:45, inferred_ty: (u32, u64, &char) -| 1: user_ty: Canonical { value: Ty((u32, u64, &'static char)), max_universe: U0, variables: [] }, span: $DIR/user_type_annotations.rs:25:20: 25:45, inferred_ty: (u32, u64, &char) +| 0: user_ty: Canonical { value: Ty((u32, u64, &'static char)), max_universe: U0, variables: [] }, span: $DIR/user_type_annotations.rs:26:20: 26:45, inferred_ty: (u32, u64, &char) +| 1: user_ty: Canonical { value: Ty((u32, u64, &'static char)), max_universe: U0, variables: [] }, span: $DIR/user_type_annotations.rs:26:20: 26:45, inferred_ty: (u32, u64, &char) | fn let_init() -> () { let mut _0: (); diff --git a/tests/mir-opt/building/user_type_annotations.let_init_bindless.built.after.mir b/tests/mir-opt/building/user_type_annotations.let_init_bindless.built.after.mir index 6702f930060..968813c826e 100644 --- a/tests/mir-opt/building/user_type_annotations.let_init_bindless.built.after.mir +++ b/tests/mir-opt/building/user_type_annotations.let_init_bindless.built.after.mir @@ -1,8 +1,8 @@ // MIR for `let_init_bindless` after built | User Type Annotations -| 0: user_ty: Canonical { value: Ty((u32, u64, &'static char)), max_universe: U0, variables: [] }, span: $DIR/user_type_annotations.rs:30:20: 30:45, inferred_ty: (u32, u64, &char) -| 1: user_ty: Canonical { value: Ty((u32, u64, &'static char)), max_universe: U0, variables: [] }, span: $DIR/user_type_annotations.rs:30:20: 30:45, inferred_ty: (u32, u64, &char) +| 0: user_ty: Canonical { value: Ty((u32, u64, &'static char)), max_universe: U0, variables: [] }, span: $DIR/user_type_annotations.rs:31:20: 31:45, inferred_ty: (u32, u64, &char) +| 1: user_ty: Canonical { value: Ty((u32, u64, &'static char)), max_universe: U0, variables: [] }, span: $DIR/user_type_annotations.rs:31:20: 31:45, inferred_ty: (u32, u64, &char) | fn let_init_bindless() -> () { let mut _0: (); diff --git a/tests/mir-opt/building/user_type_annotations.let_uninit.built.after.mir b/tests/mir-opt/building/user_type_annotations.let_uninit.built.after.mir index 76b5938b87d..b6fdc4ff46d 100644 --- a/tests/mir-opt/building/user_type_annotations.let_uninit.built.after.mir +++ b/tests/mir-opt/building/user_type_annotations.let_uninit.built.after.mir @@ -1,7 +1,7 @@ // MIR for `let_uninit` after built | User Type Annotations -| 0: user_ty: Canonical { value: Ty((u32, u64, &'static char)), max_universe: U0, variables: [] }, span: $DIR/user_type_annotations.rs:15:20: 15:45, inferred_ty: (u32, u64, &char) +| 0: user_ty: Canonical { value: Ty((u32, u64, &'static char)), max_universe: U0, variables: [] }, span: $DIR/user_type_annotations.rs:16:20: 16:45, inferred_ty: (u32, u64, &char) | fn let_uninit() -> () { let mut _0: (); diff --git a/tests/mir-opt/building/user_type_annotations.let_uninit_bindless.built.after.mir b/tests/mir-opt/building/user_type_annotations.let_uninit_bindless.built.after.mir index 0cd12558771..472dbfb6304 100644 --- a/tests/mir-opt/building/user_type_annotations.let_uninit_bindless.built.after.mir +++ b/tests/mir-opt/building/user_type_annotations.let_uninit_bindless.built.after.mir @@ -1,7 +1,7 @@ // MIR for `let_uninit_bindless` after built | User Type Annotations -| 0: user_ty: Canonical { value: Ty((u32, u64, &'static char)), max_universe: U0, variables: [] }, span: $DIR/user_type_annotations.rs:20:20: 20:45, inferred_ty: (u32, u64, &char) +| 0: user_ty: Canonical { value: Ty((u32, u64, &'static char)), max_universe: U0, variables: [] }, span: $DIR/user_type_annotations.rs:21:20: 21:45, inferred_ty: (u32, u64, &char) | fn let_uninit_bindless() -> () { let mut _0: (); diff --git a/tests/mir-opt/building/user_type_annotations.match_assoc_const.built.after.mir b/tests/mir-opt/building/user_type_annotations.match_assoc_const.built.after.mir index c0ce6f1d06b..ff4b0bf7600 100644 --- a/tests/mir-opt/building/user_type_annotations.match_assoc_const.built.after.mir +++ b/tests/mir-opt/building/user_type_annotations.match_assoc_const.built.after.mir @@ -1,8 +1,8 @@ // MIR for `match_assoc_const` after built | User Type Annotations -| 0: user_ty: Canonical { value: TypeOf(DefId(0:11 ~ user_type_annotations[ee8e]::MyTrait::FOO), UserArgs { args: [MyStruct, 'static], user_self_ty: None }), max_universe: U0, variables: [] }, span: $DIR/user_type_annotations.rs:54:9: 54:44, inferred_ty: u32 -| 1: user_ty: Canonical { value: TypeOf(DefId(0:11 ~ user_type_annotations[ee8e]::MyTrait::FOO), UserArgs { args: [MyStruct, 'static], user_self_ty: None }), max_universe: U0, variables: [] }, span: $DIR/user_type_annotations.rs:54:9: 54:44, inferred_ty: u32 +| 0: user_ty: Canonical { value: TypeOf(DefId(0:11 ~ user_type_annotations[ee8e]::MyTrait::FOO), UserArgs { args: [MyStruct, 'static], user_self_ty: None }), max_universe: U0, variables: [] }, span: $DIR/user_type_annotations.rs:55:9: 55:44, inferred_ty: u32 +| 1: user_ty: Canonical { value: TypeOf(DefId(0:11 ~ user_type_annotations[ee8e]::MyTrait::FOO), UserArgs { args: [MyStruct, 'static], user_self_ty: None }), max_universe: U0, variables: [] }, span: $DIR/user_type_annotations.rs:55:9: 55:44, inferred_ty: u32 | fn match_assoc_const() -> () { let mut _0: (); diff --git a/tests/mir-opt/building/user_type_annotations.match_assoc_const_range.built.after.mir b/tests/mir-opt/building/user_type_annotations.match_assoc_const_range.built.after.mir index 3a6aa5b7c2c..4cc433f475f 100644 --- a/tests/mir-opt/building/user_type_annotations.match_assoc_const_range.built.after.mir +++ b/tests/mir-opt/building/user_type_annotations.match_assoc_const_range.built.after.mir @@ -1,10 +1,10 @@ // MIR for `match_assoc_const_range` after built | User Type Annotations -| 0: user_ty: Canonical { value: TypeOf(DefId(0:11 ~ user_type_annotations[ee8e]::MyTrait::FOO), UserArgs { args: [MyStruct, 'static], user_self_ty: None }), max_universe: U0, variables: [] }, span: $DIR/user_type_annotations.rs:62:11: 62:46, inferred_ty: u32 -| 1: user_ty: Canonical { value: TypeOf(DefId(0:11 ~ user_type_annotations[ee8e]::MyTrait::FOO), UserArgs { args: [MyStruct, 'static], user_self_ty: None }), max_universe: U0, variables: [] }, span: $DIR/user_type_annotations.rs:62:11: 62:46, inferred_ty: u32 -| 2: user_ty: Canonical { value: TypeOf(DefId(0:11 ~ user_type_annotations[ee8e]::MyTrait::FOO), UserArgs { args: [MyStruct, 'static], user_self_ty: None }), max_universe: U0, variables: [] }, span: $DIR/user_type_annotations.rs:63:9: 63:44, inferred_ty: u32 -| 3: user_ty: Canonical { value: TypeOf(DefId(0:11 ~ user_type_annotations[ee8e]::MyTrait::FOO), UserArgs { args: [MyStruct, 'static], user_self_ty: None }), max_universe: U0, variables: [] }, span: $DIR/user_type_annotations.rs:63:9: 63:44, inferred_ty: u32 +| 0: user_ty: Canonical { value: TypeOf(DefId(0:11 ~ user_type_annotations[ee8e]::MyTrait::FOO), UserArgs { args: [MyStruct, 'static], user_self_ty: None }), max_universe: U0, variables: [] }, span: $DIR/user_type_annotations.rs:63:11: 63:46, inferred_ty: u32 +| 1: user_ty: Canonical { value: TypeOf(DefId(0:11 ~ user_type_annotations[ee8e]::MyTrait::FOO), UserArgs { args: [MyStruct, 'static], user_self_ty: None }), max_universe: U0, variables: [] }, span: $DIR/user_type_annotations.rs:63:11: 63:46, inferred_ty: u32 +| 2: user_ty: Canonical { value: TypeOf(DefId(0:11 ~ user_type_annotations[ee8e]::MyTrait::FOO), UserArgs { args: [MyStruct, 'static], user_self_ty: None }), max_universe: U0, variables: [] }, span: $DIR/user_type_annotations.rs:64:9: 64:44, inferred_ty: u32 +| 3: user_ty: Canonical { value: TypeOf(DefId(0:11 ~ user_type_annotations[ee8e]::MyTrait::FOO), UserArgs { args: [MyStruct, 'static], user_self_ty: None }), max_universe: U0, variables: [] }, span: $DIR/user_type_annotations.rs:64:9: 64:44, inferred_ty: u32 | fn match_assoc_const_range() -> () { let mut _0: (); diff --git a/tests/mir-opt/building/user_type_annotations.rs b/tests/mir-opt/building/user_type_annotations.rs index d55c678d5ae..527bf62f7dc 100644 --- a/tests/mir-opt/building/user_type_annotations.rs +++ b/tests/mir-opt/building/user_type_annotations.rs @@ -1,3 +1,4 @@ +//@ compile-flags: -Zmir-opt-level=0 //@ edition: 2024 // skip-filecheck diff --git a/tests/mir-opt/dont_reset_cast_kind_without_updating_operand.test.GVN.32bit.panic-abort.diff b/tests/mir-opt/dont_reset_cast_kind_without_updating_operand.test.GVN.32bit.panic-abort.diff index 25ffff619e6..f203b80e477 100644 --- a/tests/mir-opt/dont_reset_cast_kind_without_updating_operand.test.GVN.32bit.panic-abort.diff +++ b/tests/mir-opt/dont_reset_cast_kind_without_updating_operand.test.GVN.32bit.panic-abort.diff @@ -112,7 +112,7 @@ StorageDead(_17); StorageDead(_16); StorageDead(_14); - _3 = ShallowInitBox(move _13, ()); + _3 = ShallowInitBox(copy _13, ()); StorageDead(_13); StorageDead(_12); StorageDead(_11); diff --git a/tests/mir-opt/dont_reset_cast_kind_without_updating_operand.test.GVN.64bit.panic-abort.diff b/tests/mir-opt/dont_reset_cast_kind_without_updating_operand.test.GVN.64bit.panic-abort.diff index 839b53e3b0b..f072eb6ef8b 100644 --- a/tests/mir-opt/dont_reset_cast_kind_without_updating_operand.test.GVN.64bit.panic-abort.diff +++ b/tests/mir-opt/dont_reset_cast_kind_without_updating_operand.test.GVN.64bit.panic-abort.diff @@ -112,7 +112,7 @@ StorageDead(_17); StorageDead(_16); StorageDead(_14); - _3 = ShallowInitBox(move _13, ()); + _3 = ShallowInitBox(copy _13, ()); StorageDead(_13); StorageDead(_12); StorageDead(_11); diff --git a/tests/mir-opt/inline/inline_compatibility.rs b/tests/mir-opt/inline/inline_compatibility.rs index 1bb102ccda5..a31153dedc9 100644 --- a/tests/mir-opt/inline/inline_compatibility.rs +++ b/tests/mir-opt/inline/inline_compatibility.rs @@ -3,7 +3,7 @@ //@ compile-flags: -Cpanic=abort #![crate_type = "lib"] -#![feature(no_sanitize)] +#![feature(sanitize)] #![feature(c_variadic)] #[inline] @@ -37,22 +37,22 @@ pub unsafe fn f2() { } #[inline] -#[no_sanitize(address)] -pub unsafe fn no_sanitize() {} +#[sanitize(address = "off")] +pub unsafe fn sanitize_off() {} -// CHECK-LABEL: fn inlined_no_sanitize() +// CHECK-LABEL: fn inlined_sanitize_off() // CHECK: bb0: { // CHECK-NEXT: return; -#[no_sanitize(address)] -pub unsafe fn inlined_no_sanitize() { - no_sanitize(); +#[sanitize(address = "off")] +pub unsafe fn inlined_sanitize_off() { + sanitize_off(); } -// CHECK-LABEL: fn not_inlined_no_sanitize() +// CHECK-LABEL: fn not_inlined_sanitize_off() // CHECK: bb0: { -// CHECK-NEXT: no_sanitize() -pub unsafe fn not_inlined_no_sanitize() { - no_sanitize(); +// CHECK-NEXT: sanitize_off() +pub unsafe fn not_inlined_sanitize_off() { + sanitize_off(); } // CHECK-LABEL: fn not_inlined_c_variadic() diff --git a/tests/mir-opt/pre-codegen/issue_117368_print_invalid_constant.main.GVN.32bit.panic-abort.diff b/tests/mir-opt/pre-codegen/issue_117368_print_invalid_constant.main.GVN.32bit.panic-abort.diff index c2d144c98c3..3f854b6cbcf 100644 --- a/tests/mir-opt/pre-codegen/issue_117368_print_invalid_constant.main.GVN.32bit.panic-abort.diff +++ b/tests/mir-opt/pre-codegen/issue_117368_print_invalid_constant.main.GVN.32bit.panic-abort.diff @@ -103,7 +103,7 @@ StorageDead(_6); _4 = copy _5 as *mut [u8] (Transmute); StorageDead(_5); - _3 = move _4 as *mut u8 (PtrToPtr); + _3 = copy _4 as *mut u8 (PtrToPtr); StorageDead(_4); StorageDead(_3); - StorageDead(_1); diff --git a/tests/mir-opt/pre-codegen/issue_117368_print_invalid_constant.main.GVN.32bit.panic-unwind.diff b/tests/mir-opt/pre-codegen/issue_117368_print_invalid_constant.main.GVN.32bit.panic-unwind.diff index 88bd4628c29..15a9d9e39c4 100644 --- a/tests/mir-opt/pre-codegen/issue_117368_print_invalid_constant.main.GVN.32bit.panic-unwind.diff +++ b/tests/mir-opt/pre-codegen/issue_117368_print_invalid_constant.main.GVN.32bit.panic-unwind.diff @@ -46,7 +46,7 @@ StorageDead(_6); _4 = copy _5 as *mut [u8] (Transmute); StorageDead(_5); - _3 = move _4 as *mut u8 (PtrToPtr); + _3 = copy _4 as *mut u8 (PtrToPtr); StorageDead(_4); StorageDead(_3); - StorageDead(_1); diff --git a/tests/mir-opt/pre-codegen/issue_117368_print_invalid_constant.main.GVN.64bit.panic-abort.diff b/tests/mir-opt/pre-codegen/issue_117368_print_invalid_constant.main.GVN.64bit.panic-abort.diff index 8641d2d6fa8..1dbe9394e70 100644 --- a/tests/mir-opt/pre-codegen/issue_117368_print_invalid_constant.main.GVN.64bit.panic-abort.diff +++ b/tests/mir-opt/pre-codegen/issue_117368_print_invalid_constant.main.GVN.64bit.panic-abort.diff @@ -103,7 +103,7 @@ StorageDead(_6); _4 = copy _5 as *mut [u8] (Transmute); StorageDead(_5); - _3 = move _4 as *mut u8 (PtrToPtr); + _3 = copy _4 as *mut u8 (PtrToPtr); StorageDead(_4); StorageDead(_3); - StorageDead(_1); diff --git a/tests/mir-opt/pre-codegen/issue_117368_print_invalid_constant.main.GVN.64bit.panic-unwind.diff b/tests/mir-opt/pre-codegen/issue_117368_print_invalid_constant.main.GVN.64bit.panic-unwind.diff index 0c52f1e0583..df008ececae 100644 --- a/tests/mir-opt/pre-codegen/issue_117368_print_invalid_constant.main.GVN.64bit.panic-unwind.diff +++ b/tests/mir-opt/pre-codegen/issue_117368_print_invalid_constant.main.GVN.64bit.panic-unwind.diff @@ -46,7 +46,7 @@ StorageDead(_6); _4 = copy _5 as *mut [u8] (Transmute); StorageDead(_5); - _3 = move _4 as *mut u8 (PtrToPtr); + _3 = copy _4 as *mut u8 (PtrToPtr); StorageDead(_4); StorageDead(_3); - StorageDead(_1); diff --git a/tests/mir-opt/pre-codegen/slice_index.slice_get_mut_usize.PreCodegen.after.panic-abort.mir b/tests/mir-opt/pre-codegen/slice_index.slice_get_mut_usize.PreCodegen.after.panic-abort.mir index d1b1e3d7dd7..ebe8b23354b 100644 --- a/tests/mir-opt/pre-codegen/slice_index.slice_get_mut_usize.PreCodegen.after.panic-abort.mir +++ b/tests/mir-opt/pre-codegen/slice_index.slice_get_mut_usize.PreCodegen.after.panic-abort.mir @@ -30,7 +30,7 @@ fn slice_get_mut_usize(_1: &mut [u32], _2: usize) -> Option<&mut u32> { StorageDead(_3); StorageLive(_5); _5 = &mut (*_1)[_2]; - _0 = Option::<&mut u32>::Some(move _5); + _0 = Option::<&mut u32>::Some(copy _5); StorageDead(_5); goto -> bb3; } diff --git a/tests/mir-opt/pre-codegen/slice_index.slice_get_mut_usize.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/slice_index.slice_get_mut_usize.PreCodegen.after.panic-unwind.mir index d1b1e3d7dd7..ebe8b23354b 100644 --- a/tests/mir-opt/pre-codegen/slice_index.slice_get_mut_usize.PreCodegen.after.panic-unwind.mir +++ b/tests/mir-opt/pre-codegen/slice_index.slice_get_mut_usize.PreCodegen.after.panic-unwind.mir @@ -30,7 +30,7 @@ fn slice_get_mut_usize(_1: &mut [u32], _2: usize) -> Option<&mut u32> { StorageDead(_3); StorageLive(_5); _5 = &mut (*_1)[_2]; - _0 = Option::<&mut u32>::Some(move _5); + _0 = Option::<&mut u32>::Some(copy _5); StorageDead(_5); goto -> bb3; } diff --git a/tests/mir-opt/pre-codegen/slice_index.slice_index_range.PreCodegen.after.panic-abort.mir b/tests/mir-opt/pre-codegen/slice_index.slice_index_range.PreCodegen.after.panic-abort.mir index 731f6438a6e..2df2c4b85b8 100644 --- a/tests/mir-opt/pre-codegen/slice_index.slice_index_range.PreCodegen.after.panic-abort.mir +++ b/tests/mir-opt/pre-codegen/slice_index.slice_index_range.PreCodegen.after.panic-abort.mir @@ -4,14 +4,81 @@ fn slice_index_range(_1: &[u32], _2: std::ops::Range<usize>) -> &[u32] { debug slice => _1; debug index => _2; let mut _0: &[u32]; + let mut _3: usize; + let mut _4: usize; scope 1 (inlined #[track_caller] core::slice::index::<impl Index<std::ops::Range<usize>> for [u32]>::index) { + scope 2 (inlined #[track_caller] <std::ops::Range<usize> as SliceIndex<[u32]>>::index) { + let mut _7: usize; + let mut _8: bool; + let mut _9: *const [u32]; + let _12: *const [u32]; + let mut _13: usize; + let mut _14: !; + scope 3 (inlined core::num::<impl usize>::checked_sub) { + let mut _5: bool; + let mut _6: usize; + } + scope 4 (inlined core::slice::index::get_offset_len_noubcheck::<u32>) { + let _10: *const u32; + scope 5 { + let _11: *const u32; + scope 6 { + } + } + } + } } bb0: { - _0 = <std::ops::Range<usize> as SliceIndex<[u32]>>::index(move _2, move _1) -> [return: bb1, unwind unreachable]; + _3 = move (_2.0: usize); + _4 = move (_2.1: usize); + StorageLive(_5); + _5 = Lt(copy _4, copy _3); + switchInt(move _5) -> [0: bb1, otherwise: bb4]; } bb1: { + _6 = SubUnchecked(copy _4, copy _3); + StorageDead(_5); + StorageLive(_8); + StorageLive(_7); + _7 = PtrMetadata(copy _1); + _8 = Le(copy _4, move _7); + switchInt(move _8) -> [0: bb2, otherwise: bb3]; + } + + bb2: { + StorageDead(_7); + goto -> bb5; + } + + bb3: { + StorageDead(_7); + StorageLive(_12); + StorageLive(_9); + _9 = &raw const (*_1); + StorageLive(_10); + StorageLive(_11); + _10 = copy _9 as *const u32 (PtrToPtr); + _11 = Offset(copy _10, copy _3); + _12 = *const [u32] from (copy _11, copy _6); + StorageDead(_11); + StorageDead(_10); + StorageDead(_9); + _0 = &(*_12); + StorageDead(_12); + StorageDead(_8); return; } + + bb4: { + StorageDead(_5); + goto -> bb5; + } + + bb5: { + StorageLive(_13); + _13 = PtrMetadata(copy _1); + _14 = core::slice::index::slice_index_fail(move _3, move _4, move _13) -> unwind unreachable; + } } diff --git a/tests/mir-opt/pre-codegen/slice_index.slice_index_range.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/slice_index.slice_index_range.PreCodegen.after.panic-unwind.mir index d879d06bb4e..d4b86b9633a 100644 --- a/tests/mir-opt/pre-codegen/slice_index.slice_index_range.PreCodegen.after.panic-unwind.mir +++ b/tests/mir-opt/pre-codegen/slice_index.slice_index_range.PreCodegen.after.panic-unwind.mir @@ -4,14 +4,81 @@ fn slice_index_range(_1: &[u32], _2: std::ops::Range<usize>) -> &[u32] { debug slice => _1; debug index => _2; let mut _0: &[u32]; + let mut _3: usize; + let mut _4: usize; scope 1 (inlined #[track_caller] core::slice::index::<impl Index<std::ops::Range<usize>> for [u32]>::index) { + scope 2 (inlined #[track_caller] <std::ops::Range<usize> as SliceIndex<[u32]>>::index) { + let mut _7: usize; + let mut _8: bool; + let mut _9: *const [u32]; + let _12: *const [u32]; + let mut _13: usize; + let mut _14: !; + scope 3 (inlined core::num::<impl usize>::checked_sub) { + let mut _5: bool; + let mut _6: usize; + } + scope 4 (inlined core::slice::index::get_offset_len_noubcheck::<u32>) { + let _10: *const u32; + scope 5 { + let _11: *const u32; + scope 6 { + } + } + } + } } bb0: { - _0 = <std::ops::Range<usize> as SliceIndex<[u32]>>::index(move _2, move _1) -> [return: bb1, unwind continue]; + _3 = move (_2.0: usize); + _4 = move (_2.1: usize); + StorageLive(_5); + _5 = Lt(copy _4, copy _3); + switchInt(move _5) -> [0: bb1, otherwise: bb4]; } bb1: { + _6 = SubUnchecked(copy _4, copy _3); + StorageDead(_5); + StorageLive(_8); + StorageLive(_7); + _7 = PtrMetadata(copy _1); + _8 = Le(copy _4, move _7); + switchInt(move _8) -> [0: bb2, otherwise: bb3]; + } + + bb2: { + StorageDead(_7); + goto -> bb5; + } + + bb3: { + StorageDead(_7); + StorageLive(_12); + StorageLive(_9); + _9 = &raw const (*_1); + StorageLive(_10); + StorageLive(_11); + _10 = copy _9 as *const u32 (PtrToPtr); + _11 = Offset(copy _10, copy _3); + _12 = *const [u32] from (copy _11, copy _6); + StorageDead(_11); + StorageDead(_10); + StorageDead(_9); + _0 = &(*_12); + StorageDead(_12); + StorageDead(_8); return; } + + bb4: { + StorageDead(_5); + goto -> bb5; + } + + bb5: { + StorageLive(_13); + _13 = PtrMetadata(copy _1); + _14 = core::slice::index::slice_index_fail(move _3, move _4, move _13) -> unwind continue; + } } diff --git a/tests/mir-opt/pre-codegen/slice_iter.enumerated_loop.PreCodegen.after.panic-abort.mir b/tests/mir-opt/pre-codegen/slice_iter.enumerated_loop.PreCodegen.after.panic-abort.mir index d389e4069d0..72b39a7f6a8 100644 --- a/tests/mir-opt/pre-codegen/slice_iter.enumerated_loop.PreCodegen.after.panic-abort.mir +++ b/tests/mir-opt/pre-codegen/slice_iter.enumerated_loop.PreCodegen.after.panic-abort.mir @@ -143,7 +143,7 @@ fn enumerated_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () { _4 = &raw const (*_1); StorageLive(_5); _5 = copy _4 as *const T (PtrToPtr); - _6 = NonNull::<T> { pointer: move _5 }; + _6 = NonNull::<T> { pointer: copy _5 }; StorageDead(_5); StorageLive(_9); switchInt(const <T as std::mem::SizedTypeProperties>::IS_ZST) -> [0: bb1, otherwise: bb2]; @@ -155,7 +155,7 @@ fn enumerated_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () { _7 = copy _4 as *mut T (PtrToPtr); _8 = Offset(copy _7, copy _3); StorageDead(_7); - _9 = move _8 as *const T (PtrToPtr); + _9 = copy _8 as *const T (PtrToPtr); StorageDead(_8); goto -> bb3; } @@ -202,7 +202,7 @@ fn enumerated_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () { _17 = copy _14 as *mut T (Transmute); StorageLive(_18); _18 = copy _16 as *mut T (Transmute); - _19 = Eq(move _17, move _18); + _19 = Eq(copy _17, copy _18); StorageDead(_18); StorageDead(_17); switchInt(move _19) -> [0: bb6, otherwise: bb7]; @@ -214,9 +214,9 @@ fn enumerated_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () { StorageLive(_21); StorageLive(_20); _20 = copy _14 as *const T (Transmute); - _21 = Offset(move _20, const 1_usize); + _21 = Offset(copy _20, const 1_usize); StorageDead(_20); - _22 = NonNull::<T> { pointer: move _21 }; + _22 = NonNull::<T> { pointer: copy _21 }; StorageDead(_21); _11 = move _22; StorageDead(_22); @@ -282,7 +282,7 @@ fn enumerated_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () { StorageDead(_23); StorageDead(_15); StorageDead(_14); - _28 = move ((_27 as Some).0: &T); + _28 = copy ((_27 as Some).0: &T); StorageDead(_27); _29 = copy _13; _30 = AddWithOverflow(copy _13, const 1_usize); diff --git a/tests/mir-opt/pre-codegen/slice_iter.enumerated_loop.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/slice_iter.enumerated_loop.PreCodegen.after.panic-unwind.mir index 8c5fbda6392..42aa152ec99 100644 --- a/tests/mir-opt/pre-codegen/slice_iter.enumerated_loop.PreCodegen.after.panic-unwind.mir +++ b/tests/mir-opt/pre-codegen/slice_iter.enumerated_loop.PreCodegen.after.panic-unwind.mir @@ -70,7 +70,7 @@ fn enumerated_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () { _4 = &raw const (*_1); StorageLive(_5); _5 = copy _4 as *const T (PtrToPtr); - _6 = NonNull::<T> { pointer: move _5 }; + _6 = NonNull::<T> { pointer: copy _5 }; StorageDead(_5); StorageLive(_9); switchInt(const <T as std::mem::SizedTypeProperties>::IS_ZST) -> [0: bb1, otherwise: bb2]; @@ -82,7 +82,7 @@ fn enumerated_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () { _7 = copy _4 as *mut T (PtrToPtr); _8 = Offset(copy _7, copy _3); StorageDead(_7); - _9 = move _8 as *const T (PtrToPtr); + _9 = copy _8 as *const T (PtrToPtr); StorageDead(_8); goto -> bb3; } @@ -95,7 +95,7 @@ fn enumerated_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () { bb3: { StorageLive(_10); _10 = copy _9; - _11 = std::slice::Iter::<'_, T> { ptr: copy _6, end_or_len: move _10, _marker: const ZeroSized: PhantomData<&T> }; + _11 = std::slice::Iter::<'_, T> { ptr: copy _6, end_or_len: copy _10, _marker: const ZeroSized: PhantomData<&T> }; StorageDead(_10); StorageDead(_9); StorageDead(_4); diff --git a/tests/mir-opt/pre-codegen/slice_iter.forward_loop.PreCodegen.after.panic-abort.mir b/tests/mir-opt/pre-codegen/slice_iter.forward_loop.PreCodegen.after.panic-abort.mir index 216e05ec5b7..0d65640ec9b 100644 --- a/tests/mir-opt/pre-codegen/slice_iter.forward_loop.PreCodegen.after.panic-abort.mir +++ b/tests/mir-opt/pre-codegen/slice_iter.forward_loop.PreCodegen.after.panic-abort.mir @@ -110,7 +110,7 @@ fn forward_loop(_1: &[T], _2: impl Fn(&T)) -> () { _4 = &raw const (*_1); StorageLive(_5); _5 = copy _4 as *const T (PtrToPtr); - _6 = NonNull::<T> { pointer: move _5 }; + _6 = NonNull::<T> { pointer: copy _5 }; StorageDead(_5); StorageLive(_9); switchInt(const <T as std::mem::SizedTypeProperties>::IS_ZST) -> [0: bb1, otherwise: bb2]; @@ -122,7 +122,7 @@ fn forward_loop(_1: &[T], _2: impl Fn(&T)) -> () { _7 = copy _4 as *mut T (PtrToPtr); _8 = Offset(copy _7, copy _3); StorageDead(_7); - _9 = move _8 as *const T (PtrToPtr); + _9 = copy _8 as *const T (PtrToPtr); StorageDead(_8); goto -> bb3; } @@ -164,7 +164,7 @@ fn forward_loop(_1: &[T], _2: impl Fn(&T)) -> () { _16 = copy _13 as *mut T (Transmute); StorageLive(_17); _17 = copy _15 as *mut T (Transmute); - _18 = Eq(move _16, move _17); + _18 = Eq(copy _16, copy _17); StorageDead(_17); StorageDead(_16); switchInt(move _18) -> [0: bb6, otherwise: bb7]; @@ -176,9 +176,9 @@ fn forward_loop(_1: &[T], _2: impl Fn(&T)) -> () { StorageLive(_20); StorageLive(_19); _19 = copy _13 as *const T (Transmute); - _20 = Offset(move _19, const 1_usize); + _20 = Offset(copy _19, const 1_usize); StorageDead(_19); - _21 = NonNull::<T> { pointer: move _20 }; + _21 = NonNull::<T> { pointer: copy _20 }; StorageDead(_20); _11 = move _21; StorageDead(_21); diff --git a/tests/mir-opt/pre-codegen/slice_iter.forward_loop.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/slice_iter.forward_loop.PreCodegen.after.panic-unwind.mir index 00102391980..02efb193474 100644 --- a/tests/mir-opt/pre-codegen/slice_iter.forward_loop.PreCodegen.after.panic-unwind.mir +++ b/tests/mir-opt/pre-codegen/slice_iter.forward_loop.PreCodegen.after.panic-unwind.mir @@ -110,7 +110,7 @@ fn forward_loop(_1: &[T], _2: impl Fn(&T)) -> () { _4 = &raw const (*_1); StorageLive(_5); _5 = copy _4 as *const T (PtrToPtr); - _6 = NonNull::<T> { pointer: move _5 }; + _6 = NonNull::<T> { pointer: copy _5 }; StorageDead(_5); StorageLive(_9); switchInt(const <T as std::mem::SizedTypeProperties>::IS_ZST) -> [0: bb1, otherwise: bb2]; @@ -122,7 +122,7 @@ fn forward_loop(_1: &[T], _2: impl Fn(&T)) -> () { _7 = copy _4 as *mut T (PtrToPtr); _8 = Offset(copy _7, copy _3); StorageDead(_7); - _9 = move _8 as *const T (PtrToPtr); + _9 = copy _8 as *const T (PtrToPtr); StorageDead(_8); goto -> bb3; } @@ -164,7 +164,7 @@ fn forward_loop(_1: &[T], _2: impl Fn(&T)) -> () { _16 = copy _13 as *mut T (Transmute); StorageLive(_17); _17 = copy _15 as *mut T (Transmute); - _18 = Eq(move _16, move _17); + _18 = Eq(copy _16, copy _17); StorageDead(_17); StorageDead(_16); switchInt(move _18) -> [0: bb6, otherwise: bb7]; @@ -176,9 +176,9 @@ fn forward_loop(_1: &[T], _2: impl Fn(&T)) -> () { StorageLive(_20); StorageLive(_19); _19 = copy _13 as *const T (Transmute); - _20 = Offset(move _19, const 1_usize); + _20 = Offset(copy _19, const 1_usize); StorageDead(_19); - _21 = NonNull::<T> { pointer: move _20 }; + _21 = NonNull::<T> { pointer: copy _20 }; StorageDead(_20); _11 = move _21; StorageDead(_21); diff --git a/tests/mir-opt/pre-codegen/slice_iter.reverse_loop.PreCodegen.after.panic-abort.mir b/tests/mir-opt/pre-codegen/slice_iter.reverse_loop.PreCodegen.after.panic-abort.mir index b09e3622344..ee638be7d7a 100644 --- a/tests/mir-opt/pre-codegen/slice_iter.reverse_loop.PreCodegen.after.panic-abort.mir +++ b/tests/mir-opt/pre-codegen/slice_iter.reverse_loop.PreCodegen.after.panic-abort.mir @@ -70,7 +70,7 @@ fn reverse_loop(_1: &[T], _2: impl Fn(&T)) -> () { _4 = &raw const (*_1); StorageLive(_5); _5 = copy _4 as *const T (PtrToPtr); - _6 = NonNull::<T> { pointer: move _5 }; + _6 = NonNull::<T> { pointer: copy _5 }; StorageDead(_5); StorageLive(_9); switchInt(const <T as std::mem::SizedTypeProperties>::IS_ZST) -> [0: bb1, otherwise: bb2]; @@ -82,7 +82,7 @@ fn reverse_loop(_1: &[T], _2: impl Fn(&T)) -> () { _7 = copy _4 as *mut T (PtrToPtr); _8 = Offset(copy _7, copy _3); StorageDead(_7); - _9 = move _8 as *const T (PtrToPtr); + _9 = copy _8 as *const T (PtrToPtr); StorageDead(_8); goto -> bb3; } @@ -95,7 +95,7 @@ fn reverse_loop(_1: &[T], _2: impl Fn(&T)) -> () { bb3: { StorageLive(_10); _10 = copy _9; - _11 = std::slice::Iter::<'_, T> { ptr: copy _6, end_or_len: move _10, _marker: const ZeroSized: PhantomData<&T> }; + _11 = std::slice::Iter::<'_, T> { ptr: copy _6, end_or_len: copy _10, _marker: const ZeroSized: PhantomData<&T> }; StorageDead(_10); StorageDead(_9); StorageDead(_4); diff --git a/tests/mir-opt/pre-codegen/slice_iter.reverse_loop.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/slice_iter.reverse_loop.PreCodegen.after.panic-unwind.mir index 12b54b57b84..aee29d4d4fe 100644 --- a/tests/mir-opt/pre-codegen/slice_iter.reverse_loop.PreCodegen.after.panic-unwind.mir +++ b/tests/mir-opt/pre-codegen/slice_iter.reverse_loop.PreCodegen.after.panic-unwind.mir @@ -70,7 +70,7 @@ fn reverse_loop(_1: &[T], _2: impl Fn(&T)) -> () { _4 = &raw const (*_1); StorageLive(_5); _5 = copy _4 as *const T (PtrToPtr); - _6 = NonNull::<T> { pointer: move _5 }; + _6 = NonNull::<T> { pointer: copy _5 }; StorageDead(_5); StorageLive(_9); switchInt(const <T as std::mem::SizedTypeProperties>::IS_ZST) -> [0: bb1, otherwise: bb2]; @@ -82,7 +82,7 @@ fn reverse_loop(_1: &[T], _2: impl Fn(&T)) -> () { _7 = copy _4 as *mut T (PtrToPtr); _8 = Offset(copy _7, copy _3); StorageDead(_7); - _9 = move _8 as *const T (PtrToPtr); + _9 = copy _8 as *const T (PtrToPtr); StorageDead(_8); goto -> bb3; } @@ -95,7 +95,7 @@ fn reverse_loop(_1: &[T], _2: impl Fn(&T)) -> () { bb3: { StorageLive(_10); _10 = copy _9; - _11 = std::slice::Iter::<'_, T> { ptr: copy _6, end_or_len: move _10, _marker: const ZeroSized: PhantomData<&T> }; + _11 = std::slice::Iter::<'_, T> { ptr: copy _6, end_or_len: copy _10, _marker: const ZeroSized: PhantomData<&T> }; StorageDead(_10); StorageDead(_9); StorageDead(_4); diff --git a/tests/mir-opt/pre-codegen/slice_iter.slice_iter_generic_is_empty.PreCodegen.after.panic-abort.mir b/tests/mir-opt/pre-codegen/slice_iter.slice_iter_generic_is_empty.PreCodegen.after.panic-abort.mir index 38d00cfbabd..9b510380b10 100644 --- a/tests/mir-opt/pre-codegen/slice_iter.slice_iter_generic_is_empty.PreCodegen.after.panic-abort.mir +++ b/tests/mir-opt/pre-codegen/slice_iter.slice_iter_generic_is_empty.PreCodegen.after.panic-abort.mir @@ -39,7 +39,7 @@ fn slice_iter_generic_is_empty(_1: &std::slice::Iter<'_, T>) -> bool { bb1: { StorageLive(_2); _2 = copy ((*_1).1: *const T); - _3 = move _2 as std::ptr::NonNull<T> (Transmute); + _3 = copy _2 as std::ptr::NonNull<T> (Transmute); StorageDead(_2); StorageLive(_5); StorageLive(_4); @@ -48,7 +48,7 @@ fn slice_iter_generic_is_empty(_1: &std::slice::Iter<'_, T>) -> bool { StorageDead(_4); StorageLive(_6); _6 = copy _3 as *mut T (Transmute); - _0 = Eq(move _5, move _6); + _0 = Eq(copy _5, copy _6); StorageDead(_6); StorageDead(_5); goto -> bb3; diff --git a/tests/mir-opt/pre-codegen/slice_iter.slice_iter_generic_is_empty.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/slice_iter.slice_iter_generic_is_empty.PreCodegen.after.panic-unwind.mir index 38d00cfbabd..9b510380b10 100644 --- a/tests/mir-opt/pre-codegen/slice_iter.slice_iter_generic_is_empty.PreCodegen.after.panic-unwind.mir +++ b/tests/mir-opt/pre-codegen/slice_iter.slice_iter_generic_is_empty.PreCodegen.after.panic-unwind.mir @@ -39,7 +39,7 @@ fn slice_iter_generic_is_empty(_1: &std::slice::Iter<'_, T>) -> bool { bb1: { StorageLive(_2); _2 = copy ((*_1).1: *const T); - _3 = move _2 as std::ptr::NonNull<T> (Transmute); + _3 = copy _2 as std::ptr::NonNull<T> (Transmute); StorageDead(_2); StorageLive(_5); StorageLive(_4); @@ -48,7 +48,7 @@ fn slice_iter_generic_is_empty(_1: &std::slice::Iter<'_, T>) -> bool { StorageDead(_4); StorageLive(_6); _6 = copy _3 as *mut T (Transmute); - _0 = Eq(move _5, move _6); + _0 = Eq(copy _5, copy _6); StorageDead(_6); StorageDead(_5); goto -> bb3; diff --git a/tests/mir-opt/pre-codegen/slice_iter.slice_iter_next.PreCodegen.after.panic-abort.mir b/tests/mir-opt/pre-codegen/slice_iter.slice_iter_next.PreCodegen.after.panic-abort.mir index c0ed0aea1e2..cc0fce26149 100644 --- a/tests/mir-opt/pre-codegen/slice_iter.slice_iter_next.PreCodegen.after.panic-abort.mir +++ b/tests/mir-opt/pre-codegen/slice_iter.slice_iter_next.PreCodegen.after.panic-abort.mir @@ -72,7 +72,7 @@ fn slice_iter_next(_1: &mut std::slice::Iter<'_, T>) -> Option<&T> { _5 = copy _2 as *mut T (Transmute); StorageLive(_6); _6 = copy _4 as *mut T (Transmute); - _7 = Eq(move _5, move _6); + _7 = Eq(copy _5, copy _6); StorageDead(_6); StorageDead(_5); switchInt(move _7) -> [0: bb2, otherwise: bb3]; @@ -84,9 +84,9 @@ fn slice_iter_next(_1: &mut std::slice::Iter<'_, T>) -> Option<&T> { StorageLive(_9); StorageLive(_8); _8 = copy _2 as *const T (Transmute); - _9 = Offset(move _8, const 1_usize); + _9 = Offset(copy _8, const 1_usize); StorageDead(_8); - _10 = NonNull::<T> { pointer: move _9 }; + _10 = NonNull::<T> { pointer: copy _9 }; StorageDead(_9); ((*_1).0: std::ptr::NonNull<T>) = move _10; StorageDead(_10); diff --git a/tests/mir-opt/pre-codegen/slice_iter.slice_iter_next.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/slice_iter.slice_iter_next.PreCodegen.after.panic-unwind.mir index c0ed0aea1e2..cc0fce26149 100644 --- a/tests/mir-opt/pre-codegen/slice_iter.slice_iter_next.PreCodegen.after.panic-unwind.mir +++ b/tests/mir-opt/pre-codegen/slice_iter.slice_iter_next.PreCodegen.after.panic-unwind.mir @@ -72,7 +72,7 @@ fn slice_iter_next(_1: &mut std::slice::Iter<'_, T>) -> Option<&T> { _5 = copy _2 as *mut T (Transmute); StorageLive(_6); _6 = copy _4 as *mut T (Transmute); - _7 = Eq(move _5, move _6); + _7 = Eq(copy _5, copy _6); StorageDead(_6); StorageDead(_5); switchInt(move _7) -> [0: bb2, otherwise: bb3]; @@ -84,9 +84,9 @@ fn slice_iter_next(_1: &mut std::slice::Iter<'_, T>) -> Option<&T> { StorageLive(_9); StorageLive(_8); _8 = copy _2 as *const T (Transmute); - _9 = Offset(move _8, const 1_usize); + _9 = Offset(copy _8, const 1_usize); StorageDead(_8); - _10 = NonNull::<T> { pointer: move _9 }; + _10 = NonNull::<T> { pointer: copy _9 }; StorageDead(_9); ((*_1).0: std::ptr::NonNull<T>) = move _10; StorageDead(_10); diff --git a/tests/mir-opt/reference_prop.debuginfo.ReferencePropagation.diff b/tests/mir-opt/reference_prop.debuginfo.ReferencePropagation.diff index 05ad9dbf3cc..3da795b61f9 100644 --- a/tests/mir-opt/reference_prop.debuginfo.ReferencePropagation.diff +++ b/tests/mir-opt/reference_prop.debuginfo.ReferencePropagation.diff @@ -99,7 +99,8 @@ _13 = &(*_26); StorageLive(_15); _15 = RangeFull; - _12 = <[i32; 10] as Index<RangeFull>>::index(move _13, move _15) -> [return: bb5, unwind continue]; +- _12 = <[i32; 10] as Index<RangeFull>>::index(move _13, move _15) -> [return: bb5, unwind continue]; ++ _12 = <[i32; 10] as Index<RangeFull>>::index(copy _13, move _15) -> [return: bb5, unwind continue]; } bb5: { diff --git a/tests/mir-opt/reference_prop.reference_propagation.ReferencePropagation.diff b/tests/mir-opt/reference_prop.reference_propagation.ReferencePropagation.diff index 3c6a9a9614c..0f90cc40a3d 100644 --- a/tests/mir-opt/reference_prop.reference_propagation.ReferencePropagation.diff +++ b/tests/mir-opt/reference_prop.reference_propagation.ReferencePropagation.diff @@ -218,8 +218,9 @@ - StorageLive(_14); - _14 = &_11; - _13 = &(*_14); +- _12 = move _13; + _13 = &_11; - _12 = move _13; ++ _12 = copy _13; StorageDead(_13); - StorageDead(_14); StorageLive(_15); @@ -252,7 +253,8 @@ StorageLive(_23); StorageLive(_24); _24 = copy _21; - _23 = opaque::<&&usize>(move _24) -> [return: bb3, unwind continue]; +- _23 = opaque::<&&usize>(move _24) -> [return: bb3, unwind continue]; ++ _23 = opaque::<&&usize>(copy _24) -> [return: bb3, unwind continue]; } bb3: { @@ -276,7 +278,8 @@ StorageLive(_30); StorageLive(_31); _31 = copy _28; - _30 = opaque::<*mut &usize>(move _31) -> [return: bb4, unwind continue]; +- _30 = opaque::<*mut &usize>(move _31) -> [return: bb4, unwind continue]; ++ _30 = opaque::<*mut &usize>(copy _31) -> [return: bb4, unwind continue]; } bb4: { @@ -299,7 +302,8 @@ StorageLive(_36); StorageLive(_37); _37 = copy _34; - _36 = opaque::<&usize>(move _37) -> [return: bb5, unwind continue]; +- _36 = opaque::<&usize>(move _37) -> [return: bb5, unwind continue]; ++ _36 = opaque::<&usize>(copy _37) -> [return: bb5, unwind continue]; } bb5: { @@ -328,7 +332,8 @@ StorageLive(_45); StorageLive(_46); _46 = copy _44; - _45 = opaque::<&usize>(move _46) -> [return: bb6, unwind continue]; +- _45 = opaque::<&usize>(move _46) -> [return: bb6, unwind continue]; ++ _45 = opaque::<&usize>(copy _46) -> [return: bb6, unwind continue]; } bb6: { @@ -368,8 +373,9 @@ - StorageLive(_55); - _55 = &(*_1); - _54 = &(*_55); +- _2 = move _54; + _54 = &(*_1); - _2 = move _54; ++ _2 = copy _54; StorageDead(_54); - StorageDead(_55); StorageLive(_56); diff --git a/tests/mir-opt/reference_prop.reference_propagation_const_ptr.ReferencePropagation.diff b/tests/mir-opt/reference_prop.reference_propagation_const_ptr.ReferencePropagation.diff index 75fe99de938..99ef07a212c 100644 --- a/tests/mir-opt/reference_prop.reference_propagation_const_ptr.ReferencePropagation.diff +++ b/tests/mir-opt/reference_prop.reference_propagation_const_ptr.ReferencePropagation.diff @@ -233,7 +233,8 @@ _12 = &raw const _10; StorageLive(_13); _13 = &raw const _11; - _12 = move _13; +- _12 = move _13; ++ _12 = copy _13; StorageDead(_13); StorageLive(_14); _14 = copy (*_12); @@ -265,7 +266,8 @@ StorageLive(_22); StorageLive(_23); _23 = copy _20; - _22 = opaque::<&*const usize>(move _23) -> [return: bb3, unwind continue]; +- _22 = opaque::<&*const usize>(move _23) -> [return: bb3, unwind continue]; ++ _22 = opaque::<&*const usize>(copy _23) -> [return: bb3, unwind continue]; } bb3: { @@ -289,7 +291,8 @@ StorageLive(_29); StorageLive(_30); _30 = copy _27; - _29 = opaque::<*mut *const usize>(move _30) -> [return: bb4, unwind continue]; +- _29 = opaque::<*mut *const usize>(move _30) -> [return: bb4, unwind continue]; ++ _29 = opaque::<*mut *const usize>(copy _30) -> [return: bb4, unwind continue]; } bb4: { @@ -312,7 +315,8 @@ StorageLive(_35); StorageLive(_36); _36 = copy _33; - _35 = opaque::<*const usize>(move _36) -> [return: bb5, unwind continue]; +- _35 = opaque::<*const usize>(move _36) -> [return: bb5, unwind continue]; ++ _35 = opaque::<*const usize>(copy _36) -> [return: bb5, unwind continue]; } bb5: { @@ -341,7 +345,8 @@ StorageLive(_44); StorageLive(_45); _45 = copy _43; - _44 = opaque::<*const usize>(move _45) -> [return: bb6, unwind continue]; +- _44 = opaque::<*const usize>(move _45) -> [return: bb6, unwind continue]; ++ _44 = opaque::<*const usize>(copy _45) -> [return: bb6, unwind continue]; } bb6: { @@ -379,7 +384,8 @@ _52 = &raw const (*_2); StorageLive(_53); _53 = &raw const (*_1); - _2 = move _53; +- _2 = move _53; ++ _2 = copy _53; StorageDead(_53); StorageLive(_54); _54 = copy (*_52); diff --git a/tests/mir-opt/reference_prop.reference_propagation_mut.ReferencePropagation.diff b/tests/mir-opt/reference_prop.reference_propagation_mut.ReferencePropagation.diff index f35b4974d6e..e2fab8a5f2e 100644 --- a/tests/mir-opt/reference_prop.reference_propagation_mut.ReferencePropagation.diff +++ b/tests/mir-opt/reference_prop.reference_propagation_mut.ReferencePropagation.diff @@ -218,8 +218,9 @@ - StorageLive(_14); - _14 = &mut _11; - _13 = &mut (*_14); +- _12 = move _13; + _13 = &mut _11; - _12 = move _13; ++ _12 = copy _13; StorageDead(_13); - StorageDead(_14); StorageLive(_15); @@ -251,7 +252,8 @@ StorageLive(_23); StorageLive(_24); _24 = copy _21; - _23 = opaque::<&&mut usize>(move _24) -> [return: bb3, unwind continue]; +- _23 = opaque::<&&mut usize>(move _24) -> [return: bb3, unwind continue]; ++ _23 = opaque::<&&mut usize>(copy _24) -> [return: bb3, unwind continue]; } bb3: { @@ -275,7 +277,8 @@ StorageLive(_30); StorageLive(_31); _31 = copy _28; - _30 = opaque::<*mut &mut usize>(move _31) -> [return: bb4, unwind continue]; +- _30 = opaque::<*mut &mut usize>(move _31) -> [return: bb4, unwind continue]; ++ _30 = opaque::<*mut &mut usize>(copy _31) -> [return: bb4, unwind continue]; } bb4: { @@ -296,8 +299,10 @@ _35 = copy (*_34); StorageLive(_36); StorageLive(_37); - _37 = move _34; - _36 = opaque::<&mut usize>(move _37) -> [return: bb5, unwind continue]; +- _37 = move _34; +- _36 = opaque::<&mut usize>(move _37) -> [return: bb5, unwind continue]; ++ _37 = copy _34; ++ _36 = opaque::<&mut usize>(copy _37) -> [return: bb5, unwind continue]; } bb5: { @@ -316,15 +321,19 @@ StorageLive(_41); _41 = copy (*_40); StorageLive(_42); - _42 = move _40; +- _42 = move _40; ++ _42 = copy _40; StorageLive(_43); _43 = copy (*_42); StorageLive(_44); - _44 = move _42; +- _44 = move _42; ++ _44 = copy _42; StorageLive(_45); StorageLive(_46); - _46 = move _44; - _45 = opaque::<&mut usize>(move _46) -> [return: bb6, unwind continue]; +- _46 = move _44; +- _45 = opaque::<&mut usize>(move _46) -> [return: bb6, unwind continue]; ++ _46 = copy _44; ++ _45 = opaque::<&mut usize>(copy _46) -> [return: bb6, unwind continue]; } bb6: { @@ -364,8 +373,9 @@ - StorageLive(_55); - _55 = &mut (*_1); - _54 = &mut (*_55); +- _2 = move _54; + _54 = &mut (*_1); - _2 = move _54; ++ _2 = copy _54; StorageDead(_54); - StorageDead(_55); StorageLive(_56); diff --git a/tests/mir-opt/reference_prop.reference_propagation_mut_ptr.ReferencePropagation.diff b/tests/mir-opt/reference_prop.reference_propagation_mut_ptr.ReferencePropagation.diff index 21b322b7218..c49254ee6c6 100644 --- a/tests/mir-opt/reference_prop.reference_propagation_mut_ptr.ReferencePropagation.diff +++ b/tests/mir-opt/reference_prop.reference_propagation_mut_ptr.ReferencePropagation.diff @@ -214,7 +214,8 @@ _12 = &raw mut _10; StorageLive(_13); _13 = &raw mut _11; - _12 = move _13; +- _12 = move _13; ++ _12 = copy _13; StorageDead(_13); StorageLive(_14); _14 = copy (*_12); @@ -245,7 +246,8 @@ StorageLive(_22); StorageLive(_23); _23 = copy _20; - _22 = opaque::<&*mut usize>(move _23) -> [return: bb3, unwind continue]; +- _22 = opaque::<&*mut usize>(move _23) -> [return: bb3, unwind continue]; ++ _22 = opaque::<&*mut usize>(copy _23) -> [return: bb3, unwind continue]; } bb3: { @@ -269,7 +271,8 @@ StorageLive(_29); StorageLive(_30); _30 = copy _27; - _29 = opaque::<*mut *mut usize>(move _30) -> [return: bb4, unwind continue]; +- _29 = opaque::<*mut *mut usize>(move _30) -> [return: bb4, unwind continue]; ++ _29 = opaque::<*mut *mut usize>(copy _30) -> [return: bb4, unwind continue]; } bb4: { @@ -291,7 +294,8 @@ StorageLive(_35); StorageLive(_36); _36 = copy _33; - _35 = opaque::<*mut usize>(move _36) -> [return: bb5, unwind continue]; +- _35 = opaque::<*mut usize>(move _36) -> [return: bb5, unwind continue]; ++ _35 = opaque::<*mut usize>(copy _36) -> [return: bb5, unwind continue]; } bb5: { @@ -318,7 +322,8 @@ StorageLive(_44); StorageLive(_45); _45 = copy _43; - _44 = opaque::<*mut usize>(move _45) -> [return: bb6, unwind continue]; +- _44 = opaque::<*mut usize>(move _45) -> [return: bb6, unwind continue]; ++ _44 = opaque::<*mut usize>(copy _45) -> [return: bb6, unwind continue]; } bb6: { @@ -356,7 +361,8 @@ _52 = &raw mut (*_2); StorageLive(_53); _53 = &raw mut (*_1); - _2 = move _53; +- _2 = move _53; ++ _2 = copy _53; StorageDead(_53); StorageLive(_54); _54 = copy (*_52); diff --git a/tests/mir-opt/reference_prop.rs b/tests/mir-opt/reference_prop.rs index 00d48938071..c4b63b6313c 100644 --- a/tests/mir-opt/reference_prop.rs +++ b/tests/mir-opt/reference_prop.rs @@ -30,7 +30,7 @@ fn reference_propagation<'a, T: Copy>(single: &'a T, mut multiple: &'a T) { // CHECK: [[a2:_.*]] = const 7_usize; // CHECK: [[b:_.*]] = &[[a]]; // CHECK: [[btmp:_.*]] = &[[a2]]; - // CHECK: [[b]] = move [[btmp]]; + // CHECK: [[b]] = copy [[btmp]]; // CHECK: [[c:_.*]] = copy (*[[b]]); let a = 5_usize; @@ -122,7 +122,7 @@ fn reference_propagation<'a, T: Copy>(single: &'a T, mut multiple: &'a T) { // CHECK: bb7: { // CHECK: [[a:_.*]] = &(*_2); // CHECK: [[tmp:_.*]] = &(*_1); - // CHECK: _2 = move [[tmp]]; + // CHECK: _2 = copy [[tmp]]; // CHECK: [[b:_.*]] = copy (*[[a]]); let a = &*multiple; @@ -186,7 +186,7 @@ fn reference_propagation_mut<'a, T: Copy>(single: &'a mut T, mut multiple: &'a m // CHECK: [[a2:_.*]] = const 7_usize; // CHECK: [[b:_.*]] = &mut [[a]]; // CHECK: [[btmp:_.*]] = &mut [[a2]]; - // CHECK: [[b]] = move [[btmp]]; + // CHECK: [[b]] = copy [[btmp]]; // CHECK: [[c:_.*]] = copy (*[[b]]); let mut a = 5_usize; @@ -247,9 +247,9 @@ fn reference_propagation_mut<'a, T: Copy>(single: &'a mut T, mut multiple: &'a m // CHECK: [[a:_.*]] = const 7_usize; // CHECK: [[b1:_.*]] = &mut [[a]]; // CHECK: [[c:_.*]] = copy (*[[b1]]); - // CHECK: [[b2:_.*]] = move [[b1]]; + // CHECK: [[b2:_.*]] = copy [[b1]]; // CHECK: [[c2:_.*]] = copy (*[[b2]]); - // CHECK: [[b3:_.*]] = move [[b2]]; + // CHECK: [[b3:_.*]] = copy [[b2]]; let mut a = 7_usize; let b1 = &mut a; @@ -278,7 +278,7 @@ fn reference_propagation_mut<'a, T: Copy>(single: &'a mut T, mut multiple: &'a m // CHECK: bb7: { // CHECK: [[a:_.*]] = &mut (*_2); // CHECK: [[tmp:_.*]] = &mut (*_1); - // CHECK: _2 = move [[tmp]]; + // CHECK: _2 = copy [[tmp]]; // CHECK: [[b:_.*]] = copy (*[[a]]); let a = &mut *multiple; @@ -343,7 +343,7 @@ fn reference_propagation_const_ptr<T: Copy>(single: *const T, mut multiple: *con // CHECK: [[a2:_.*]] = const 7_usize; // CHECK: [[b:_.*]] = &raw const [[a]]; // CHECK: [[btmp:_.*]] = &raw const [[a2]]; - // CHECK: [[b]] = move [[btmp]]; + // CHECK: [[b]] = copy [[btmp]]; // CHECK: [[c:_.*]] = copy (*[[b]]); let a = 5_usize; @@ -435,7 +435,7 @@ fn reference_propagation_const_ptr<T: Copy>(single: *const T, mut multiple: *con // CHECK: bb7: { // CHECK: [[a:_.*]] = &raw const (*_2); // CHECK: [[tmp:_.*]] = &raw const (*_1); - // CHECK: _2 = move [[tmp]]; + // CHECK: _2 = copy [[tmp]]; // CHECK: [[b:_.*]] = copy (*[[a]]); let a = &raw const *multiple; @@ -514,7 +514,7 @@ fn reference_propagation_mut_ptr<T: Copy>(single: *mut T, mut multiple: *mut T) // CHECK: [[a2:_.*]] = const 7_usize; // CHECK: [[b:_.*]] = &raw mut [[a]]; // CHECK: [[btmp:_.*]] = &raw mut [[a2]]; - // CHECK: [[b]] = move [[btmp]]; + // CHECK: [[b]] = copy [[btmp]]; // CHECK: [[c:_.*]] = copy (*[[b]]); let mut a = 5_usize; @@ -606,7 +606,7 @@ fn reference_propagation_mut_ptr<T: Copy>(single: *mut T, mut multiple: *mut T) // CHECK: bb7: { // CHECK: [[a:_.*]] = &raw mut (*_2); // CHECK: [[tmp:_.*]] = &raw mut (*_1); - // CHECK: _2 = move [[tmp]]; + // CHECK: _2 = copy [[tmp]]; // CHECK: [[b:_.*]] = copy (*[[a]]); let a = &raw mut *multiple; diff --git a/tests/mir-opt/reference_prop_do_not_reuse_move.rs b/tests/mir-opt/reference_prop_do_not_reuse_move.rs new file mode 100644 index 00000000000..8859d30aed1 --- /dev/null +++ b/tests/mir-opt/reference_prop_do_not_reuse_move.rs @@ -0,0 +1,44 @@ +//@ test-mir-pass: ReferencePropagation + +#![feature(custom_mir, core_intrinsics)] +#![allow(internal_features)] +#![crate_type = "lib"] + +use std::intrinsics::mir::*; + +#[inline(never)] +fn opaque(_: impl Sized, _: impl Sized) {} + +#[custom_mir(dialect = "runtime")] +pub fn fn0() { + // CHECK-LABEL: fn0 + // CHECK: _9 = opaque::<&u8, &u64>(copy (_2.1: &u8), copy _6) -> [return: bb1, unwind unreachable]; + mir! { + let _1: (u8, u8); + let _2: (u64, &u8); + let _3: (u8, &&u64); + let _4: u64; + let _5: &u64; + let _6: &u64; + let _7: &u64; + let _8: u64; + let n: (); + { + _3.0 = 0; + _1 = (0, _3.0); + _4 = 0; + _2.1 = &_1.0; + _8 = 0; + _5 = &_8; + _5 = &_4; + _6 = _5; + _7 = _6; + _3.1 = &_6; + Call(n = opaque(_2.1, Move(_6)), ReturnTo(bb1), UnwindUnreachable()) + } + bb1 = { + _2.0 = *_7; + Return() + } + } +} diff --git a/tests/mir-opt/uninhabited_not_read.main.SimplifyLocals-final.after.mir b/tests/mir-opt/uninhabited_not_read.main.SimplifyLocals-final.after.mir index 6bf4be652be..89f4cbc2ede 100644 --- a/tests/mir-opt/uninhabited_not_read.main.SimplifyLocals-final.after.mir +++ b/tests/mir-opt/uninhabited_not_read.main.SimplifyLocals-final.after.mir @@ -31,7 +31,7 @@ fn main() -> () { StorageLive(_2); StorageLive(_3); _3 = &raw const _1; - _2 = move _3 as *const ! (PtrToPtr); + _2 = copy _3 as *const ! (PtrToPtr); StorageDead(_3); StorageDead(_2); StorageDead(_1); @@ -40,7 +40,7 @@ fn main() -> () { StorageLive(_5); StorageLive(_6); _6 = &raw const _4; - _5 = move _6 as *const ! (PtrToPtr); + _5 = copy _6 as *const ! (PtrToPtr); StorageDead(_6); StorageDead(_5); StorageDead(_4); diff --git a/tests/run-make/emit-shared-files/rmake.rs b/tests/run-make/emit-shared-files/rmake.rs index f88fe69aa9c..911ceb3adca 100644 --- a/tests/run-make/emit-shared-files/rmake.rs +++ b/tests/run-make/emit-shared-files/rmake.rs @@ -19,7 +19,7 @@ fn main() { .args(&["--extend-css", "z.css"]) .input("x.rs") .run(); - assert!(path("invocation-only/search-index-xxx.js").exists()); + assert!(path("invocation-only/search.index/root-xxx.js").exists()); assert!(path("invocation-only/crates-xxx.js").exists()); assert!(path("invocation-only/settings.html").exists()); assert!(path("invocation-only/x/all.html").exists()); diff --git a/tests/run-make/linker-warning/short-error.txt b/tests/run-make/linker-warning/short-error.txt index 5b7c040bc50..e5861b732c5 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" "/symbols.o" "<2 object files omitted>" "-Wl,--as-needed" "-Wl,-Bstatic" "/build-root/test/run-make/linker-warning/rmake_out/{libfoo,libbar}.rlib" "<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-*,librustc_std_workspace_core-*,liballoc-*,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: "./fake-linker" "-m64" "/symbols.o" "<2 object files omitted>" "-Wl,--as-needed" "-Wl,-Bstatic" "/build-root/test/run-make/linker-warning/rmake_out/{libfoo,libbar}.rlib" "<sysroot>/lib/rustlib/x86_64-unknown-linux-gnu/lib/{libstd-*,libpanic_unwind-*,libobject-*,libmemchr-*,libaddr2line-*,libgimli-*,libcfg_if-*,librustc_demangle-*,libstd_detect-*,libhashbrown-*,librustc_std_workspace_alloc-*,libminiz_oxide-*,libadler2-*,libunwind-*,liblibc-*,librustc_std_workspace_core-*,liballoc-*,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/rustdoc-default-output/output-default.stdout b/tests/run-make/rustdoc-default-output/output-default.stdout index 506f135ff8e..badbc0b6d15 100644 --- a/tests/run-make/rustdoc-default-output/output-default.stdout +++ b/tests/run-make/rustdoc-default-output/output-default.stdout @@ -194,6 +194,9 @@ Options: --disable-minification disable the minification of CSS/JS files (perma-unstable, do not use with cached files) + --generate-macro-expansion + Add possibility to expand macros in the HTML source + code pages --plugin-path DIR removed, see issue #44136 <https://github.com/rust-lang/rust/issues/44136> for diff --git a/tests/run-make/rustdoc-determinism/rmake.rs b/tests/run-make/rustdoc-determinism/rmake.rs index 921baef4a97..5705dff6858 100644 --- a/tests/run-make/rustdoc-determinism/rmake.rs +++ b/tests/run-make/rustdoc-determinism/rmake.rs @@ -15,7 +15,7 @@ fn main() { rustdoc().input("foo.rs").out_dir(&bar_first).run(); diff() - .expected_file(foo_first.join("search-index.js")) - .actual_file(bar_first.join("search-index.js")) + .expected_file(foo_first.join("search.index/root.js")) + .actual_file(bar_first.join("search.index/root.js")) .run(); } diff --git a/tests/run-make/rustdoc-scrape-examples-paths/rmake.rs b/tests/run-make/rustdoc-scrape-examples-paths/rmake.rs index 03888f69eab..6784e438762 100644 --- a/tests/run-make/rustdoc-scrape-examples-paths/rmake.rs +++ b/tests/run-make/rustdoc-scrape-examples-paths/rmake.rs @@ -1,16 +1,16 @@ //! Test to ensure that the rustdoc `scrape-examples` feature is not panicking. //! Regression test for <https://github.com/rust-lang/rust/issues/144752>. -use run_make_support::{cargo, path, rfs}; +use run_make_support::cargo; +use run_make_support::scoped_run::run_in_tmpdir; fn main() { // We copy the crate to be documented "outside" to prevent documenting // the whole compiler. - let tmp = std::env::temp_dir(); - let test_crate = tmp.join("foo"); - rfs::copy_dir_all(path("foo"), &test_crate); - - // The `scrape-examples` feature is also implemented in `cargo` so instead of reproducing - // what `cargo` does, better to just let `cargo` do it. - cargo().current_dir(&test_crate).args(["doc", "-p", "foo", "-Zrustdoc-scrape-examples"]).run(); + std::env::set_current_dir("foo").unwrap(); + run_in_tmpdir(|| { + // The `scrape-examples` feature is also implemented in `cargo` so instead of reproducing + // what `cargo` does, better to just let `cargo` do it. + cargo().args(["doc", "-p", "foo", "-Zrustdoc-scrape-examples"]).run(); + }) } diff --git a/tests/run-make/wasm-unexpected-features/rmake.rs b/tests/run-make/wasm-unexpected-features/rmake.rs index 416b5ef4caa..01eff54e823 100644 --- a/tests/run-make/wasm-unexpected-features/rmake.rs +++ b/tests/run-make/wasm-unexpected-features/rmake.rs @@ -21,6 +21,6 @@ fn verify_features(path: &Path) { eprintln!("verify {path:?}"); let file = rfs::read(&path); - let mut validator = wasmparser::Validator::new_with_features(wasmparser::WasmFeatures::WASM1); + let mut validator = wasmparser::Validator::new_with_features(wasmparser::WasmFeatures::MVP); validator.validate_all(&file).unwrap(); } diff --git a/tests/rustdoc-gui/code-example-buttons.goml b/tests/rustdoc-gui/code-example-buttons.goml index b96f6ddcc37..1429f978a28 100644 --- a/tests/rustdoc-gui/code-example-buttons.goml +++ b/tests/rustdoc-gui/code-example-buttons.goml @@ -5,25 +5,25 @@ include: "utils.goml" // First we check we "hover". move-cursor-to: ".example-wrap" assert-css: (".example-wrap .copy-button", { "visibility": "visible" }) -move-cursor-to: ".search-input" +move-cursor-to: "#search-button" assert-css: (".example-wrap .copy-button", { "visibility": "hidden" }) // Now we check the click. assert-count: (".example-wrap:not(:hover) .button-holder.keep-visible", 0) click: ".example-wrap" -move-cursor-to: ".search-input" +move-cursor-to: "#search-button" // It should have a new class and be visible. wait-for-count: (".example-wrap:not(:hover) .button-holder.keep-visible", 1) wait-for-css: (".example-wrap:not(:hover) .button-holder.keep-visible", { "visibility": "visible" }) // Clicking again will remove the class. click: ".example-wrap" -move-cursor-to: ".search-input" +move-cursor-to: "rustdoc-toolbar #search-button" assert-count: (".example-wrap:not(:hover) .button-holder.keep-visible", 0) assert-css: (".example-wrap .copy-button", { "visibility": "hidden" }) // Clicking on the "copy code" button shouldn't make the buttons stick. click: ".example-wrap .copy-button" -move-cursor-to: ".search-input" +move-cursor-to: "#search-button" 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. diff --git a/tests/rustdoc-gui/copy-code.goml b/tests/rustdoc-gui/copy-code.goml index 9cc717bc67a..a6fb816c4bd 100644 --- a/tests/rustdoc-gui/copy-code.goml +++ b/tests/rustdoc-gui/copy-code.goml @@ -12,7 +12,7 @@ define-function: ( assert-count: (".example-wrap .copy-button", 1) // We now ensure it's only displayed when the example is hovered. assert-css: (".example-wrap .copy-button", { "visibility": "visible" }) - move-cursor-to: ".search-input" + move-cursor-to: "rustdoc-toolbar #search-button" assert-css: (".example-wrap .copy-button", { "visibility": "hidden" }) // Checking that the copy button has the same size as the "copy path" button. compare-elements-size: ( diff --git a/tests/rustdoc-gui/cursor.goml b/tests/rustdoc-gui/cursor.goml index 9412987fc32..0d78e192606 100644 --- a/tests/rustdoc-gui/cursor.goml +++ b/tests/rustdoc-gui/cursor.goml @@ -1,4 +1,5 @@ // This test ensures that several clickable items actually have the pointer cursor. +include: "utils.goml" go-to: "file://" + |DOC_PATH| + "/lib2/struct.Foo.html" // the `[+]/[-]` button @@ -8,11 +9,7 @@ assert-css: ("#toggle-all-docs", {"cursor": "pointer"}) assert-css: ("#copy-path", {"cursor": "pointer"}) // the search tabs -write-into: (".search-input", "Foo") -// To be SURE that the search will be run. -press-key: 'Enter' -// Waiting for the search results to appear... -wait-for: "#search-tabs" +call-function: ("perform-search", {"query": "Foo"}) assert-css: ("#search-tabs > button", {"cursor": "pointer"}) // mobile sidebar toggle button diff --git a/tests/rustdoc-gui/docblock-code-block-line-number.goml b/tests/rustdoc-gui/docblock-code-block-line-number.goml index 0df9cc2a659..a182124aced 100644 --- a/tests/rustdoc-gui/docblock-code-block-line-number.goml +++ b/tests/rustdoc-gui/docblock-code-block-line-number.goml @@ -69,7 +69,7 @@ call-function: ("check-colors", { // and make sure it goes away. // First, open the settings menu. -click: "#settings-menu" +click: "rustdoc-toolbar .settings-menu" wait-for: "#settings" assert-css: ("#settings", {"display": "block"}) @@ -121,7 +121,7 @@ call-function: ("check-padding", { define-function: ("check-line-numbers-existence", [], block { assert-local-storage: {"rustdoc-line-numbers": "true" } assert-false: ".example-line-numbers" - click: "#settings-menu" + click: "rustdoc-toolbar .settings-menu" wait-for: "#settings" // Then, click the toggle button. @@ -137,7 +137,7 @@ define-function: ("check-line-numbers-existence", [], block { // Line numbers should still be there. assert-css: ("[data-nosnippet]", { "display": "block"}) // Closing settings menu. - click: "#settings-menu" + click: "rustdoc-toolbar .settings-menu" wait-for-css: ("#settings", {"display": "none"}) }) @@ -168,7 +168,7 @@ assert: ".example-wrap > pre.rust" assert-count: (".example-wrap", 2) assert-count: (".example-wrap.digits-1", 2) -click: "#settings-menu" +click: "rustdoc-toolbar .settings-menu" wait-for: "#settings" // Then, click the toggle button. diff --git a/tests/rustdoc-gui/escape-key.goml b/tests/rustdoc-gui/escape-key.goml index ff8557b9b81..ab5615ebcd8 100644 --- a/tests/rustdoc-gui/escape-key.goml +++ b/tests/rustdoc-gui/escape-key.goml @@ -1,13 +1,10 @@ // This test ensures that the "Escape" shortcut is handled correctly based on the // current content displayed. +include: "utils.goml" go-to: "file://" + |DOC_PATH| + "/test_docs/index.html" // First, we check that the search results are hidden when the Escape key is pressed. -write-into: (".search-input", "test") -// To be SURE that the search will be run. -press-key: 'Enter' -wait-for: "#search h1" // The search element is empty before the first search +call-function: ("perform-search", {"query": "test"}) // Check that the currently displayed element is search. -wait-for: "#alternative-display #search" assert-attribute: ("#main-content", {"class": "content hidden"}) assert-document-property: ({"URL": "index.html?search=test"}, ENDS_WITH) press-key: "Escape" @@ -17,8 +14,8 @@ assert-false: "#alternative-display #search" assert-attribute: ("#main-content", {"class": "content"}) assert-document-property: ({"URL": "index.html"}, [ENDS_WITH]) -// Check that focusing the search input brings back the search results -focus: ".search-input" +// Check that clicking the search button brings back the search results +click: "#search-button" wait-for: "#alternative-display #search" assert-attribute: ("#main-content", {"class": "content hidden"}) assert-document-property: ({"URL": "index.html?search=test"}, ENDS_WITH) diff --git a/tests/rustdoc-gui/font-serif-change.goml b/tests/rustdoc-gui/font-serif-change.goml index b14d5ae96f9..1e9f21c3541 100644 --- a/tests/rustdoc-gui/font-serif-change.goml +++ b/tests/rustdoc-gui/font-serif-change.goml @@ -8,7 +8,7 @@ assert-css: ("body", {"font-family": |serif_font|}) assert-css: ("p code", {"font-family": |serif_code_font|}) // We now switch to the sans serif font -click: "#settings-menu" +click: "main .settings-menu" wait-for: "#sans-serif-fonts" click: "#sans-serif-fonts" @@ -23,7 +23,7 @@ assert-css: ("body", {"font-family": |font|}) assert-css: ("p code", {"font-family": |code_font|}) // We switch back to the serif font -click: "#settings-menu" +click: "main .settings-menu" wait-for: "#sans-serif-fonts" click: "#sans-serif-fonts" diff --git a/tests/rustdoc-gui/globals.goml b/tests/rustdoc-gui/globals.goml index 7a0e2b9eb74..89f57add816 100644 --- a/tests/rustdoc-gui/globals.goml +++ b/tests/rustdoc-gui/globals.goml @@ -1,6 +1,7 @@ // Make sure search stores its data in `window` // It needs to use a global to avoid racing on search-index.js and search.js // https://github.com/rust-lang/rust/pull/118961 +include: "utils.goml" // URL query go-to: "file://" + |DOC_PATH| + "/test_docs/index.html?search=sa'%3Bda'%3Bds" @@ -9,9 +10,7 @@ assert-window-property-false: {"searchIndex": null} // Form input go-to: "file://" + |DOC_PATH| + "/test_docs/index.html" -write-into: (".search-input", "Foo") -press-key: 'Enter' -wait-for: "#search-tabs" +call-function: ("perform-search", {"query": "Foo"}) assert-window-property-false: {"searchIndex": null} // source sidebar diff --git a/tests/rustdoc-gui/help-page.goml b/tests/rustdoc-gui/help-page.goml index 6d6e353ae36..34b40814027 100644 --- a/tests/rustdoc-gui/help-page.goml +++ b/tests/rustdoc-gui/help-page.goml @@ -6,12 +6,12 @@ assert-css: ("#help", {"display": "block"}) assert-css: ("#help dd", {"font-size": "16px"}) assert-false: "#help-button > a" assert-css: ("#help", {"display": "block"}) -compare-elements-property: (".sub", "#help", ["offsetWidth"]) -compare-elements-position: (".sub", "#help", ["x"]) +compare-elements-property: (".main-heading", "#help", ["offsetWidth"]) +compare-elements-position: (".main-heading", "#help", ["x"]) set-window-size: (500, 1000) // Try mobile next. assert-css: ("#help", {"display": "block"}) -compare-elements-property: (".sub", "#help", ["offsetWidth"]) -compare-elements-position: (".sub", "#help", ["x"]) +compare-elements-property: (".main-heading", "#help", ["offsetWidth"]) +compare-elements-position: (".main-heading", "#help", ["x"]) // Checking the color of the elements of the help menu. show-text: true @@ -54,19 +54,17 @@ go-to: "file://" + |DOC_PATH| + "/test_docs/index.html?search=a" wait-for: "#search-tabs" // Waiting for the search.js to load. set-window-size: (1000, 1000) // Only supported on desktop. assert-false: "#help" -click: "#help-button > a" +click: "rustdoc-toolbar .help-menu > a" assert-css: ("#help", {"display": "block"}) assert-css: ("#help dd", {"font-size": "16px"}) -click: "#help-button > a" -assert-css: ("#help", {"display": "none"}) -compare-elements-property-false: (".sub", "#help", ["offsetWidth"]) -compare-elements-position-false: (".sub", "#help", ["x"]) +click: "rustdoc-toolbar .help-menu > a" +assert-false: "#help" // This test ensures that the "the rustdoc book" anchor link within the help popover works. go-to: "file://" + |DOC_PATH| + "/test_docs/index.html?search=a" wait-for: "#search-tabs" // Waiting for the search.js to load. set-window-size: (1000, 1000) // Popover only appears when the screen width is >700px. assert-false: "#help" -click: "#help-button > a" +click: "rustdoc-toolbar .help-menu > a" click: "//*[@id='help']//a[text()='the rustdoc book']" wait-for-document-property: ({"URL": "https://doc.rust-lang.org/"}, STARTS_WITH) diff --git a/tests/rustdoc-gui/hide-mobile-topbar.goml b/tests/rustdoc-gui/hide-mobile-topbar.goml index 46eb8acfe8c..1e46d235827 100644 --- a/tests/rustdoc-gui/hide-mobile-topbar.goml +++ b/tests/rustdoc-gui/hide-mobile-topbar.goml @@ -1,20 +1,19 @@ // Checks sidebar resizing stays synced with the setting -go-to: "file://" + |DOC_PATH| + "/test_docs/index.html" +go-to: "file://" + |DOC_PATH| + "/settings.html" set-window-size: (400, 600) // Verify that the "hide" option is unchecked -click: "#settings-menu" wait-for: "#settings" assert-css: ("#settings", {"display": "block"}) assert-property: ("#hide-sidebar", {"checked": "false"}) -assert-css: (".mobile-topbar", {"display": "flex"}) +assert-css: ("rustdoc-topbar", {"display": "flex"}) // Toggle it click: "#hide-sidebar" assert-property: ("#hide-sidebar", {"checked": "true"}) -assert-css: (".mobile-topbar", {"display": "none"}) +assert-css: ("rustdoc-topbar", {"display": "none"}) // Toggle it again click: "#hide-sidebar" assert-property: ("#hide-sidebar", {"checked": "false"}) -assert-css: (".mobile-topbar", {"display": "flex"}) +assert-css: ("rustdoc-topbar", {"display": "flex"}) diff --git a/tests/rustdoc-gui/huge-logo.goml b/tests/rustdoc-gui/huge-logo.goml index d207ab5bb37..6ad6948ef2a 100644 --- a/tests/rustdoc-gui/huge-logo.goml +++ b/tests/rustdoc-gui/huge-logo.goml @@ -8,8 +8,3 @@ assert-property: (".sidebar-crate .logo-container", {"offsetWidth": "96", "offse // offsetWidth = width of sidebar, offsetHeight = height + top padding assert-property: (".sidebar-crate .logo-container img", {"offsetWidth": "48", "offsetHeight": 64}) assert-css: (".sidebar-crate .logo-container img", {"border-top-width": "16px", "margin-top": "-16px"}) - -set-window-size: (400, 600) -// offset = size + margin -assert-property: (".mobile-topbar .logo-container", {"offsetWidth": "55", "offsetHeight": 45}) -assert-property: (".mobile-topbar .logo-container img", {"offsetWidth": "35", "offsetHeight": 35}) diff --git a/tests/rustdoc-gui/item-info.goml b/tests/rustdoc-gui/item-info.goml index 647a2fd290d..11388c79e0b 100644 --- a/tests/rustdoc-gui/item-info.goml +++ b/tests/rustdoc-gui/item-info.goml @@ -20,7 +20,7 @@ store-position: ( {"x": second_line_x, "y": second_line_y}, ) assert: |first_line_x| != |second_line_x| && |first_line_x| == 521 && |second_line_x| == 277 -assert: |first_line_y| != |second_line_y| && |first_line_y| == 718 && |second_line_y| == 741 +assert: |first_line_y| != |second_line_y| && |first_line_y| == 676 && |second_line_y| == 699 // Now we ensure that they're not rendered on the same line. set-window-size: (1100, 800) diff --git a/tests/rustdoc-gui/links-color.goml b/tests/rustdoc-gui/links-color.goml index f11920cdd8c..a363175c1dd 100644 --- a/tests/rustdoc-gui/links-color.goml +++ b/tests/rustdoc-gui/links-color.goml @@ -9,7 +9,7 @@ show-text: true define-function: ( "check-colors", [theme, mod, macro, struct, enum, trait, fn, type, union, keyword, - sidebar, sidebar_current, sidebar_current_background], + attribute, sidebar, sidebar_current, sidebar_current_background], block { call-function: ("switch-theme", {"theme": |theme|}) // Checking results colors. @@ -22,6 +22,7 @@ define-function: ( assert-css: (".item-table .type", {"color": |type|}, ALL) assert-css: (".item-table .union", {"color": |union|}, ALL) assert-css: (".item-table .keyword", {"color": |keyword|}, ALL) + assert-css: (".item-table .attribute", {"color": |attribute|}, ALL) // Checking sidebar elements. assert-css: ( ".sidebar-elems li:not(.current) a", @@ -58,6 +59,7 @@ call-function: ( "type": "#ffa0a5", "union": "#ffa0a5", "keyword": "#39afd7", + "attribute": "#39afd7", "sidebar": "#53b1db", "sidebar_current": "#ffb44c", "sidebar_current_background": "transparent", @@ -76,6 +78,7 @@ call-function: ( "type": "#2dbfb8", "union": "#2dbfb8", "keyword": "#d2991d", + "attribute": "#d2991d", "sidebar": "#fdbf35", "sidebar_current": "#fdbf35", "sidebar_current_background": "#444", @@ -94,6 +97,7 @@ call-function: ( "type": "#ad378a", "union": "#ad378a", "keyword": "#3873ad", + "attribute": "#3873ad", "sidebar": "#356da4", "sidebar_current": "#356da4", "sidebar_current_background": "#fff", diff --git a/tests/rustdoc-gui/macro-expansion.goml b/tests/rustdoc-gui/macro-expansion.goml new file mode 100644 index 00000000000..b87d0e4870a --- /dev/null +++ b/tests/rustdoc-gui/macro-expansion.goml @@ -0,0 +1,126 @@ +// This test ensures that the macro expansion is generated and working as expected. +go-to: "file://" + |DOC_PATH| + "/src/macro_expansion/lib.rs.html" + +define-function: ( + "check-expansion", + [line, original_content], + block { + assert-text: ("a[id='" + |line| + "'] + .expansion .original", |original_content|) + // The "original" content should be expanded. + assert-css: ("a[id='" + |line| + "'] + .expansion .original", {"display": "inline"}) + // The expanded macro should be hidden. + assert-css: ("a[id='" + |line| + "'] + .expansion .expanded", {"display": "none"}) + + // We "expand" the macro. + click: "a[id='" + |line| + "'] + .expansion input[type=checkbox]" + // The "original" content is hidden. + assert-css: ("a[id='" + |line| + "'] + .expansion .original", {"display": "none"}) + // The expanded macro is visible. + assert-css: ("a[id='" + |line| + "'] + .expansion .expanded", {"display": "inline"}) + + // We collapse the macro. + click: "a[id='" + |line| + "'] + .expansion input[type=checkbox]" + // The "original" content is expanded. + assert-css: ("a[id='" + |line| + "'] + .expansion .original", {"display": "inline"}) + // The expanded macro is hidden. + assert-css: ("a[id='" + |line| + "'] + .expansion .expanded", {"display": "none"}) + } +) + +// First we check the derive macro expansion at line 33. +call-function: ("check-expansion", {"line": 35, "original_content": "Debug"}) +// Then we check the `bar` macro expansion at line 41. +call-function: ("check-expansion", {"line": 43, "original_content": "bar!(y)"}) +// Then we check the `println` macro expansion at line 42-44. +call-function: ("check-expansion", {"line": 44, "original_content": 'println!(" +45 {y} +46 ")'}) + +// Then finally we check when there are two macro calls on a same line. +assert-count: ("#expand-52 ~ .original", 2) +assert-count: ("#expand-52 ~ .expanded", 2) + +store-value: (repeat_o, '/following-sibling::*[@class="original"]') +store-value: (repeat_e, '/following-sibling::*[@class="expanded"]') +store-value: (expand_id, "expand-52") +assert-text: ('//*[@id="' + |expand_id| + '"]' + |repeat_o|, "stringify!(foo)") +assert-text: ('//*[@id="' + |expand_id| + '"]' + |repeat_o| + |repeat_o|, "stringify!(bar)") +assert-text: ('//*[@id="' + |expand_id| + '"]' + |repeat_e|, '"foo"') +assert-text: ('//*[@id="' + |expand_id| + '"]' + |repeat_e| + |repeat_e|, '"bar"') + +// The "original" content should be expanded. +assert-css: ('//*[@id="' + |expand_id| + '"]' + |repeat_o|, {"display": "inline"}) +assert-css: ('//*[@id="' + |expand_id| + '"]' + |repeat_o| + |repeat_o|, {"display": "inline"}) +// The expanded macro should be hidden. +assert-css: ('//*[@id="' + |expand_id| + '"]' + |repeat_e|, {"display": "none"}) +assert-css: ('//*[@id="' + |expand_id| + '"]' + |repeat_e| + |repeat_e|, {"display": "none"}) + +// We "expand" the macro (because the line starts with a string, the label is not at the "top +// level" of the `<code>`, so we need to use a different selector). +click: "#" + |expand_id| +// The "original" content is hidden. +assert-css: ('//*[@id="' + |expand_id| + '"]' + |repeat_o|, {"display": "none"}) +assert-css: ('//*[@id="' + |expand_id| + '"]' + |repeat_o| + |repeat_o|, {"display": "none"}) +// The expanded macro is visible. +assert-css: ('//*[@id="' + |expand_id| + '"]' + |repeat_e|, {"display": "inline"}) +assert-css: ('//*[@id="' + |expand_id| + '"]' + |repeat_e| + |repeat_e|, {"display": "inline"}) + +// We collapse the macro. +click: "#" + |expand_id| +// The "original" content is expanded. +assert-css: ('//*[@id="' + |expand_id| + '"]' + |repeat_o|, {"display": "inline"}) +assert-css: ('//*[@id="' + |expand_id| + '"]' + |repeat_o| + |repeat_o|, {"display": "inline"}) +// The expanded macro is hidden. +assert-css: ('//*[@id="' + |expand_id| + '"]' + |repeat_e|, {"display": "none"}) +assert-css: ('//*[@id="' + |expand_id| + '"]' + |repeat_e| + |repeat_e|, {"display": "none"}) + +// Checking the line 48 `println` which needs to be handled differently because the line number is +// inside a "comment" span. +store-value: (expand_id, "expand-48") +assert-text: ("#" + |expand_id| + " ~ .original", 'println!(" +49 {y} +50 ")') +// The "original" content should be expanded. +assert-css: ("#" + |expand_id| + " ~ .original", {"display": "inline"}) +// The expanded macro should be hidden. +assert-css: ("#" + |expand_id| + " ~ .expanded", {"display": "none"}) + +// We "expand" the macro. +click: "#" + |expand_id| +// The "original" content is hidden. +assert-css: ("#" + |expand_id| + " ~ .original", {"display": "none"}) +// The expanded macro is visible. +assert-css: ("#" + |expand_id| + " ~ .expanded", {"display": "inline"}) + +// We collapse the macro. +click: "#" + |expand_id| +// The "original" content is expanded. +assert-css: ("#" + |expand_id| + " ~ .original", {"display": "inline"}) +// The expanded macro is hidden. +assert-css: ("#" + |expand_id| + " ~ .expanded", {"display": "none"}) + +// Ensure that the toggles are focusable and can be interacted with keyboard. +focus: "//a[@id='29']" +press-key: "Tab" +store-value: (expand_id, "expand-29") +assert: "#" + |expand_id| + ":focus" +assert-css: ("#" + |expand_id| +" ~ .expanded", {"display": "none"}) +assert-css: ("#" + |expand_id| +" ~ .original", {"display": "inline"}) +// We now expand the macro. +press-key: "Space" +assert-css: ("#" + |expand_id| + " ~ .expanded", {"display": "inline"}) +assert-css: ("#" + |expand_id| + " ~ .original", {"display": "none"}) +// We collapse the macro. +press-key: "Space" +assert-css: ("#" + |expand_id| + " ~ .expanded", {"display": "none"}) +assert-css: ("#" + |expand_id| + " ~ .original", {"display": "inline"}) + +// Now we check a macro coming from another file. +store-value: (expand_id, "expand-55") +// We "expand" the macro. +click: "#" + |expand_id| +// The "original" content is hidden. +assert-css: ("#" + |expand_id| + " ~ .original", {"display": "none"}) +// The expanded macro is visible. +assert-css: ("#" + |expand_id| + " ~ .expanded", {"display": "inline"}) +assert-text: ("#" + |expand_id| + " ~ .expanded", "{ y += 2; };") diff --git a/tests/rustdoc-gui/mobile-crate-name.goml b/tests/rustdoc-gui/mobile-crate-name.goml index a0c96eec8a5..524c1d36a8a 100644 --- a/tests/rustdoc-gui/mobile-crate-name.goml +++ b/tests/rustdoc-gui/mobile-crate-name.goml @@ -5,18 +5,18 @@ go-to: "file://" + |DOC_PATH| + "/test_docs/index.html" // First we change the title to make it big. set-window-size: (350, 800) // We ensure that the "format" of the title is the same as the one we'll use. -assert-text: (".mobile-topbar .location a", "test_docs") +assert-text: ("rustdoc-topbar h2 a", "Crate test_docs") // We store the height we know is correct. -store-property: (".mobile-topbar .location", {"offsetHeight": height}) +store-property: ("rustdoc-topbar h2", {"offsetHeight": height}) // We change the crate name to something longer. -set-text: (".mobile-topbar .location a", "cargo_packager_resource_resolver") +set-text: ("rustdoc-topbar h2 a", "cargo_packager_resource_resolver") // And we check that the size remained the same. -assert-property: (".mobile-topbar .location", {"offsetHeight": |height|}) +assert-property: ("rustdoc-topbar h2", {"offsetHeight": |height|}) // Now we check if it works for the non-crate pages as well. go-to: "file://" + |DOC_PATH| + "/test_docs/struct.Foo.html" // We store the height we know is correct. -store-property: (".mobile-topbar .location", {"offsetHeight": height}) -set-text: (".mobile-topbar .location a", "Something_incredibly_long_because") +store-property: ("rustdoc-topbar h2", {"offsetHeight": height}) +set-text: ("rustdoc-topbar h2 a", "Something_incredibly_long_because") // And we check that the size remained the same. -assert-property: (".mobile-topbar .location", {"offsetHeight": |height|}) +assert-property: ("rustdoc-topbar h2", {"offsetHeight": |height|}) diff --git a/tests/rustdoc-gui/mobile.goml b/tests/rustdoc-gui/mobile.goml index a9eee53dd1d..d292281932d 100644 --- a/tests/rustdoc-gui/mobile.goml +++ b/tests/rustdoc-gui/mobile.goml @@ -5,7 +5,7 @@ set-window-size: (400, 600) set-font-size: 18 wait-for: 100 // wait a bit for the resize and the font-size change to be fully taken into account. -assert-property: (".mobile-topbar h2", {"offsetHeight": 33}) +assert-property: ("rustdoc-topbar h2", {"offsetHeight": 33}) // On the settings page, the theme buttons should not line-wrap. Instead, they should // all be placed as a group on a line below the setting name "Theme." diff --git a/tests/rustdoc-gui/module-items-font.goml b/tests/rustdoc-gui/module-items-font.goml index 0e6dd81c05b..bed95b378c6 100644 --- a/tests/rustdoc-gui/module-items-font.goml +++ b/tests/rustdoc-gui/module-items-font.goml @@ -65,3 +65,12 @@ assert-css: ( "#keywords + .item-table dd", {"font-family": '"Source Serif 4", NanumBarunGothic, serif'}, ) +// attributes +assert-css: ( + "#attributes + .item-table dt a", + {"font-family": '"Fira Sans", Arial, NanumBarunGothic, sans-serif'}, +) +assert-css: ( + "#attributes + .item-table dd", + {"font-family": '"Source Serif 4", NanumBarunGothic, serif'}, +) diff --git a/tests/rustdoc-gui/notable-trait.goml b/tests/rustdoc-gui/notable-trait.goml index 423a273fde7..6bd4661ac8f 100644 --- a/tests/rustdoc-gui/notable-trait.goml +++ b/tests/rustdoc-gui/notable-trait.goml @@ -82,15 +82,6 @@ call-function: ("check-notable-tooltip-position", { "i_x": 528, }) -// Checking on mobile now. -set-window-size: (650, 600) -wait-for-size: ("body", {"width": 650}) -call-function: ("check-notable-tooltip-position-complete", { - "x": 26, - "i_x": 305, - "popover_x": 0, -}) - // Now check the colors. define-function: ( "check-colors", @@ -176,6 +167,15 @@ call-function: ( }, ) +// Checking on mobile now. +set-window-size: (650, 600) +wait-for-size: ("body", {"width": 650}) +call-function: ("check-notable-tooltip-position-complete", { + "x": 26, + "i_x": 305, + "popover_x": 0, +}) + reload: // Check that pressing escape works @@ -189,7 +189,7 @@ assert: "#method\.create_an_iterator_from_read .tooltip:focus" // Check that clicking outside works. click: "//*[@id='method.create_an_iterator_from_read']//*[@class='tooltip']" assert-count: ("//*[@class='tooltip popover']", 1) -click: ".search-input" +click: ".main-heading h1" assert-count: ("//*[@class='tooltip popover']", 0) assert-false: "#method\.create_an_iterator_from_read .tooltip:focus" @@ -219,14 +219,14 @@ define-function: ( store-window-property: {"scrollY": scroll} click: "//*[@id='method.create_an_iterator_from_read']//*[@class='tooltip']" wait-for: "//*[@class='tooltip popover']" - click: "#settings-menu a" + click: ".main-heading h1" } ) // Now we check that the focus isn't given back to the wrong item when opening // another popover. call-function: ("setup-popup", {}) -click: ".search-input" +click: ".main-heading h1" // We ensure we didn't come back to the previous focused item. assert-window-property-false: {"scrollY": |scroll|} @@ -251,7 +251,7 @@ reload: assert-count: ("//*[@class='tooltip popover']", 0) click: "//*[@id='method.create_an_iterator_from_read']//*[@class='tooltip']" assert-count: ("//*[@class='tooltip popover']", 1) -click: "#settings-menu a" +click: "rustdoc-toolbar .settings-menu a" wait-for: "#settings" assert-count: ("//*[@class='tooltip popover']", 0) assert-false: "#method\.create_an_iterator_from_read .tooltip:focus" diff --git a/tests/rustdoc-gui/pocket-menu.goml b/tests/rustdoc-gui/pocket-menu.goml index 073172dd8a7..a0815bfa9a0 100644 --- a/tests/rustdoc-gui/pocket-menu.goml +++ b/tests/rustdoc-gui/pocket-menu.goml @@ -3,33 +3,33 @@ include: "utils.goml" go-to: "file://" + |DOC_PATH| + "/test_docs/index.html?search=test" wait-for: "#crate-search" // First we check that the help menu doesn't exist yet. -assert-false: "#help-button .popover" +assert-false: "rustdoc-toolbar .help-menu .popover" // Then we display the help menu. -click: "#help-button" -assert: "#help-button .popover" -assert-css: ("#help-button .popover", {"display": "block"}) +click: "rustdoc-toolbar .help-menu" +assert: "rustdoc-toolbar .help-menu .popover" +assert-css: ("rustdoc-toolbar .help-menu .popover", {"display": "block"}) // Now we click somewhere else on the page to ensure it is handling the blur event // correctly. click: ".sidebar" -assert-css: ("#help-button .popover", {"display": "none"}) +assert-false: "rustdoc-toolbar .help-menu .popover" // Now we will check that we cannot have two "pocket menus" displayed at the same time. -click: "#help-button" -assert-css: ("#help-button .popover", {"display": "block"}) -click: "#settings-menu" -assert-css: ("#help-button .popover", {"display": "none"}) -assert-css: ("#settings-menu .popover", {"display": "block"}) +click: "rustdoc-toolbar .help-menu" +assert-css: ("rustdoc-toolbar .help-menu .popover", {"display": "block"}) +click: "rustdoc-toolbar .settings-menu" +assert-false: "rustdoc-toolbar .help-menu .popover" +assert-css: ("rustdoc-toolbar .settings-menu .popover", {"display": "block"}) // Now the other way. -click: "#help-button" -assert-css: ("#help-button .popover", {"display": "block"}) -assert-css: ("#settings-menu .popover", {"display": "none"}) +click: "rustdoc-toolbar .help-menu" +assert-css: ("rustdoc-toolbar .help-menu .popover", {"display": "block"}) +assert-css: ("rustdoc-toolbar .settings-menu .popover", {"display": "none"}) // Now verify that clicking the help menu again closes it. -click: "#help-button" -assert-css: ("#help-button .popover", {"display": "none"}) -assert-css: ("#settings-menu .popover", {"display": "none"}) +click: "rustdoc-toolbar .help-menu" +assert-false: "rustdoc-toolbar .help-menu .popover" +assert-css: (".settings-menu .popover", {"display": "none"}) define-function: ( "check-popover-colors", @@ -37,13 +37,21 @@ define-function: ( block { call-function: ("switch-theme", {"theme": |theme|}) - click: "#help-button" + click: "rustdoc-toolbar .help-menu" assert-css: ( - "#help-button .popover", + "rustdoc-toolbar .help-menu .popover", {"display": "block", "border-color": |border_color|}, ) - compare-elements-css: ("#help-button .popover", "#help-button .top", ["border-color"]) - compare-elements-css: ("#help-button .popover", "#help-button .bottom", ["border-color"]) + compare-elements-css: ( + "rustdoc-toolbar .help-menu .popover", + "rustdoc-toolbar .help-menu .top", + ["border-color"], + ) + compare-elements-css: ( + "rustdoc-toolbar .help-menu .popover", + "rustdoc-toolbar .help-menu .bottom", + ["border-color"], + ) } ) @@ -63,8 +71,21 @@ call-function: ("check-popover-colors", { // Opening the mobile sidebar should close the settings popover. set-window-size: (650, 600) -click: "#settings-menu a" -assert-css: ("#settings-menu .popover", {"display": "block"}) +click: "rustdoc-topbar .settings-menu a" +assert-css: ("rustdoc-topbar .settings-menu .popover", {"display": "block"}) +click: ".sidebar-menu-toggle" +assert: "//*[@class='sidebar shown']" +assert-css: ("rustdoc-topbar .settings-menu .popover", {"display": "none"}) +// Opening the settings popover should close the sidebar. +click: ".settings-menu a" +assert-css: ("rustdoc-topbar .settings-menu .popover", {"display": "block"}) +assert-false: "//*[@class='sidebar shown']" + +// Opening the settings popover at start (which async loads stuff) should also close. +reload: click: ".sidebar-menu-toggle" assert: "//*[@class='sidebar shown']" -assert-css: ("#settings-menu .popover", {"display": "none"}) +assert-false: "rustdoc-topbar .settings-menu .popover" +click: "rustdoc-topbar .settings-menu a" +assert-false: "//*[@class='sidebar shown']" +wait-for: "rustdoc-topbar .settings-menu .popover" diff --git a/tests/rustdoc-gui/scrape-examples-color.goml b/tests/rustdoc-gui/scrape-examples-color.goml index b0faca190a5..c84fe1f3411 100644 --- a/tests/rustdoc-gui/scrape-examples-color.goml +++ b/tests/rustdoc-gui/scrape-examples-color.goml @@ -27,7 +27,7 @@ define-function: ( "color": |help_hover_color|, }) // Moving the cursor to another item to not break next runs. - move-cursor-to: ".search-input" + move-cursor-to: "#search-button" } ) diff --git a/tests/rustdoc-gui/scrape-examples-layout.goml b/tests/rustdoc-gui/scrape-examples-layout.goml index 85a3b2a6287..681d0c24c6d 100644 --- a/tests/rustdoc-gui/scrape-examples-layout.goml +++ b/tests/rustdoc-gui/scrape-examples-layout.goml @@ -64,8 +64,8 @@ assert-size: (".more-scraped-examples .scraped-example .example-wrap", { store-value: (offset_y, 4) // First with desktop -assert-position: (".scraped-example", {"y": 256}) -assert-position: (".scraped-example .prev", {"y": 256 + |offset_y|}) +assert-position: (".scraped-example", {"y": 214}) +assert-position: (".scraped-example .prev", {"y": 214 + |offset_y|}) // Gradient background should be at the top of the code block. assert-css: (".scraped-example .example-wrap::before", {"top": "0px"}) @@ -74,8 +74,8 @@ assert-css: (".scraped-example .example-wrap::after", {"bottom": "0px"}) // Then with mobile set-window-size: (600, 600) store-size: (".scraped-example .scraped-example-title", {"height": title_height}) -assert-position: (".scraped-example", {"y": 291}) -assert-position: (".scraped-example .prev", {"y": 291 + |offset_y| + |title_height|}) +assert-position: (".scraped-example", {"y": 249}) +assert-position: (".scraped-example .prev", {"y": 249 + |offset_y| + |title_height|}) define-function: ( "check_title_and_code_position", diff --git a/tests/rustdoc-gui/scrape-examples-toggle.goml b/tests/rustdoc-gui/scrape-examples-toggle.goml index 441895a7c0e..ec5710fbcdc 100644 --- a/tests/rustdoc-gui/scrape-examples-toggle.goml +++ b/tests/rustdoc-gui/scrape-examples-toggle.goml @@ -25,7 +25,7 @@ define-function: ( // We put the toggle in the original state. click: ".more-examples-toggle" // Moving cursor away from the toggle line to prevent disrupting next test. - move-cursor-to: ".search-input" + move-cursor-to: "rustdoc-toolbar #search-button" }, ) diff --git a/tests/rustdoc-gui/search-about-this-result.goml b/tests/rustdoc-gui/search-about-this-result.goml index 1d45c06dc43..ec1df737c81 100644 --- a/tests/rustdoc-gui/search-about-this-result.goml +++ b/tests/rustdoc-gui/search-about-this-result.goml @@ -7,6 +7,7 @@ focus: ".search-input" press-key: "Enter" wait-for: "#search-tabs" +wait-for-false: "#search-tabs .count.loading" assert-count: ("#search-tabs button", 1) assert-count: (".search-results > a", 1) @@ -32,6 +33,7 @@ focus: ".search-input" press-key: "Enter" wait-for: "#search-tabs" +wait-for-false: "#search-tabs .count.loading" assert-text: ("//div[@class='type-signature']", "F -> WhereWhitespace<T>") assert-count: ("#search-tabs button", 1) assert-count: (".search-results > a", 1) diff --git a/tests/rustdoc-gui/search-corrections.goml b/tests/rustdoc-gui/search-corrections.goml index f80675730c4..a14a80f357c 100644 --- a/tests/rustdoc-gui/search-corrections.goml +++ b/tests/rustdoc-gui/search-corrections.goml @@ -1,101 +1,60 @@ // ignore-tidy-linelength +include: "utils.goml" // Checks that the search tab result tell the user about corrections // First, try a search-by-name go-to: "file://" + |DOC_PATH| + "/test_docs/index.html" -// Intentionally wrong spelling of "NotableStructWithLongName" -write-into: (".search-input", "NotableStructWithLongNamr") -// To be SURE that the search will be run. -press-key: 'Enter' -// Waiting for the search results to appear... -wait-for: "#search-tabs" +call-function: ("perform-search", {"query": "NotableStructWithLongNamr"}) // Corrections aren't shown on the "In Names" tab. assert: "#search-tabs button.selected:first-child" -assert-css: (".search-corrections", { - "display": "none" -}) +assert-false: ".search-results:nth-child(1) .search-corrections" // Corrections do get shown on the "In Parameters" tab. click: "#search-tabs button:nth-child(2)" assert: "#search-tabs button.selected:nth-child(2)" -assert-css: (".search-corrections", { - "display": "block" -}) assert-text: ( - ".search-corrections", - "Type \"NotableStructWithLongNamr\" not found. Showing results for closest type name \"notablestructwithlongname\" instead." + ".search-results:nth-child(2) .search-corrections", + "Type \"NotableStructWithLongNamr\" not found. Showing results for closest type name \"NotableStructWithLongName\" instead." ) // Corrections do get shown on the "In Return Type" tab. click: "#search-tabs button:nth-child(3)" assert: "#search-tabs button.selected:nth-child(3)" -assert-css: (".search-corrections", { - "display": "block" -}) assert-text: ( - ".search-corrections", - "Type \"NotableStructWithLongNamr\" not found. Showing results for closest type name \"notablestructwithlongname\" instead." + ".search-results:nth-child(3) .search-corrections", + "Type \"NotableStructWithLongNamr\" not found. Showing results for closest type name \"NotableStructWithLongName\" instead." ) // Now, explicit return values go-to: "file://" + |DOC_PATH| + "/test_docs/index.html" -// Intentionally wrong spelling of "NotableStructWithLongName" -write-into: (".search-input", "-> NotableStructWithLongNamr") -// To be SURE that the search will be run. -press-key: 'Enter' -// Waiting for the search results to appear... -wait-for: "#search-tabs" +call-function: ("perform-search", {"query": "-> NotableStructWithLongNamr"}) -assert-css: (".search-corrections", { - "display": "block" -}) assert-text: ( - ".search-corrections", - "Type \"NotableStructWithLongNamr\" not found. Showing results for closest type name \"notablestructwithlongname\" instead." + ".search-results.active .search-corrections", + "Type \"NotableStructWithLongNamr\" not found and used as generic parameter. Consider searching for \"NotableStructWithLongName\" instead." ) // Now, generic correction go-to: "file://" + |DOC_PATH| + "/test_docs/index.html" -// Intentionally wrong spelling of "NotableStructWithLongName" -write-into: (".search-input", "NotableStructWithLongNamr, NotableStructWithLongNamr") -// To be SURE that the search will be run. -press-key: 'Enter' -// Waiting for the search results to appear... -wait-for: "#search-tabs" +call-function: ("perform-search", {"query": "NotableStructWithLongNamr, NotableStructWithLongNamr"}) -assert-css: (".search-corrections", { - "display": "block" -}) assert-text: ( - ".search-corrections", - "Type \"NotableStructWithLongNamr\" not found and used as generic parameter. Consider searching for \"notablestructwithlongname\" instead." + ".search-failed.active .search-corrections", + "Type \"NotableStructWithLongNamr\" not found and used as generic parameter. Consider searching for \"NotableStructWithLongName\" instead." ) // Now, generic correction plus error go-to: "file://" + |DOC_PATH| + "/test_docs/index.html" -// Intentionally wrong spelling of "NotableStructWithLongName" -write-into: (".search-input", "Foo<NotableStructWithLongNamr>,y") -// To be SURE that the search will be run. -press-key: 'Enter' -// Waiting for the search results to appear... -wait-for: "#search-tabs" +call-function: ("perform-search", {"query": "Foo<NotableStructWithLongNamr>,y"}) -assert-css: (".search-corrections", { - "display": "block" -}) assert-text: ( - ".search-corrections", - "Type \"NotableStructWithLongNamr\" not found and used as generic parameter. Consider searching for \"notablestructwithlongname\" instead." + ".search-failed.active .search-corrections", + "Type \"NotableStructWithLongNamr\" not found and used as generic parameter. Consider searching for \"NotableStructWithLongName\" instead." ) go-to: "file://" + |DOC_PATH| + "/test_docs/index.html" -// Intentionally wrong spelling of "NotableStructWithLongName" -write-into: (".search-input", "generic:NotableStructWithLongNamr<x>,y") -// To be SURE that the search will be run. -press-key: 'Enter' -// Waiting for the search results to appear... -wait-for: "#search-tabs" +call-function: ("perform-search", {"query": "generic:NotableStructWithLongNamr<x>,y"}) assert-css: (".error", { "display": "block" diff --git a/tests/rustdoc-gui/search-error.goml b/tests/rustdoc-gui/search-error.goml index 4dc60669c7a..4d7c2263fd1 100644 --- a/tests/rustdoc-gui/search-error.goml +++ b/tests/rustdoc-gui/search-error.goml @@ -8,6 +8,7 @@ define-function: ( [theme, error_background], block { call-function: ("switch-theme", {"theme": |theme|}) + wait-for-false: "#search-tabs .count.loading" wait-for: "#search .error code" assert-css: ("#search .error code", {"background-color": |error_background|}) } diff --git a/tests/rustdoc-gui/search-filter.goml b/tests/rustdoc-gui/search-filter.goml index c5038e0892b..d92d522c119 100644 --- a/tests/rustdoc-gui/search-filter.goml +++ b/tests/rustdoc-gui/search-filter.goml @@ -2,11 +2,7 @@ include: "utils.goml" go-to: "file://" + |DOC_PATH| + "/test_docs/index.html" show-text: true -write-into: (".search-input", "test") -// To be SURE that the search will be run. -press-key: 'Enter' -// Waiting for the search results to appear... -wait-for: "#search-tabs" +call-function: ("perform-search", {"query": "test"}) assert-text: ("#results .externcrate", "test_docs") wait-for: "#crate-search" @@ -21,6 +17,7 @@ press-key: "ArrowDown" press-key: "Enter" // Waiting for the search results to appear... wait-for: "#search-tabs" +wait-for-false: "#search-tabs .count.loading" assert-document-property: ({"URL": "&filter-crate="}, CONTAINS) // We check that there is no more "test_docs" appearing. assert-false: "#results .externcrate" @@ -31,7 +28,8 @@ assert-property: ("#crate-search", {"value": "lib2"}) // crate filtering. press-key: "Escape" wait-for-css: ("#main-content", {"display": "block"}) -focus: ".search-input" +click: "#search-button" +wait-for: ".search-input" wait-for-css: ("#main-content", {"display": "none"}) // We check that there is no more "test_docs" appearing. assert-false: "#results .externcrate" @@ -47,6 +45,7 @@ press-key: "ArrowUp" press-key: "Enter" // Waiting for the search results to appear... wait-for: "#search-tabs" +wait-for-false: "#search-tabs .count.loading" assert-property: ("#crate-search", {"value": "all crates"}) // Checking that the URL parameter is taken into account for crate filtering. @@ -56,8 +55,7 @@ assert-property: ("#crate-search", {"value": "lib2"}) assert-false: "#results .externcrate" // Checking that the text for the "title" is correct (the "all crates" comes from the "<select>"). -assert-text: (".search-results-title", "Results", STARTS_WITH) -assert-text: (".search-results-title + .sub-heading", " in all crates", STARTS_WITH) +assert-text: (".search-switcher", "Search results in all crates", STARTS_WITH) // Checking the display of the crate filter. // We start with the light theme. @@ -72,7 +70,7 @@ assert-css: ("#crate-search", { }) // We now check the dark theme. -click: "#settings-menu" +click: "rustdoc-toolbar .settings-menu" wait-for: "#settings" click: "#theme-dark" wait-for-css: ("#crate-search", { diff --git a/tests/rustdoc-gui/search-form-elements.goml b/tests/rustdoc-gui/search-form-elements.goml index efe39f7a9d1..fdf0afb7e8f 100644 --- a/tests/rustdoc-gui/search-form-elements.goml +++ b/tests/rustdoc-gui/search-form-elements.goml @@ -2,6 +2,7 @@ include: "utils.goml" go-to: "file://" + |DOC_PATH| + "/test_docs/index.html?search=test" wait-for: "#search-tabs" // Waiting for the search.js to load. +wait-for-false: "#search-tabs .count.loading" show-text: true define-function: ( @@ -31,7 +32,7 @@ define-function: ( }, ) assert-css: ( - "#help-button > a", + "rustdoc-toolbar .help-menu > a", { "color": |menu_button_a_color|, "border-color": "transparent", @@ -39,9 +40,9 @@ define-function: ( }, ) // Hover help button. - move-cursor-to: "#help-button" + move-cursor-to: "rustdoc-toolbar .help-menu" assert-css: ( - "#help-button > a", + "rustdoc-toolbar .help-menu > a", { "color": |menu_button_a_color|, "border-color": |menu_button_a_border_hover|, @@ -49,15 +50,15 @@ define-function: ( }, ) // Link color inside - click: "#help-button" + click: "rustdoc-toolbar .help-menu" assert-css: ( - "#help a", + "rustdoc-toolbar #help a", { "color": |menu_a_color|, }, ) assert-css: ( - "#settings-menu > a", + "rustdoc-toolbar .settings-menu > a", { "color": |menu_button_a_color|, "border-color": "transparent", @@ -65,9 +66,9 @@ define-function: ( }, ) // Hover settings menu. - move-cursor-to: "#settings-menu" + move-cursor-to: "rustdoc-toolbar .settings-menu" assert-css: ( - "#settings-menu:hover > a", + "rustdoc-toolbar .settings-menu:hover > a", { "color": |menu_button_a_color|, "border-color": |menu_button_a_border_hover|, @@ -120,8 +121,10 @@ call-function: ( // Check that search input correctly decodes form encoding. go-to: "file://" + |DOC_PATH| + "/test_docs/index.html?search=a+b" wait-for: "#search-tabs" // Waiting for the search.js to load. +wait-for-false: "#search-tabs .count.loading" assert-property: (".search-input", { "value": "a b" }) // Check that literal + is not treated as space. go-to: "file://" + |DOC_PATH| + "/test_docs/index.html?search=a%2Bb" wait-for: "#search-tabs" // Waiting for the search.js to load. +wait-for-false: "#search-tabs .count.loading" assert-property: (".search-input", { "value": "a+b" }) diff --git a/tests/rustdoc-gui/search-input-mobile.goml b/tests/rustdoc-gui/search-input-mobile.goml index adcb3658a27..a383d92d288 100644 --- a/tests/rustdoc-gui/search-input-mobile.goml +++ b/tests/rustdoc-gui/search-input-mobile.goml @@ -2,10 +2,13 @@ // The PR which fixed it is: https://github.com/rust-lang/rust/pull/81592 go-to: "file://" + |DOC_PATH| + "/test_docs/index.html" set-window-size: (463, 700) -// We first check that the search input isn't already focused. -assert-false: ("input.search-input:focus") -click: "input.search-input" +click: "#search-button" +wait-for: ".search-input" +assert: "input.search-input:focus" + +go-to: "file://" + |DOC_PATH| + "/test_docs/index.html" reload: set-window-size: (750, 700) -click: "input.search-input" -assert: ("input.search-input:focus") +click: "#search-button" +wait-for: ".search-input" +assert: "input.search-input:focus" diff --git a/tests/rustdoc-gui/search-keyboard.goml b/tests/rustdoc-gui/search-keyboard.goml index 707bb8f5faa..4adaaa106ea 100644 --- a/tests/rustdoc-gui/search-keyboard.goml +++ b/tests/rustdoc-gui/search-keyboard.goml @@ -1,28 +1,25 @@ // Checks that the search tab results work correctly with function signature syntax // First, try a search-by-name +include: "utils.goml" go-to: "file://" + |DOC_PATH| + "/test_docs/index.html" -write-into: (".search-input", "Foo") -// To be SURE that the search will be run. -press-key: 'Enter' -// Waiting for the search results to appear... -wait-for: "#search-tabs" +call-function: ("perform-search", {"query": "Foo"}) // Now use the keyboard commands to switch to the third result. press-key: "ArrowDown" press-key: "ArrowDown" press-key: "ArrowDown" -assert: ".search-results.active > a:focus:nth-of-type(3)" +wait-for: ".search-results.active > a:focus:nth-of-type(3)" // Now switch to the second tab, then back to the first one, then arrow back up. press-key: "ArrowRight" -assert: ".search-results.active:nth-of-type(2) > a:focus:nth-of-type(1)" +wait-for: ".search-results.active:nth-of-type(2) > a:focus:nth-of-type(1)" press-key: "ArrowLeft" -assert: ".search-results.active:nth-of-type(1) > a:focus:nth-of-type(3)" +wait-for: ".search-results.active:nth-of-type(1) > a:focus:nth-of-type(3)" press-key: "ArrowUp" -assert: ".search-results.active > a:focus:nth-of-type(2)" +wait-for: ".search-results.active > a:focus:nth-of-type(2)" press-key: "ArrowUp" -assert: ".search-results.active > a:focus:nth-of-type(1)" +wait-for: ".search-results.active > a:focus:nth-of-type(1)" press-key: "ArrowUp" -assert: ".search-input:focus" +wait-for: ".search-input:focus" press-key: "ArrowDown" -assert: ".search-results.active > a:focus:nth-of-type(1)" +wait-for: ".search-results.active > a:focus:nth-of-type(1)" diff --git a/tests/rustdoc-gui/search-reexport.goml b/tests/rustdoc-gui/search-reexport.goml index fa9eedeceac..c69464f8bd9 100644 --- a/tests/rustdoc-gui/search-reexport.goml +++ b/tests/rustdoc-gui/search-reexport.goml @@ -6,10 +6,8 @@ call-function: ("switch-theme", {"theme": "dark"}) // First we check that the reexport has the correct ID and no background color. assert-text: ("//*[@id='reexport.TheStdReexport']", "pub use ::std as TheStdReexport;") assert-css: ("//*[@id='reexport.TheStdReexport']", {"background-color": "rgba(0, 0, 0, 0)"}) -write-into: (".search-input", "TheStdReexport") -// To be SURE that the search will be run. -press-key: 'Enter' -wait-for: "//a[@class='result-import']" +call-function: ("perform-search", {"query": "TheStdReexport"}) +assert: "//a[@class='result-import']" assert-attribute: ( "//a[@class='result-import']", {"href": "../test_docs/index.html#reexport.TheStdReexport"}, @@ -21,9 +19,8 @@ wait-for-css: ("//*[@id='reexport.TheStdReexport']", {"background-color": "#494a // We now check that the alias is working as well on the reexport. // To be SURE that the search will be run. -press-key: 'Enter' -write-into: (".search-input", "AliasForTheStdReexport") -wait-for: "//a[@class='result-import']" +call-function: ("perform-search", {"query": "AliasForTheStdReexport"}) +assert: "//a[@class='result-import']" assert-text: ( "a.result-import .result-name", "re-export AliasForTheStdReexport - see test_docs::TheStdReexport", diff --git a/tests/rustdoc-gui/search-result-color.goml b/tests/rustdoc-gui/search-result-color.goml index e6dd504d703..fe0f6401089 100644 --- a/tests/rustdoc-gui/search-result-color.goml +++ b/tests/rustdoc-gui/search-result-color.goml @@ -7,13 +7,15 @@ define-function: ( [ theme, count_color, desc_color, path_color, bottom_border_color, keyword_color, struct_color, associatedtype_color, tymethod_color, method_color, structfield_color, - structfield_hover_color, macro_color, fn_color, hover_path_color, hover_background, grey + structfield_hover_color, macro_color, fn_color, hover_path_color, hover_background, + attribute_color, grey ], block { call-function: ("switch-theme", {"theme": |theme|}) // Waiting for the search results to appear... wait-for: "#search-tabs" + wait-for-false: "#search-tabs .count.loading" assert-css: ( "#search-tabs > button > .count", {"color": |count_color|}, @@ -46,6 +48,11 @@ define-function: ( "hover_color": |keyword_color|, }) call-function: ("check-result-color", { + "result_kind": "attribute", + "color": |attribute_color|, + "hover_color": |attribute_color|, + }) + call-function: ("check-result-color", { "result_kind": "struct", "color": |struct_color|, "hover_color": |struct_color|, @@ -154,6 +161,7 @@ call-function: ("check-search-color", { "path_color": "#0096cf", "bottom_border_color": "#aaa3", "keyword_color": "#39afd7", + "attribute_color": "#39afd7", "struct_color": "#ffa0a5", "associatedtype_color": "#39afd7", "tymethod_color": "#fdd687", @@ -175,6 +183,7 @@ call-function: ("check-search-color", { "path_color": "#ddd", "bottom_border_color": "#aaa3", "keyword_color": "#d2991d", + "attribute_color": "#d2991d", "struct_color": "#2dbfb8", "associatedtype_color": "#d2991d", "tymethod_color": "#2bab63", @@ -196,6 +205,7 @@ call-function: ("check-search-color", { "path_color": "#000", "bottom_border_color": "#aaa3", "keyword_color": "#3873ad", + "attribute_color": "#3873ad", "struct_color": "#ad378a", "associatedtype_color": "#3873ad", "tymethod_color": "#ad7c37", @@ -212,11 +222,7 @@ call-function: ("check-search-color", { // Check the alias. go-to: "file://" + |DOC_PATH| + "/test_docs/index.html" -write-into: (".search-input", "thisisanalias") -// To be SURE that the search will be run. -press-key: 'Enter' -// Waiting for the search results to appear... -wait-for: "#search-tabs" +call-function: ("perform-search", {"query": "thisisanalias"}) define-function: ( "check-alias", diff --git a/tests/rustdoc-gui/search-result-description.goml b/tests/rustdoc-gui/search-result-description.goml index 745ef31e6cb..4ab250b472d 100644 --- a/tests/rustdoc-gui/search-result-description.goml +++ b/tests/rustdoc-gui/search-result-description.goml @@ -2,4 +2,5 @@ go-to: "file://" + |DOC_PATH| + "/test_docs/index.html?search=some_more_function" // Waiting for the search results to appear... wait-for: "#search-tabs" +wait-for-false: "#search-tabs .count.loading" assert-text: (".search-results .desc code", "format!") diff --git a/tests/rustdoc-gui/search-result-display.goml b/tests/rustdoc-gui/search-result-display.goml index 1521267956a..345e08cd578 100644 --- a/tests/rustdoc-gui/search-result-display.goml +++ b/tests/rustdoc-gui/search-result-display.goml @@ -7,6 +7,7 @@ write-into: (".search-input", "test") // To be SURE that the search will be run. press-key: 'Enter' wait-for: "#crate-search" +wait-for-false: "#search-tabs .count.loading" // The width is returned by "getComputedStyle" which returns the exact number instead of the // CSS rule which is "50%"... assert-size: (".search-results div.desc", {"width": 248}) @@ -34,6 +35,7 @@ assert: |new_width| < |width| - 10 // Check that if the search is too long on mobile, it'll go under the "typename". go-to: "file://" + |DOC_PATH| + "/test_docs/index.html?search=SuperIncrediblyLongLongLongLongLongLongLongGigaGigaGigaMegaLongLongLongStructName" wait-for: "#crate-search" +wait-for-false: "#search-tabs .count.loading" compare-elements-position-near: ( ".search-results .result-name .typename", ".search-results .result-name .path", @@ -51,7 +53,7 @@ set-window-size: (900, 900) // First we check the current width, height and position. assert-css: ("#crate-search", {"width": "159px"}) -store-size: (".search-results-title", { +store-size: (".search-switcher", { "height": search_results_title_height, "width": search_results_title_width, }) @@ -64,8 +66,8 @@ set-text: ( ) // Then we compare again to confirm the height didn't change. -assert-size: ("#crate-search", {"width": 370}) -assert-size: (".search-results-title", { +assert-size: ("#crate-search", {"width": 185}) +assert-size: (".search-switcher", { "height": |search_results_title_height|, }) assert-css: ("#search", {"width": "640px"}) @@ -79,6 +81,7 @@ define-function: ( block { call-function: ("switch-theme", {"theme": |theme|}) wait-for: "#crate-search" + wait-for-false: "#search-tabs .count.loading" assert-css: ("#crate-search", {"border": "1px solid " + |border|}) assert-css: ("#crate-search-div::after", {"filter": |filter|}) move-cursor-to: "#crate-search" diff --git a/tests/rustdoc-gui/search-result-go-to-first.goml b/tests/rustdoc-gui/search-result-go-to-first.goml index 136213c517e..acb25453171 100644 --- a/tests/rustdoc-gui/search-result-go-to-first.goml +++ b/tests/rustdoc-gui/search-result-go-to-first.goml @@ -9,6 +9,7 @@ assert-text-false: (".main-heading h1", "Struct test_docs::FooCopy item path") go-to: "file://" + |DOC_PATH| + "/test_docs/index.html?search=struct%3AFoo" // Waiting for the search results to appear... wait-for: "#search-tabs" +wait-for-false: "#search-tabs .count.loading" assert-text-false: (".main-heading h1", "Struct test_docs::FooCopy item path") // Ensure that the search results are displayed, not the "normal" content. assert-css: ("#main-content", {"display": "none"}) @@ -17,4 +18,4 @@ assert-css: ("#main-content", {"display": "none"}) go-to: "file://" + |DOC_PATH| + "/test_docs/index.html?search=struct%3AFoo&go_to_first=true" // Waiting for the page to load... wait-for-text: (".main-heading .rustdoc-breadcrumbs", "test_docs") -wait-for-text: (".main-heading h1", "Struct FooCopy item path") +wait-for-text: (".main-heading h1", "Struct Foo Copy item path") diff --git a/tests/rustdoc-gui/search-result-impl-disambiguation.goml b/tests/rustdoc-gui/search-result-impl-disambiguation.goml index bca52b46498..e39b90a735e 100644 --- a/tests/rustdoc-gui/search-result-impl-disambiguation.goml +++ b/tests/rustdoc-gui/search-result-impl-disambiguation.goml @@ -1,15 +1,12 @@ // ignore-tidy-linelength +include: "utils.goml" // Checks that, if a type has two methods with the same name, they both get // linked correctly. go-to: "file://" + |DOC_PATH| + "/test_docs/index.html" // This should link to the inherent impl -write-into: (".search-input", "ZyxwvutMethodDisambiguation -> bool") -// To be SURE that the search will be run. -press-key: 'Enter' -// Waiting for the search results to appear... -wait-for: "#search-tabs" +call-function: ("perform-search", {"query": "ZyxwvutMethodDisambiguation -> bool"}) // Check the disambiguated link. assert-count: ("a.result-method", 1) assert-attribute: ("a.result-method", { @@ -25,11 +22,7 @@ assert: "section:target" go-to: "file://" + |DOC_PATH| + "/test_docs/index.html" // This should link to the trait impl -write-into: (".search-input", "ZyxwvutMethodDisambiguation, usize -> usize") -// To be SURE that the search will be run. -press-key: 'Enter' -// Waiting for the search results to appear... -wait-for: "#search-tabs" +call-function: ("perform-search", {"query": "ZyxwvutMethodDisambiguation, usize -> usize"}) // Check the disambiguated link. assert-count: ("a.result-method", 1) assert-attribute: ("a.result-method", { @@ -47,6 +40,7 @@ assert: "section:target" // impl block's disambiguator is also acted upon. go-to: "file://" + |DOC_PATH| + "/lib2/index.html?search=MultiImplBlockStruct->bool" wait-for: "#search-tabs" +wait-for-false: "#search-tabs .count.loading" assert-count: ("a.result-method", 1) assert-attribute: ("a.result-method", { "href": "../lib2/another_mod/struct.MultiImplBlockStruct.html#impl-MultiImplBlockStruct/method.second_fn" @@ -56,6 +50,7 @@ wait-for: "details:has(summary > #impl-MultiImplBlockStruct-1) > div section[id= go-to: "file://" + |DOC_PATH| + "/lib2/index.html?search=MultiImplBlockStruct->u32" wait-for: "#search-tabs" +wait-for-false: "#search-tabs .count.loading" assert-count: ("a.result-method", 1) assert-attribute: ("a.result-method", { "href": "../lib2/another_mod/struct.MultiImplBlockStruct.html#impl-MultiImplBlockTrait-for-MultiImplBlockStruct/method.second_fn" diff --git a/tests/rustdoc-gui/search-result-keyword.goml b/tests/rustdoc-gui/search-result-keyword.goml index 02305f2587c..d9bdf6d0135 100644 --- a/tests/rustdoc-gui/search-result-keyword.goml +++ b/tests/rustdoc-gui/search-result-keyword.goml @@ -1,8 +1,5 @@ // Checks that the "keyword" results have the expected text alongside them. +include: "utils.goml" go-to: "file://" + |DOC_PATH| + "/test_docs/index.html" -write-into: (".search-input", "for") -// To be SURE that the search will be run. -press-key: 'Enter' -// Waiting for the search results to appear... -wait-for: "#search-tabs" +call-function: ("perform-search", {"query": "for"}) assert-text: (".result-keyword .result-name", "keyword for") diff --git a/tests/rustdoc-gui/search-tab-change-title-fn-sig.goml b/tests/rustdoc-gui/search-tab-change-title-fn-sig.goml index 7e26229ec6e..7bd283c5739 100644 --- a/tests/rustdoc-gui/search-tab-change-title-fn-sig.goml +++ b/tests/rustdoc-gui/search-tab-change-title-fn-sig.goml @@ -1,11 +1,9 @@ // Checks that the search tab results work correctly with function signature syntax // First, try a search-by-name +include: "utils.goml" go-to: "file://" + |DOC_PATH| + "/test_docs/index.html" -write-into: (".search-input", "Foo") -// To be SURE that the search will be run. -press-key: 'Enter' -// Waiting for the search results to appear... -wait-for: "#search-tabs" +call-function: ("perform-search", {"query": "Foo"}) + assert-attribute: ("#search-tabs > button:nth-of-type(1)", {"class": "selected"}) assert-text: ("#search-tabs > button:nth-of-type(1)", "In Names", STARTS_WITH) assert: "input.search-input:focus" @@ -23,11 +21,7 @@ wait-for-attribute: ("#search-tabs > button:nth-of-type(3)", {"class": "selected // Now try search-by-return go-to: "file://" + |DOC_PATH| + "/test_docs/index.html" -write-into: (".search-input", "-> String") -// To be SURE that the search will be run. -press-key: 'Enter' -// Waiting for the search results to appear... -wait-for: "#search-tabs" +call-function: ("perform-search", {"query": "-> String"}) assert-attribute: ("#search-tabs > button:nth-of-type(1)", {"class": "selected"}) assert-text: ("#search-tabs > button:nth-of-type(1)", "In Function Return Types", STARTS_WITH) assert: "input.search-input:focus" @@ -45,30 +39,18 @@ wait-for-attribute: ("#search-tabs > button:nth-of-type(1)", {"class": "selected // Try with a search-by-return with no results go-to: "file://" + |DOC_PATH| + "/test_docs/index.html" -write-into: (".search-input", "-> Something") -// To be SURE that the search will be run. -press-key: 'Enter' -// Waiting for the search results to appear... -wait-for: "#search-tabs" +call-function: ("perform-search", {"query": "-> Something"}) assert-attribute: ("#search-tabs > button:nth-of-type(1)", {"class": "selected"}) assert-text: ("#search-tabs > button:nth-of-type(1)", "In Function Return Types", STARTS_WITH) // Try with a search-by-parameter go-to: "file://" + |DOC_PATH| + "/test_docs/index.html" -write-into: (".search-input", "usize,pattern") -// To be SURE that the search will be run. -press-key: 'Enter' -// Waiting for the search results to appear... -wait-for: "#search-tabs" +call-function: ("perform-search", {"query": "usize,pattern"}) assert-attribute: ("#search-tabs > button:nth-of-type(1)", {"class": "selected"}) assert-text: ("#search-tabs > button:nth-of-type(1)", "In Function Parameters", STARTS_WITH) // Try with a search-by-parameter-and-return go-to: "file://" + |DOC_PATH| + "/test_docs/index.html" -write-into: (".search-input", "pattern -> str") -// To be SURE that the search will be run. -press-key: 'Enter' -// Waiting for the search results to appear... -wait-for: "#search-tabs" +call-function: ("perform-search", {"query": "pattern -> str"}) assert-attribute: ("#search-tabs > button:nth-of-type(1)", {"class": "selected"}) assert-text: ("#search-tabs > button:nth-of-type(1)", "In Function Signatures", STARTS_WITH) diff --git a/tests/rustdoc-gui/search-tab.goml b/tests/rustdoc-gui/search-tab.goml index 826e272e508..00ca952033d 100644 --- a/tests/rustdoc-gui/search-tab.goml +++ b/tests/rustdoc-gui/search-tab.goml @@ -15,7 +15,8 @@ define-function: ( focus: ".search-input" press-key: "Enter" - wait-for: "#search-tabs" + wait-for: "#search-tabs .count" + wait-for-false: "#search-tabs .count.loading" assert-css: ("#search-tabs > button:not(.selected)", { "background-color": |background|, "border-bottom": |border_bottom|, diff --git a/tests/rustdoc-gui/search-title.goml b/tests/rustdoc-gui/search-title.goml index 95bc36af449..83321a05f2b 100644 --- a/tests/rustdoc-gui/search-title.goml +++ b/tests/rustdoc-gui/search-title.goml @@ -5,10 +5,7 @@ go-to: "file://" + |DOC_PATH| + "/test_docs/index.html" store-value: (title, "test_docs - Rust") assert-document-property: {"title": |title|} -write-into: (".search-input", "test") -// To be SURE that the search will be run. -press-key: 'Enter' -wait-for: "#crate-search" +call-function: ("perform-search", {"query": "test"}) assert-document-property: {"title": '"test" Search - Rust'} @@ -16,6 +13,7 @@ set-property: (".search-input", {"value": "another one"}) // To be SURE that the search will be run. press-key: 'Enter' wait-for: "#crate-search" +wait-for-false: "#search-tabs .count.loading" assert-document-property: {"title": '"another one" Search - Rust'} diff --git a/tests/rustdoc-gui/setting-auto-hide-content-large-items.goml b/tests/rustdoc-gui/setting-auto-hide-content-large-items.goml index 9afde7c61da..342bd726694 100644 --- a/tests/rustdoc-gui/setting-auto-hide-content-large-items.goml +++ b/tests/rustdoc-gui/setting-auto-hide-content-large-items.goml @@ -9,7 +9,7 @@ define-function: ( [storage_value, setting_attribute_value, toggle_attribute_value], block { assert-local-storage: {"rustdoc-auto-hide-large-items": |storage_value|} - click: "#settings-menu" + click: "rustdoc-toolbar .settings-menu" wait-for: "#settings" assert-property: ("#auto-hide-large-items", {"checked": |setting_attribute_value|}) assert-attribute: (".item-decl .type-contents-toggle", {"open": |toggle_attribute_value|}) diff --git a/tests/rustdoc-gui/setting-auto-hide-item-methods-docs.goml b/tests/rustdoc-gui/setting-auto-hide-item-methods-docs.goml index 644396ed578..02d4ce8855f 100644 --- a/tests/rustdoc-gui/setting-auto-hide-item-methods-docs.goml +++ b/tests/rustdoc-gui/setting-auto-hide-item-methods-docs.goml @@ -6,7 +6,7 @@ define-function: ( [storage_value, setting_attribute_value, toggle_attribute_value], block { assert-local-storage: {"rustdoc-auto-hide-method-docs": |storage_value|} - click: "#settings-menu" + click: "rustdoc-toolbar .settings-menu" wait-for: "#settings" assert-property: ("#auto-hide-method-docs", {"checked": |setting_attribute_value|}) assert-attribute: (".toggle.method-toggle", {"open": |toggle_attribute_value|}) diff --git a/tests/rustdoc-gui/setting-auto-hide-trait-implementations.goml b/tests/rustdoc-gui/setting-auto-hide-trait-implementations.goml index 3c09198dae5..4af1e829b31 100644 --- a/tests/rustdoc-gui/setting-auto-hide-trait-implementations.goml +++ b/tests/rustdoc-gui/setting-auto-hide-trait-implementations.goml @@ -5,7 +5,7 @@ define-function: ( [storage_value, setting_attribute_value, toggle_attribute_value], block { assert-local-storage: {"rustdoc-auto-hide-trait-implementations": |storage_value|} - click: "#settings-menu" + click: "rustdoc-toolbar .settings-menu" wait-for: "#settings" assert-property: ("#auto-hide-trait-implementations", {"checked": |setting_attribute_value|}) assert-attribute: ("#trait-implementations-list > details", {"open": |toggle_attribute_value|}, ALL) diff --git a/tests/rustdoc-gui/setting-go-to-only-result.goml b/tests/rustdoc-gui/setting-go-to-only-result.goml index f8535477c22..5a9c81e0b83 100644 --- a/tests/rustdoc-gui/setting-go-to-only-result.goml +++ b/tests/rustdoc-gui/setting-go-to-only-result.goml @@ -5,7 +5,7 @@ define-function: ( [storage_value, setting_attribute_value], block { assert-local-storage: {"rustdoc-go-to-only-result": |storage_value|} - click: "#settings-menu" + click: "rustdoc-toolbar .settings-menu" wait-for: "#settings" assert-property: ("#go-to-only-result", {"checked": |setting_attribute_value|}) } @@ -25,7 +25,7 @@ wait-for: "#search" assert-document-property: ({"URL": "/lib2/index.html"}, CONTAINS) // Now we change its value. -click: "#settings-menu" +click: "rustdoc-toolbar .settings-menu" wait-for: "#settings" click: "#go-to-only-result" assert-local-storage: {"rustdoc-go-to-only-result": "true"} diff --git a/tests/rustdoc-gui/settings-button.goml b/tests/rustdoc-gui/settings-button.goml index d78034769e2..28ce06207aa 100644 --- a/tests/rustdoc-gui/settings-button.goml +++ b/tests/rustdoc-gui/settings-button.goml @@ -9,7 +9,7 @@ define-function: ( [theme, filter], block { call-function: ("switch-theme", {"theme": |theme|}) - assert-css: ("#settings-menu > a::before", { + assert-css: ("rustdoc-toolbar .settings-menu > a::before", { "filter": |filter|, "width": "18px", "height": "18px", diff --git a/tests/rustdoc-gui/settings.goml b/tests/rustdoc-gui/settings.goml index 11d3696ccf6..7a163103b5a 100644 --- a/tests/rustdoc-gui/settings.goml +++ b/tests/rustdoc-gui/settings.goml @@ -5,7 +5,7 @@ show-text: true // needed when we check for colors below. // First, we check that the settings page doesn't exist. assert-false: "#settings" // We now click on the settings button. -click: "#settings-menu" +click: "rustdoc-toolbar .settings-menu" wait-for: "#settings" assert-css: ("#settings", {"display": "block"}) @@ -13,11 +13,11 @@ assert-css: ("#settings", {"display": "block"}) store-css: (".setting-line", {"margin": setting_line_margin}) // Let's close it by clicking on the same button. -click: "#settings-menu" +click: "rustdoc-toolbar .settings-menu" wait-for-css: ("#settings", {"display": "none"}) // Let's check that pressing "ESCAPE" is closing it. -click: "#settings-menu" +click: "rustdoc-toolbar .settings-menu" wait-for-css: ("#settings", {"display": "block"}) press-key: "Escape" wait-for-css: ("#settings", {"display": "none"}) @@ -28,7 +28,7 @@ write: "test" // To be SURE that the search will be run. press-key: 'Enter' wait-for: "#alternative-display #search" -click: "#settings-menu" +click: "rustdoc-toolbar .settings-menu" wait-for-css: ("#settings", {"display": "block"}) // Ensure that the search is still displayed. wait-for: "#alternative-display #search" @@ -41,7 +41,7 @@ set-local-storage: {"rustdoc-theme": "dark", "rustdoc-use-system-theme": "false" // We reload the page so the local storage settings are being used. reload: -click: "#settings-menu" +click: "rustdoc-toolbar .settings-menu" wait-for: "#settings" // We check that the "Use system theme" is disabled. @@ -55,7 +55,7 @@ assert: "#preferred-light-theme.setting-line.hidden" assert-property: ("#theme .setting-radio-choices #theme-dark", {"checked": "true"}) // Some style checks... -move-cursor-to: "#settings-menu > a" +move-cursor-to: "rustdoc-toolbar .settings-menu > a" // First we check the "default" display for radio buttons. assert-css: ( "#theme-dark", @@ -194,7 +194,7 @@ assert-css: ( "border-width": "2px", }, ) -move-cursor-to: "#settings-menu > a" +move-cursor-to: "rustdoc-toolbar .settings-menu > a" // Let's now check with the focus for toggles. focus: "#auto-hide-large-items" assert-css: ( @@ -273,43 +273,43 @@ assert-local-storage: {"rustdoc-disable-shortcuts": "true"} press-key: "Escape" press-key: "?" assert-false: "#help-button .popover" -wait-for-css: ("#settings-menu .popover", {"display": "block"}) +wait-for-css: ("rustdoc-toolbar .settings-menu .popover", {"display": "block"}) // Now turn keyboard shortcuts back on, and see if they work. click: "#disable-shortcuts" assert-local-storage: {"rustdoc-disable-shortcuts": "false"} press-key: "Escape" press-key: "?" -wait-for-css: ("#help-button .popover", {"display": "block"}) -assert-css: ("#settings-menu .popover", {"display": "none"}) +wait-for-css: ("rustdoc-toolbar .help-menu .popover", {"display": "block"}) +assert-css: ("rustdoc-toolbar .settings-menu .popover", {"display": "none"}) // Now switch back to the settings popover, and make sure the keyboard // shortcut works when a check box is selected. -click: "#settings-menu > a" -wait-for-css: ("#settings-menu .popover", {"display": "block"}) +click: "rustdoc-toolbar .settings-menu > a" +wait-for-css: ("rustdoc-toolbar .settings-menu .popover", {"display": "block"}) focus: "#auto-hide-large-items" press-key: "?" -wait-for-css: ("#settings-menu .popover", {"display": "none"}) -wait-for-css: ("#help-button .popover", {"display": "block"}) +wait-for-css: ("rustdoc-toolbar .settings-menu .popover", {"display": "none"}) +wait-for-css: ("rustdoc-toolbar .help-menu .popover", {"display": "block"}) // Now switch back to the settings popover, and make sure the keyboard // shortcut works when a check box is selected. -click: "#settings-menu > a" -wait-for-css: ("#settings-menu .popover", {"display": "block"}) -wait-for-css: ("#help-button .popover", {"display": "none"}) +click: "rustdoc-toolbar .settings-menu > a" +wait-for-css: ("rustdoc-toolbar .settings-menu .popover", {"display": "block"}) +assert-false: "rustdoc-toolbar .help-menu .popover" focus: "#theme-system-preference" press-key: "?" -wait-for-css: ("#settings-menu .popover", {"display": "none"}) -wait-for-css: ("#help-button .popover", {"display": "block"}) +wait-for-css: ("rustdoc-toolbar .settings-menu .popover", {"display": "none"}) +wait-for-css: ("rustdoc-toolbar .help-menu .popover", {"display": "block"}) // Now we go to the settings page to check that the CSS is loaded as expected. go-to: "file://" + |DOC_PATH| + "/settings.html" wait-for: "#settings" -assert-false: "#settings-menu" +assert-false: "rustdoc-toolbar .settings-menu" assert-css: (".setting-radio", {"cursor": "pointer"}) assert-attribute-false: ("#settings", {"class": "popover"}, CONTAINS) -compare-elements-position: (".sub form", "#settings", ["x"]) +compare-elements-position: (".main-heading", "#settings", ["x"]) // Check that setting-line has the same margin in this mode as in the popover. assert-css: (".setting-line", {"margin": |setting_line_margin|}) diff --git a/tests/rustdoc-gui/shortcuts.goml b/tests/rustdoc-gui/shortcuts.goml index 5a6171d6f76..b27cf8c407d 100644 --- a/tests/rustdoc-gui/shortcuts.goml +++ b/tests/rustdoc-gui/shortcuts.goml @@ -8,9 +8,9 @@ press-key: "Escape" assert-false: "input.search-input:focus" // We now check for the help popup. press-key: "?" -assert-css: ("#help-button .popover", {"display": "block"}) +assert-css: ("rustdoc-toolbar .help-menu .popover", {"display": "block"}) press-key: "Escape" -assert-css: ("#help-button .popover", {"display": "none"}) +assert-false: "rustdoc-toolbar .help-menu .popover" // Checking doc collapse and expand. // It should be displaying a "-": assert-text: ("#toggle-all-docs", "Summary") diff --git a/tests/rustdoc-gui/sidebar-links-color.goml b/tests/rustdoc-gui/sidebar-links-color.goml index 57c45555a76..9a398655f8f 100644 --- a/tests/rustdoc-gui/sidebar-links-color.goml +++ b/tests/rustdoc-gui/sidebar-links-color.goml @@ -12,6 +12,7 @@ define-function: ( enum_hover_background, union, union_hover, union_hover_background, trait, trait_hover, trait_hover_background, fn, fn_hover, fn_hover_background, type, type_hover, type_hover_background, keyword, keyword_hover, keyword_hover_background, + attribute, attribute_hover, attribute_hover_background, ], block { call-function: ("switch-theme", {"theme": |theme|}) @@ -85,6 +86,16 @@ define-function: ( ".sidebar .block.keyword a:hover", {"color": |keyword_hover|, "background-color": |keyword_hover_background|}, ) + // Attribute + assert-css: ( + ".sidebar .block.attribute a", + {"color": |attribute|, "background-color": "rgba(0, 0, 0, 0)"}, + ) + move-cursor-to: ".sidebar .block.attribute a" + assert-css: ( + ".sidebar .block.attribute a:hover", + {"color": |attribute_hover|, "background-color": |attribute_hover_background|}, + ) } ) @@ -113,6 +124,9 @@ call-function: ( "keyword": "#53b1db", "keyword_hover": "#ffb44c", "keyword_hover_background": "transparent", + "attribute": "#53b1db", + "attribute_hover": "#ffb44c", + "attribute_hover_background": "transparent", } ) call-function: ( @@ -140,6 +154,9 @@ call-function: ( "keyword": "#fdbf35", "keyword_hover": "#fdbf35", "keyword_hover_background": "#444", + "attribute": "#fdbf35", + "attribute_hover": "#fdbf35", + "attribute_hover_background": "#444", } ) call-function: ( @@ -167,5 +184,8 @@ call-function: ( "keyword": "#356da4", "keyword_hover": "#356da4", "keyword_hover_background": "#fff", + "attribute": "#356da4", + "attribute_hover": "#356da4", + "attribute_hover_background": "#fff", } ) diff --git a/tests/rustdoc-gui/sidebar-mobile.goml b/tests/rustdoc-gui/sidebar-mobile.goml index 6ddc07c6481..f828516d762 100644 --- a/tests/rustdoc-gui/sidebar-mobile.goml +++ b/tests/rustdoc-gui/sidebar-mobile.goml @@ -17,7 +17,7 @@ assert-css: (".sidebar", {"display": "block", "left": "-1000px"}) focus: ".sidebar-elems h3 a" assert-css: (".sidebar", {"display": "block", "left": "0px"}) // When we tab out of the sidebar, close it. -focus: ".search-input" +focus: "#search-button" assert-css: (".sidebar", {"display": "block", "left": "-1000px"}) // Open the sidebar menu. @@ -43,7 +43,7 @@ press-key: "Escape" assert-css: (".sidebar", {"display": "block", "left": "-1000px"}) // Check that the topbar is visible -assert-property: (".mobile-topbar", {"clientHeight": "45"}) +assert-property: ("rustdoc-topbar", {"clientHeight": "45"}) // Check that clicking an element from the sidebar scrolls to the right place // so the target is not obscured by the topbar. @@ -54,7 +54,7 @@ assert-position: ("#method\.must_use", {"y": 46}) // Check that the bottom-most item on the sidebar menu can be scrolled fully into view. click: ".sidebar-menu-toggle" scroll-to: ".block.keyword li:nth-child(1)" -compare-elements-position-near: (".block.keyword li:nth-child(1)", ".mobile-topbar", {"y": 544}) +compare-elements-position-near: (".block.keyword li:nth-child(1)", "rustdoc-topbar", {"y": 544}) // Now checking the background color of the sidebar. // Close the sidebar menu. @@ -65,7 +65,7 @@ define-function: ( "check-colors", [theme, color, background], block { - call-function: ("switch-theme", {"theme": |theme|}) + call-function: ("switch-theme-mobile", {"theme": |theme|}) reload: // Open the sidebar menu. diff --git a/tests/rustdoc-gui/sidebar-resize-close-popover.goml b/tests/rustdoc-gui/sidebar-resize-close-popover.goml index 2d26caf1a39..d3fea9b0f40 100644 --- a/tests/rustdoc-gui/sidebar-resize-close-popover.goml +++ b/tests/rustdoc-gui/sidebar-resize-close-popover.goml @@ -2,7 +2,7 @@ go-to: "file://" + |DOC_PATH| + "/test_docs/index.html" assert-property: (".sidebar", {"clientWidth": "199"}) show-text: true -click: "#settings-menu" +click: "rustdoc-toolbar .settings-menu" wait-for: "#settings" assert-css: ("#settings", {"display": "block"}) // normal resizing @@ -12,7 +12,7 @@ assert-css: ("#settings", {"display": "none"}) // Now same thing, but for source code go-to: "file://" + |DOC_PATH| + "/src/test_docs/lib.rs.html" -click: "#settings-menu" +click: "rustdoc-toolbar .settings-menu" wait-for: "#settings" assert-css: ("#settings", {"display": "block"}) assert-property: (".sidebar", {"clientWidth": "49"}) diff --git a/tests/rustdoc-gui/sidebar-resize-setting.goml b/tests/rustdoc-gui/sidebar-resize-setting.goml index e346fe6aeac..a4572c670f8 100644 --- a/tests/rustdoc-gui/sidebar-resize-setting.goml +++ b/tests/rustdoc-gui/sidebar-resize-setting.goml @@ -4,7 +4,7 @@ assert-property: (".sidebar", {"clientWidth": "199"}) show-text: true // Verify that the "hide" option is unchecked -click: "#settings-menu" +click: "rustdoc-toolbar .settings-menu" wait-for: "#settings" assert-css: ("#settings", {"display": "block"}) assert-property: ("#hide-sidebar", {"checked": "false"}) @@ -15,7 +15,7 @@ drag-and-drop: ((205, 100), (5, 100)) assert-css: (".sidebar", {"display": "none"}) // Verify that the "hide" option is checked -focus: "#settings-menu a" +focus: "rustdoc-toolbar .settings-menu a" press-key: "Enter" wait-for-css: ("#settings", {"display": "block"}) assert-property: ("#hide-sidebar", {"checked": "true"}) @@ -24,28 +24,28 @@ wait-for-css: (".sidebar", {"display": "block"}) // Verify that hiding the sidebar hides the source sidebar // and puts the button in static position mode on mobile -go-to: "file://" + |DOC_PATH| + "/src/test_docs/lib.rs.html" +go-to: "file://" + |DOC_PATH| + "/test_docs/index.html" set-window-size: (600, 600) -focus: "#settings-menu a" +focus: "rustdoc-topbar .settings-menu a" press-key: "Enter" wait-for-css: ("#settings", {"display": "block"}) +wait-for-css: ("#sidebar-button", {"position": "static"}) +assert-property: ("#hide-sidebar", {"checked": "false"}) +click: "#hide-sidebar" +wait-for-css: (".sidebar", {"display": "none"}) wait-for-css: ("#sidebar-button", {"position": "fixed"}) store-position: ("#sidebar-button", { "y": sidebar_button_y, "x": sidebar_button_x, }) -assert-property: ("#hide-sidebar", {"checked": "false"}) -click: "#hide-sidebar" -wait-for-css: (".sidebar", {"display": "none"}) -wait-for-css: ("#sidebar-button", {"position": "static"}) -assert-position: ("#sidebar-button", { - "y": |sidebar_button_y|, - "x": |sidebar_button_x|, -}) assert-property: ("#hide-sidebar", {"checked": "true"}) press-key: "Escape" // Clicking the sidebar button should work, and implicitly re-enable // the persistent navigation bar wait-for-css: ("#settings", {"display": "none"}) +assert-position: ("#sidebar-button", { + "y": |sidebar_button_y|, + "x": |sidebar_button_x|, +}) click: "#sidebar-button" wait-for-css: (".sidebar", {"display": "block"}) diff --git a/tests/rustdoc-gui/sidebar-source-code-display.goml b/tests/rustdoc-gui/sidebar-source-code-display.goml index 1e77bcc2273..99810cd7863 100644 --- a/tests/rustdoc-gui/sidebar-source-code-display.goml +++ b/tests/rustdoc-gui/sidebar-source-code-display.goml @@ -141,7 +141,7 @@ click: "#sidebar-button" wait-for-css: (".src .sidebar > *", {"visibility": "hidden"}) // We scroll to line 117 to change the scroll position. scroll-to: '//*[@id="117"]' -store-value: (y_offset, "2578") +store-value: (y_offset, "2567") assert-window-property: {"pageYOffset": |y_offset|} // Expanding the sidebar... click: "#sidebar-button" diff --git a/tests/rustdoc-gui/sidebar-source-code.goml b/tests/rustdoc-gui/sidebar-source-code.goml index 6afccf6a95f..3f6914a89d6 100644 --- a/tests/rustdoc-gui/sidebar-source-code.goml +++ b/tests/rustdoc-gui/sidebar-source-code.goml @@ -71,7 +71,7 @@ assert: "//*[@class='dir-entry' and @open]/*[normalize-space()='sub_mod']" // Only "another_folder" should be "open" in "lib2". assert: "//*[@class='dir-entry' and not(@open)]/*[normalize-space()='another_mod']" // All other trees should be collapsed. -assert-count: ("//*[@id='src-sidebar']/details[not(normalize-space()='lib2') and not(@open)]", 11) +assert-count: ("//*[@id='src-sidebar']/details[not(normalize-space()='lib2') and not(@open)]", 12) // We now switch to mobile mode. set-window-size: (600, 600) @@ -85,4 +85,4 @@ assert-false: ".src-sidebar-expanded" assert: "nav.sidebar" // Check that the topbar is not visible -assert-false: ".mobile-topbar" +assert-false: "rustdoc-topbar" diff --git a/tests/rustdoc-gui/sidebar.goml b/tests/rustdoc-gui/sidebar.goml index c0fe240e2be..5ec0008ad8a 100644 --- a/tests/rustdoc-gui/sidebar.goml +++ b/tests/rustdoc-gui/sidebar.goml @@ -200,7 +200,7 @@ drag-and-drop: ((205, 100), (108, 100)) assert-position: (".sidebar-crate > h2 > a", {"x": -3}) // Check that the mobile sidebar and the source sidebar use the same icon. -store-css: (".mobile-topbar .sidebar-menu-toggle::before", {"content": image_url}) +store-css: ("rustdoc-topbar .sidebar-menu-toggle::before", {"content": image_url}) // Then we go to a source page. click: ".main-heading .src" assert-css: ("#sidebar-button a::before", {"content": |image_url|}) @@ -212,7 +212,7 @@ assert: |sidebar_background| != |sidebar_background_hover| click: "#sidebar-button a" wait-for: "html.src-sidebar-expanded" assert-css: ("#sidebar-button a:hover", {"background-color": |sidebar_background_hover|}) -move-cursor-to: "#settings-menu" +move-cursor-to: "#search-button" assert-css: ("#sidebar-button a:not(:hover)", {"background-color": |sidebar_background|}) // Closing sidebar. click: "#sidebar-button a" @@ -220,7 +220,7 @@ wait-for: "html:not(.src-sidebar-expanded)" // Now we check the same when the sidebar button is moved alongside the search. set-window-size: (500, 500) store-css: ("#sidebar-button a:hover", {"background-color": not_sidebar_background_hover}) -move-cursor-to: "#settings-menu" +move-cursor-to: "rustdoc-toolbar #search-button" store-css: ("#sidebar-button a:not(:hover)", {"background-color": not_sidebar_background}) // The sidebar background is supposed to be the same as the main background. assert-css: ("body", {"background-color": |not_sidebar_background|}) diff --git a/tests/rustdoc-gui/source-anchor-scroll.goml b/tests/rustdoc-gui/source-anchor-scroll.goml index c005af1e7a1..b1cbd02ef04 100644 --- a/tests/rustdoc-gui/source-anchor-scroll.goml +++ b/tests/rustdoc-gui/source-anchor-scroll.goml @@ -8,13 +8,13 @@ set-window-size: (600, 800) assert-property: ("html", {"scrollTop": "0"}) click: '//a[text() = "barbar" and @href="#5-7"]' -assert-property: ("html", {"scrollTop": "206"}) +assert-property: ("html", {"scrollTop": "195"}) click: '//a[text() = "bar" and @href="#28-36"]' -assert-property: ("html", {"scrollTop": "239"}) +assert-property: ("html", {"scrollTop": "228"}) click: '//a[normalize-space() = "sub_fn" and @href="#2-4"]' -assert-property: ("html", {"scrollTop": "134"}) +assert-property: ("html", {"scrollTop": "123"}) // We now check that clicking on lines doesn't change the scroll // Extra information: the "sub_fn" function header is on line 1. click: '//*[@id="6"]' -assert-property: ("html", {"scrollTop": "134"}) +assert-property: ("html", {"scrollTop": "123"}) diff --git a/tests/rustdoc-gui/source-code-page.goml b/tests/rustdoc-gui/source-code-page.goml index aa5a16aac70..5e3470dca20 100644 --- a/tests/rustdoc-gui/source-code-page.goml +++ b/tests/rustdoc-gui/source-code-page.goml @@ -89,9 +89,9 @@ assert-css: ("a[data-nosnippet]", {"text-align": "right"}, ALL) // do anything (and certainly not add a `#NaN` to the URL!). go-to: "file://" + |DOC_PATH| + "/src/test_docs/lib.rs.html" // We use this assert-position to know where we will click. -assert-position: ("//*[@id='1']", {"x": 81, "y": 169}) -// We click on the left of the "1" anchor but still in the `a[data-nosnippet]`. -click: (77, 163) +assert-position: ("//*[@id='1']", {"x": 81, "y": 141}) +// We click on the left of the "1" anchor but still in the "src-line-number" `<pre>`. +click: (135, 77) assert-document-property: ({"URL": "/lib.rs.html"}, ENDS_WITH) // Checking the source code sidebar. @@ -156,27 +156,8 @@ call-function: ("check-sidebar-dir-entry", { "y": |source_sidebar_title_y| + |source_sidebar_title_height| + 7, }) -// Check the search form -assert-css: ("nav.sub", {"flex-direction": "row"}) -// The goal of this test is to ensure the search input is perfectly centered -// between the top of the page and the header. -// To check this, we maintain the invariant: -// -// offsetTop[nav.sub form] = offsetTop[#main-content] - offsetHeight[nav.sub form] - offsetTop[nav.sub form] -assert-position: ("nav.sub form", {"y": 15}) -assert-property: ("nav.sub form", {"offsetHeight": 34}) -assert-position: ("h1", {"y": 68}) -// 15 = 64 - 34 - 15 - -// Now do the same check on moderately-sized, tablet mobile. -set-window-size: (700, 700) -assert-css: ("nav.sub", {"flex-direction": "row"}) -assert-position: ("nav.sub form", {"y": 8}) -assert-property: ("nav.sub form", {"offsetHeight": 34}) -assert-position: ("h1", {"y": 54}) -// 8 = 50 - 34 - 8 - // Check the sidebar directory entries have a marker and spacing (tablet). +set-window-size: (700, 700) store-property: (".src-sidebar-title", { "offsetHeight": source_sidebar_title_height, "offsetTop": source_sidebar_title_y, @@ -187,11 +168,8 @@ call-function: ("check-sidebar-dir-entry", { "y": |source_sidebar_title_y| + |source_sidebar_title_height| + 7, }) -// Tiny, phone mobile gets a different display where the logo is stacked on top. -set-window-size: (450, 700) -assert-css: ("nav.sub", {"flex-direction": "column"}) - // Check the sidebar directory entries have a marker and spacing (phone). +set-window-size: (450, 700) store-property: (".src-sidebar-title", { "offsetHeight": source_sidebar_title_height, "offsetTop": source_sidebar_title_y, diff --git a/tests/rustdoc-gui/source-code-wrapping.goml b/tests/rustdoc-gui/source-code-wrapping.goml index 0dab9c72ea9..c1fc2835c89 100644 --- a/tests/rustdoc-gui/source-code-wrapping.goml +++ b/tests/rustdoc-gui/source-code-wrapping.goml @@ -13,7 +13,7 @@ define-function: ( ) store-size: (".rust code", {"width": width, "height": height}) -click: "#settings-menu" +click: "main .settings-menu" wait-for: "#settings" call-function: ("click-code-wrapping", {"expected": "true"}) wait-for-size-false: (".rust code", {"width": |width|, "height": |height|}) @@ -28,7 +28,7 @@ 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" +click: "main .settings-menu" wait-for: "#settings" store-property: (".example-wrap .rust code", {"scrollWidth": rust_width, "scrollHeight": rust_height}) diff --git a/tests/rustdoc-gui/src/macro_expansion/Cargo.lock b/tests/rustdoc-gui/src/macro_expansion/Cargo.lock new file mode 100644 index 00000000000..9c5cee8fb9d --- /dev/null +++ b/tests/rustdoc-gui/src/macro_expansion/Cargo.lock @@ -0,0 +1,7 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 4 + +[[package]] +name = "macro_expansion" +version = "0.1.0" diff --git a/tests/rustdoc-gui/src/macro_expansion/Cargo.toml b/tests/rustdoc-gui/src/macro_expansion/Cargo.toml new file mode 100644 index 00000000000..6d362850fc5 --- /dev/null +++ b/tests/rustdoc-gui/src/macro_expansion/Cargo.toml @@ -0,0 +1,7 @@ +[package] +name = "macro_expansion" +version = "0.1.0" +edition = "2021" + +[lib] +path = "lib.rs" diff --git a/tests/rustdoc-gui/src/macro_expansion/lib.rs b/tests/rustdoc-gui/src/macro_expansion/lib.rs new file mode 100644 index 00000000000..62a92d5d15e --- /dev/null +++ b/tests/rustdoc-gui/src/macro_expansion/lib.rs @@ -0,0 +1,56 @@ +// Test crate used to check the `--generate-macro-expansion` option. +//@ compile-flags: -Zunstable-options --generate-macro-expansion --generate-link-to-definition + +mod other; + +#[macro_export] +macro_rules! bar { + ($x:ident) => {{ + $x += 2; + $x *= 2; + }} +} + +macro_rules! bar2 { + () => { + fn foo2() -> impl std::fmt::Display { + String::new() + } + } +} + +macro_rules! bar3 { + () => { + fn foo3() {} + fn foo4() -> String { String::new() } + } +} + +bar2!(); +bar3!(); + +#[derive(Debug, PartialEq)] +pub struct Bar; + +#[derive(Debug +)] +pub struct Bar2; + +fn y_f(_: &str, _: &str, _: &str) {} + +fn foo() { + let mut y = 0; + bar!(y); + println!(" + {y} + "); + // comment + println!(" + {y} + "); + let s = y_f("\ +bla", stringify!(foo), stringify!(bar)); + + // Macro from another file. + other_macro!(y); +} diff --git a/tests/rustdoc-gui/src/macro_expansion/other.rs b/tests/rustdoc-gui/src/macro_expansion/other.rs new file mode 100644 index 00000000000..8661b01be38 --- /dev/null +++ b/tests/rustdoc-gui/src/macro_expansion/other.rs @@ -0,0 +1,6 @@ +#[macro_export] +macro_rules! other_macro { + ($x:ident) => {{ + $x += 2; + }} +} diff --git a/tests/rustdoc-gui/src/test_docs/lib.rs b/tests/rustdoc-gui/src/test_docs/lib.rs index 623f5b33e9b..42f2fbd93b1 100644 --- a/tests/rustdoc-gui/src/test_docs/lib.rs +++ b/tests/rustdoc-gui/src/test_docs/lib.rs @@ -161,6 +161,10 @@ pub enum AnEnum { /// Some keyword. pub mod keyword {} +#[doc(attribute = "forbid")] +/// Some attribute. +pub mod repr {} + /// Just some type alias. pub type SomeType = u32; diff --git a/tests/rustdoc-gui/theme-change.goml b/tests/rustdoc-gui/theme-change.goml index 58987110509..3860596e343 100644 --- a/tests/rustdoc-gui/theme-change.goml +++ b/tests/rustdoc-gui/theme-change.goml @@ -7,7 +7,7 @@ store-value: (background_light, "white") store-value: (background_dark, "#353535") store-value: (background_ayu, "#0f1419") -click: "#settings-menu" +click: "rustdoc-toolbar .settings-menu" wait-for: "#theme-ayu" click: "#theme-ayu" // should be the ayu theme so let's check the color. @@ -75,7 +75,7 @@ store-value: (background_dark, "#353535") store-value: (background_ayu, "#0f1419") store-value: (background_custom_theme, "red") -click: "#settings-menu" +click: "rustdoc-toolbar .settings-menu" wait-for: "#theme-ayu" click: "#theme-ayu" // should be the ayu theme so let's check the color. diff --git a/tests/rustdoc-gui/theme-defaults.goml b/tests/rustdoc-gui/theme-defaults.goml index 2cc5d716cfe..12c17166e87 100644 --- a/tests/rustdoc-gui/theme-defaults.goml +++ b/tests/rustdoc-gui/theme-defaults.goml @@ -1,6 +1,6 @@ // Ensure that the theme picker always starts with the actual defaults. go-to: "file://" + |DOC_PATH| + "/test_docs/index.html" -click: "#settings-menu" +click: "rustdoc-toolbar .settings-menu" wait-for: "#theme-system-preference" assert: "#theme-system-preference:checked" assert: "#preferred-light-theme-light:checked" @@ -16,7 +16,7 @@ set-local-storage: { "rustdoc-theme": "ayu" } go-to: "file://" + |DOC_PATH| + "/test_docs/index.html" -click: "#settings-menu" +click: "rustdoc-toolbar .settings-menu" wait-for: "#theme-system-preference" assert: "#theme-system-preference:checked" assert: "#preferred-light-theme-light:checked" diff --git a/tests/rustdoc-gui/toggle-click-deadspace.goml b/tests/rustdoc-gui/toggle-click-deadspace.goml index caca1b61493..c6d13973087 100644 --- a/tests/rustdoc-gui/toggle-click-deadspace.goml +++ b/tests/rustdoc-gui/toggle-click-deadspace.goml @@ -13,4 +13,4 @@ assert-attribute-false: (".impl-items .toggle", {"open": ""}) // Click the "Trait" part of "impl Trait" and verify it navigates. click: "#impl-Trait-for-Foo h3 a:first-of-type" assert-text: (".main-heading .rustdoc-breadcrumbs", "lib2") -assert-text: (".main-heading h1", "Trait TraitCopy item path") +assert-text: (".main-heading h1", "Trait Trait Copy item path") diff --git a/tests/rustdoc-gui/toggle-docs-mobile.goml b/tests/rustdoc-gui/toggle-docs-mobile.goml index 6a40ba83b84..d038ebcdd6f 100644 --- a/tests/rustdoc-gui/toggle-docs-mobile.goml +++ b/tests/rustdoc-gui/toggle-docs-mobile.goml @@ -3,12 +3,12 @@ go-to: "file://" + |DOC_PATH| + "/test_docs/struct.Foo.html" set-window-size: (433, 600) assert-attribute: (".top-doc", {"open": ""}) -click: (4, 270) // This is the position of the top doc comment toggle +click: (4, 230) // This is the position of the top doc comment toggle assert-attribute-false: (".top-doc", {"open": ""}) -click: (4, 270) +click: (4, 230) assert-attribute: (".top-doc", {"open": ""}) // To ensure that the toggle isn't over the text, we check that the toggle isn't clicked. -click: (3, 270) +click: (3, 230) assert-attribute: (".top-doc", {"open": ""}) // Assert the position of the toggle on the top doc block. @@ -24,12 +24,12 @@ assert-position: ( // Now we do the same but with a little bigger width set-window-size: (600, 600) assert-attribute: (".top-doc", {"open": ""}) -click: (4, 270) // New Y position since all search elements are back on one line. +click: (4, 230) // New Y position since all search elements are back on one line. assert-attribute-false: (".top-doc", {"open": ""}) -click: (4, 270) +click: (4, 230) assert-attribute: (".top-doc", {"open": ""}) // To ensure that the toggle isn't over the text, we check that the toggle isn't clicked. -click: (3, 270) +click: (3, 230) assert-attribute: (".top-doc", {"open": ""}) // Same check on trait items. diff --git a/tests/rustdoc-gui/toggle-docs.goml b/tests/rustdoc-gui/toggle-docs.goml index 4607c604eeb..9eea687f74e 100644 --- a/tests/rustdoc-gui/toggle-docs.goml +++ b/tests/rustdoc-gui/toggle-docs.goml @@ -64,7 +64,7 @@ define-function: ( "filter": |filter|, }) // moving the cursor somewhere else to not mess with next function calls. - move-cursor-to: ".search-input" + move-cursor-to: "#search-button" }, ) diff --git a/tests/rustdoc-gui/type-declation-overflow.goml b/tests/rustdoc-gui/type-declation-overflow.goml index 4f8fe78ea4d..e53d7f00d93 100644 --- a/tests/rustdoc-gui/type-declation-overflow.goml +++ b/tests/rustdoc-gui/type-declation-overflow.goml @@ -47,27 +47,27 @@ assert-property: ("pre.item-decl", {"scrollWidth": "950"}) set-window-size: (600, 600) go-to: "file://" + |DOC_PATH| + "/lib2/too_long/struct.SuperIncrediblyLongLongLongLongLongLongLongGigaGigaGigaMegaLongLongLongStructName.html" // It shouldn't have an overflow in the topbar either. -store-property: (".mobile-topbar", {"scrollWidth": scrollWidth}) -assert-property: (".mobile-topbar", {"clientWidth": |scrollWidth|}) -assert-css: (".mobile-topbar h2", {"overflow-x": "hidden"}) +store-property: ("rustdoc-topbar", {"scrollWidth": scrollWidth}) +assert-property: ("rustdoc-topbar", {"clientWidth": |scrollWidth|}, NEAR) +assert-css: ("rustdoc-topbar h2", {"overflow-x": "hidden"}) // Check that main heading and toolbar go side-by-side, both on desktop and on mobile. set-window-size: (1100, 800) go-to: "file://" + |DOC_PATH| + "/lib2/too_long/struct.SuperIncrediblyLongLongLongLongLongLongLongGigaGigaGigaMegaLongLongLongStructName.html" -compare-elements-position: (".main-heading h1", ".main-heading rustdoc-toolbar", ["y"]) -compare-elements-position-near-false: (".main-heading h1", ".main-heading rustdoc-toolbar", {"x": 550}) +compare-elements-position: (".main-heading h1", ".main-heading rustdoc-toolbar #search-button", ["y"]) +compare-elements-position-near-false: (".main-heading h1", ".main-heading rustdoc-toolbar #search-button", {"x": 300}) go-to: "file://" + |DOC_PATH| + "/lib2/index.html" -compare-elements-position: (".main-heading h1", ".main-heading rustdoc-toolbar", ["y"]) -compare-elements-position-near-false: (".main-heading h1", ".main-heading rustdoc-toolbar", {"x": 550}) +compare-elements-position: (".main-heading h1", ".main-heading rustdoc-toolbar #search-button", ["y"]) +compare-elements-position-near-false: (".main-heading h1", ".main-heading rustdoc-toolbar #search-button", {"x": 300}) // On mobile, they always wrap. set-window-size: (600, 600) go-to: "file://" + |DOC_PATH| + "/lib2/too_long/struct.SuperIncrediblyLongLongLongLongLongLongLongGigaGigaGigaMegaLongLongLongStructName.html" -compare-elements-position: (".main-heading h1", ".main-heading rustdoc-toolbar", ["y"]) -compare-elements-position-near-false: (".main-heading h1", ".main-heading rustdoc-toolbar", {"x": 200}) +compare-elements-position: (".main-heading h1", ".main-heading rustdoc-toolbar #search-button", ["y"]) +compare-elements-position-near-false: (".main-heading h1", ".main-heading rustdoc-toolbar #search-button", {"x": 200}) go-to: "file://" + |DOC_PATH| + "/lib2/index.html" -compare-elements-position: (".main-heading h1", ".main-heading rustdoc-toolbar", ["y"]) -compare-elements-position-near-false: (".main-heading h1", ".main-heading rustdoc-toolbar", {"x": 200}) +compare-elements-position: (".main-heading h1", ".main-heading rustdoc-toolbar #search-button", ["y"]) +compare-elements-position-near-false: (".main-heading h1", ".main-heading rustdoc-toolbar #search-button", {"x": 200}) // Now we will check that the scrolling is working. // First on an item with "hidden methods". diff --git a/tests/rustdoc-gui/utils.goml b/tests/rustdoc-gui/utils.goml index 844dc98a537..e13aef6712f 100644 --- a/tests/rustdoc-gui/utils.goml +++ b/tests/rustdoc-gui/utils.goml @@ -5,14 +5,54 @@ define-function: ( block { // Set the theme. // Open the settings menu. - click: "#settings-menu" + click: "rustdoc-toolbar .settings-menu" // Wait for the popover to appear... wait-for: "#settings" // Change the setting. click: "#theme-"+ |theme| // Close the popover. - click: "#settings-menu" + click: "rustdoc-toolbar .settings-menu" // Ensure that the local storage was correctly updated. assert-local-storage: {"rustdoc-theme": |theme|} }, ) + +define-function: ( + "switch-theme-mobile", + [theme], + block { + // Set the theme. + // Open the settings menu. + click: "rustdoc-topbar .settings-menu" + // Wait for the popover to appear... + wait-for: "#settings" + // Change the setting. + click: "#theme-"+ |theme| + // Close the popover. + click: "rustdoc-topbar .settings-menu" + // Ensure that the local storage was correctly updated. + assert-local-storage: {"rustdoc-theme": |theme|} + }, +) + +define-function: ( + "perform-search", + [query], + block { + // Block requests with doubled `//`. + // Amazon S3 doesn't support them, but other web hosts do, + // and so do file:/// URLs, which means we need to block + // it here if we want to avoid breaking the main docs site. + // https://github.com/rust-lang/rust/issues/145646 + block-network-request: "file://*//*" + // Perform search + click: "#search-button" + wait-for: ".search-input" + write-into: (".search-input", |query|) + press-key: 'Enter' + // wait for the search to start + wait-for: "#search-tabs" + // then wait for it to finish + wait-for-false: "#search-tabs .count.loading" + } +) diff --git a/tests/rustdoc-js-std/alias-1.js b/tests/rustdoc-js-std/alias-1.js index c31d1a3b1ad..b8f8db1f629 100644 --- a/tests/rustdoc-js-std/alias-1.js +++ b/tests/rustdoc-js-std/alias-1.js @@ -6,5 +6,10 @@ const EXPECTED = { 'name': 'reference', 'desc': "References, <code>&T</code> and <code>&mut T</code>.", }, + { + 'path': 'std::ops', + 'name': 'BitAnd', + 'desc': "The bitwise AND operator <code>&</code>.", + }, ], }; diff --git a/tests/rustdoc-js-std/alias-2.js b/tests/rustdoc-js-std/alias-2.js index 5735b573bcb..9e97501e443 100644 --- a/tests/rustdoc-js-std/alias-2.js +++ b/tests/rustdoc-js-std/alias-2.js @@ -1,9 +1,7 @@ const EXPECTED = { 'query': '+', 'others': [ - { 'path': 'std::ops', 'name': 'AddAssign' }, { 'path': 'std::ops', 'name': 'Add' }, - { 'path': 'core::ops', 'name': 'AddAssign' }, - { 'path': 'core::ops', 'name': 'Add' }, + { 'path': 'std::ops', 'name': 'AddAssign' }, ], }; diff --git a/tests/rustdoc-js-std/basic.js b/tests/rustdoc-js-std/basic.js index baff24b0af6..74467f0eef1 100644 --- a/tests/rustdoc-js-std/basic.js +++ b/tests/rustdoc-js-std/basic.js @@ -9,6 +9,6 @@ const EXPECTED = { { 'path': 'std::str', 'name': 'eq' }, ], 'returned': [ - { 'path': 'std::string::String', 'name': 'add' }, + { 'path': 'std::string::String', 'name': 'new' }, ], }; diff --git a/tests/rustdoc-js-std/parser-bindings.js b/tests/rustdoc-js-std/parser-bindings.js index bd379f139ff..e00e3088303 100644 --- a/tests/rustdoc-js-std/parser-bindings.js +++ b/tests/rustdoc-js-std/parser-bindings.js @@ -20,12 +20,12 @@ const PARSED = [ pathLast: "c", normalizedPathLast: "c", generics: [], - typeFilter: -1, + typeFilter: null, }, ] ], ], - typeFilter: -1, + typeFilter: null, }, ], foundElems: 1, @@ -51,11 +51,11 @@ const PARSED = [ pathWithoutLast: [], pathLast: "c", generics: [], - typeFilter: -1, + typeFilter: null, }] ], ], - typeFilter: -1, + typeFilter: null, }, ], foundElems: 1, @@ -81,11 +81,11 @@ const PARSED = [ pathWithoutLast: [], pathLast: "never", generics: [], - typeFilter: 1, + typeFilter: "primitive", }] ], ], - typeFilter: -1, + typeFilter: null, }, ], foundElems: 1, @@ -111,11 +111,11 @@ const PARSED = [ pathWithoutLast: [], pathLast: "[]", generics: [], - typeFilter: 1, + typeFilter: "primitive", }] ], ], - typeFilter: -1, + typeFilter: null, }, ], foundElems: 1, @@ -147,14 +147,14 @@ const PARSED = [ pathWithoutLast: [], pathLast: "never", generics: [], - typeFilter: 1, + typeFilter: "primitive", }, ], - typeFilter: 1, + typeFilter: "primitive", }] ], ], - typeFilter: -1, + typeFilter: null, }, ], foundElems: 1, @@ -213,7 +213,7 @@ const PARSED = [ pathWithoutLast: [], pathLast: "c", generics: [], - typeFilter: -1, + typeFilter: null, }, { name: "X", @@ -221,12 +221,12 @@ const PARSED = [ pathWithoutLast: [], pathLast: "x", generics: [], - typeFilter: -1, + typeFilter: null, }, ], ], ], - typeFilter: -1, + typeFilter: null, }, ], foundElems: 1, diff --git a/tests/rustdoc-js-std/parser-errors.js b/tests/rustdoc-js-std/parser-errors.js index 8bffef61c8f..6e11dda8532 100644 --- a/tests/rustdoc-js-std/parser-errors.js +++ b/tests/rustdoc-js-std/parser-errors.js @@ -16,14 +16,6 @@ const PARSED = [ error: "Found generics without a path", }, { - query: '-> *', - elems: [], - foundElems: 0, - userQuery: "-> *", - returned: [], - error: "Unexpected `*` after ` ` (not a valid identifier)", - }, - { query: 'a<"P">', elems: [], foundElems: 0, @@ -406,10 +398,10 @@ const PARSED = [ pathWithoutLast: [], pathLast: "x", generics: [], - typeFilter: -1, + typeFilter: null, }, ], - typeFilter: -1, + typeFilter: null, }, { name: "y", @@ -417,7 +409,7 @@ const PARSED = [ pathWithoutLast: [], pathLast: "y", generics: [], - typeFilter: -1, + typeFilter: null, }, ], foundElems: 2, @@ -440,7 +432,7 @@ const PARSED = [ pathWithoutLast: [], pathLast: "x", generics: [], - typeFilter: -1, + typeFilter: null, }, { name: "y", @@ -448,10 +440,10 @@ const PARSED = [ pathWithoutLast: [], pathLast: "y", generics: [], - typeFilter: -1, + typeFilter: null, }, ], - typeFilter: -1, + typeFilter: null, }, ], foundElems: 1, @@ -468,7 +460,7 @@ const PARSED = [ pathWithoutLast: [], pathLast: "p", generics: [], - typeFilter: -1, + typeFilter: null, }, { name: "x", @@ -476,7 +468,7 @@ const PARSED = [ pathWithoutLast: [], pathLast: "x", generics: [], - typeFilter: -1, + typeFilter: null, }, { name: "y", @@ -484,7 +476,7 @@ const PARSED = [ pathWithoutLast: [], pathLast: "y", generics: [], - typeFilter: -1, + typeFilter: null, }, ], foundElems: 3, diff --git a/tests/rustdoc-js-std/parser-filter.js b/tests/rustdoc-js-std/parser-filter.js index cda950461f7..569ef9aa96c 100644 --- a/tests/rustdoc-js-std/parser-filter.js +++ b/tests/rustdoc-js-std/parser-filter.js @@ -7,7 +7,7 @@ const PARSED = [ pathWithoutLast: [], pathLast: "foo", generics: [], - typeFilter: 7, + typeFilter: "fn", }], foundElems: 1, userQuery: "fn:foo", @@ -22,7 +22,7 @@ const PARSED = [ pathWithoutLast: [], pathLast: "foo", generics: [], - typeFilter: 6, + typeFilter: "enum", }], foundElems: 1, userQuery: "enum : foo", @@ -45,7 +45,7 @@ const PARSED = [ pathWithoutLast: [], pathLast: "macro", generics: [], - typeFilter: 16, + typeFilter: "macro", }], foundElems: 1, userQuery: "macro!", @@ -60,7 +60,7 @@ const PARSED = [ pathWithoutLast: [], pathLast: "mac", generics: [], - typeFilter: 16, + typeFilter: "macro", }], foundElems: 1, userQuery: "macro:mac!", @@ -75,7 +75,7 @@ const PARSED = [ pathWithoutLast: ["a"], pathLast: "mac", generics: [], - typeFilter: 16, + typeFilter: "macro", }], foundElems: 1, userQuery: "a::mac!", @@ -93,7 +93,7 @@ const PARSED = [ pathWithoutLast: [], pathLast: "foo", generics: [], - typeFilter: 7, + typeFilter: "fn", }], error: null, }, @@ -114,10 +114,10 @@ const PARSED = [ pathWithoutLast: [], pathLast: "bar", generics: [], - typeFilter: 7, + typeFilter: "fn", } ], - typeFilter: 7, + typeFilter: "fn", }], error: null, }, @@ -138,7 +138,7 @@ const PARSED = [ pathWithoutLast: [], pathLast: "bar", generics: [], - typeFilter: 7, + typeFilter: "fn", }, { name: "baz::fuzz", @@ -146,10 +146,10 @@ const PARSED = [ pathWithoutLast: ["baz"], pathLast: "fuzz", generics: [], - typeFilter: 6, + typeFilter: "enum", }, ], - typeFilter: 7, + typeFilter: "fn", }], error: null, }, diff --git a/tests/rustdoc-js-std/parser-generics.js b/tests/rustdoc-js-std/parser-generics.js index 8b8d95bcb88..deaa0adbc63 100644 --- a/tests/rustdoc-js-std/parser-generics.js +++ b/tests/rustdoc-js-std/parser-generics.js @@ -16,7 +16,7 @@ const PARSED = [ pathWithoutLast: [], pathLast: "p", generics: [], - typeFilter: -1, + typeFilter: null, }, { name: "u8", @@ -24,7 +24,7 @@ const PARSED = [ pathWithoutLast: [], pathLast: "u8", generics: [], - typeFilter: -1, + typeFilter: null, }, ], foundElems: 2, @@ -49,7 +49,7 @@ const PARSED = [ generics: [], }, ], - typeFilter: -1, + typeFilter: null, }, ], foundElems: 1, @@ -82,7 +82,7 @@ const PARSED = [ ], }, ], - typeFilter: -1, + typeFilter: null, }, ], foundElems: 1, @@ -122,7 +122,7 @@ const PARSED = [ generics: [], }, ], - typeFilter: -1, + typeFilter: null, }, ], foundElems: 1, @@ -162,7 +162,7 @@ const PARSED = [ ], }, ], - typeFilter: -1, + typeFilter: null, }, ], foundElems: 1, diff --git a/tests/rustdoc-js-std/parser-hof.js b/tests/rustdoc-js-std/parser-hof.js index ca761015412..5de232a66cd 100644 --- a/tests/rustdoc-js-std/parser-hof.js +++ b/tests/rustdoc-js-std/parser-hof.js @@ -25,11 +25,11 @@ const PARSED = [ generics: [], }, ], - typeFilter: -1, + typeFilter: null, }], ], ], - typeFilter: -1, + typeFilter: null, }], foundElems: 1, userQuery: "(-> F<P>)", @@ -53,11 +53,11 @@ const PARSED = [ pathWithoutLast: [], pathLast: "p", generics: [], - typeFilter: -1, + typeFilter: null, }], ], ], - typeFilter: -1, + typeFilter: null, }], foundElems: 1, userQuery: "(-> P)", @@ -81,11 +81,11 @@ const PARSED = [ pathWithoutLast: [], pathLast: "a", generics: [], - typeFilter: -1, + typeFilter: null, }], ], ], - typeFilter: -1, + typeFilter: null, }], foundElems: 1, userQuery: "(->,a)", @@ -113,7 +113,7 @@ const PARSED = [ generics: [], }, ], - typeFilter: -1, + typeFilter: null, }], bindings: [ [ @@ -121,7 +121,7 @@ const PARSED = [ [], ], ], - typeFilter: -1, + typeFilter: null, }], foundElems: 1, userQuery: "(F<P> ->)", @@ -141,7 +141,7 @@ const PARSED = [ pathWithoutLast: [], pathLast: "p", generics: [], - typeFilter: -1, + typeFilter: null, }], bindings: [ [ @@ -149,7 +149,7 @@ const PARSED = [ [], ], ], - typeFilter: -1, + typeFilter: null, }], foundElems: 1, userQuery: "(P ->)", @@ -169,7 +169,7 @@ const PARSED = [ pathWithoutLast: [], pathLast: "a", generics: [], - typeFilter: -1, + typeFilter: null, }], bindings: [ [ @@ -177,7 +177,7 @@ const PARSED = [ [], ], ], - typeFilter: -1, + typeFilter: null, }], foundElems: 1, userQuery: "(,a->)", @@ -197,7 +197,7 @@ const PARSED = [ pathWithoutLast: [], pathLast: "aaaaa", generics: [], - typeFilter: -1, + typeFilter: null, }], bindings: [ [ @@ -208,11 +208,11 @@ const PARSED = [ pathWithoutLast: [], pathLast: "a", generics: [], - typeFilter: -1, + typeFilter: null, }], ], ], - typeFilter: -1, + typeFilter: null, }], foundElems: 1, userQuery: "(aaaaa->a)", @@ -233,7 +233,7 @@ const PARSED = [ pathWithoutLast: [], pathLast: "aaaaa", generics: [], - typeFilter: -1, + typeFilter: null, }, { name: "b", @@ -241,7 +241,7 @@ const PARSED = [ pathWithoutLast: [], pathLast: "b", generics: [], - typeFilter: -1, + typeFilter: null, }, ], bindings: [ @@ -253,11 +253,11 @@ const PARSED = [ pathWithoutLast: [], pathLast: "a", generics: [], - typeFilter: -1, + typeFilter: null, }], ], ], - typeFilter: -1, + typeFilter: null, }], foundElems: 1, userQuery: "(aaaaa, b -> a)", @@ -278,7 +278,7 @@ const PARSED = [ pathWithoutLast: [], pathLast: "aaaaa", generics: [], - typeFilter: -1, + typeFilter: null, }, { name: "b", @@ -286,7 +286,7 @@ const PARSED = [ pathWithoutLast: [], pathLast: "b", generics: [], - typeFilter: -1, + typeFilter: null, }, ], bindings: [ @@ -298,11 +298,11 @@ const PARSED = [ pathWithoutLast: [], pathLast: "a", generics: [], - typeFilter: -1, + typeFilter: null, }], ], ], - typeFilter: 1, + typeFilter: "primitive", }], foundElems: 1, userQuery: "primitive:(aaaaa, b -> a)", @@ -318,7 +318,7 @@ const PARSED = [ pathWithoutLast: [], pathLast: "x", generics: [], - typeFilter: -1, + typeFilter: null, }, { name: "->", @@ -332,7 +332,7 @@ const PARSED = [ pathWithoutLast: [], pathLast: "aaaaa", generics: [], - typeFilter: -1, + typeFilter: null, }, { name: "b", @@ -340,7 +340,7 @@ const PARSED = [ pathWithoutLast: [], pathLast: "b", generics: [], - typeFilter: -1, + typeFilter: null, }, ], bindings: [ @@ -352,11 +352,11 @@ const PARSED = [ pathWithoutLast: [], pathLast: "a", generics: [], - typeFilter: -1, + typeFilter: null, }], ], ], - typeFilter: 10, + typeFilter: "trait", } ], foundElems: 2, @@ -390,11 +390,11 @@ const PARSED = [ generics: [], }, ], - typeFilter: -1, + typeFilter: null, }], ], ], - typeFilter: -1, + typeFilter: null, }], foundElems: 1, userQuery: "Fn () -> F<P>", @@ -418,11 +418,11 @@ const PARSED = [ pathWithoutLast: [], pathLast: "p", generics: [], - typeFilter: -1, + typeFilter: null, }], ], ], - typeFilter: -1, + typeFilter: null, }], foundElems: 1, userQuery: "FnMut() -> P", @@ -446,11 +446,11 @@ const PARSED = [ pathWithoutLast: [], pathLast: "p", generics: [], - typeFilter: -1, + typeFilter: null, }], ], ], - typeFilter: -1, + typeFilter: null, }], foundElems: 1, userQuery: "(FnMut() -> P)", @@ -478,7 +478,7 @@ const PARSED = [ generics: [], }, ], - typeFilter: -1, + typeFilter: null, }], bindings: [ [ @@ -486,7 +486,7 @@ const PARSED = [ [], ], ], - typeFilter: -1, + typeFilter: null, }], foundElems: 1, userQuery: "Fn(F<P>)", @@ -507,7 +507,7 @@ const PARSED = [ pathWithoutLast: [], pathLast: "aaaaa", generics: [], - typeFilter: -1, + typeFilter: null, }, { name: "b", @@ -515,7 +515,7 @@ const PARSED = [ pathWithoutLast: [], pathLast: "b", generics: [], - typeFilter: -1, + typeFilter: null, }, ], bindings: [ @@ -527,11 +527,11 @@ const PARSED = [ pathWithoutLast: [], pathLast: "a", generics: [], - typeFilter: -1, + typeFilter: null, }], ], ], - typeFilter: 1, + typeFilter: "primitive", }], foundElems: 1, userQuery: "primitive:fnonce(aaaaa, b) -> a", @@ -552,7 +552,7 @@ const PARSED = [ pathWithoutLast: [], pathLast: "aaaaa", generics: [], - typeFilter: -1, + typeFilter: null, }, { name: "b", @@ -560,7 +560,7 @@ const PARSED = [ pathWithoutLast: [], pathLast: "b", generics: [], - typeFilter: 0, + typeFilter: "keyword", }, ], bindings: [ @@ -572,11 +572,11 @@ const PARSED = [ pathWithoutLast: [], pathLast: "a", generics: [], - typeFilter: 10, + typeFilter: "trait", }], ], ], - typeFilter: 1, + typeFilter: "primitive", }], foundElems: 1, userQuery: "primitive:fnonce(aaaaa, keyword:b) -> trait:a", @@ -592,7 +592,7 @@ const PARSED = [ pathWithoutLast: [], pathLast: "x", generics: [], - typeFilter: -1, + typeFilter: null, }, { name: "fn", @@ -612,7 +612,7 @@ const PARSED = [ pathWithoutLast: [], pathLast: "aaaaa", generics: [], - typeFilter: -1, + typeFilter: null, }, { name: "b", @@ -620,7 +620,7 @@ const PARSED = [ pathWithoutLast: [], pathLast: "b", generics: [], - typeFilter: -1, + typeFilter: null, }, ], bindings: [ @@ -632,11 +632,11 @@ const PARSED = [ pathWithoutLast: [], pathLast: "a", generics: [], - typeFilter: -1, + typeFilter: null, }], ], ], - typeFilter: -1, + typeFilter: null, }, ], bindings: [ @@ -645,7 +645,7 @@ const PARSED = [ [], ] ], - typeFilter: 10, + typeFilter: "trait", } ], foundElems: 2, @@ -662,7 +662,7 @@ const PARSED = [ pathWithoutLast: [], pathLast: "a", generics: [], - typeFilter: -1, + typeFilter: null, }, { name: "b", @@ -675,7 +675,7 @@ const PARSED = [ pathWithoutLast: [], pathLast: "c", generics: [], - typeFilter: -1, + typeFilter: null, }], bindings: [ [ @@ -683,7 +683,7 @@ const PARSED = [ [], ] ], - typeFilter: -1, + typeFilter: null, } ], foundElems: 2, diff --git a/tests/rustdoc-js-std/parser-ident.js b/tests/rustdoc-js-std/parser-ident.js index f65391b1571..5366ac847b0 100644 --- a/tests/rustdoc-js-std/parser-ident.js +++ b/tests/rustdoc-js-std/parser-ident.js @@ -13,10 +13,10 @@ const PARSED = [ pathWithoutLast: [], pathLast: "never", generics: [], - typeFilter: 1, + typeFilter: "primitive", }, ], - typeFilter: -1, + typeFilter: null, }], foundElems: 1, userQuery: "R<!>", @@ -31,7 +31,7 @@ const PARSED = [ pathWithoutLast: [], pathLast: "never", generics: [], - typeFilter: 1, + typeFilter: "primitive", }], foundElems: 1, userQuery: "!", @@ -46,7 +46,7 @@ const PARSED = [ pathWithoutLast: [], pathLast: "a", generics: [], - typeFilter: 16, + typeFilter: "macro", }], foundElems: 1, userQuery: "a!", @@ -77,7 +77,7 @@ const PARSED = [ pathWithoutLast: ["never"], pathLast: "b", generics: [], - typeFilter: -1, + typeFilter: null, }], foundElems: 1, userQuery: "!::b", @@ -122,10 +122,10 @@ const PARSED = [ pathWithoutLast: [], pathLast: "t", generics: [], - typeFilter: -1, + typeFilter: null, } ], - typeFilter: -1, + typeFilter: null, }], foundElems: 1, userQuery: "!::b<T>", diff --git a/tests/rustdoc-js-std/parser-literal.js b/tests/rustdoc-js-std/parser-literal.js index 63e07a246a1..803929b74fd 100644 --- a/tests/rustdoc-js-std/parser-literal.js +++ b/tests/rustdoc-js-std/parser-literal.js @@ -15,7 +15,7 @@ const PARSED = [ generics: [], }, ], - typeFilter: -1, + typeFilter: null, }], foundElems: 1, userQuery: "R<P>", diff --git a/tests/rustdoc-js-std/parser-paths.js b/tests/rustdoc-js-std/parser-paths.js index bb34e22e518..3ddd6572277 100644 --- a/tests/rustdoc-js-std/parser-paths.js +++ b/tests/rustdoc-js-std/parser-paths.js @@ -7,7 +7,7 @@ const PARSED = [ pathWithoutLast: ["a"], pathLast: "b", generics: [], - typeFilter: -1, + typeFilter: null, }], foundElems: 1, userQuery: "A::B", @@ -22,7 +22,7 @@ const PARSED = [ pathWithoutLast: ["a"], pathLast: "a", generics: [], - typeFilter: -1, + typeFilter: null, }], foundElems: 1, userQuery: 'a:: a', @@ -37,7 +37,7 @@ const PARSED = [ pathWithoutLast: ["a"], pathLast: "a", generics: [], - typeFilter: -1, + typeFilter: null, }], foundElems: 1, userQuery: 'a ::a', @@ -52,7 +52,7 @@ const PARSED = [ pathWithoutLast: ["a"], pathLast: "a", generics: [], - typeFilter: -1, + typeFilter: null, }], foundElems: 1, userQuery: 'a :: a', @@ -68,7 +68,7 @@ const PARSED = [ pathWithoutLast: ["a"], pathLast: "b", generics: [], - typeFilter: -1, + typeFilter: null, }, { name: "C", @@ -76,7 +76,7 @@ const PARSED = [ pathWithoutLast: [], pathLast: "c", generics: [], - typeFilter: -1, + typeFilter: null, }, ], foundElems: 2, @@ -101,7 +101,7 @@ const PARSED = [ generics: [], }, ], - typeFilter: -1, + typeFilter: null, }, { name: "C", @@ -109,7 +109,7 @@ const PARSED = [ pathWithoutLast: [], pathLast: "c", generics: [], - typeFilter: -1, + typeFilter: null, }, ], foundElems: 2, @@ -125,7 +125,7 @@ const PARSED = [ pathWithoutLast: ["mod"], pathLast: "a", generics: [], - typeFilter: -1, + typeFilter: null, }], foundElems: 1, userQuery: "mod::a", diff --git a/tests/rustdoc-js-std/parser-quote.js b/tests/rustdoc-js-std/parser-quote.js index b485047e385..d5a9863367f 100644 --- a/tests/rustdoc-js-std/parser-quote.js +++ b/tests/rustdoc-js-std/parser-quote.js @@ -10,7 +10,7 @@ const PARSED = [ pathWithoutLast: [], pathLast: "p", generics: [], - typeFilter: -1, + typeFilter: null, }], error: null, }, @@ -22,7 +22,7 @@ const PARSED = [ pathWithoutLast: [], pathLast: "p", generics: [], - typeFilter: -1, + typeFilter: null, }], foundElems: 1, userQuery: '"p",', diff --git a/tests/rustdoc-js-std/parser-reference.js b/tests/rustdoc-js-std/parser-reference.js index 0fa07ae9895..b17dad5fb1f 100644 --- a/tests/rustdoc-js-std/parser-reference.js +++ b/tests/rustdoc-js-std/parser-reference.js @@ -42,16 +42,16 @@ const PARSED = [ pathWithoutLast: [], pathLast: "d", generics: [], - typeFilter: -1, + typeFilter: null, }, ], - typeFilter: 1, + typeFilter: "primitive", }, ], - typeFilter: 1, + typeFilter: "primitive", }, ], - typeFilter: 1, + typeFilter: "primitive", }, { name: "[]", @@ -59,7 +59,7 @@ const PARSED = [ pathWithoutLast: [], pathLast: "[]", generics: [], - typeFilter: 1, + typeFilter: "primitive", }, ], foundElems: 2, @@ -100,19 +100,19 @@ const PARSED = [ pathWithoutLast: [], pathLast: "d", generics: [], - typeFilter: -1, + typeFilter: null, }, ], - typeFilter: 1, + typeFilter: "primitive", }, ], - typeFilter: 1, + typeFilter: "primitive", }, ], - typeFilter: 1, + typeFilter: "primitive", }, ], - typeFilter: 1, + typeFilter: "primitive", }, ], foundElems: 1, @@ -129,7 +129,7 @@ const PARSED = [ pathWithoutLast: [], pathLast: "reference", generics: [], - typeFilter: 1, + typeFilter: "primitive", }, ], foundElems: 1, @@ -152,10 +152,10 @@ const PARSED = [ pathWithoutLast: [], pathLast: "mut", generics: [], - typeFilter: 0, + typeFilter: "keyword", }, ], - typeFilter: 1, + typeFilter: "primitive", }, ], foundElems: 1, @@ -172,7 +172,7 @@ const PARSED = [ pathWithoutLast: [], pathLast: "reference", generics: [], - typeFilter: 1, + typeFilter: "primitive", }, { name: "u8", @@ -180,7 +180,7 @@ const PARSED = [ pathWithoutLast: [], pathLast: "u8", generics: [], - typeFilter: -1, + typeFilter: null, }, ], foundElems: 2, @@ -203,10 +203,10 @@ const PARSED = [ pathWithoutLast: [], pathLast: "mut", generics: [], - typeFilter: 0, + typeFilter: "keyword", }, ], - typeFilter: 1, + typeFilter: "primitive", }, { name: "u8", @@ -214,7 +214,7 @@ const PARSED = [ pathWithoutLast: [], pathLast: "u8", generics: [], - typeFilter: -1, + typeFilter: null, }, ], foundElems: 2, @@ -237,10 +237,10 @@ const PARSED = [ pathWithoutLast: [], pathLast: "u8", generics: [], - typeFilter: -1, + typeFilter: null, }, ], - typeFilter: 1, + typeFilter: "primitive", }, ], foundElems: 1, @@ -269,13 +269,13 @@ const PARSED = [ pathWithoutLast: [], pathLast: "u8", generics: [], - typeFilter: -1, + typeFilter: null, }, ], - typeFilter: -1, + typeFilter: null, }, ], - typeFilter: 1, + typeFilter: "primitive", }, ], foundElems: 1, @@ -304,13 +304,13 @@ const PARSED = [ pathWithoutLast: [], pathLast: "u8", generics: [], - typeFilter: -1, + typeFilter: null, }, ], - typeFilter: 1, + typeFilter: "primitive", }, ], - typeFilter: -1, + typeFilter: null, }, ], foundElems: 1, @@ -339,10 +339,10 @@ const PARSED = [ pathWithoutLast: [], pathLast: "u8", generics: [], - typeFilter: -1, + typeFilter: null, }, ], - typeFilter: 1, + typeFilter: "primitive", }, { name: "u8", @@ -350,10 +350,10 @@ const PARSED = [ pathWithoutLast: [], pathLast: "u8", generics: [], - typeFilter: -1, + typeFilter: null, }, ], - typeFilter: -1, + typeFilter: null, }, ], foundElems: 1, @@ -382,13 +382,13 @@ const PARSED = [ pathWithoutLast: [], pathLast: "u8", generics: [], - typeFilter: -1, + typeFilter: null, }, ], - typeFilter: 1, + typeFilter: "primitive", }, ], - typeFilter: -1, + typeFilter: null, }, ], foundElems: 1, @@ -417,7 +417,7 @@ const PARSED = [ pathWithoutLast: [], pathLast: "mut", generics: [], - typeFilter: 0, + typeFilter: "keyword", }, { name: "u8", @@ -425,10 +425,10 @@ const PARSED = [ pathWithoutLast: [], pathLast: "u8", generics: [], - typeFilter: -1, + typeFilter: null, }, ], - typeFilter: 1, + typeFilter: "primitive", }, { name: "u8", @@ -436,10 +436,10 @@ const PARSED = [ pathWithoutLast: [], pathLast: "u8", generics: [], - typeFilter: -1, + typeFilter: null, }, ], - typeFilter: -1, + typeFilter: null, }, ], foundElems: 1, @@ -462,10 +462,10 @@ const PARSED = [ pathWithoutLast: [], pathLast: "u8", generics: [], - typeFilter: -1, + typeFilter: null, }, ], - typeFilter: 1, + typeFilter: "primitive", }, ], foundElems: 1, @@ -496,10 +496,10 @@ const PARSED = [ pathWithoutLast: [], pathLast: "u8", generics: [], - typeFilter: 16, + typeFilter: "macro", }, ], - typeFilter: 1, + typeFilter: "primitive", }, ], foundElems: 1, diff --git a/tests/rustdoc-js-std/parser-returned.js b/tests/rustdoc-js-std/parser-returned.js index 30ce26a8920..67aabdacb04 100644 --- a/tests/rustdoc-js-std/parser-returned.js +++ b/tests/rustdoc-js-std/parser-returned.js @@ -18,7 +18,7 @@ const PARSED = [ generics: [], }, ], - typeFilter: -1, + typeFilter: null, }], error: null, }, @@ -33,7 +33,7 @@ const PARSED = [ pathWithoutLast: [], pathLast: "p", generics: [], - typeFilter: -1, + typeFilter: null, }], error: null, }, @@ -48,7 +48,7 @@ const PARSED = [ pathWithoutLast: [], pathLast: "a", generics: [], - typeFilter: -1, + typeFilter: null, }], error: null, }, @@ -60,7 +60,7 @@ const PARSED = [ pathWithoutLast: [], pathLast: "aaaaa", generics: [], - typeFilter: -1, + typeFilter: null, }], foundElems: 2, userQuery: "aaaaa->a", @@ -70,7 +70,7 @@ const PARSED = [ pathWithoutLast: [], pathLast: "a", generics: [], - typeFilter: -1, + typeFilter: null, }], error: null, }, @@ -85,7 +85,7 @@ const PARSED = [ pathWithoutLast: [], pathLast: "never", generics: [], - typeFilter: 1, + typeFilter: "primitive", }], error: null, }, @@ -97,7 +97,7 @@ const PARSED = [ pathWithoutLast: [], pathLast: "a", generics: [], - typeFilter: -1, + typeFilter: null, }], foundElems: 1, userQuery: "a->", @@ -113,7 +113,7 @@ const PARSED = [ pathWithoutLast: [], pathLast: "never", generics: [], - typeFilter: 1, + typeFilter: "primitive", }], foundElems: 1, userQuery: "!->", @@ -129,7 +129,7 @@ const PARSED = [ pathWithoutLast: [], pathLast: "never", generics: [], - typeFilter: 1, + typeFilter: "primitive", }], foundElems: 1, userQuery: "! ->", @@ -145,7 +145,7 @@ const PARSED = [ pathWithoutLast: [], pathLast: "never", generics: [], - typeFilter: 1, + typeFilter: "primitive", }], foundElems: 1, userQuery: "primitive:!->", diff --git a/tests/rustdoc-js-std/parser-separators.js b/tests/rustdoc-js-std/parser-separators.js index cf271c80cdc..2f41211d783 100644 --- a/tests/rustdoc-js-std/parser-separators.js +++ b/tests/rustdoc-js-std/parser-separators.js @@ -10,7 +10,7 @@ const PARSED = [ pathWithoutLast: ['aaaaaa'], pathLast: 'b', generics: [], - typeFilter: -1, + typeFilter: null, }, ], foundElems: 1, @@ -27,7 +27,7 @@ const PARSED = [ pathWithoutLast: [], pathLast: 'aaaaaa', generics: [], - typeFilter: -1, + typeFilter: null, }, { name: 'b', @@ -35,7 +35,7 @@ const PARSED = [ pathWithoutLast: [], pathLast: 'b', generics: [], - typeFilter: -1, + typeFilter: null, }, ], foundElems: 2, @@ -52,7 +52,7 @@ const PARSED = [ pathWithoutLast: ['a'], pathLast: 'b', generics: [], - typeFilter: -1, + typeFilter: null, }, ], foundElems: 1, @@ -69,7 +69,7 @@ const PARSED = [ pathWithoutLast: [], pathLast: 'a', generics: [], - typeFilter: -1, + typeFilter: null, }, { name: 'b', @@ -77,7 +77,7 @@ const PARSED = [ pathWithoutLast: [], pathLast: 'b', generics: [], - typeFilter: -1, + typeFilter: null, }, ], foundElems: 2, @@ -94,7 +94,7 @@ const PARSED = [ pathWithoutLast: ['a'], pathLast: 'b', generics: [], - typeFilter: -1, + typeFilter: null, }, ], foundElems: 1, @@ -119,7 +119,7 @@ const PARSED = [ generics: [], }, ], - typeFilter: -1, + typeFilter: null, }, ], foundElems: 1, @@ -151,7 +151,7 @@ const PARSED = [ generics: [], }, ], - typeFilter: -1, + typeFilter: null, }, ], foundElems: 1, @@ -176,7 +176,7 @@ const PARSED = [ generics: [], }, ], - typeFilter: -1, + typeFilter: null, }, ], foundElems: 1, diff --git a/tests/rustdoc-js-std/parser-slice-array.js b/tests/rustdoc-js-std/parser-slice-array.js index 65797945535..c587eb9001f 100644 --- a/tests/rustdoc-js-std/parser-slice-array.js +++ b/tests/rustdoc-js-std/parser-slice-array.js @@ -34,7 +34,7 @@ const PARSED = [ pathWithoutLast: [], pathLast: "d", generics: [], - typeFilter: -1, + typeFilter: null, }, { name: "[]", @@ -42,16 +42,16 @@ const PARSED = [ pathWithoutLast: [], pathLast: "[]", generics: [], - typeFilter: 1, + typeFilter: "primitive", }, ], - typeFilter: 1, + typeFilter: "primitive", }, ], - typeFilter: 1, + typeFilter: "primitive", }, ], - typeFilter: 1, + typeFilter: "primitive", }, ], foundElems: 1, @@ -68,7 +68,7 @@ const PARSED = [ pathWithoutLast: [], pathLast: "[]", generics: [], - typeFilter: 1, + typeFilter: "primitive", }, { name: "u8", @@ -76,7 +76,7 @@ const PARSED = [ pathWithoutLast: [], pathLast: "u8", generics: [], - typeFilter: -1, + typeFilter: null, }, ], foundElems: 2, @@ -99,10 +99,10 @@ const PARSED = [ pathWithoutLast: [], pathLast: "u8", generics: [], - typeFilter: -1, + typeFilter: null, }, ], - typeFilter: 1, + typeFilter: "primitive", }, ], foundElems: 1, @@ -125,7 +125,7 @@ const PARSED = [ pathWithoutLast: [], pathLast: "u8", generics: [], - typeFilter: -1, + typeFilter: null, }, { name: "u8", @@ -133,10 +133,10 @@ const PARSED = [ pathWithoutLast: [], pathLast: "u8", generics: [], - typeFilter: -1, + typeFilter: null, }, ], - typeFilter: 1, + typeFilter: "primitive", }, ], foundElems: 1, @@ -165,13 +165,13 @@ const PARSED = [ pathWithoutLast: [], pathLast: "u8", generics: [], - typeFilter: -1, + typeFilter: null, }, ], - typeFilter: -1, + typeFilter: null, }, ], - typeFilter: 1, + typeFilter: "primitive", }, ], foundElems: 1, @@ -188,7 +188,7 @@ const PARSED = [ pathWithoutLast: [], pathLast: "[]", generics: [], - typeFilter: 1, + typeFilter: "primitive", }, ], foundElems: 1, @@ -283,10 +283,10 @@ const PARSED = [ pathWithoutLast: [], pathLast: "u8", generics: [], - typeFilter: -1, + typeFilter: null, }, ], - typeFilter: 1, + typeFilter: "primitive", }, ], foundElems: 1, diff --git a/tests/rustdoc-js-std/parser-tuple.js b/tests/rustdoc-js-std/parser-tuple.js index 61925068387..dfe9fdc98e3 100644 --- a/tests/rustdoc-js-std/parser-tuple.js +++ b/tests/rustdoc-js-std/parser-tuple.js @@ -22,7 +22,7 @@ const PARSED = [ pathWithoutLast: [], pathLast: "d", generics: [], - typeFilter: -1, + typeFilter: null, }, { name: "()", @@ -30,10 +30,10 @@ const PARSED = [ pathWithoutLast: [], pathLast: "()", generics: [], - typeFilter: 1, + typeFilter: "primitive", }, ], - typeFilter: 1, + typeFilter: "primitive", } ], foundElems: 1, @@ -50,7 +50,7 @@ const PARSED = [ pathWithoutLast: [], pathLast: "()", generics: [], - typeFilter: 1, + typeFilter: "primitive", }, { name: "u8", @@ -58,7 +58,7 @@ const PARSED = [ pathWithoutLast: [], pathLast: "u8", generics: [], - typeFilter: -1, + typeFilter: null, }, ], foundElems: 2, @@ -81,7 +81,7 @@ const PARSED = [ pathWithoutLast: [], pathLast: "u8", generics: [], - typeFilter: -1, + typeFilter: null, }, ], foundElems: 1, @@ -104,10 +104,10 @@ const PARSED = [ pathWithoutLast: [], pathLast: "u8", generics: [], - typeFilter: -1, + typeFilter: null, }, ], - typeFilter: 1, + typeFilter: "primitive", }, ], foundElems: 1, @@ -130,10 +130,10 @@ const PARSED = [ pathWithoutLast: [], pathLast: "u8", generics: [], - typeFilter: -1, + typeFilter: null, }, ], - typeFilter: 1, + typeFilter: "primitive", }, ], foundElems: 1, @@ -156,10 +156,10 @@ const PARSED = [ pathWithoutLast: [], pathLast: "u8", generics: [], - typeFilter: -1, + typeFilter: null, }, ], - typeFilter: 1, + typeFilter: "primitive", }, ], foundElems: 1, @@ -176,7 +176,7 @@ const PARSED = [ pathWithoutLast: [], pathLast: "u8", generics: [], - typeFilter: 1, + typeFilter: "primitive", }, ], foundElems: 1, @@ -199,7 +199,7 @@ const PARSED = [ pathWithoutLast: [], pathLast: "u8", generics: [], - typeFilter: -1, + typeFilter: null, }, { name: "u8", @@ -207,10 +207,10 @@ const PARSED = [ pathWithoutLast: [], pathLast: "u8", generics: [], - typeFilter: -1, + typeFilter: null, }, ], - typeFilter: 1, + typeFilter: "primitive", }, ], foundElems: 1, @@ -233,10 +233,10 @@ const PARSED = [ pathWithoutLast: [], pathLast: "u8", generics: [], - typeFilter: -1, + typeFilter: null, }, ], - typeFilter: -1, + typeFilter: null, }, ], foundElems: 1, @@ -253,7 +253,7 @@ const PARSED = [ pathWithoutLast: [], pathLast: "()", generics: [], - typeFilter: 1, + typeFilter: "primitive", }, ], foundElems: 1, diff --git a/tests/rustdoc-js-std/path-end-empty.js b/tests/rustdoc-js-std/path-end-empty.js index 6e853c61b4d..17b8cac8a66 100644 --- a/tests/rustdoc-js-std/path-end-empty.js +++ b/tests/rustdoc-js-std/path-end-empty.js @@ -1,6 +1,7 @@ +const FILTER_CRATE = "std"; const EXPECTED = { 'query': 'Option::', 'others': [ - { 'path': 'std::option::Option', 'name': 'get_or_insert_default' }, + { 'path': 'std::option::Option', 'name': 'eq' }, ], } diff --git a/tests/rustdoc-js-std/path-maxeditdistance.js b/tests/rustdoc-js-std/path-maxeditdistance.js index 6989e7d6488..b22a506eee5 100644 --- a/tests/rustdoc-js-std/path-maxeditdistance.js +++ b/tests/rustdoc-js-std/path-maxeditdistance.js @@ -10,15 +10,15 @@ const EXPECTED = [ query: 'vec::iter', others: [ // std::net::ToSocketAttrs::iter should not show up here - { 'path': 'std::vec', 'name': 'IntoIter' }, + { 'path': 'std::collections::VecDeque', 'name': 'iter' }, + { 'path': 'std::collections::VecDeque', 'name': 'iter_mut' }, { 'path': 'std::vec::Vec', 'name': 'from_iter' }, + { 'path': 'std::vec', 'name': 'IntoIter' }, { 'path': 'std::vec::Vec', 'name': 'into_iter' }, { 'path': 'std::vec::ExtractIf', 'name': 'into_iter' }, { 'path': 'std::vec::Drain', 'name': 'into_iter' }, { 'path': 'std::vec::IntoIter', 'name': 'into_iter' }, { 'path': 'std::vec::Splice', 'name': 'into_iter' }, - { 'path': 'std::collections::VecDeque', 'name': 'iter' }, - { 'path': 'std::collections::VecDeque', 'name': 'iter_mut' }, { 'path': 'std::collections::VecDeque', 'name': 'from_iter' }, { 'path': 'std::collections::VecDeque', 'name': 'into_iter' }, ], diff --git a/tests/rustdoc-js-std/return-specific-literal.js b/tests/rustdoc-js-std/return-specific-literal.js index 86ed3aceb4e..1efdb776ad7 100644 --- a/tests/rustdoc-js-std/return-specific-literal.js +++ b/tests/rustdoc-js-std/return-specific-literal.js @@ -4,6 +4,6 @@ const EXPECTED = { { 'path': 'std::string::String', 'name': 'ne' }, ], 'returned': [ - { 'path': 'std::string::String', 'name': 'add' }, + { 'path': 'std::string::String', 'name': 'new' }, ], }; diff --git a/tests/rustdoc-js-std/return-specific.js b/tests/rustdoc-js-std/return-specific.js index be54a1c9772..abf243bf6ab 100644 --- a/tests/rustdoc-js-std/return-specific.js +++ b/tests/rustdoc-js-std/return-specific.js @@ -4,6 +4,6 @@ const EXPECTED = { { 'path': 'std::string::String', 'name': 'ne' }, ], 'returned': [ - { 'path': 'std::string::String', 'name': 'add' }, + { 'path': 'std::string::String', 'name': 'new' }, ], }; diff --git a/tests/rustdoc-js/doc-alias.js b/tests/rustdoc-js/doc-alias.js index e57bd71419d..74f1665f74a 100644 --- a/tests/rustdoc-js/doc-alias.js +++ b/tests/rustdoc-js/doc-alias.js @@ -232,6 +232,12 @@ const EXPECTED = [ 'query': 'UnionItem', 'others': [ { + 'path': 'doc_alias::Union', + 'name': 'union_item', + 'desc': 'Doc for <code>Union::union_item</code>', + 'href': '../doc_alias/union.Union.html#structfield.union_item' + }, + { 'path': 'doc_alias', 'name': 'Union', 'desc': 'Doc for <code>Union</code>', @@ -239,13 +245,6 @@ const EXPECTED = [ 'href': '../doc_alias/union.Union.html', 'is_alias': true }, - // Not an alias! - { - 'path': 'doc_alias::Union', - 'name': 'union_item', - 'desc': 'Doc for <code>Union::union_item</code>', - 'href': '../doc_alias/union.Union.html#structfield.union_item' - }, ], }, { diff --git a/tests/rustdoc-js/generics-trait.js b/tests/rustdoc-js/generics-trait.js index 8da9c67050e..cd100463e9a 100644 --- a/tests/rustdoc-js/generics-trait.js +++ b/tests/rustdoc-js/generics-trait.js @@ -25,8 +25,25 @@ const EXPECTED = [ }, { 'query': 'Resulx<SomeTrait>', - 'in_args': [], - 'returned': [], + 'correction': 'Result', + 'in_args': [ + { + 'path': 'generics_trait', + 'name': 'beta', + 'displayType': '`Result`<`T`, ()> -> ()', + 'displayMappedNames': '', + 'displayWhereClause': 'T: `SomeTrait`', + }, + ], + 'returned': [ + { + 'path': 'generics_trait', + 'name': 'bet', + 'displayType': ' -> `Result`<`T`, ()>', + 'displayMappedNames': '', + 'displayWhereClause': 'T: `SomeTrait`', + }, + ], }, { 'query': 'Result<SomeTraiz>', diff --git a/tests/rustdoc-js/non-english-identifier.js b/tests/rustdoc-js/non-english-identifier.js index 3d50bd3ee90..0f9ffe7c038 100644 --- a/tests/rustdoc-js/non-english-identifier.js +++ b/tests/rustdoc-js/non-english-identifier.js @@ -7,7 +7,7 @@ const PARSED = [ pathWithoutLast: [], pathLast: "中文", generics: [], - typeFilter: -1, + typeFilter: null, }], returned: [], foundElems: 1, @@ -23,7 +23,7 @@ const PARSED = [ pathLast: "_0mixed中英文", normalizedPathLast: "0mixed中英文", generics: [], - typeFilter: -1, + typeFilter: null, }], foundElems: 1, userQuery: "_0Mixed中英文", @@ -38,7 +38,7 @@ const PARSED = [ pathWithoutLast: ["my_crate"], pathLast: "中文api", generics: [], - typeFilter: -1, + typeFilter: null, }], foundElems: 1, userQuery: "my_crate::中文API", @@ -94,7 +94,7 @@ const PARSED = [ pathWithoutLast: ["my_crate"], pathLast: "中文宏", generics: [], - typeFilter: 16, + typeFilter: "macro", }], foundElems: 1, userQuery: "my_crate 中文宏!", diff --git a/tests/rustdoc-js/ordering.js b/tests/rustdoc-js/ordering.js new file mode 100644 index 00000000000..a7c10900da6 --- /dev/null +++ b/tests/rustdoc-js/ordering.js @@ -0,0 +1,9 @@ +const EXPECTED = [ + { + 'query': 'Entry', + 'others': [ + { 'path': 'ordering', 'name': 'Entry1a' }, + { 'path': 'ordering', 'name': 'Entry2ab' }, + ], + }, +]; diff --git a/tests/rustdoc-js/ordering.rs b/tests/rustdoc-js/ordering.rs new file mode 100644 index 00000000000..18ca06ab5ec --- /dev/null +++ b/tests/rustdoc-js/ordering.rs @@ -0,0 +1,3 @@ +pub struct Entry1a; +pub struct Entry1b; +pub struct Entry2ab; diff --git a/tests/rustdoc-js/pointer.js b/tests/rustdoc-js/pointer.js new file mode 100644 index 00000000000..b2b556858fd --- /dev/null +++ b/tests/rustdoc-js/pointer.js @@ -0,0 +1,240 @@ +// exact-check + +const EXPECTED = [ + // pinkie with explicit names + { + 'query': 'usize, usize -> ()', + 'others': [ + { 'path': 'pointer', 'name': 'pinky' }, + ], + }, + { + 'query': 'pointer<usize>, usize -> ()', + 'others': [ + { 'path': 'pointer', 'name': 'pinky' }, + ], + }, + { + 'query': 'pointer<usize>, pointer<usize> -> ()', + 'others': [], + }, + { + 'query': 'pointer<mut, usize>, usize -> ()', + 'others': [], + }, + // thumb with explicit names + { + 'query': 'thumb, thumb -> ()', + 'others': [ + { 'path': 'pointer::Thumb', 'name': 'up' }, + ], + }, + { + 'query': 'pointer<thumb>, thumb -> ()', + 'others': [ + { 'path': 'pointer::Thumb', 'name': 'up' }, + ], + }, + { + 'query': 'pointer<thumb>, pointer<thumb> -> ()', + 'others': [], + }, + { + 'query': 'pointer<mut, thumb>, thumb -> ()', + 'others': [], + }, + // index with explicit names + { + 'query': 'index, index -> ()', + 'others': [ + { 'path': 'pointer::Index', 'name': 'point' }, + ], + }, + { + 'query': 'pointer<index>, index -> ()', + 'others': [ + { 'path': 'pointer::Index', 'name': 'point' }, + ], + }, + { + 'query': 'pointer<index>, pointer<index> -> ()', + 'others': [], + }, + { + 'query': 'pointer<mut, index>, index -> ()', + 'others': [], + }, + // ring with explicit names + { + 'query': 'ring, ring -> ()', + 'others': [ + { 'path': 'pointer::Ring', 'name': 'wear' }, + ], + }, + { + 'query': 'pointer<ring>, ring -> ()', + 'others': [ + { 'path': 'pointer::Ring', 'name': 'wear' }, + ], + }, + { + 'query': 'pointer<ring>, pointer<ring> -> ()', + // can't leave out the `mut`, because can't reorder like that + 'others': [], + }, + { + 'query': 'pointer<mut, ring>, pointer<ring> -> ()', + 'others': [ + { 'path': 'pointer::Ring', 'name': 'wear' }, + ], + }, + { + 'query': 'pointer<mut, ring>, pointer<mut, ring> -> ()', + 'others': [], + }, + // middle with explicit names + { + 'query': 'middle, middle -> ()', + 'others': [ + { 'path': 'pointer', 'name': 'show' }, + ], + }, + { + 'query': 'pointer<middle>, pointer<middle> -> ()', + // can't leave out the mut + 'others': [], + }, + { + 'query': 'pointer<mut, middle>, pointer<mut, middle> -> ()', + 'others': [ + { 'path': 'pointer', 'name': 'show' }, + ], + }, + { + 'query': 'pointer<pointer<mut, middle>>, pointer<mut, pointer<middle>> -> ()', + 'others': [ + { 'path': 'pointer', 'name': 'show' }, + ], + }, + { + 'query': 'pointer<mut, pointer<middle>>, pointer<pointer<mut, middle>> -> ()', + 'others': [ + { 'path': 'pointer', 'name': 'show' }, + ], + }, + { + 'query': 'pointer<pointer<mut, middle>>, pointer<pointer<mut, middle>> -> ()', + 'others': [], + }, + { + 'query': 'pointer<mut, pointer<middle>>, pointer<mut, pointer<middle>> -> ()', + 'others': [], + }, + // pinkie with shorthand + { + 'query': '*const usize, usize -> ()', + 'others': [ + { 'path': 'pointer', 'name': 'pinky' }, + ], + }, + // you can omit the `const`, if you want. + { + 'query': '*usize, usize -> ()', + 'others': [ + { 'path': 'pointer', 'name': 'pinky' }, + ], + }, + { + 'query': '*const usize, *const usize -> ()', + 'others': [], + }, + { + 'query': '*mut usize, usize -> ()', + 'others': [], + }, + // thumb with shorthand + { + 'query': '*const thumb, thumb -> ()', + 'others': [ + { 'path': 'pointer::Thumb', 'name': 'up' }, + ], + }, + { + 'query': '*const thumb, *const thumb -> ()', + 'others': [], + }, + { + 'query': '*mut thumb, thumb -> ()', + 'others': [], + }, + // index with explicit names + { + 'query': '*const index, index -> ()', + 'others': [ + { 'path': 'pointer::Index', 'name': 'point' }, + ], + }, + { + 'query': '*const index, *const index -> ()', + 'others': [], + }, + { + 'query': '*mut index, index -> ()', + 'others': [], + }, + // ring with shorthand + { + 'query': '*const ring, ring -> ()', + 'others': [ + { 'path': 'pointer::Ring', 'name': 'wear' }, + ], + }, + { + 'query': '*const ring, ring -> ()', + 'others': [ + { 'path': 'pointer::Ring', 'name': 'wear' }, + ], + }, + { + 'query': '*mut ring, *const ring -> ()', + 'others': [ + { 'path': 'pointer::Ring', 'name': 'wear' }, + ], + }, + { + 'query': '*mut ring, *mut ring -> ()', + 'others': [], + }, + // middle with shorthand + { + 'query': '*const middle, *const middle -> ()', + // can't leave out the mut + 'others': [], + }, + { + 'query': '*mut middle, *mut middle -> ()', + 'others': [ + { 'path': 'pointer', 'name': 'show' }, + ], + }, + { + 'query': '*const *mut middle, *mut *const middle -> ()', + 'others': [ + { 'path': 'pointer', 'name': 'show' }, + ], + }, + { + 'query': '*mut *const middle, *const *mut middle -> ()', + 'others': [ + { 'path': 'pointer', 'name': 'show' }, + ], + }, + { + 'query': '*const *mut middle, *const *mut middle -> ()', + 'others': [], + }, + { + 'query': '*mut *const middle, *mut *const middle -> ()', + 'others': [], + }, +]; diff --git a/tests/rustdoc-js/pointer.rs b/tests/rustdoc-js/pointer.rs new file mode 100644 index 00000000000..8375a174303 --- /dev/null +++ b/tests/rustdoc-js/pointer.rs @@ -0,0 +1,40 @@ +#![feature(extern_types)] + +pub fn pinky(input: *const usize, manage: usize) { + unimplemented!() +} + +pub struct Thumb; + +impl Thumb { + pub fn up(this: *const Self, finger: Thumb) { + unimplemented!() + } +} + +pub enum Index {} + +impl Index { + pub fn point(self, data: *const Index) { + unimplemented!() + } +} + +pub union Ring { + magic: u32, + marriage: f32, +} + +impl Ring { + pub fn wear(this: *mut Self, extra: *const Ring) { + unimplemented!() + } +} + +extern "C" { + pub type Middle; +} + +pub fn show(left: *const *mut Middle, right: *mut *const Middle) { + unimplemented!() +} diff --git a/tests/rustdoc-js/type-parameters.js b/tests/rustdoc-js/type-parameters.js index fa2b8d2ebfd..b1f1ee951c6 100644 --- a/tests/rustdoc-js/type-parameters.js +++ b/tests/rustdoc-js/type-parameters.js @@ -4,8 +4,8 @@ const EXPECTED = [ { query: '-> trait:Some', others: [ - { path: 'foo', name: 'alpha' }, { path: 'foo', name: 'alef' }, + { path: 'foo', name: 'alpha' }, ], }, { @@ -75,10 +75,8 @@ const EXPECTED = [ { query: 'Other', in_args: [ - // because function is called "other", it's sorted first - // even though it has higher type distance - { path: 'foo', name: 'other' }, { path: 'foo', name: 'alternate' }, + { path: 'foo', name: 'other' }, ], }, { diff --git a/tests/rustdoc-json/doc_attribute.rs b/tests/rustdoc-json/doc_attribute.rs new file mode 100644 index 00000000000..9e1a711f0b7 --- /dev/null +++ b/tests/rustdoc-json/doc_attribute.rs @@ -0,0 +1,18 @@ +// Doc attributes (`#[doc(attribute = "...")]` should not be generated in rustdoc JSON output +// and this test ensures it. + +#![feature(rustdoc_internals)] +#![no_std] + +//@ !has "$.index[?(@.name=='repr')]" +//@ has "$.index[?(@.name=='foo')]" + +#[doc(attribute = "repr")] +/// this is a test! +pub mod foo {} + +//@ !has "$.index[?(@.name=='forbid')]" +//@ !has "$.index[?(@.name=='bar')]" +#[doc(attribute = "forbid")] +/// hello +mod bar {} diff --git a/tests/rustdoc-ui/doc-attribute-unsupported.rs b/tests/rustdoc-ui/doc-attribute-unsupported.rs new file mode 100644 index 00000000000..3bd153117a9 --- /dev/null +++ b/tests/rustdoc-ui/doc-attribute-unsupported.rs @@ -0,0 +1,7 @@ +// This is currently not supported but should be! + +#![feature(rustdoc_internals)] + +#[doc(attribute = "diagnostic::do_not_recommend")] //~ ERROR +/// bla +mod yup {} diff --git a/tests/rustdoc-ui/doc-attribute-unsupported.stderr b/tests/rustdoc-ui/doc-attribute-unsupported.stderr new file mode 100644 index 00000000000..e2480a548ac --- /dev/null +++ b/tests/rustdoc-ui/doc-attribute-unsupported.stderr @@ -0,0 +1,10 @@ +error: nonexistent builtin attribute `diagnostic::do_not_recommend` used in `#[doc(attribute = "...")]` + --> $DIR/doc-attribute-unsupported.rs:5:19 + | +LL | #[doc(attribute = "diagnostic::do_not_recommend")] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: only existing builtin attributes are allowed in core/std + +error: aborting due to 1 previous error + diff --git a/tests/rustdoc-ui/invalid-attribute.rs b/tests/rustdoc-ui/invalid-attribute.rs new file mode 100644 index 00000000000..2fc7be2cf34 --- /dev/null +++ b/tests/rustdoc-ui/invalid-attribute.rs @@ -0,0 +1,10 @@ +// Testing the output when an invalid builtin attribute is passed as value +// to `doc(attribute = "...")`. + +#![feature(rustdoc_internals)] + +#[doc(attribute = "foo df")] //~ ERROR +mod foo {} + +#[doc(attribute = "fooyi")] //~ ERROR +mod foo2 {} diff --git a/tests/rustdoc-ui/invalid-attribute.stderr b/tests/rustdoc-ui/invalid-attribute.stderr new file mode 100644 index 00000000000..66e68ce44b4 --- /dev/null +++ b/tests/rustdoc-ui/invalid-attribute.stderr @@ -0,0 +1,18 @@ +error: nonexistent builtin attribute `foo df` used in `#[doc(attribute = "...")]` + --> $DIR/invalid-attribute.rs:6:19 + | +LL | #[doc(attribute = "foo df")] + | ^^^^^^^^ + | + = help: only existing builtin attributes are allowed in core/std + +error: nonexistent builtin attribute `fooyi` used in `#[doc(attribute = "...")]` + --> $DIR/invalid-attribute.rs:9:19 + | +LL | #[doc(attribute = "fooyi")] + | ^^^^^^^ + | + = help: only existing builtin attributes are allowed in core/std + +error: aborting due to 2 previous errors + diff --git a/tests/rustdoc-ui/issues/issue-79494.rs b/tests/rustdoc-ui/issues/issue-79494.rs index 28ef82dac0f..737c00a0269 100644 --- a/tests/rustdoc-ui/issues/issue-79494.rs +++ b/tests/rustdoc-ui/issues/issue-79494.rs @@ -1,5 +1,6 @@ -//@ only-x86_64-unknown-linux-gnu +//@ only-64bit #![feature(const_transmute)] -pub 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 transmuting from 8-byte type to 16-byte type diff --git a/tests/rustdoc-ui/issues/issue-79494.stderr b/tests/rustdoc-ui/issues/issue-79494.stderr index 20e568d8eab..fa797bfd50a 100644 --- a/tests/rustdoc-ui/issues/issue-79494.stderr +++ b/tests/rustdoc-ui/issues/issue-79494.stderr @@ -1,12 +1,9 @@ -error[E0512]: cannot transmute between types of different sizes, or dependently-sized types +error[E0080]: transmuting from 8-byte type to 16-byte type: `usize` -> `&[u8]` --> $DIR/issue-79494.rs:5:33 | LL | pub const ZST: &[u8] = unsafe { std::mem::transmute(1usize) }; - | ^^^^^^^^^^^^^^^^^^^ - | - = note: source type: `usize` (64 bits) - = note: target type: `&[u8]` (128 bits) + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `ZST` failed here error: aborting due to 1 previous error -For more information about this error, try `rustc --explain E0512`. +For more information about this error, try `rustc --explain E0080`. diff --git a/tests/rustdoc-ui/lints/invalid-html-tags.rs b/tests/rustdoc-ui/lints/invalid-html-tags.rs index 317f1fd1d46..8003e5efdd5 100644 --- a/tests/rustdoc-ui/lints/invalid-html-tags.rs +++ b/tests/rustdoc-ui/lints/invalid-html-tags.rs @@ -43,7 +43,7 @@ pub fn b() {} /// <h3> //~^ ERROR unclosed HTML tag `h3` /// <script -//~^ ERROR unclosed HTML tag `script` +//~^ ERROR incomplete HTML tag `script` pub fn c() {} // Unclosed tags shouldn't warn if they are nested inside a <script> elem. @@ -72,6 +72,7 @@ pub fn e() {} /// <div></div > /// <div></div //~^ ERROR unclosed HTML tag `div` +//~| ERROR incomplete HTML tag `div` pub fn f() {} /// <!----> @@ -105,7 +106,7 @@ pub fn j() {} /// uiapp.run(&env::args().collect::<Vec<_>>()); /// ``` /// -/// <Vec<_> shouldn't warn! +// <Vec<_> shouldn't warn! /// `````` pub fn k() {} @@ -121,3 +122,92 @@ pub fn no_error_1() {} /// backslashed \<<a href=""> //~^ ERROR unclosed HTML tag `a` pub fn p() {} + +/// <svg width="512" height="512" viewBox="0 0 512" fill="none" xmlns="http://www.w3.org/2000/svg"> +/// <rect +/// width="256" +/// height="256" +/// fill="#5064C8" +/// stroke="black" +/// /> +/// </svg> +pub fn no_error_2() {} + +/// <div> +/// <img +/// src="https://example.com/ferris.png" +/// width="512" +/// height="512" +/// /> +/// </div> +pub fn no_error_3() {} + +/// > <div +/// > class="foo"> +/// > </div> +pub fn no_error_4() {} + +/// unfinished ALLOWED_UNCLOSED +/// +/// note: CommonMark doesn't allow an html block to start with a multiline tag, +/// so we use `<br>` a bunch to force these to be parsed as html blocks. +/// +/// <br> +/// <img +//~^ ERROR incomplete HTML tag `img` +pub fn q() {} + +/// nested unfinished ALLOWED_UNCLOSED +/// <p><img</p> +//~^ ERROR incomplete HTML tag `img` +pub fn r() {} + +/// > <br> +/// > <img +//~^ ERROR incomplete HTML tag `img` +/// > href="#broken" +pub fn s() {} + +/// <br> +/// <br<br> +//~^ ERROR incomplete HTML tag `br` +pub fn t() {} + +/// <br> +/// <br +//~^ ERROR incomplete HTML tag `br` +pub fn u() {} + +/// <a href=">" alt="<">html5 allows this</a> +pub fn no_error_5() {} + +/// <br> +/// <img title=" +/// html5 +/// allows +/// multiline +/// attr +/// values +/// these are just text, not tags: +/// </div> +/// <p/> +/// <div> +/// "> +pub fn no_error_6() {} + +/// <br> +/// <a href="data:text/html,<!DOCTYPE> +/// <html> +/// <body><b>this is allowed for some reason</b></body> +/// </html> +/// ">what</a> +pub fn no_error_7() {} + +/// Technically this is allowed per the html5 spec, +/// but there's basically no legitemate reason to do it, +/// so we don't allow it. +/// +/// <p <!-->foobar</p> +//~^ ERROR Unclosed HTML comment +//~| ERROR incomplete HTML tag `p` +pub fn v() {} diff --git a/tests/rustdoc-ui/lints/invalid-html-tags.stderr b/tests/rustdoc-ui/lints/invalid-html-tags.stderr index 9c2bfcf2c3d..b6ec22c2479 100644 --- a/tests/rustdoc-ui/lints/invalid-html-tags.stderr +++ b/tests/rustdoc-ui/lints/invalid-html-tags.stderr @@ -52,6 +52,12 @@ error: unclosed HTML tag `p` LL | /// <br/> <p> | ^^^ +error: incomplete HTML tag `script` + --> $DIR/invalid-html-tags.rs:45:5 + | +LL | /// <script + | ^^^^^^^ + error: unclosed HTML tag `div` --> $DIR/invalid-html-tags.rs:41:5 | @@ -64,11 +70,11 @@ error: unclosed HTML tag `h3` LL | /// <h3> | ^^^^ -error: unclosed HTML tag `script` - --> $DIR/invalid-html-tags.rs:45:5 +error: incomplete HTML tag `div` + --> $DIR/invalid-html-tags.rs:73:10 | -LL | /// <script - | ^^^^^^ +LL | /// <div></div + | ^^^^^ error: unclosed HTML tag `div` --> $DIR/invalid-html-tags.rs:73:5 @@ -77,28 +83,73 @@ LL | /// <div></div | ^^^^^ error: Unclosed HTML comment - --> $DIR/invalid-html-tags.rs:87:5 + --> $DIR/invalid-html-tags.rs:88:5 | LL | /// <!-- - | ^^^ + | ^^^^ error: unopened HTML tag `unopened-tag` - --> $DIR/invalid-html-tags.rs:114:26 + --> $DIR/invalid-html-tags.rs:115:26 | LL | /// Web Components style </unopened-tag> | ^^^^^^^^^^^^^^^ error: unclosed HTML tag `dashed-tags` - --> $DIR/invalid-html-tags.rs:112:26 + --> $DIR/invalid-html-tags.rs:113:26 | LL | /// Web Components style <dashed-tags> | ^^^^^^^^^^^^^ error: unclosed HTML tag `a` - --> $DIR/invalid-html-tags.rs:121:19 + --> $DIR/invalid-html-tags.rs:122:19 | LL | /// backslashed \<<a href=""> | ^^ -error: aborting due to 16 previous errors +error: incomplete HTML tag `img` + --> $DIR/invalid-html-tags.rs:156:5 + | +LL | /// <img + | ^^^^ + +error: incomplete HTML tag `img` + --> $DIR/invalid-html-tags.rs:161:8 + | +LL | /// <p><img</p> + | ^^^^ + +error: incomplete HTML tag `img` + --> $DIR/invalid-html-tags.rs:166:7 + | +LL | /// > <img + | _______^ +LL | | +LL | | /// > href="#broken" + | |____________________^ + +error: incomplete HTML tag `br` + --> $DIR/invalid-html-tags.rs:172:5 + | +LL | /// <br<br> + | ^^^ + +error: incomplete HTML tag `br` + --> $DIR/invalid-html-tags.rs:177:5 + | +LL | /// <br + | ^^^ + +error: incomplete HTML tag `p` + --> $DIR/invalid-html-tags.rs:210:5 + | +LL | /// <p <!-->foobar</p> + | ^^^ + +error: Unclosed HTML comment + --> $DIR/invalid-html-tags.rs:210:8 + | +LL | /// <p <!-->foobar</p> + | ^^^^ + +error: aborting due to 24 previous errors diff --git a/tests/rustdoc/attribute-rendering.rs b/tests/rustdoc/attribute-rendering.rs index bf9b81077f3..fb40d0a9887 100644 --- a/tests/rustdoc/attribute-rendering.rs +++ b/tests/rustdoc/attribute-rendering.rs @@ -1,7 +1,8 @@ #![crate_name = "foo"] //@ has 'foo/fn.f.html' -//@ has - //*[@'class="rust item-decl"]' '#[unsafe(export_name = "f")] pub fn f()' +//@ has - //*[@'class="code-attribute"]' '#[unsafe(export_name = "f")]' +//@ has - //*[@'class="rust item-decl"]' 'pub fn f()' #[unsafe(export_name = "\ f")] pub fn f() {} diff --git a/tests/rustdoc/attributes.rs b/tests/rustdoc/attributes.rs index 34487a89127..33e4e31bec6 100644 --- a/tests/rustdoc/attributes.rs +++ b/tests/rustdoc/attributes.rs @@ -1,18 +1,81 @@ //@ edition: 2024 #![crate_name = "foo"] -//@ has foo/fn.f.html '//pre[@class="rust item-decl"]' '#[unsafe(no_mangle)]' +//@ has foo/fn.f.html '//*[@class="code-attribute"]' '#[unsafe(no_mangle)]' #[unsafe(no_mangle)] pub extern "C" fn f() {} -//@ has foo/fn.g.html '//pre[@class="rust item-decl"]' '#[unsafe(export_name = "bar")]' +//@ has foo/fn.g.html '//*[@class="code-attribute"]' '#[unsafe(export_name = "bar")]' #[unsafe(export_name = "bar")] pub extern "C" fn g() {} -//@ has foo/fn.example.html '//pre[@class="rust item-decl"]' '#[unsafe(link_section = ".text")]' +//@ has foo/fn.example.html '//*[@class="code-attribute"]' '#[unsafe(link_section = ".text")]' #[unsafe(link_section = ".text")] pub extern "C" fn example() {} -//@ has foo/struct.Repr.html '//pre[@class="rust item-decl"]' '#[repr(C, align(8))]' +//@ has foo/struct.Repr.html '//*[@class="code-attribute"]' '#[repr(C, align(8))]' #[repr(C, align(8))] pub struct Repr; + +//@ has foo/macro.macro_rule.html '//*[@class="code-attribute"]' '#[unsafe(link_section = ".text")]' +#[unsafe(link_section = ".text")] +#[macro_export] +macro_rules! macro_rule { + () => {}; +} + +//@ has 'foo/enum.Enum.html' '//*[@class="code-attribute"]' '#[unsafe(link_section = "enum")]' +#[unsafe(link_section = "enum")] +pub enum Enum { + //@ has 'foo/enum.Enum.html' '//*[@class="code-attribute"]' '#[unsafe(link_section = "a")]' + //@ has - '//*[@class="variants"]//*[@class="code-attribute"]' '#[unsafe(link_section = "a")]' + #[unsafe(link_section = "a")] + A, + //@ has 'foo/enum.Enum.html' '//*[@class="code-attribute"]' '#[unsafe(link_section = "quz")]' + //@ has - '//*[@class="variants"]//*[@class="code-attribute"]' '#[unsafe(link_section = "quz")]' + #[unsafe(link_section = "quz")] + Quz { + //@ has 'foo/enum.Enum.html' '//*[@class="code-attribute"]' '#[unsafe(link_section = "b")]' + //@ has - '//*[@class="variants"]//*[@class="code-attribute"]' '#[unsafe(link_section = "b")]' + #[unsafe(link_section = "b")] + b: (), + }, +} + +//@ has 'foo/trait.Trait.html' '//*[@class="code-attribute"]' '#[unsafe(link_section = "trait")]' +#[unsafe(link_section = "trait")] +pub trait Trait { + //@ has 'foo/trait.Trait.html' + //@ has - '//*[@id="associatedconstant.BAR"]/*[@class="code-header"]/*[@class="code-attribute"]' '#[unsafe(link_section = "bar")]' + //@ has - '//*[@id="associatedconstant.BAR"]/*[@class="code-header"]' 'const BAR: u32 = 0u32' + #[unsafe(link_section = "bar")] + const BAR: u32 = 0; + + //@ has - '//*[@class="code-attribute"]' '#[unsafe(link_section = "foo")]' + #[unsafe(link_section = "foo")] + fn foo() {} +} + +//@ has 'foo/union.Union.html' '//*[@class="code-attribute"]' '#[unsafe(link_section = "union")]' +#[unsafe(link_section = "union")] +pub union Union { + //@ has 'foo/union.Union.html' '//*[@class="code-attribute"]' '#[unsafe(link_section = "x")]' + #[unsafe(link_section = "x")] + pub x: u32, + y: f32, +} + +//@ has 'foo/struct.Struct.html' '//*[@class="code-attribute"]' '#[unsafe(link_section = "struct")]' +#[unsafe(link_section = "struct")] +pub struct Struct { + //@ has 'foo/struct.Struct.html' '//*[@class="code-attribute"]' '#[unsafe(link_section = "x")]' + //@ has - '//*[@id="structfield.x"]//*[@class="code-attribute"]' '#[unsafe(link_section = "x")]' + #[unsafe(link_section = "x")] + pub x: u32, + y: f32, +} + +// Check that the attributes from the trait items show up consistently in the impl. +//@ has 'foo/struct.Struct.html' '//*[@id="trait-implementations-list"]//*[@class="code-attribute"]' '#[unsafe(link_section = "bar")]' +//@ has 'foo/struct.Struct.html' '//*[@id="trait-implementations-list"]//*[@class="code-attribute"]' '#[unsafe(link_section = "foo")]' +impl Trait for Struct {} diff --git a/tests/rustdoc/cross-crate-info/cargo-transitive-no-index/s.rs b/tests/rustdoc/cross-crate-info/cargo-transitive-no-index/s.rs index 85c460ace64..088ab242d27 100644 --- a/tests/rustdoc/cross-crate-info/cargo-transitive-no-index/s.rs +++ b/tests/rustdoc/cross-crate-info/cargo-transitive-no-index/s.rs @@ -5,9 +5,9 @@ //@ has t/trait.Tango.html //@ hasraw s/struct.Sierra.html 'Tango' //@ hasraw trait.impl/t/trait.Tango.js 'struct.Sierra.html' -//@ hasraw search-index.js 'Tango' -//@ hasraw search-index.js 'Sierra' -//@ hasraw search-index.js 'Quebec' +//@ hasraw search.index/name/*.js 'Tango' +//@ hasraw search.index/name/*.js 'Sierra' +//@ hasraw search.index/name/*.js 'Quebec' // We document multiple crates into the same output directory, which // merges the cross-crate information. Everything is available. diff --git a/tests/rustdoc/cross-crate-info/cargo-transitive/s.rs b/tests/rustdoc/cross-crate-info/cargo-transitive/s.rs index 68bfc34883b..fb6eef0bf69 100644 --- a/tests/rustdoc/cross-crate-info/cargo-transitive/s.rs +++ b/tests/rustdoc/cross-crate-info/cargo-transitive/s.rs @@ -13,9 +13,9 @@ //@ has t/trait.Tango.html //@ hasraw s/struct.Sierra.html 'Tango' //@ hasraw trait.impl/t/trait.Tango.js 'struct.Sierra.html' -//@ hasraw search-index.js 'Tango' -//@ hasraw search-index.js 'Sierra' -//@ hasraw search-index.js 'Quebec' +//@ hasraw search.index/name/*.js 'Tango' +//@ hasraw search.index/name/*.js 'Sierra' +//@ hasraw search.index/name/*.js 'Quebec' // We document multiple crates into the same output directory, which // merges the cross-crate information. Everything is available. diff --git a/tests/rustdoc/cross-crate-info/cargo-two-no-index/e.rs b/tests/rustdoc/cross-crate-info/cargo-two-no-index/e.rs index c93298f969e..53375670552 100644 --- a/tests/rustdoc/cross-crate-info/cargo-two-no-index/e.rs +++ b/tests/rustdoc/cross-crate-info/cargo-two-no-index/e.rs @@ -4,8 +4,8 @@ //@ has f/trait.Foxtrot.html //@ hasraw e/enum.Echo.html 'Foxtrot' //@ hasraw trait.impl/f/trait.Foxtrot.js 'enum.Echo.html' -//@ hasraw search-index.js 'Foxtrot' -//@ hasraw search-index.js 'Echo' +//@ hasraw search.index/name/*.js 'Foxtrot' +//@ hasraw search.index/name/*.js 'Echo' // document two crates in the same way that cargo does. do not provide // --enable-index-page diff --git a/tests/rustdoc/cross-crate-info/cargo-two/e.rs b/tests/rustdoc/cross-crate-info/cargo-two/e.rs index 00f86cbc348..936e75c97af 100644 --- a/tests/rustdoc/cross-crate-info/cargo-two/e.rs +++ b/tests/rustdoc/cross-crate-info/cargo-two/e.rs @@ -11,8 +11,8 @@ //@ has f/trait.Foxtrot.html //@ hasraw e/enum.Echo.html 'Foxtrot' //@ hasraw trait.impl/f/trait.Foxtrot.js 'enum.Echo.html' -//@ hasraw search-index.js 'Foxtrot' -//@ hasraw search-index.js 'Echo' +//@ hasraw search.index/name/*.js 'Foxtrot' +//@ hasraw search.index/name/*.js 'Echo' // document two crates in the same way that cargo does, writing them both // into the same output directory diff --git a/tests/rustdoc/cross-crate-info/index-on-last/e.rs b/tests/rustdoc/cross-crate-info/index-on-last/e.rs index ffee898cd96..dbaeaf5b725 100644 --- a/tests/rustdoc/cross-crate-info/index-on-last/e.rs +++ b/tests/rustdoc/cross-crate-info/index-on-last/e.rs @@ -11,8 +11,8 @@ //@ has f/trait.Foxtrot.html //@ hasraw e/enum.Echo.html 'Foxtrot' //@ hasraw trait.impl/f/trait.Foxtrot.js 'enum.Echo.html' -//@ hasraw search-index.js 'Foxtrot' -//@ hasraw search-index.js 'Echo' +//@ hasraw search.index/name/*.js 'Foxtrot' +//@ hasraw search.index/name/*.js 'Echo' // only declare --enable-index-page to the last rustdoc invocation extern crate f; diff --git a/tests/rustdoc/cross-crate-info/kitchen-sink/i.rs b/tests/rustdoc/cross-crate-info/kitchen-sink/i.rs index bcb9464795a..979d77d8c42 100644 --- a/tests/rustdoc/cross-crate-info/kitchen-sink/i.rs +++ b/tests/rustdoc/cross-crate-info/kitchen-sink/i.rs @@ -19,10 +19,10 @@ //@ has t/trait.Tango.html //@ hasraw s/struct.Sierra.html 'Tango' //@ hasraw trait.impl/t/trait.Tango.js 'struct.Sierra.html' -//@ hasraw search-index.js 'Quebec' -//@ hasraw search-index.js 'Romeo' -//@ hasraw search-index.js 'Sierra' -//@ hasraw search-index.js 'Tango' +//@ hasraw search.index/name/*.js 'Quebec' +//@ hasraw search.index/name/*.js 'Romeo' +//@ hasraw search.index/name/*.js 'Sierra' +//@ hasraw search.index/name/*.js 'Tango' //@ has type.impl/s/struct.Sierra.js //@ hasraw type.impl/s/struct.Sierra.js 'Tango' //@ hasraw type.impl/s/struct.Sierra.js 'Romeo' diff --git a/tests/rustdoc/cross-crate-info/single-crate-baseline/q.rs b/tests/rustdoc/cross-crate-info/single-crate-baseline/q.rs index c5e3dc0a0f4..439ab23de18 100644 --- a/tests/rustdoc/cross-crate-info/single-crate-baseline/q.rs +++ b/tests/rustdoc/cross-crate-info/single-crate-baseline/q.rs @@ -6,7 +6,7 @@ //@ has index.html '//h1' 'List of all crates' //@ has index.html '//ul[@class="all-items"]//a[@href="q/index.html"]' 'q' //@ has q/struct.Quebec.html -//@ hasraw search-index.js 'Quebec' +//@ hasraw search.index/name/*.js 'Quebec' // there's nothing cross-crate going on here pub struct Quebec; diff --git a/tests/rustdoc/cross-crate-info/single-crate-no-index/q.rs b/tests/rustdoc/cross-crate-info/single-crate-no-index/q.rs index d3e71fa0ce3..b3703658465 100644 --- a/tests/rustdoc/cross-crate-info/single-crate-no-index/q.rs +++ b/tests/rustdoc/cross-crate-info/single-crate-no-index/q.rs @@ -1,6 +1,6 @@ //@ build-aux-docs //@ has q/struct.Quebec.html -//@ hasraw search-index.js 'Quebec' +//@ hasraw search.index/name/*.js 'Quebec' // there's nothing cross-crate going on here pub struct Quebec; diff --git a/tests/rustdoc/cross-crate-info/write-docs-somewhere-else/e.rs b/tests/rustdoc/cross-crate-info/write-docs-somewhere-else/e.rs index 9dcec211e17..6ded19546b8 100644 --- a/tests/rustdoc/cross-crate-info/write-docs-somewhere-else/e.rs +++ b/tests/rustdoc/cross-crate-info/write-docs-somewhere-else/e.rs @@ -4,8 +4,8 @@ //@ !has f/trait.Foxtrot.html //@ hasraw e/enum.Echo.html 'Foxtrot' //@ hasraw trait.impl/f/trait.Foxtrot.js 'enum.Echo.html' -//@ !hasraw search-index.js 'Foxtrot' -//@ hasraw search-index.js 'Echo' +//@ !hasraw search.index/name/*.js 'Foxtrot' +//@ hasraw search.index/name/*.js 'Echo' // test the fact that our test runner will document this crate somewhere // else diff --git a/tests/rustdoc/doc-attribute.rs b/tests/rustdoc/doc-attribute.rs new file mode 100644 index 00000000000..92e603ae6e5 --- /dev/null +++ b/tests/rustdoc/doc-attribute.rs @@ -0,0 +1,24 @@ +// Test checking the `#[doc(attribute = "...")]` attribute. + +#![crate_name = "foo"] + +#![feature(rustdoc_internals)] + +//@ has foo/index.html '//h2[@id="attributes"]' 'Attributes' +//@ has foo/index.html '//a[@href="attribute.no_mangle.html"]' 'no_mangle' +//@ has foo/index.html '//div[@class="sidebar-elems"]//li/a' 'Attributes' +//@ has foo/index.html '//div[@class="sidebar-elems"]//li/a/@href' '#attributes' +//@ has foo/attribute.no_mangle.html '//h1' 'Attribute no_mangle' +//@ has foo/attribute.no_mangle.html '//section[@id="main-content"]//div[@class="docblock"]//p' 'this is a test!' +//@ has foo/index.html '//a/@href' '../foo/index.html' +//@ !has foo/foo/index.html +//@ !has-dir foo/foo +//@ !has foo/index.html '//span' '🔒' +#[doc(attribute = "no_mangle")] +/// this is a test! +mod foo{} + +//@ has foo/attribute.repr.html '//section[@id="main-content"]//div[@class="docblock"]//p' 'hello' +#[doc(attribute = "repr")] +/// hello +mod bar {} diff --git a/tests/rustdoc/enum/enum-variant-non_exhaustive.type-alias-code.html b/tests/rustdoc/enum/enum-variant-non_exhaustive.type-alias-code.html index 04eea709079..e8b8e93beb4 100644 --- a/tests/rustdoc/enum/enum-variant-non_exhaustive.type-alias-code.html +++ b/tests/rustdoc/enum/enum-variant-non_exhaustive.type-alias-code.html @@ -1,4 +1,4 @@ <code>pub enum TypeAlias { - #[non_exhaustive] + <div class="code-attribute">#[non_exhaustive]</div> Variant, -}</code> \ No newline at end of file +}</code> diff --git a/tests/rustdoc/enum/enum-variant-non_exhaustive.type-code.html b/tests/rustdoc/enum/enum-variant-non_exhaustive.type-code.html index 6c8851ea5df..51763c824eb 100644 --- a/tests/rustdoc/enum/enum-variant-non_exhaustive.type-code.html +++ b/tests/rustdoc/enum/enum-variant-non_exhaustive.type-code.html @@ -1,4 +1,4 @@ <code>pub enum Type { - #[non_exhaustive] + <div class="code-attribute">#[non_exhaustive]</div> Variant, -}</code> \ No newline at end of file +}</code> diff --git a/tests/rustdoc/macro/macro_expansion.rs b/tests/rustdoc/macro/macro_expansion.rs new file mode 100644 index 00000000000..c989ccad967 --- /dev/null +++ b/tests/rustdoc/macro/macro_expansion.rs @@ -0,0 +1,28 @@ +// This test checks that patterns and statements are also getting expanded. + +//@ compile-flags: -Zunstable-options --generate-macro-expansion + +#![crate_name = "foo"] + +//@ has 'src/foo/macro_expansion.rs.html' +//@ count - '//span[@class="expansion"]' 2 + +macro_rules! pat { + ($x:literal) => { + Some($x) + } +} + +macro_rules! stmt { + ($x:expr) => {{ + let _ = $x; + }} +} + +fn bar() { + match Some("hello") { + pat!("blolb") => {} + _ => {} + } + stmt!(1) +} diff --git a/tests/rustdoc/masked.rs b/tests/rustdoc/masked.rs index 4f361ca881e..bc0a5f57cef 100644 --- a/tests/rustdoc/masked.rs +++ b/tests/rustdoc/masked.rs @@ -7,7 +7,7 @@ #[doc(masked)] extern crate masked; -//@ !hasraw 'search-index.js' 'masked_method' +//@ !hasraw 'search.index/name/*.js' 'masked_method' //@ !hasraw 'foo/struct.String.html' 'MaskedTrait' //@ !hasraw 'foo/struct.String.html' 'MaskedBlanketTrait' diff --git a/tests/rustdoc/merge-cross-crate-info/cargo-transitive-read-write/sierra.rs b/tests/rustdoc/merge-cross-crate-info/cargo-transitive-read-write/sierra.rs index 665f9567ba2..26292c50d35 100644 --- a/tests/rustdoc/merge-cross-crate-info/cargo-transitive-read-write/sierra.rs +++ b/tests/rustdoc/merge-cross-crate-info/cargo-transitive-read-write/sierra.rs @@ -14,9 +14,9 @@ //@ has tango/trait.Tango.html //@ hasraw sierra/struct.Sierra.html 'Tango' //@ hasraw trait.impl/tango/trait.Tango.js 'struct.Sierra.html' -//@ hasraw search-index.js 'Tango' -//@ hasraw search-index.js 'Sierra' -//@ hasraw search-index.js 'Quebec' +//@ hasraw search.index/name/*.js 'Tango' +//@ hasraw search.index/name/*.js 'Sierra' +//@ hasraw search.index/name/*.js 'Quebec' // similar to cargo-workflow-transitive, but we use --merge=read-write, // which is the default. diff --git a/tests/rustdoc/merge-cross-crate-info/kitchen-sink-separate-dirs/indigo.rs b/tests/rustdoc/merge-cross-crate-info/kitchen-sink-separate-dirs/indigo.rs index f03f6bd6026..fd6ee0cbf24 100644 --- a/tests/rustdoc/merge-cross-crate-info/kitchen-sink-separate-dirs/indigo.rs +++ b/tests/rustdoc/merge-cross-crate-info/kitchen-sink-separate-dirs/indigo.rs @@ -23,10 +23,10 @@ //@ !has sierra/struct.Sierra.html //@ !has tango/trait.Tango.html //@ hasraw trait.impl/tango/trait.Tango.js 'struct.Sierra.html' -//@ hasraw search-index.js 'Quebec' -//@ hasraw search-index.js 'Romeo' -//@ hasraw search-index.js 'Sierra' -//@ hasraw search-index.js 'Tango' +//@ hasraw search.index/name/*.js 'Quebec' +//@ hasraw search.index/name/*.js 'Romeo' +//@ hasraw search.index/name/*.js 'Sierra' +//@ hasraw search.index/name/*.js 'Tango' //@ has type.impl/sierra/struct.Sierra.js //@ hasraw type.impl/sierra/struct.Sierra.js 'Tango' //@ hasraw type.impl/sierra/struct.Sierra.js 'Romeo' diff --git a/tests/rustdoc/merge-cross-crate-info/no-merge-separate/sierra.rs b/tests/rustdoc/merge-cross-crate-info/no-merge-separate/sierra.rs index 7eac207e518..c3b8200f151 100644 --- a/tests/rustdoc/merge-cross-crate-info/no-merge-separate/sierra.rs +++ b/tests/rustdoc/merge-cross-crate-info/no-merge-separate/sierra.rs @@ -8,7 +8,7 @@ //@ has sierra/struct.Sierra.html //@ hasraw sierra/struct.Sierra.html 'Tango' //@ !has trait.impl/tango/trait.Tango.js -//@ !has search-index.js +//@ !has search.index/name/*.js // we don't generate any cross-crate info if --merge=none, even if we // document crates separately diff --git a/tests/rustdoc/merge-cross-crate-info/no-merge-write-anyway/sierra.rs b/tests/rustdoc/merge-cross-crate-info/no-merge-write-anyway/sierra.rs index f3340a80c84..2e47d42daff 100644 --- a/tests/rustdoc/merge-cross-crate-info/no-merge-write-anyway/sierra.rs +++ b/tests/rustdoc/merge-cross-crate-info/no-merge-write-anyway/sierra.rs @@ -10,7 +10,7 @@ //@ has tango/trait.Tango.html //@ hasraw sierra/struct.Sierra.html 'Tango' //@ !has trait.impl/tango/trait.Tango.js -//@ !has search-index.js +//@ !has search.index/name/*.js // we --merge=none, so --parts-out-dir doesn't do anything extern crate tango; diff --git a/tests/rustdoc/merge-cross-crate-info/overwrite-but-include/sierra.rs b/tests/rustdoc/merge-cross-crate-info/overwrite-but-include/sierra.rs index 8eb0f1d0498..337dc558f35 100644 --- a/tests/rustdoc/merge-cross-crate-info/overwrite-but-include/sierra.rs +++ b/tests/rustdoc/merge-cross-crate-info/overwrite-but-include/sierra.rs @@ -10,9 +10,9 @@ //@ has tango/trait.Tango.html //@ hasraw sierra/struct.Sierra.html 'Tango' //@ hasraw trait.impl/tango/trait.Tango.js 'struct.Sierra.html' -//@ hasraw search-index.js 'Tango' -//@ hasraw search-index.js 'Sierra' -//@ !hasraw search-index.js 'Quebec' +//@ hasraw search.index/name/*.js 'Tango' +//@ hasraw search.index/name/*.js 'Sierra' +//@ !hasraw search.index/name/*.js 'Quebec' // we overwrite quebec and tango's cross-crate information, but we // include the info from tango meaning that it should appear in the out diff --git a/tests/rustdoc/merge-cross-crate-info/overwrite-but-separate/sierra.rs b/tests/rustdoc/merge-cross-crate-info/overwrite-but-separate/sierra.rs index 4ee036238b4..c07b30d2aa0 100644 --- a/tests/rustdoc/merge-cross-crate-info/overwrite-but-separate/sierra.rs +++ b/tests/rustdoc/merge-cross-crate-info/overwrite-but-separate/sierra.rs @@ -13,9 +13,9 @@ //@ has index.html '//ul[@class="all-items"]//a[@href="tango/index.html"]' 'tango' //@ has sierra/struct.Sierra.html //@ hasraw trait.impl/tango/trait.Tango.js 'struct.Sierra.html' -//@ hasraw search-index.js 'Tango' -//@ hasraw search-index.js 'Sierra' -//@ hasraw search-index.js 'Quebec' +//@ hasraw search.index/name/*.js 'Tango' +//@ hasraw search.index/name/*.js 'Sierra' +//@ hasraw search.index/name/*.js 'Quebec' // If these were documeted into the same directory, the info would be // overwritten. However, since they are merged, we can still recover all diff --git a/tests/rustdoc/merge-cross-crate-info/overwrite/sierra.rs b/tests/rustdoc/merge-cross-crate-info/overwrite/sierra.rs index 11e61dd2744..cac978f3bb2 100644 --- a/tests/rustdoc/merge-cross-crate-info/overwrite/sierra.rs +++ b/tests/rustdoc/merge-cross-crate-info/overwrite/sierra.rs @@ -9,9 +9,9 @@ //@ has tango/trait.Tango.html //@ hasraw sierra/struct.Sierra.html 'Tango' //@ hasraw trait.impl/tango/trait.Tango.js 'struct.Sierra.html' -//@ hasraw search-index.js 'Tango' -//@ hasraw search-index.js 'Sierra' -//@ !hasraw search-index.js 'Quebec' +//@ hasraw search.index/name/*.js 'Tango' +//@ hasraw search.index/name/*.js 'Sierra' +//@ !hasraw search.index/name/*.js 'Quebec' // since tango is documented with --merge=finalize, we overwrite q's // cross-crate information diff --git a/tests/rustdoc/merge-cross-crate-info/single-crate-finalize/quebec.rs b/tests/rustdoc/merge-cross-crate-info/single-crate-finalize/quebec.rs index 09bb78c06f1..2ab08c112a1 100644 --- a/tests/rustdoc/merge-cross-crate-info/single-crate-finalize/quebec.rs +++ b/tests/rustdoc/merge-cross-crate-info/single-crate-finalize/quebec.rs @@ -6,7 +6,7 @@ //@ has index.html '//h1' 'List of all crates' //@ has index.html '//ul[@class="all-items"]//a[@href="quebec/index.html"]' 'quebec' //@ has quebec/struct.Quebec.html -//@ hasraw search-index.js 'Quebec' +//@ hasraw search.index/name/*.js 'Quebec' // there is nothing to read from the output directory if we use a single // crate diff --git a/tests/rustdoc/merge-cross-crate-info/single-crate-read-write/quebec.rs b/tests/rustdoc/merge-cross-crate-info/single-crate-read-write/quebec.rs index 72475426f6e..1b9e8a3db08 100644 --- a/tests/rustdoc/merge-cross-crate-info/single-crate-read-write/quebec.rs +++ b/tests/rustdoc/merge-cross-crate-info/single-crate-read-write/quebec.rs @@ -6,7 +6,7 @@ //@ has index.html '//h1' 'List of all crates' //@ has index.html '//ul[@class="all-items"]//a[@href="quebec/index.html"]' 'quebec' //@ has quebec/struct.Quebec.html -//@ hasraw search-index.js 'Quebec' +//@ hasraw search.index/name/*.js 'Quebec' // read-write is the default and this does the same as `single-crate` pub struct Quebec; diff --git a/tests/rustdoc/merge-cross-crate-info/single-crate-write-anyway/quebec.rs b/tests/rustdoc/merge-cross-crate-info/single-crate-write-anyway/quebec.rs index b20e173a830..6b72615eb9d 100644 --- a/tests/rustdoc/merge-cross-crate-info/single-crate-write-anyway/quebec.rs +++ b/tests/rustdoc/merge-cross-crate-info/single-crate-write-anyway/quebec.rs @@ -6,7 +6,7 @@ //@ has index.html '//h1' 'List of all crates' //@ has index.html '//ul[@class="all-items"]//a[@href="quebec/index.html"]' 'quebec' //@ has quebec/struct.Quebec.html -//@ hasraw search-index.js 'Quebec' +//@ hasraw search.index/name/*.js 'Quebec' // we can --parts-out-dir, but that doesn't do anything other than create // the file diff --git a/tests/rustdoc/merge-cross-crate-info/single-merge-none-useless-write/quebec.rs b/tests/rustdoc/merge-cross-crate-info/single-merge-none-useless-write/quebec.rs index e888a43c460..bfde21c9ed3 100644 --- a/tests/rustdoc/merge-cross-crate-info/single-merge-none-useless-write/quebec.rs +++ b/tests/rustdoc/merge-cross-crate-info/single-merge-none-useless-write/quebec.rs @@ -5,7 +5,7 @@ //@ !has index.html //@ has quebec/struct.Quebec.html -//@ !has search-index.js +//@ !has search.index/name/*.js // --merge=none doesn't write anything, despite --parts-out-dir pub struct Quebec; diff --git a/tests/rustdoc/merge-cross-crate-info/transitive-finalize/sierra.rs b/tests/rustdoc/merge-cross-crate-info/transitive-finalize/sierra.rs index 68fc4b13fa8..b45895a40a1 100644 --- a/tests/rustdoc/merge-cross-crate-info/transitive-finalize/sierra.rs +++ b/tests/rustdoc/merge-cross-crate-info/transitive-finalize/sierra.rs @@ -12,7 +12,7 @@ //@ has tango/trait.Tango.html //@ hasraw sierra/struct.Sierra.html 'Tango' //@ hasraw trait.impl/tango/trait.Tango.js 'struct.Sierra.html' -//@ hasraw search-index.js 'Sierra' +//@ hasraw search.index/name/*.js 'Sierra' // write only overwrites stuff in the output directory extern crate tango; diff --git a/tests/rustdoc/merge-cross-crate-info/transitive-merge-none/sierra.rs b/tests/rustdoc/merge-cross-crate-info/transitive-merge-none/sierra.rs index b407228085e..be371376179 100644 --- a/tests/rustdoc/merge-cross-crate-info/transitive-merge-none/sierra.rs +++ b/tests/rustdoc/merge-cross-crate-info/transitive-merge-none/sierra.rs @@ -16,9 +16,9 @@ //@ has tango/trait.Tango.html //@ hasraw sierra/struct.Sierra.html 'Tango' //@ hasraw trait.impl/tango/trait.Tango.js 'struct.Sierra.html' -//@ hasraw search-index.js 'Tango' -//@ hasraw search-index.js 'Sierra' -//@ hasraw search-index.js 'Quebec' +//@ hasraw search.index/name/*.js 'Tango' +//@ hasraw search.index/name/*.js 'Sierra' +//@ hasraw search.index/name/*.js 'Quebec' // We avoid writing any cross-crate information, preferring to include it // with --include-parts-dir. diff --git a/tests/rustdoc/merge-cross-crate-info/transitive-merge-read-write/sierra.rs b/tests/rustdoc/merge-cross-crate-info/transitive-merge-read-write/sierra.rs index 15e32d5941f..dc10ec3de35 100644 --- a/tests/rustdoc/merge-cross-crate-info/transitive-merge-read-write/sierra.rs +++ b/tests/rustdoc/merge-cross-crate-info/transitive-merge-read-write/sierra.rs @@ -14,9 +14,9 @@ //@ has tango/trait.Tango.html //@ hasraw sierra/struct.Sierra.html 'Tango' //@ hasraw trait.impl/tango/trait.Tango.js 'struct.Sierra.html' -//@ hasraw search-index.js 'Tango' -//@ hasraw search-index.js 'Sierra' -//@ hasraw search-index.js 'Quebec' +//@ hasraw search.index/name/*.js 'Tango' +//@ hasraw search.index/name/*.js 'Sierra' +//@ hasraw search.index/name/*.js 'Quebec' // We can use read-write to emulate the default behavior of rustdoc, when // --merge is left out. diff --git a/tests/rustdoc/merge-cross-crate-info/transitive-no-info/sierra.rs b/tests/rustdoc/merge-cross-crate-info/transitive-no-info/sierra.rs index 3eb2cebd743..9eaa627419b 100644 --- a/tests/rustdoc/merge-cross-crate-info/transitive-no-info/sierra.rs +++ b/tests/rustdoc/merge-cross-crate-info/transitive-no-info/sierra.rs @@ -9,7 +9,7 @@ //@ has tango/trait.Tango.html //@ hasraw sierra/struct.Sierra.html 'Tango' //@ !has trait.impl/tango/trait.Tango.js -//@ !has search-index.js +//@ !has search.index/name/*.js // --merge=none on all crates does not generate any cross-crate info extern crate tango; diff --git a/tests/rustdoc/merge-cross-crate-info/two-separate-out-dir/echo.rs b/tests/rustdoc/merge-cross-crate-info/two-separate-out-dir/echo.rs index ee2b646e43c..d79302e62cd 100644 --- a/tests/rustdoc/merge-cross-crate-info/two-separate-out-dir/echo.rs +++ b/tests/rustdoc/merge-cross-crate-info/two-separate-out-dir/echo.rs @@ -6,8 +6,8 @@ //@ has echo/enum.Echo.html //@ hasraw echo/enum.Echo.html 'Foxtrot' //@ hasraw trait.impl/foxtrot/trait.Foxtrot.js 'enum.Echo.html' -//@ hasraw search-index.js 'Foxtrot' -//@ hasraw search-index.js 'Echo' +//@ hasraw search.index/name/*.js 'Foxtrot' +//@ hasraw search.index/name/*.js 'Echo' // document two crates in different places, and merge their docs after // they are generated diff --git a/tests/rustdoc/no-unit-struct-field.rs b/tests/rustdoc/no-unit-struct-field.rs index 6ac44037cea..cb74a9d19ad 100644 --- a/tests/rustdoc/no-unit-struct-field.rs +++ b/tests/rustdoc/no-unit-struct-field.rs @@ -1,10 +1,11 @@ // This test ensures that the tuple struct fields are not generated in the // search index. -//@ !hasraw search-index.js '"0"' -//@ !hasraw search-index.js '"1"' -//@ hasraw search-index.js '"foo_a"' -//@ hasraw search-index.js '"bar_a"' +// vlqhex encoding ` = 0, a = 1, e = 5 +//@ !hasraw search.index/name/*.js 'a0' +//@ !hasraw search.index/name/*.js 'a1' +//@ hasraw search.index/name/*.js 'efoo_a' +//@ hasraw search.index/name/*.js 'ebar_a' pub struct Bar(pub u32, pub u8); pub struct Foo { diff --git a/tests/rustdoc/primitive/search-index-primitive-inherent-method-23511.rs b/tests/rustdoc/primitive/search-index-primitive-inherent-method-23511.rs index 6054d8f12f5..ea828e08d82 100644 --- a/tests/rustdoc/primitive/search-index-primitive-inherent-method-23511.rs +++ b/tests/rustdoc/primitive/search-index-primitive-inherent-method-23511.rs @@ -9,7 +9,7 @@ pub mod str { #![rustc_doc_primitive = "str"] impl str { - //@ hasraw search-index.js foo + //@ hasraw search.index/name/*.js foo #[rustc_allow_incoherent_impl] pub fn foo(&self) {} } diff --git a/tests/rustdoc/search-index-summaries.rs b/tests/rustdoc/search-index-summaries.rs index 55db04340a6..e680a9d57c1 100644 --- a/tests/rustdoc/search-index-summaries.rs +++ b/tests/rustdoc/search-index-summaries.rs @@ -1,6 +1,6 @@ #![crate_name = "foo"] -//@ hasraw 'search.desc/foo/foo-desc-0-.js' 'Foo short link.' +//@ hasraw 'search.index/desc/*.js' 'Foo short link.' //@ !hasraw - 'www.example.com' //@ !hasraw - 'More Foo.' diff --git a/tests/rustdoc/search-index.rs b/tests/rustdoc/search-index.rs index f53862ede38..49ccacd0a5c 100644 --- a/tests/rustdoc/search-index.rs +++ b/tests/rustdoc/search-index.rs @@ -2,7 +2,7 @@ use std::ops::Deref; -//@ hasraw search-index.js Foo +//@ hasraw search.index/name/*.js Foo pub use private::Foo; mod private { @@ -20,7 +20,7 @@ mod private { pub struct Bar; impl Deref for Bar { - //@ !hasraw search-index.js Target + //@ !hasraw search.index/name/*.js Target type Target = Bar; fn deref(&self) -> &Bar { self } } diff --git a/tests/rustdoc/type-alias/repr.rs b/tests/rustdoc/type-alias/repr.rs index cf907980360..884ed74264a 100644 --- a/tests/rustdoc/type-alias/repr.rs +++ b/tests/rustdoc/type-alias/repr.rs @@ -22,7 +22,8 @@ pub union Foo2 { } //@ has 'foo/type.Bar2.html' -//@ matches - '//*[@class="rust item-decl"]' '#\[repr\(C\)\]\npub union Bar2 \{*' +//@ matches - '//*[@class="code-attribute"]' '#\[repr\(C\)\]' +//@ matches - '//*[@class="rust item-decl"]' 'pub union Bar2 \{*' // Ensures that we see the doc comment of the type alias and not of the aliased type. //@ has - '//*[@class="toggle top-doc"]/*[@class="docblock"]' 'bar' /// bar diff --git a/tests/ui-fulldeps/internal-lints/import-of-type-ir-traits.rs b/tests/ui-fulldeps/internal-lints/import-of-type-ir-traits.rs index 3fdd65d6c87..965fd832722 100644 --- a/tests/ui-fulldeps/internal-lints/import-of-type-ir-traits.rs +++ b/tests/ui-fulldeps/internal-lints/import-of-type-ir-traits.rs @@ -8,7 +8,7 @@ extern crate rustc_type_ir; use rustc_type_ir::Interner; -fn foo<I: Interner>(cx: I, did: I::DefId) { +fn foo<I: Interner>(cx: I, did: I::TraitId) { let _ = cx.trait_is_unsafe(did); //~^ ERROR do not use `rustc_type_ir::Interner` or `rustc_type_ir::InferCtxtLike` unless you're inside of the trait solver } diff --git a/tests/ui-fulldeps/internal-lints/query_stability.rs b/tests/ui-fulldeps/internal-lints/query_stability.rs index 7b897fabd2d..92c1d6bf7f8 100644 --- a/tests/ui-fulldeps/internal-lints/query_stability.rs +++ b/tests/ui-fulldeps/internal-lints/query_stability.rs @@ -1,4 +1,5 @@ //@ compile-flags: -Z unstable-options +//@ ignore-stage1 #![feature(rustc_private)] #![deny(rustc::potential_query_instability)] @@ -34,4 +35,16 @@ fn main() { //~^ ERROR using `values_mut` can result in unstable query results *val = *val + 10; } + + FxHashMap::<u32, i32>::default().extend(x); + //~^ ERROR using `into_iter` can result in unstable query results +} + +fn hide_into_iter<T>(x: impl IntoIterator<Item = T>) -> impl Iterator<Item = T> { + x.into_iter() +} + +fn take(map: std::collections::HashMap<i32, i32>) { + _ = hide_into_iter(map); + //~^ ERROR using `into_iter` can result in unstable query results } diff --git a/tests/ui-fulldeps/internal-lints/query_stability.stderr b/tests/ui-fulldeps/internal-lints/query_stability.stderr index 43b156dc20a..e5bb0453f90 100644 --- a/tests/ui-fulldeps/internal-lints/query_stability.stderr +++ b/tests/ui-fulldeps/internal-lints/query_stability.stderr @@ -1,18 +1,18 @@ error: using `drain` can result in unstable query results - --> $DIR/query_stability.rs:13:16 + --> $DIR/query_stability.rs:14:16 | LL | for _ in x.drain() {} | ^^^^^ | = note: if you believe this case to be fine, allow this lint and add a comment explaining your rationale note: the lint level is defined here - --> $DIR/query_stability.rs:4:9 + --> $DIR/query_stability.rs:5:9 | LL | #![deny(rustc::potential_query_instability)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: using `iter` can result in unstable query results - --> $DIR/query_stability.rs:16:16 + --> $DIR/query_stability.rs:17:16 | LL | for _ in x.iter() {} | ^^^^ @@ -20,7 +20,7 @@ LL | for _ in x.iter() {} = note: if you believe this case to be fine, allow this lint and add a comment explaining your rationale error: using `iter_mut` can result in unstable query results - --> $DIR/query_stability.rs:19:36 + --> $DIR/query_stability.rs:20:36 | LL | for _ in Some(&mut x).unwrap().iter_mut() {} | ^^^^^^^^ @@ -28,7 +28,7 @@ LL | for _ in Some(&mut x).unwrap().iter_mut() {} = note: if you believe this case to be fine, allow this lint and add a comment explaining your rationale error: using `into_iter` can result in unstable query results - --> $DIR/query_stability.rs:22:14 + --> $DIR/query_stability.rs:23:14 | LL | for _ in x {} | ^ @@ -36,7 +36,7 @@ LL | for _ in x {} = note: if you believe this case to be fine, allow this lint and add a comment explaining your rationale error: using `keys` can result in unstable query results - --> $DIR/query_stability.rs:26:15 + --> $DIR/query_stability.rs:27:15 | LL | let _ = x.keys(); | ^^^^ @@ -44,7 +44,7 @@ LL | let _ = x.keys(); = note: if you believe this case to be fine, allow this lint and add a comment explaining your rationale error: using `values` can result in unstable query results - --> $DIR/query_stability.rs:29:15 + --> $DIR/query_stability.rs:30:15 | LL | let _ = x.values(); | ^^^^^^ @@ -52,12 +52,28 @@ LL | let _ = x.values(); = note: if you believe this case to be fine, allow this lint and add a comment explaining your rationale error: using `values_mut` can result in unstable query results - --> $DIR/query_stability.rs:33:18 + --> $DIR/query_stability.rs:34:18 | LL | for val in x.values_mut() { | ^^^^^^^^^^ | = note: if you believe this case to be fine, allow this lint and add a comment explaining your rationale -error: aborting due to 7 previous errors +error: using `into_iter` can result in unstable query results + --> $DIR/query_stability.rs:39:38 + | +LL | FxHashMap::<u32, i32>::default().extend(x); + | ^^^^^^^^^ + | + = note: if you believe this case to be fine, allow this lint and add a comment explaining your rationale + +error: using `into_iter` can result in unstable query results + --> $DIR/query_stability.rs:48:9 + | +LL | _ = hide_into_iter(map); + | ^^^^^^^^^^^^^^^^^^^ + | + = note: if you believe this case to be fine, allow this lint and add a comment explaining your rationale + +error: aborting due to 9 previous errors diff --git a/tests/ui-fulldeps/rustc-dev-remap.only-remap.stderr b/tests/ui-fulldeps/rustc-dev-remap.only-remap.stderr index 0c969b9c6d8..b8de9291d65 100644 --- a/tests/ui-fulldeps/rustc-dev-remap.only-remap.stderr +++ b/tests/ui-fulldeps/rustc-dev-remap.only-remap.stderr @@ -2,8 +2,13 @@ error[E0277]: the trait bound `NotAValidResultType: VisitorResult` is not satisf --> $DIR/rustc-dev-remap.rs:LL:COL | LL | type Result = NotAValidResultType; - | ^^^^^^^^^^^^^^^^^^^ the trait `VisitorResult` is not implemented for `NotAValidResultType` + | ^^^^^^^^^^^^^^^^^^^ unsatisfied trait bound | +help: the trait `VisitorResult` is not implemented for `NotAValidResultType` + --> $DIR/rustc-dev-remap.rs:LL:COL + | +LL | struct NotAValidResultType; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ = help: the following other types implement trait `VisitorResult`: () ControlFlow<T> diff --git a/tests/ui-fulldeps/rustc-dev-remap.remap-unremap.stderr b/tests/ui-fulldeps/rustc-dev-remap.remap-unremap.stderr index 6ac8c3046f6..29b43c819d0 100644 --- a/tests/ui-fulldeps/rustc-dev-remap.remap-unremap.stderr +++ b/tests/ui-fulldeps/rustc-dev-remap.remap-unremap.stderr @@ -2,8 +2,13 @@ error[E0277]: the trait bound `NotAValidResultType: VisitorResult` is not satisf --> $DIR/rustc-dev-remap.rs:LL:COL | LL | type Result = NotAValidResultType; - | ^^^^^^^^^^^^^^^^^^^ the trait `VisitorResult` is not implemented for `NotAValidResultType` + | ^^^^^^^^^^^^^^^^^^^ unsatisfied trait bound | +help: the trait `VisitorResult` is not implemented for `NotAValidResultType` + --> $DIR/rustc-dev-remap.rs:LL:COL + | +LL | struct NotAValidResultType; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ = help: the following other types implement trait `VisitorResult`: () ControlFlow<T> diff --git a/tests/ui-fulldeps/session-diagnostic/diagnostic-derive-doc-comment-field.stderr b/tests/ui-fulldeps/session-diagnostic/diagnostic-derive-doc-comment-field.stderr index 7377b0dfd0a..8b6c4b181c0 100644 --- a/tests/ui-fulldeps/session-diagnostic/diagnostic-derive-doc-comment-field.stderr +++ b/tests/ui-fulldeps/session-diagnostic/diagnostic-derive-doc-comment-field.stderr @@ -5,8 +5,13 @@ LL | #[derive(Diagnostic)] | ---------- required by a bound introduced by this call ... LL | arg: NotIntoDiagArg, - | ^^^^^^^^^^^^^^ the trait `IntoDiagArg` is not implemented for `NotIntoDiagArg` + | ^^^^^^^^^^^^^^ unsatisfied trait bound | +help: the trait `IntoDiagArg` is not implemented for `NotIntoDiagArg` + --> $DIR/diagnostic-derive-doc-comment-field.rs:28:1 + | +LL | struct NotIntoDiagArg; + | ^^^^^^^^^^^^^^^^^^^^^ = help: normalized in stderr note: required by a bound in `Diag::<'a, G>::arg` --> $COMPILER_DIR/rustc_errors/src/diagnostic.rs:LL:CC @@ -19,8 +24,13 @@ LL | #[derive(Subdiagnostic)] | ------------- required by a bound introduced by this call ... LL | arg: NotIntoDiagArg, - | ^^^^^^^^^^^^^^ the trait `IntoDiagArg` is not implemented for `NotIntoDiagArg` + | ^^^^^^^^^^^^^^ unsatisfied trait bound + | +help: the trait `IntoDiagArg` is not implemented for `NotIntoDiagArg` + --> $DIR/diagnostic-derive-doc-comment-field.rs:28:1 | +LL | struct NotIntoDiagArg; + | ^^^^^^^^^^^^^^^^^^^^^ = help: normalized in stderr note: required by a bound in `Diag::<'a, G>::arg` --> $COMPILER_DIR/rustc_errors/src/diagnostic.rs:LL:CC diff --git a/tests/ui-fulldeps/session-diagnostic/diagnostic-derive.stderr b/tests/ui-fulldeps/session-diagnostic/diagnostic-derive.stderr index 001699b2bc7..59b48e9f0ec 100644 --- a/tests/ui-fulldeps/session-diagnostic/diagnostic-derive.stderr +++ b/tests/ui-fulldeps/session-diagnostic/diagnostic-derive.stderr @@ -559,6 +559,12 @@ error: cannot find attribute `error` in this scope | LL | #[error(no_crate_example, code = E0123)] | ^^^^^ + | +help: `error` is an attribute that can be used by the derive macro `Error`, you might be missing a `derive` attribute + | +LL + #[derive(Error)] +LL | struct ErrorAttribute {} + | error: cannot find attribute `warn_` in this scope --> $DIR/diagnostic-derive.rs:590:3 @@ -631,8 +637,13 @@ LL | #[derive(Diagnostic)] | ---------- required by a bound introduced by this call ... LL | other: Hello, - | ^^^^^ the trait `IntoDiagArg` is not implemented for `Hello` + | ^^^^^ unsatisfied trait bound + | +help: the trait `IntoDiagArg` is not implemented for `Hello` + --> $DIR/diagnostic-derive.rs:40:1 | +LL | struct Hello {} + | ^^^^^^^^^^^^ = help: normalized in stderr note: required by a bound in `Diag::<'a, G>::arg` --> $COMPILER_DIR/rustc_errors/src/diagnostic.rs:LL:CC diff --git a/tests/ui/abi/c-zst.powerpc-linux.stderr b/tests/ui/abi/c-zst.powerpc-linux.stderr index b8d6c632b97..ec6b9b8f027 100644 --- a/tests/ui/abi/c-zst.powerpc-linux.stderr +++ b/tests/ui/abi/c-zst.powerpc-linux.stderr @@ -27,7 +27,7 @@ error: fn_abi_of(pass_zst) = FnAbi { }, mode: Indirect { attrs: ArgAttributes { - regular: NoAlias | NoCapture | NonNull | NoUndef, + regular: NoAlias | CapturesAddress | NonNull | NoUndef, arg_ext: None, pointee_size: Size(0 bytes), pointee_align: Some( diff --git a/tests/ui/abi/c-zst.s390x-linux.stderr b/tests/ui/abi/c-zst.s390x-linux.stderr index b8d6c632b97..ec6b9b8f027 100644 --- a/tests/ui/abi/c-zst.s390x-linux.stderr +++ b/tests/ui/abi/c-zst.s390x-linux.stderr @@ -27,7 +27,7 @@ error: fn_abi_of(pass_zst) = FnAbi { }, mode: Indirect { attrs: ArgAttributes { - regular: NoAlias | NoCapture | NonNull | NoUndef, + regular: NoAlias | CapturesAddress | NonNull | NoUndef, arg_ext: None, pointee_size: Size(0 bytes), pointee_align: Some( diff --git a/tests/ui/abi/c-zst.sparc64-linux.stderr b/tests/ui/abi/c-zst.sparc64-linux.stderr index b8d6c632b97..ec6b9b8f027 100644 --- a/tests/ui/abi/c-zst.sparc64-linux.stderr +++ b/tests/ui/abi/c-zst.sparc64-linux.stderr @@ -27,7 +27,7 @@ error: fn_abi_of(pass_zst) = FnAbi { }, mode: Indirect { attrs: ArgAttributes { - regular: NoAlias | NoCapture | NonNull | NoUndef, + regular: NoAlias | CapturesAddress | NonNull | NoUndef, arg_ext: None, pointee_size: Size(0 bytes), pointee_align: Some( 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 b8d6c632b97..ec6b9b8f027 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 @@ -27,7 +27,7 @@ error: fn_abi_of(pass_zst) = FnAbi { }, mode: Indirect { attrs: ArgAttributes { - regular: NoAlias | NoCapture | NonNull | NoUndef, + regular: NoAlias | CapturesAddress | NonNull | NoUndef, arg_ext: None, pointee_size: Size(0 bytes), pointee_align: Some( diff --git a/tests/ui/abi/cannot-be-called.avr.stderr b/tests/ui/abi/cannot-be-called.avr.stderr index 1129893cbfa..ed3fa4a20c5 100644 --- a/tests/ui/abi/cannot-be-called.avr.stderr +++ b/tests/ui/abi/cannot-be-called.avr.stderr @@ -19,53 +19,53 @@ LL | extern "riscv-interrupt-s" fn riscv_s() {} error[E0570]: "x86-interrupt" is not a supported ABI for the current target --> $DIR/cannot-be-called.rs:45:8 | -LL | extern "x86-interrupt" fn x86() {} +LL | extern "x86-interrupt" fn x86(_x: *const u8) {} | ^^^^^^^^^^^^^^^ error[E0570]: "msp430-interrupt" is not a supported ABI for the current target - --> $DIR/cannot-be-called.rs:70:25 + --> $DIR/cannot-be-called.rs:72:25 | LL | fn msp430_ptr(f: extern "msp430-interrupt" fn()) { | ^^^^^^^^^^^^^^^^^^ error[E0570]: "riscv-interrupt-m" is not a supported ABI for the current target - --> $DIR/cannot-be-called.rs:76:26 + --> $DIR/cannot-be-called.rs:78:26 | LL | fn riscv_m_ptr(f: extern "riscv-interrupt-m" fn()) { | ^^^^^^^^^^^^^^^^^^^ error[E0570]: "riscv-interrupt-s" is not a supported ABI for the current target - --> $DIR/cannot-be-called.rs:82:26 + --> $DIR/cannot-be-called.rs:84:26 | LL | fn riscv_s_ptr(f: extern "riscv-interrupt-s" fn()) { | ^^^^^^^^^^^^^^^^^^^ error[E0570]: "x86-interrupt" is not a supported ABI for the current target - --> $DIR/cannot-be-called.rs:88:22 + --> $DIR/cannot-be-called.rs:90:22 | LL | fn x86_ptr(f: extern "x86-interrupt" fn()) { | ^^^^^^^^^^^^^^^ error: functions with the "avr-interrupt" ABI cannot be called - --> $DIR/cannot-be-called.rs:50:5 + --> $DIR/cannot-be-called.rs:52:5 | LL | avr(); | ^^^^^ | note: an `extern "avr-interrupt"` function can only be called using inline assembly - --> $DIR/cannot-be-called.rs:50:5 + --> $DIR/cannot-be-called.rs:52:5 | LL | avr(); | ^^^^^ error: functions with the "avr-interrupt" ABI cannot be called - --> $DIR/cannot-be-called.rs:66:5 + --> $DIR/cannot-be-called.rs:68:5 | LL | f() | ^^^ | note: an `extern "avr-interrupt"` function can only be called using inline assembly - --> $DIR/cannot-be-called.rs:66:5 + --> $DIR/cannot-be-called.rs:68:5 | LL | f() | ^^^ diff --git a/tests/ui/abi/cannot-be-called.i686.stderr b/tests/ui/abi/cannot-be-called.i686.stderr index 024d5e2e93d..6ccb10c44fd 100644 --- a/tests/ui/abi/cannot-be-called.i686.stderr +++ b/tests/ui/abi/cannot-be-called.i686.stderr @@ -23,49 +23,49 @@ LL | extern "riscv-interrupt-s" fn riscv_s() {} | ^^^^^^^^^^^^^^^^^^^ error[E0570]: "avr-interrupt" is not a supported ABI for the current target - --> $DIR/cannot-be-called.rs:64:22 + --> $DIR/cannot-be-called.rs:66:22 | LL | fn avr_ptr(f: extern "avr-interrupt" fn()) { | ^^^^^^^^^^^^^^^ error[E0570]: "msp430-interrupt" is not a supported ABI for the current target - --> $DIR/cannot-be-called.rs:70:25 + --> $DIR/cannot-be-called.rs:72:25 | LL | fn msp430_ptr(f: extern "msp430-interrupt" fn()) { | ^^^^^^^^^^^^^^^^^^ error[E0570]: "riscv-interrupt-m" is not a supported ABI for the current target - --> $DIR/cannot-be-called.rs:76:26 + --> $DIR/cannot-be-called.rs:78:26 | LL | fn riscv_m_ptr(f: extern "riscv-interrupt-m" fn()) { | ^^^^^^^^^^^^^^^^^^^ error[E0570]: "riscv-interrupt-s" is not a supported ABI for the current target - --> $DIR/cannot-be-called.rs:82:26 + --> $DIR/cannot-be-called.rs:84:26 | LL | fn riscv_s_ptr(f: extern "riscv-interrupt-s" fn()) { | ^^^^^^^^^^^^^^^^^^^ error: functions with the "x86-interrupt" ABI cannot be called - --> $DIR/cannot-be-called.rs:58:5 + --> $DIR/cannot-be-called.rs:60:5 | -LL | x86(); - | ^^^^^ +LL | x86(&raw const BYTE); + | ^^^^^^^^^^^^^^^^^^^^ | note: an `extern "x86-interrupt"` function can only be called using inline assembly - --> $DIR/cannot-be-called.rs:58:5 + --> $DIR/cannot-be-called.rs:60:5 | -LL | x86(); - | ^^^^^ +LL | x86(&raw const BYTE); + | ^^^^^^^^^^^^^^^^^^^^ error: functions with the "x86-interrupt" ABI cannot be called - --> $DIR/cannot-be-called.rs:90:5 + --> $DIR/cannot-be-called.rs:92:5 | LL | f() | ^^^ | note: an `extern "x86-interrupt"` function can only be called using inline assembly - --> $DIR/cannot-be-called.rs:90:5 + --> $DIR/cannot-be-called.rs:92:5 | LL | f() | ^^^ diff --git a/tests/ui/abi/cannot-be-called.msp430.stderr b/tests/ui/abi/cannot-be-called.msp430.stderr index 52d7d792510..0bd5bb40b71 100644 --- a/tests/ui/abi/cannot-be-called.msp430.stderr +++ b/tests/ui/abi/cannot-be-called.msp430.stderr @@ -19,53 +19,53 @@ LL | extern "riscv-interrupt-s" fn riscv_s() {} error[E0570]: "x86-interrupt" is not a supported ABI for the current target --> $DIR/cannot-be-called.rs:45:8 | -LL | extern "x86-interrupt" fn x86() {} +LL | extern "x86-interrupt" fn x86(_x: *const u8) {} | ^^^^^^^^^^^^^^^ error[E0570]: "avr-interrupt" is not a supported ABI for the current target - --> $DIR/cannot-be-called.rs:64:22 + --> $DIR/cannot-be-called.rs:66:22 | LL | fn avr_ptr(f: extern "avr-interrupt" fn()) { | ^^^^^^^^^^^^^^^ error[E0570]: "riscv-interrupt-m" is not a supported ABI for the current target - --> $DIR/cannot-be-called.rs:76:26 + --> $DIR/cannot-be-called.rs:78:26 | LL | fn riscv_m_ptr(f: extern "riscv-interrupt-m" fn()) { | ^^^^^^^^^^^^^^^^^^^ error[E0570]: "riscv-interrupt-s" is not a supported ABI for the current target - --> $DIR/cannot-be-called.rs:82:26 + --> $DIR/cannot-be-called.rs:84:26 | LL | fn riscv_s_ptr(f: extern "riscv-interrupt-s" fn()) { | ^^^^^^^^^^^^^^^^^^^ error[E0570]: "x86-interrupt" is not a supported ABI for the current target - --> $DIR/cannot-be-called.rs:88:22 + --> $DIR/cannot-be-called.rs:90:22 | LL | fn x86_ptr(f: extern "x86-interrupt" fn()) { | ^^^^^^^^^^^^^^^ error: functions with the "msp430-interrupt" ABI cannot be called - --> $DIR/cannot-be-called.rs:52:5 + --> $DIR/cannot-be-called.rs:54:5 | LL | msp430(); | ^^^^^^^^ | note: an `extern "msp430-interrupt"` function can only be called using inline assembly - --> $DIR/cannot-be-called.rs:52:5 + --> $DIR/cannot-be-called.rs:54:5 | LL | msp430(); | ^^^^^^^^ error: functions with the "msp430-interrupt" ABI cannot be called - --> $DIR/cannot-be-called.rs:72:5 + --> $DIR/cannot-be-called.rs:74:5 | LL | f() | ^^^ | note: an `extern "msp430-interrupt"` function can only be called using inline assembly - --> $DIR/cannot-be-called.rs:72:5 + --> $DIR/cannot-be-called.rs:74:5 | LL | f() | ^^^ diff --git a/tests/ui/abi/cannot-be-called.riscv32.stderr b/tests/ui/abi/cannot-be-called.riscv32.stderr index 119d93bd58e..6d763bd6379 100644 --- a/tests/ui/abi/cannot-be-called.riscv32.stderr +++ b/tests/ui/abi/cannot-be-called.riscv32.stderr @@ -13,71 +13,71 @@ LL | extern "avr-interrupt" fn avr() {} error[E0570]: "x86-interrupt" is not a supported ABI for the current target --> $DIR/cannot-be-called.rs:45:8 | -LL | extern "x86-interrupt" fn x86() {} +LL | extern "x86-interrupt" fn x86(_x: *const u8) {} | ^^^^^^^^^^^^^^^ error[E0570]: "avr-interrupt" is not a supported ABI for the current target - --> $DIR/cannot-be-called.rs:64:22 + --> $DIR/cannot-be-called.rs:66:22 | LL | fn avr_ptr(f: extern "avr-interrupt" fn()) { | ^^^^^^^^^^^^^^^ error[E0570]: "msp430-interrupt" is not a supported ABI for the current target - --> $DIR/cannot-be-called.rs:70:25 + --> $DIR/cannot-be-called.rs:72:25 | LL | fn msp430_ptr(f: extern "msp430-interrupt" fn()) { | ^^^^^^^^^^^^^^^^^^ error[E0570]: "x86-interrupt" is not a supported ABI for the current target - --> $DIR/cannot-be-called.rs:88:22 + --> $DIR/cannot-be-called.rs:90:22 | LL | fn x86_ptr(f: extern "x86-interrupt" fn()) { | ^^^^^^^^^^^^^^^ error: functions with the "riscv-interrupt-m" ABI cannot be called - --> $DIR/cannot-be-called.rs:54:5 + --> $DIR/cannot-be-called.rs:56:5 | LL | riscv_m(); | ^^^^^^^^^ | note: an `extern "riscv-interrupt-m"` function can only be called using inline assembly - --> $DIR/cannot-be-called.rs:54:5 + --> $DIR/cannot-be-called.rs:56:5 | LL | riscv_m(); | ^^^^^^^^^ error: functions with the "riscv-interrupt-s" ABI cannot be called - --> $DIR/cannot-be-called.rs:56:5 + --> $DIR/cannot-be-called.rs:58:5 | LL | riscv_s(); | ^^^^^^^^^ | note: an `extern "riscv-interrupt-s"` function can only be called using inline assembly - --> $DIR/cannot-be-called.rs:56:5 + --> $DIR/cannot-be-called.rs:58:5 | LL | riscv_s(); | ^^^^^^^^^ error: functions with the "riscv-interrupt-m" ABI cannot be called - --> $DIR/cannot-be-called.rs:78:5 + --> $DIR/cannot-be-called.rs:80:5 | LL | f() | ^^^ | note: an `extern "riscv-interrupt-m"` function can only be called using inline assembly - --> $DIR/cannot-be-called.rs:78:5 + --> $DIR/cannot-be-called.rs:80:5 | LL | f() | ^^^ error: functions with the "riscv-interrupt-s" ABI cannot be called - --> $DIR/cannot-be-called.rs:84:5 + --> $DIR/cannot-be-called.rs:86:5 | LL | f() | ^^^ | note: an `extern "riscv-interrupt-s"` function can only be called using inline assembly - --> $DIR/cannot-be-called.rs:84:5 + --> $DIR/cannot-be-called.rs:86:5 | LL | f() | ^^^ diff --git a/tests/ui/abi/cannot-be-called.riscv64.stderr b/tests/ui/abi/cannot-be-called.riscv64.stderr index 119d93bd58e..6d763bd6379 100644 --- a/tests/ui/abi/cannot-be-called.riscv64.stderr +++ b/tests/ui/abi/cannot-be-called.riscv64.stderr @@ -13,71 +13,71 @@ LL | extern "avr-interrupt" fn avr() {} error[E0570]: "x86-interrupt" is not a supported ABI for the current target --> $DIR/cannot-be-called.rs:45:8 | -LL | extern "x86-interrupt" fn x86() {} +LL | extern "x86-interrupt" fn x86(_x: *const u8) {} | ^^^^^^^^^^^^^^^ error[E0570]: "avr-interrupt" is not a supported ABI for the current target - --> $DIR/cannot-be-called.rs:64:22 + --> $DIR/cannot-be-called.rs:66:22 | LL | fn avr_ptr(f: extern "avr-interrupt" fn()) { | ^^^^^^^^^^^^^^^ error[E0570]: "msp430-interrupt" is not a supported ABI for the current target - --> $DIR/cannot-be-called.rs:70:25 + --> $DIR/cannot-be-called.rs:72:25 | LL | fn msp430_ptr(f: extern "msp430-interrupt" fn()) { | ^^^^^^^^^^^^^^^^^^ error[E0570]: "x86-interrupt" is not a supported ABI for the current target - --> $DIR/cannot-be-called.rs:88:22 + --> $DIR/cannot-be-called.rs:90:22 | LL | fn x86_ptr(f: extern "x86-interrupt" fn()) { | ^^^^^^^^^^^^^^^ error: functions with the "riscv-interrupt-m" ABI cannot be called - --> $DIR/cannot-be-called.rs:54:5 + --> $DIR/cannot-be-called.rs:56:5 | LL | riscv_m(); | ^^^^^^^^^ | note: an `extern "riscv-interrupt-m"` function can only be called using inline assembly - --> $DIR/cannot-be-called.rs:54:5 + --> $DIR/cannot-be-called.rs:56:5 | LL | riscv_m(); | ^^^^^^^^^ error: functions with the "riscv-interrupt-s" ABI cannot be called - --> $DIR/cannot-be-called.rs:56:5 + --> $DIR/cannot-be-called.rs:58:5 | LL | riscv_s(); | ^^^^^^^^^ | note: an `extern "riscv-interrupt-s"` function can only be called using inline assembly - --> $DIR/cannot-be-called.rs:56:5 + --> $DIR/cannot-be-called.rs:58:5 | LL | riscv_s(); | ^^^^^^^^^ error: functions with the "riscv-interrupt-m" ABI cannot be called - --> $DIR/cannot-be-called.rs:78:5 + --> $DIR/cannot-be-called.rs:80:5 | LL | f() | ^^^ | note: an `extern "riscv-interrupt-m"` function can only be called using inline assembly - --> $DIR/cannot-be-called.rs:78:5 + --> $DIR/cannot-be-called.rs:80:5 | LL | f() | ^^^ error: functions with the "riscv-interrupt-s" ABI cannot be called - --> $DIR/cannot-be-called.rs:84:5 + --> $DIR/cannot-be-called.rs:86:5 | LL | f() | ^^^ | note: an `extern "riscv-interrupt-s"` function can only be called using inline assembly - --> $DIR/cannot-be-called.rs:84:5 + --> $DIR/cannot-be-called.rs:86:5 | LL | f() | ^^^ diff --git a/tests/ui/abi/cannot-be-called.rs b/tests/ui/abi/cannot-be-called.rs index af979d65d33..b0267cfa37e 100644 --- a/tests/ui/abi/cannot-be-called.rs +++ b/tests/ui/abi/cannot-be-called.rs @@ -42,9 +42,11 @@ extern "riscv-interrupt-m" fn riscv_m() {} //[x64,x64_win,i686,avr,msp430]~^ ERROR is not a supported ABI extern "riscv-interrupt-s" fn riscv_s() {} //[x64,x64_win,i686,avr,msp430]~^ ERROR is not a supported ABI -extern "x86-interrupt" fn x86() {} +extern "x86-interrupt" fn x86(_x: *const u8) {} //[riscv32,riscv64,avr,msp430]~^ ERROR is not a supported ABI +static BYTE: u8 = 0; + /* extern "interrupt" calls */ fn call_the_interrupts() { avr(); @@ -55,7 +57,7 @@ fn call_the_interrupts() { //[riscv32,riscv64]~^ ERROR functions with the "riscv-interrupt-m" ABI cannot be called riscv_s(); //[riscv32,riscv64]~^ ERROR functions with the "riscv-interrupt-s" ABI cannot be called - x86(); + x86(&raw const BYTE); //[x64,x64_win,i686]~^ ERROR functions with the "x86-interrupt" ABI cannot be called } diff --git a/tests/ui/abi/cannot-be-called.x64.stderr b/tests/ui/abi/cannot-be-called.x64.stderr index 024d5e2e93d..6ccb10c44fd 100644 --- a/tests/ui/abi/cannot-be-called.x64.stderr +++ b/tests/ui/abi/cannot-be-called.x64.stderr @@ -23,49 +23,49 @@ LL | extern "riscv-interrupt-s" fn riscv_s() {} | ^^^^^^^^^^^^^^^^^^^ error[E0570]: "avr-interrupt" is not a supported ABI for the current target - --> $DIR/cannot-be-called.rs:64:22 + --> $DIR/cannot-be-called.rs:66:22 | LL | fn avr_ptr(f: extern "avr-interrupt" fn()) { | ^^^^^^^^^^^^^^^ error[E0570]: "msp430-interrupt" is not a supported ABI for the current target - --> $DIR/cannot-be-called.rs:70:25 + --> $DIR/cannot-be-called.rs:72:25 | LL | fn msp430_ptr(f: extern "msp430-interrupt" fn()) { | ^^^^^^^^^^^^^^^^^^ error[E0570]: "riscv-interrupt-m" is not a supported ABI for the current target - --> $DIR/cannot-be-called.rs:76:26 + --> $DIR/cannot-be-called.rs:78:26 | LL | fn riscv_m_ptr(f: extern "riscv-interrupt-m" fn()) { | ^^^^^^^^^^^^^^^^^^^ error[E0570]: "riscv-interrupt-s" is not a supported ABI for the current target - --> $DIR/cannot-be-called.rs:82:26 + --> $DIR/cannot-be-called.rs:84:26 | LL | fn riscv_s_ptr(f: extern "riscv-interrupt-s" fn()) { | ^^^^^^^^^^^^^^^^^^^ error: functions with the "x86-interrupt" ABI cannot be called - --> $DIR/cannot-be-called.rs:58:5 + --> $DIR/cannot-be-called.rs:60:5 | -LL | x86(); - | ^^^^^ +LL | x86(&raw const BYTE); + | ^^^^^^^^^^^^^^^^^^^^ | note: an `extern "x86-interrupt"` function can only be called using inline assembly - --> $DIR/cannot-be-called.rs:58:5 + --> $DIR/cannot-be-called.rs:60:5 | -LL | x86(); - | ^^^^^ +LL | x86(&raw const BYTE); + | ^^^^^^^^^^^^^^^^^^^^ error: functions with the "x86-interrupt" ABI cannot be called - --> $DIR/cannot-be-called.rs:90:5 + --> $DIR/cannot-be-called.rs:92:5 | LL | f() | ^^^ | note: an `extern "x86-interrupt"` function can only be called using inline assembly - --> $DIR/cannot-be-called.rs:90:5 + --> $DIR/cannot-be-called.rs:92:5 | LL | f() | ^^^ diff --git a/tests/ui/abi/cannot-be-called.x64_win.stderr b/tests/ui/abi/cannot-be-called.x64_win.stderr index 024d5e2e93d..6ccb10c44fd 100644 --- a/tests/ui/abi/cannot-be-called.x64_win.stderr +++ b/tests/ui/abi/cannot-be-called.x64_win.stderr @@ -23,49 +23,49 @@ LL | extern "riscv-interrupt-s" fn riscv_s() {} | ^^^^^^^^^^^^^^^^^^^ error[E0570]: "avr-interrupt" is not a supported ABI for the current target - --> $DIR/cannot-be-called.rs:64:22 + --> $DIR/cannot-be-called.rs:66:22 | LL | fn avr_ptr(f: extern "avr-interrupt" fn()) { | ^^^^^^^^^^^^^^^ error[E0570]: "msp430-interrupt" is not a supported ABI for the current target - --> $DIR/cannot-be-called.rs:70:25 + --> $DIR/cannot-be-called.rs:72:25 | LL | fn msp430_ptr(f: extern "msp430-interrupt" fn()) { | ^^^^^^^^^^^^^^^^^^ error[E0570]: "riscv-interrupt-m" is not a supported ABI for the current target - --> $DIR/cannot-be-called.rs:76:26 + --> $DIR/cannot-be-called.rs:78:26 | LL | fn riscv_m_ptr(f: extern "riscv-interrupt-m" fn()) { | ^^^^^^^^^^^^^^^^^^^ error[E0570]: "riscv-interrupt-s" is not a supported ABI for the current target - --> $DIR/cannot-be-called.rs:82:26 + --> $DIR/cannot-be-called.rs:84:26 | LL | fn riscv_s_ptr(f: extern "riscv-interrupt-s" fn()) { | ^^^^^^^^^^^^^^^^^^^ error: functions with the "x86-interrupt" ABI cannot be called - --> $DIR/cannot-be-called.rs:58:5 + --> $DIR/cannot-be-called.rs:60:5 | -LL | x86(); - | ^^^^^ +LL | x86(&raw const BYTE); + | ^^^^^^^^^^^^^^^^^^^^ | note: an `extern "x86-interrupt"` function can only be called using inline assembly - --> $DIR/cannot-be-called.rs:58:5 + --> $DIR/cannot-be-called.rs:60:5 | -LL | x86(); - | ^^^^^ +LL | x86(&raw const BYTE); + | ^^^^^^^^^^^^^^^^^^^^ error: functions with the "x86-interrupt" ABI cannot be called - --> $DIR/cannot-be-called.rs:90:5 + --> $DIR/cannot-be-called.rs:92:5 | LL | f() | ^^^ | note: an `extern "x86-interrupt"` function can only be called using inline assembly - --> $DIR/cannot-be-called.rs:90:5 + --> $DIR/cannot-be-called.rs:92:5 | LL | f() | ^^^ diff --git a/tests/ui/abi/cannot-be-coroutine.i686.stderr b/tests/ui/abi/cannot-be-coroutine.i686.stderr index 8c9292b6a32..230847ff269 100644 --- a/tests/ui/abi/cannot-be-coroutine.i686.stderr +++ b/tests/ui/abi/cannot-be-coroutine.i686.stderr @@ -1,13 +1,13 @@ error: functions with the "x86-interrupt" ABI cannot be `async` --> $DIR/cannot-be-coroutine.rs:52:1 | -LL | async extern "x86-interrupt" fn x86() { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | async extern "x86-interrupt" fn x86(_p: *mut ()) { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | help: remove the `async` keyword from this definition | -LL - async extern "x86-interrupt" fn x86() { -LL + extern "x86-interrupt" fn x86() { +LL - async extern "x86-interrupt" fn x86(_p: *mut ()) { +LL + extern "x86-interrupt" fn x86(_p: *mut ()) { | error: requires `ResumeTy` lang_item diff --git a/tests/ui/abi/cannot-be-coroutine.rs b/tests/ui/abi/cannot-be-coroutine.rs index 7270a55f69e..e3d3d45c632 100644 --- a/tests/ui/abi/cannot-be-coroutine.rs +++ b/tests/ui/abi/cannot-be-coroutine.rs @@ -49,6 +49,6 @@ async extern "riscv-interrupt-s" fn riscv_s() { //[riscv32,riscv64]~^ ERROR functions with the "riscv-interrupt-s" ABI cannot be `async` } -async extern "x86-interrupt" fn x86() { +async extern "x86-interrupt" fn x86(_p: *mut ()) { //[x64,x64_win,i686]~^ ERROR functions with the "x86-interrupt" ABI cannot be `async` } diff --git a/tests/ui/abi/cannot-be-coroutine.x64.stderr b/tests/ui/abi/cannot-be-coroutine.x64.stderr index 8c9292b6a32..230847ff269 100644 --- a/tests/ui/abi/cannot-be-coroutine.x64.stderr +++ b/tests/ui/abi/cannot-be-coroutine.x64.stderr @@ -1,13 +1,13 @@ error: functions with the "x86-interrupt" ABI cannot be `async` --> $DIR/cannot-be-coroutine.rs:52:1 | -LL | async extern "x86-interrupt" fn x86() { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | async extern "x86-interrupt" fn x86(_p: *mut ()) { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | help: remove the `async` keyword from this definition | -LL - async extern "x86-interrupt" fn x86() { -LL + extern "x86-interrupt" fn x86() { +LL - async extern "x86-interrupt" fn x86(_p: *mut ()) { +LL + extern "x86-interrupt" fn x86(_p: *mut ()) { | error: requires `ResumeTy` lang_item diff --git a/tests/ui/abi/cannot-be-coroutine.x64_win.stderr b/tests/ui/abi/cannot-be-coroutine.x64_win.stderr index 8c9292b6a32..230847ff269 100644 --- a/tests/ui/abi/cannot-be-coroutine.x64_win.stderr +++ b/tests/ui/abi/cannot-be-coroutine.x64_win.stderr @@ -1,13 +1,13 @@ error: functions with the "x86-interrupt" ABI cannot be `async` --> $DIR/cannot-be-coroutine.rs:52:1 | -LL | async extern "x86-interrupt" fn x86() { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | async extern "x86-interrupt" fn x86(_p: *mut ()) { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | help: remove the `async` keyword from this definition | -LL - async extern "x86-interrupt" fn x86() { -LL + extern "x86-interrupt" fn x86() { +LL - async extern "x86-interrupt" fn x86(_p: *mut ()) { +LL + extern "x86-interrupt" fn x86(_p: *mut ()) { | error: requires `ResumeTy` lang_item diff --git a/tests/ui/abi/debug.generic.stderr b/tests/ui/abi/debug.generic.stderr index 3b29efc8102..47341da221f 100644 --- a/tests/ui/abi/debug.generic.stderr +++ b/tests/ui/abi/debug.generic.stderr @@ -89,7 +89,7 @@ error: fn_abi_of(test) = FnAbi { conv: Rust, can_unwind: $SOME_BOOL, } - --> $DIR/debug.rs:27:1 + --> $DIR/debug.rs:30:1 | LL | fn test(_x: u8) -> bool { | ^^^^^^^^^^^^^^^^^^^^^^^ @@ -185,7 +185,7 @@ error: fn_abi_of(TestFnPtr) = FnAbi { conv: Rust, can_unwind: $SOME_BOOL, } - --> $DIR/debug.rs:33:1 + --> $DIR/debug.rs:36:1 | LL | type TestFnPtr = fn(bool) -> u8; | ^^^^^^^^^^^^^^ @@ -263,13 +263,13 @@ error: fn_abi_of(test_generic) = FnAbi { conv: Rust, can_unwind: $SOME_BOOL, } - --> $DIR/debug.rs:36:1 + --> $DIR/debug.rs:39:1 | LL | fn test_generic<T>(_x: *const T) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: `#[rustc_abi]` can only be applied to function items, type aliases, and associated functions - --> $DIR/debug.rs:39:1 + --> $DIR/debug.rs:42:1 | LL | const C: () = (); | ^^^^^^^^^^^ @@ -419,7 +419,7 @@ error: ABIs are not compatible conv: Rust, can_unwind: $SOME_BOOL, } - --> $DIR/debug.rs:55:1 + --> $DIR/debug.rs:58:1 | LL | type TestAbiNe = (fn(u8), fn(u32)); | ^^^^^^^^^^^^^^ @@ -454,7 +454,7 @@ error: ABIs are not compatible }, mode: Indirect { attrs: ArgAttributes { - regular: NoAlias | NoCapture | NonNull | NoUndef, + regular: NoAlias | CapturesAddress | NonNull | NoUndef, arg_ext: None, pointee_size: Size(32 bytes), pointee_align: Some( @@ -527,7 +527,7 @@ error: ABIs are not compatible }, mode: Indirect { attrs: ArgAttributes { - regular: NoAlias | NoCapture | NonNull | NoUndef, + regular: NoAlias | CapturesAddress | NonNull | NoUndef, arg_ext: None, pointee_size: Size(128 bytes), pointee_align: Some( @@ -571,7 +571,7 @@ error: ABIs are not compatible conv: Rust, can_unwind: $SOME_BOOL, } - --> $DIR/debug.rs:58:1 + --> $DIR/debug.rs:61:1 | LL | type TestAbiNeLarger = (fn([u8; 32]), fn([u32; 32])); | ^^^^^^^^^^^^^^^^^^^^ @@ -720,7 +720,7 @@ error: ABIs are not compatible conv: Rust, can_unwind: $SOME_BOOL, } - --> $DIR/debug.rs:61:1 + --> $DIR/debug.rs:64:1 | LL | type TestAbiNeFloat = (fn(f32), fn(u32)); | ^^^^^^^^^^^^^^^^^^^ @@ -870,13 +870,13 @@ error: ABIs are not compatible conv: Rust, can_unwind: $SOME_BOOL, } - --> $DIR/debug.rs:65:1 + --> $DIR/debug.rs:68:1 | LL | type TestAbiNeSign = (fn(i32), fn(u32)); | ^^^^^^^^^^^^^^^^^^ error[E0277]: the size for values of type `str` cannot be known at compilation time - --> $DIR/debug.rs:68:46 + --> $DIR/debug.rs:71:46 | LL | type TestAbiEqNonsense = (fn((str, str)), fn((str, str))); | ^^^^^^^^^^ doesn't have a size known at compile-time @@ -885,13 +885,13 @@ LL | type TestAbiEqNonsense = (fn((str, str)), fn((str, str))); = note: only the last element of a tuple may have a dynamically sized type error: unrecognized argument - --> $DIR/debug.rs:70:13 + --> $DIR/debug.rs:73:13 | LL | #[rustc_abi("assert_eq")] | ^^^^^^^^^^^ error: `#[rustc_abi]` can only be applied to function items, type aliases, and associated functions - --> $DIR/debug.rs:43:5 + --> $DIR/debug.rs:46:5 | LL | const C: () = (); | ^^^^^^^^^^^ @@ -939,7 +939,7 @@ error: fn_abi_of(assoc_test) = FnAbi { }, mode: Direct( ArgAttributes { - regular: NoAlias | NonNull | ReadOnly | NoUndef, + regular: NoAlias | NonNull | ReadOnly | NoUndef | CapturesReadOnly, arg_ext: None, pointee_size: Size(2 bytes), pointee_align: Some( @@ -981,7 +981,7 @@ error: fn_abi_of(assoc_test) = FnAbi { conv: Rust, can_unwind: $SOME_BOOL, } - --> $DIR/debug.rs:48:5 + --> $DIR/debug.rs:51:5 | LL | fn assoc_test(&self) {} | ^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/abi/debug.loongarch64.stderr b/tests/ui/abi/debug.loongarch64.stderr new file mode 100644 index 00000000000..94a01a80873 --- /dev/null +++ b/tests/ui/abi/debug.loongarch64.stderr @@ -0,0 +1,991 @@ +error: fn_abi_of(test) = FnAbi { + args: [ + ArgAbi { + layout: TyAndLayout { + ty: u8, + layout: Layout { + size: Size(1 bytes), + align: AbiAlign { + abi: $SOME_ALIGN, + }, + backend_repr: Scalar( + Initialized { + value: Int( + I8, + false, + ), + valid_range: 0..=255, + }, + ), + fields: Primitive, + largest_niche: None, + uninhabited: false, + variants: Single { + index: 0, + }, + max_repr_align: None, + unadjusted_abi_align: $SOME_ALIGN, + randomization_seed: $SEED, + }, + }, + mode: Direct( + ArgAttributes { + regular: NoUndef, + arg_ext: Zext, + pointee_size: Size(0 bytes), + pointee_align: None, + }, + ), + }, + ], + ret: ArgAbi { + layout: TyAndLayout { + ty: bool, + layout: Layout { + size: Size(1 bytes), + align: AbiAlign { + abi: $SOME_ALIGN, + }, + backend_repr: Scalar( + Initialized { + value: Int( + I8, + false, + ), + valid_range: 0..=1, + }, + ), + fields: Primitive, + largest_niche: Some( + Niche { + offset: Size(0 bytes), + value: Int( + I8, + false, + ), + valid_range: 0..=1, + }, + ), + uninhabited: false, + variants: Single { + index: 0, + }, + max_repr_align: None, + unadjusted_abi_align: $SOME_ALIGN, + randomization_seed: $SEED, + }, + }, + mode: Direct( + ArgAttributes { + regular: NoUndef, + arg_ext: Zext, + pointee_size: Size(0 bytes), + pointee_align: None, + }, + ), + }, + c_variadic: false, + fixed_count: 1, + conv: Rust, + can_unwind: $SOME_BOOL, + } + --> $DIR/debug.rs:30:1 + | +LL | fn test(_x: u8) -> bool { + | ^^^^^^^^^^^^^^^^^^^^^^^ + +error: fn_abi_of(TestFnPtr) = FnAbi { + args: [ + ArgAbi { + layout: TyAndLayout { + ty: bool, + layout: Layout { + size: Size(1 bytes), + align: AbiAlign { + abi: $SOME_ALIGN, + }, + backend_repr: Scalar( + Initialized { + value: Int( + I8, + false, + ), + valid_range: 0..=1, + }, + ), + fields: Primitive, + largest_niche: Some( + Niche { + offset: Size(0 bytes), + value: Int( + I8, + false, + ), + valid_range: 0..=1, + }, + ), + uninhabited: false, + variants: Single { + index: 0, + }, + max_repr_align: None, + unadjusted_abi_align: $SOME_ALIGN, + randomization_seed: $SEED, + }, + }, + mode: Direct( + ArgAttributes { + regular: NoUndef, + arg_ext: Zext, + pointee_size: Size(0 bytes), + pointee_align: None, + }, + ), + }, + ], + ret: ArgAbi { + layout: TyAndLayout { + ty: u8, + layout: Layout { + size: Size(1 bytes), + align: AbiAlign { + abi: $SOME_ALIGN, + }, + backend_repr: Scalar( + Initialized { + value: Int( + I8, + false, + ), + valid_range: 0..=255, + }, + ), + fields: Primitive, + largest_niche: None, + uninhabited: false, + variants: Single { + index: 0, + }, + max_repr_align: None, + unadjusted_abi_align: $SOME_ALIGN, + randomization_seed: $SEED, + }, + }, + mode: Direct( + ArgAttributes { + regular: NoUndef, + arg_ext: None, + pointee_size: Size(0 bytes), + pointee_align: None, + }, + ), + }, + c_variadic: false, + fixed_count: 1, + conv: Rust, + can_unwind: $SOME_BOOL, + } + --> $DIR/debug.rs:36:1 + | +LL | type TestFnPtr = fn(bool) -> u8; + | ^^^^^^^^^^^^^^ + +error: fn_abi_of(test_generic) = FnAbi { + args: [ + ArgAbi { + layout: TyAndLayout { + ty: *const T, + layout: Layout { + size: $SOME_SIZE, + align: AbiAlign { + abi: $SOME_ALIGN, + }, + backend_repr: Scalar( + Initialized { + value: Pointer( + AddressSpace( + 0, + ), + ), + valid_range: $FULL, + }, + ), + fields: Primitive, + largest_niche: None, + uninhabited: false, + variants: Single { + index: 0, + }, + max_repr_align: None, + unadjusted_abi_align: $SOME_ALIGN, + randomization_seed: $SEED, + }, + }, + mode: Direct( + ArgAttributes { + regular: NoUndef, + arg_ext: None, + pointee_size: Size(0 bytes), + pointee_align: None, + }, + ), + }, + ], + ret: ArgAbi { + layout: TyAndLayout { + ty: (), + layout: Layout { + size: Size(0 bytes), + align: AbiAlign { + abi: $SOME_ALIGN, + }, + backend_repr: Memory { + sized: true, + }, + fields: Arbitrary { + offsets: [], + memory_index: [], + }, + largest_niche: None, + uninhabited: false, + variants: Single { + index: 0, + }, + max_repr_align: None, + unadjusted_abi_align: $SOME_ALIGN, + randomization_seed: $SEED, + }, + }, + mode: Ignore, + }, + c_variadic: false, + fixed_count: 1, + conv: Rust, + can_unwind: $SOME_BOOL, + } + --> $DIR/debug.rs:39:1 + | +LL | fn test_generic<T>(_x: *const T) {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: `#[rustc_abi]` can only be applied to function items, type aliases, and associated functions + --> $DIR/debug.rs:42:1 + | +LL | const C: () = (); + | ^^^^^^^^^^^ + +error: ABIs are not compatible + left ABI = FnAbi { + args: [ + ArgAbi { + layout: TyAndLayout { + ty: u8, + layout: Layout { + size: Size(1 bytes), + align: AbiAlign { + abi: $SOME_ALIGN, + }, + backend_repr: Scalar( + Initialized { + value: Int( + I8, + false, + ), + valid_range: 0..=255, + }, + ), + fields: Primitive, + largest_niche: None, + uninhabited: false, + variants: Single { + index: 0, + }, + max_repr_align: None, + unadjusted_abi_align: $SOME_ALIGN, + randomization_seed: $SEED, + }, + }, + mode: Direct( + ArgAttributes { + regular: NoUndef, + arg_ext: Zext, + pointee_size: Size(0 bytes), + pointee_align: None, + }, + ), + }, + ], + ret: ArgAbi { + layout: TyAndLayout { + ty: (), + layout: Layout { + size: Size(0 bytes), + align: AbiAlign { + abi: $SOME_ALIGN, + }, + backend_repr: Memory { + sized: true, + }, + fields: Arbitrary { + offsets: [], + memory_index: [], + }, + largest_niche: None, + uninhabited: false, + variants: Single { + index: 0, + }, + max_repr_align: None, + unadjusted_abi_align: $SOME_ALIGN, + randomization_seed: $SEED, + }, + }, + mode: Ignore, + }, + c_variadic: false, + fixed_count: 1, + conv: Rust, + can_unwind: $SOME_BOOL, + } + right ABI = FnAbi { + args: [ + ArgAbi { + layout: TyAndLayout { + ty: u32, + layout: Layout { + size: $SOME_SIZE, + align: AbiAlign { + abi: $SOME_ALIGN, + }, + backend_repr: Scalar( + Initialized { + value: Int( + I32, + false, + ), + valid_range: $FULL, + }, + ), + fields: Primitive, + largest_niche: None, + uninhabited: false, + variants: Single { + index: 0, + }, + max_repr_align: None, + unadjusted_abi_align: $SOME_ALIGN, + randomization_seed: $SEED, + }, + }, + mode: Direct( + ArgAttributes { + regular: NoUndef, + arg_ext: Sext, + pointee_size: Size(0 bytes), + pointee_align: None, + }, + ), + }, + ], + ret: ArgAbi { + layout: TyAndLayout { + ty: (), + layout: Layout { + size: Size(0 bytes), + align: AbiAlign { + abi: $SOME_ALIGN, + }, + backend_repr: Memory { + sized: true, + }, + fields: Arbitrary { + offsets: [], + memory_index: [], + }, + largest_niche: None, + uninhabited: false, + variants: Single { + index: 0, + }, + max_repr_align: None, + unadjusted_abi_align: $SOME_ALIGN, + randomization_seed: $SEED, + }, + }, + mode: Ignore, + }, + c_variadic: false, + fixed_count: 1, + conv: Rust, + can_unwind: $SOME_BOOL, + } + --> $DIR/debug.rs:58:1 + | +LL | type TestAbiNe = (fn(u8), fn(u32)); + | ^^^^^^^^^^^^^^ + +error: ABIs are not compatible + left ABI = FnAbi { + args: [ + ArgAbi { + layout: TyAndLayout { + ty: [u8; 32], + layout: Layout { + size: Size(32 bytes), + align: AbiAlign { + abi: $SOME_ALIGN, + }, + backend_repr: Memory { + sized: true, + }, + fields: Array { + stride: Size(1 bytes), + count: 32, + }, + largest_niche: None, + uninhabited: false, + variants: Single { + index: 0, + }, + max_repr_align: None, + unadjusted_abi_align: $SOME_ALIGN, + randomization_seed: $SEED, + }, + }, + mode: Indirect { + attrs: ArgAttributes { + regular: NoAlias | CapturesAddress | NonNull | NoUndef, + arg_ext: None, + pointee_size: Size(32 bytes), + pointee_align: Some( + Align(1 bytes), + ), + }, + meta_attrs: None, + on_stack: false, + }, + }, + ], + ret: ArgAbi { + layout: TyAndLayout { + ty: (), + layout: Layout { + size: Size(0 bytes), + align: AbiAlign { + abi: $SOME_ALIGN, + }, + backend_repr: Memory { + sized: true, + }, + fields: Arbitrary { + offsets: [], + memory_index: [], + }, + largest_niche: None, + uninhabited: false, + variants: Single { + index: 0, + }, + max_repr_align: None, + unadjusted_abi_align: $SOME_ALIGN, + randomization_seed: $SEED, + }, + }, + mode: Ignore, + }, + c_variadic: false, + fixed_count: 1, + conv: Rust, + can_unwind: $SOME_BOOL, + } + right ABI = FnAbi { + args: [ + ArgAbi { + layout: TyAndLayout { + ty: [u32; 32], + layout: Layout { + size: Size(128 bytes), + align: AbiAlign { + abi: $SOME_ALIGN, + }, + backend_repr: Memory { + sized: true, + }, + fields: Array { + stride: Size(4 bytes), + count: 32, + }, + largest_niche: None, + uninhabited: false, + variants: Single { + index: 0, + }, + max_repr_align: None, + unadjusted_abi_align: $SOME_ALIGN, + randomization_seed: $SEED, + }, + }, + mode: Indirect { + attrs: ArgAttributes { + regular: NoAlias | CapturesAddress | NonNull | NoUndef, + arg_ext: None, + pointee_size: Size(128 bytes), + pointee_align: Some( + Align(4 bytes), + ), + }, + meta_attrs: None, + on_stack: false, + }, + }, + ], + ret: ArgAbi { + layout: TyAndLayout { + ty: (), + layout: Layout { + size: Size(0 bytes), + align: AbiAlign { + abi: $SOME_ALIGN, + }, + backend_repr: Memory { + sized: true, + }, + fields: Arbitrary { + offsets: [], + memory_index: [], + }, + largest_niche: None, + uninhabited: false, + variants: Single { + index: 0, + }, + max_repr_align: None, + unadjusted_abi_align: $SOME_ALIGN, + randomization_seed: $SEED, + }, + }, + mode: Ignore, + }, + c_variadic: false, + fixed_count: 1, + conv: Rust, + can_unwind: $SOME_BOOL, + } + --> $DIR/debug.rs:61:1 + | +LL | type TestAbiNeLarger = (fn([u8; 32]), fn([u32; 32])); + | ^^^^^^^^^^^^^^^^^^^^ + +error: ABIs are not compatible + left ABI = FnAbi { + args: [ + ArgAbi { + layout: TyAndLayout { + ty: f32, + layout: Layout { + size: $SOME_SIZE, + align: AbiAlign { + abi: $SOME_ALIGN, + }, + backend_repr: Scalar( + Initialized { + value: Float( + F32, + ), + valid_range: $FULL, + }, + ), + fields: Primitive, + largest_niche: None, + uninhabited: false, + variants: Single { + index: 0, + }, + max_repr_align: None, + unadjusted_abi_align: $SOME_ALIGN, + randomization_seed: $SEED, + }, + }, + mode: Direct( + ArgAttributes { + regular: NoUndef, + arg_ext: None, + pointee_size: Size(0 bytes), + pointee_align: None, + }, + ), + }, + ], + ret: ArgAbi { + layout: TyAndLayout { + ty: (), + layout: Layout { + size: Size(0 bytes), + align: AbiAlign { + abi: $SOME_ALIGN, + }, + backend_repr: Memory { + sized: true, + }, + fields: Arbitrary { + offsets: [], + memory_index: [], + }, + largest_niche: None, + uninhabited: false, + variants: Single { + index: 0, + }, + max_repr_align: None, + unadjusted_abi_align: $SOME_ALIGN, + randomization_seed: $SEED, + }, + }, + mode: Ignore, + }, + c_variadic: false, + fixed_count: 1, + conv: Rust, + can_unwind: $SOME_BOOL, + } + right ABI = FnAbi { + args: [ + ArgAbi { + layout: TyAndLayout { + ty: u32, + layout: Layout { + size: $SOME_SIZE, + align: AbiAlign { + abi: $SOME_ALIGN, + }, + backend_repr: Scalar( + Initialized { + value: Int( + I32, + false, + ), + valid_range: $FULL, + }, + ), + fields: Primitive, + largest_niche: None, + uninhabited: false, + variants: Single { + index: 0, + }, + max_repr_align: None, + unadjusted_abi_align: $SOME_ALIGN, + randomization_seed: $SEED, + }, + }, + mode: Direct( + ArgAttributes { + regular: NoUndef, + arg_ext: Sext, + pointee_size: Size(0 bytes), + pointee_align: None, + }, + ), + }, + ], + ret: ArgAbi { + layout: TyAndLayout { + ty: (), + layout: Layout { + size: Size(0 bytes), + align: AbiAlign { + abi: $SOME_ALIGN, + }, + backend_repr: Memory { + sized: true, + }, + fields: Arbitrary { + offsets: [], + memory_index: [], + }, + largest_niche: None, + uninhabited: false, + variants: Single { + index: 0, + }, + max_repr_align: None, + unadjusted_abi_align: $SOME_ALIGN, + randomization_seed: $SEED, + }, + }, + mode: Ignore, + }, + c_variadic: false, + fixed_count: 1, + conv: Rust, + can_unwind: $SOME_BOOL, + } + --> $DIR/debug.rs:64:1 + | +LL | type TestAbiNeFloat = (fn(f32), fn(u32)); + | ^^^^^^^^^^^^^^^^^^^ + +error: ABIs are not compatible + left ABI = FnAbi { + args: [ + ArgAbi { + layout: TyAndLayout { + ty: i32, + layout: Layout { + size: $SOME_SIZE, + align: AbiAlign { + abi: $SOME_ALIGN, + }, + backend_repr: Scalar( + Initialized { + value: Int( + I32, + true, + ), + valid_range: $FULL, + }, + ), + fields: Primitive, + largest_niche: None, + uninhabited: false, + variants: Single { + index: 0, + }, + max_repr_align: None, + unadjusted_abi_align: $SOME_ALIGN, + randomization_seed: $SEED, + }, + }, + mode: Direct( + ArgAttributes { + regular: NoUndef, + arg_ext: Sext, + pointee_size: Size(0 bytes), + pointee_align: None, + }, + ), + }, + ], + ret: ArgAbi { + layout: TyAndLayout { + ty: (), + layout: Layout { + size: Size(0 bytes), + align: AbiAlign { + abi: $SOME_ALIGN, + }, + backend_repr: Memory { + sized: true, + }, + fields: Arbitrary { + offsets: [], + memory_index: [], + }, + largest_niche: None, + uninhabited: false, + variants: Single { + index: 0, + }, + max_repr_align: None, + unadjusted_abi_align: $SOME_ALIGN, + randomization_seed: $SEED, + }, + }, + mode: Ignore, + }, + c_variadic: false, + fixed_count: 1, + conv: Rust, + can_unwind: $SOME_BOOL, + } + right ABI = FnAbi { + args: [ + ArgAbi { + layout: TyAndLayout { + ty: u32, + layout: Layout { + size: $SOME_SIZE, + align: AbiAlign { + abi: $SOME_ALIGN, + }, + backend_repr: Scalar( + Initialized { + value: Int( + I32, + false, + ), + valid_range: $FULL, + }, + ), + fields: Primitive, + largest_niche: None, + uninhabited: false, + variants: Single { + index: 0, + }, + max_repr_align: None, + unadjusted_abi_align: $SOME_ALIGN, + randomization_seed: $SEED, + }, + }, + mode: Direct( + ArgAttributes { + regular: NoUndef, + arg_ext: Sext, + pointee_size: Size(0 bytes), + pointee_align: None, + }, + ), + }, + ], + ret: ArgAbi { + layout: TyAndLayout { + ty: (), + layout: Layout { + size: Size(0 bytes), + align: AbiAlign { + abi: $SOME_ALIGN, + }, + backend_repr: Memory { + sized: true, + }, + fields: Arbitrary { + offsets: [], + memory_index: [], + }, + largest_niche: None, + uninhabited: false, + variants: Single { + index: 0, + }, + max_repr_align: None, + unadjusted_abi_align: $SOME_ALIGN, + randomization_seed: $SEED, + }, + }, + mode: Ignore, + }, + c_variadic: false, + fixed_count: 1, + conv: Rust, + can_unwind: $SOME_BOOL, + } + --> $DIR/debug.rs:68:1 + | +LL | type TestAbiNeSign = (fn(i32), fn(u32)); + | ^^^^^^^^^^^^^^^^^^ + +error[E0277]: the size for values of type `str` cannot be known at compilation time + --> $DIR/debug.rs:71:46 + | +LL | type TestAbiEqNonsense = (fn((str, str)), fn((str, str))); + | ^^^^^^^^^^ doesn't have a size known at compile-time + | + = help: the trait `Sized` is not implemented for `str` + = note: only the last element of a tuple may have a dynamically sized type + +error: unrecognized argument + --> $DIR/debug.rs:73:13 + | +LL | #[rustc_abi("assert_eq")] + | ^^^^^^^^^^^ + +error: `#[rustc_abi]` can only be applied to function items, type aliases, and associated functions + --> $DIR/debug.rs:46:5 + | +LL | const C: () = (); + | ^^^^^^^^^^^ + +error: fn_abi_of(assoc_test) = FnAbi { + args: [ + ArgAbi { + layout: TyAndLayout { + ty: &S, + layout: Layout { + size: $SOME_SIZE, + align: AbiAlign { + abi: $SOME_ALIGN, + }, + backend_repr: Scalar( + Initialized { + value: Pointer( + AddressSpace( + 0, + ), + ), + valid_range: $NON_NULL, + }, + ), + fields: Primitive, + largest_niche: Some( + Niche { + offset: Size(0 bytes), + value: Pointer( + AddressSpace( + 0, + ), + ), + valid_range: $NON_NULL, + }, + ), + uninhabited: false, + variants: Single { + index: 0, + }, + max_repr_align: None, + unadjusted_abi_align: $SOME_ALIGN, + randomization_seed: $SEED, + }, + }, + mode: Direct( + ArgAttributes { + regular: NoAlias | NonNull | ReadOnly | NoUndef | CapturesReadOnly, + arg_ext: None, + pointee_size: Size(2 bytes), + pointee_align: Some( + Align(2 bytes), + ), + }, + ), + }, + ], + ret: ArgAbi { + layout: TyAndLayout { + ty: (), + layout: Layout { + size: Size(0 bytes), + align: AbiAlign { + abi: $SOME_ALIGN, + }, + backend_repr: Memory { + sized: true, + }, + fields: Arbitrary { + offsets: [], + memory_index: [], + }, + largest_niche: None, + uninhabited: false, + variants: Single { + index: 0, + }, + max_repr_align: None, + unadjusted_abi_align: $SOME_ALIGN, + randomization_seed: $SEED, + }, + }, + mode: Ignore, + }, + c_variadic: false, + fixed_count: 1, + conv: Rust, + can_unwind: $SOME_BOOL, + } + --> $DIR/debug.rs:51:5 + | +LL | fn assoc_test(&self) {} + | ^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to 12 previous errors + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/abi/debug.riscv64.stderr b/tests/ui/abi/debug.riscv64.stderr index 2417396de2f..94a01a80873 100644 --- a/tests/ui/abi/debug.riscv64.stderr +++ b/tests/ui/abi/debug.riscv64.stderr @@ -89,7 +89,7 @@ error: fn_abi_of(test) = FnAbi { conv: Rust, can_unwind: $SOME_BOOL, } - --> $DIR/debug.rs:27:1 + --> $DIR/debug.rs:30:1 | LL | fn test(_x: u8) -> bool { | ^^^^^^^^^^^^^^^^^^^^^^^ @@ -185,7 +185,7 @@ error: fn_abi_of(TestFnPtr) = FnAbi { conv: Rust, can_unwind: $SOME_BOOL, } - --> $DIR/debug.rs:33:1 + --> $DIR/debug.rs:36:1 | LL | type TestFnPtr = fn(bool) -> u8; | ^^^^^^^^^^^^^^ @@ -263,13 +263,13 @@ error: fn_abi_of(test_generic) = FnAbi { conv: Rust, can_unwind: $SOME_BOOL, } - --> $DIR/debug.rs:36:1 + --> $DIR/debug.rs:39:1 | LL | fn test_generic<T>(_x: *const T) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: `#[rustc_abi]` can only be applied to function items, type aliases, and associated functions - --> $DIR/debug.rs:39:1 + --> $DIR/debug.rs:42:1 | LL | const C: () = (); | ^^^^^^^^^^^ @@ -419,7 +419,7 @@ error: ABIs are not compatible conv: Rust, can_unwind: $SOME_BOOL, } - --> $DIR/debug.rs:55:1 + --> $DIR/debug.rs:58:1 | LL | type TestAbiNe = (fn(u8), fn(u32)); | ^^^^^^^^^^^^^^ @@ -454,7 +454,7 @@ error: ABIs are not compatible }, mode: Indirect { attrs: ArgAttributes { - regular: NoAlias | NoCapture | NonNull | NoUndef, + regular: NoAlias | CapturesAddress | NonNull | NoUndef, arg_ext: None, pointee_size: Size(32 bytes), pointee_align: Some( @@ -527,7 +527,7 @@ error: ABIs are not compatible }, mode: Indirect { attrs: ArgAttributes { - regular: NoAlias | NoCapture | NonNull | NoUndef, + regular: NoAlias | CapturesAddress | NonNull | NoUndef, arg_ext: None, pointee_size: Size(128 bytes), pointee_align: Some( @@ -571,7 +571,7 @@ error: ABIs are not compatible conv: Rust, can_unwind: $SOME_BOOL, } - --> $DIR/debug.rs:58:1 + --> $DIR/debug.rs:61:1 | LL | type TestAbiNeLarger = (fn([u8; 32]), fn([u32; 32])); | ^^^^^^^^^^^^^^^^^^^^ @@ -720,7 +720,7 @@ error: ABIs are not compatible conv: Rust, can_unwind: $SOME_BOOL, } - --> $DIR/debug.rs:61:1 + --> $DIR/debug.rs:64:1 | LL | type TestAbiNeFloat = (fn(f32), fn(u32)); | ^^^^^^^^^^^^^^^^^^^ @@ -870,13 +870,13 @@ error: ABIs are not compatible conv: Rust, can_unwind: $SOME_BOOL, } - --> $DIR/debug.rs:65:1 + --> $DIR/debug.rs:68:1 | LL | type TestAbiNeSign = (fn(i32), fn(u32)); | ^^^^^^^^^^^^^^^^^^ error[E0277]: the size for values of type `str` cannot be known at compilation time - --> $DIR/debug.rs:68:46 + --> $DIR/debug.rs:71:46 | LL | type TestAbiEqNonsense = (fn((str, str)), fn((str, str))); | ^^^^^^^^^^ doesn't have a size known at compile-time @@ -885,13 +885,13 @@ LL | type TestAbiEqNonsense = (fn((str, str)), fn((str, str))); = note: only the last element of a tuple may have a dynamically sized type error: unrecognized argument - --> $DIR/debug.rs:70:13 + --> $DIR/debug.rs:73:13 | LL | #[rustc_abi("assert_eq")] | ^^^^^^^^^^^ error: `#[rustc_abi]` can only be applied to function items, type aliases, and associated functions - --> $DIR/debug.rs:43:5 + --> $DIR/debug.rs:46:5 | LL | const C: () = (); | ^^^^^^^^^^^ @@ -939,7 +939,7 @@ error: fn_abi_of(assoc_test) = FnAbi { }, mode: Direct( ArgAttributes { - regular: NoAlias | NonNull | ReadOnly | NoUndef, + regular: NoAlias | NonNull | ReadOnly | NoUndef | CapturesReadOnly, arg_ext: None, pointee_size: Size(2 bytes), pointee_align: Some( @@ -981,7 +981,7 @@ error: fn_abi_of(assoc_test) = FnAbi { conv: Rust, can_unwind: $SOME_BOOL, } - --> $DIR/debug.rs:48:5 + --> $DIR/debug.rs:51:5 | LL | fn assoc_test(&self) {} | ^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/abi/debug.rs b/tests/ui/abi/debug.rs index cc1589d8621..59c0908041d 100644 --- a/tests/ui/abi/debug.rs +++ b/tests/ui/abi/debug.rs @@ -8,10 +8,13 @@ //@ normalize-stderr: "(valid_range): [1-9]\.\.=(429496729[0-9]|1844674407370955161[0-9])" -> "$1: $$NON_NULL" // Some attributes are only computed for release builds: //@ compile-flags: -O -//@ revisions: generic riscv64 +//@ revisions: generic riscv64 loongarch64 //@ [riscv64] compile-flags: --target riscv64gc-unknown-linux-gnu //@ [riscv64] needs-llvm-components: riscv +//@ [loongarch64] compile-flags: --target loongarch64-unknown-linux-gnu +//@ [loongarch64] needs-llvm-components: loongarch //@ [generic] ignore-riscv64 +//@ [generic] ignore-loongarch64 #![feature(rustc_attrs)] #![crate_type = "lib"] #![feature(no_core)] diff --git a/tests/ui/abi/interrupt-invalid-signature.i686.stderr b/tests/ui/abi/interrupt-invalid-signature.i686.stderr index 86f2e097c37..df8e318bf0a 100644 --- a/tests/ui/abi/interrupt-invalid-signature.i686.stderr +++ b/tests/ui/abi/interrupt-invalid-signature.i686.stderr @@ -1,15 +1,31 @@ error: invalid signature for `extern "x86-interrupt"` function - --> $DIR/interrupt-invalid-signature.rs:83:40 + --> $DIR/interrupt-invalid-signature.rs:83:53 | -LL | extern "x86-interrupt" fn x86_ret() -> u8 { - | ^^ +LL | extern "x86-interrupt" fn x86_ret(_p: *const u8) -> u8 { + | ^^ | = note: functions with the "x86-interrupt" ABI cannot have a return type help: remove the return type - --> $DIR/interrupt-invalid-signature.rs:83:40 + --> $DIR/interrupt-invalid-signature.rs:83:53 | -LL | extern "x86-interrupt" fn x86_ret() -> u8 { - | ^^ +LL | extern "x86-interrupt" fn x86_ret(_p: *const u8) -> u8 { + | ^^ -error: aborting due to 1 previous error +error: invalid signature for `extern "x86-interrupt"` function + --> $DIR/interrupt-invalid-signature.rs:89:1 + | +LL | extern "x86-interrupt" fn x86_0() { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: functions with the "x86-interrupt" ABI must be have either 1 or 2 parameters (but found 0) + +error: invalid signature for `extern "x86-interrupt"` function + --> $DIR/interrupt-invalid-signature.rs:100:33 + | +LL | extern "x86-interrupt" fn x86_3(_p1: *const u8, _p2: *const u8, _p3: *const u8) { + | ^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^ + | + = note: functions with the "x86-interrupt" ABI must be have either 1 or 2 parameters (but found 3) + +error: aborting due to 3 previous errors diff --git a/tests/ui/abi/interrupt-invalid-signature.rs b/tests/ui/abi/interrupt-invalid-signature.rs index e389285b069..09bda0d5faf 100644 --- a/tests/ui/abi/interrupt-invalid-signature.rs +++ b/tests/ui/abi/interrupt-invalid-signature.rs @@ -80,11 +80,27 @@ extern "riscv-interrupt-s" fn riscv_s_ret() -> u8 { } #[cfg(any(x64,i686))] -extern "x86-interrupt" fn x86_ret() -> u8 { +extern "x86-interrupt" fn x86_ret(_p: *const u8) -> u8 { //[x64,i686]~^ ERROR invalid signature 1 } +#[cfg(any(x64,i686))] +extern "x86-interrupt" fn x86_0() { + //[x64,i686]~^ ERROR invalid signature +} + +#[cfg(any(x64,i686))] +extern "x86-interrupt" fn x86_1(_p1: *const u8) { } + +#[cfg(any(x64,i686))] +extern "x86-interrupt" fn x86_2(_p1: *const u8, _p2: *const u8) { } + +#[cfg(any(x64,i686))] +extern "x86-interrupt" fn x86_3(_p1: *const u8, _p2: *const u8, _p3: *const u8) { + //[x64,i686]~^ ERROR invalid signature +} + /* extern "interrupt" fnptrs with invalid signatures */ diff --git a/tests/ui/abi/interrupt-invalid-signature.x64.stderr b/tests/ui/abi/interrupt-invalid-signature.x64.stderr index 86f2e097c37..df8e318bf0a 100644 --- a/tests/ui/abi/interrupt-invalid-signature.x64.stderr +++ b/tests/ui/abi/interrupt-invalid-signature.x64.stderr @@ -1,15 +1,31 @@ error: invalid signature for `extern "x86-interrupt"` function - --> $DIR/interrupt-invalid-signature.rs:83:40 + --> $DIR/interrupt-invalid-signature.rs:83:53 | -LL | extern "x86-interrupt" fn x86_ret() -> u8 { - | ^^ +LL | extern "x86-interrupt" fn x86_ret(_p: *const u8) -> u8 { + | ^^ | = note: functions with the "x86-interrupt" ABI cannot have a return type help: remove the return type - --> $DIR/interrupt-invalid-signature.rs:83:40 + --> $DIR/interrupt-invalid-signature.rs:83:53 | -LL | extern "x86-interrupt" fn x86_ret() -> u8 { - | ^^ +LL | extern "x86-interrupt" fn x86_ret(_p: *const u8) -> u8 { + | ^^ -error: aborting due to 1 previous error +error: invalid signature for `extern "x86-interrupt"` function + --> $DIR/interrupt-invalid-signature.rs:89:1 + | +LL | extern "x86-interrupt" fn x86_0() { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: functions with the "x86-interrupt" ABI must be have either 1 or 2 parameters (but found 0) + +error: invalid signature for `extern "x86-interrupt"` function + --> $DIR/interrupt-invalid-signature.rs:100:33 + | +LL | extern "x86-interrupt" fn x86_3(_p1: *const u8, _p2: *const u8, _p3: *const u8) { + | ^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^ + | + = note: functions with the "x86-interrupt" ABI must be have either 1 or 2 parameters (but found 3) + +error: aborting due to 3 previous errors diff --git a/tests/ui/abi/interrupt-returns-never-or-unit.rs b/tests/ui/abi/interrupt-returns-never-or-unit.rs index 8e224229a0b..104b36363d0 100644 --- a/tests/ui/abi/interrupt-returns-never-or-unit.rs +++ b/tests/ui/abi/interrupt-returns-never-or-unit.rs @@ -56,7 +56,7 @@ extern "riscv-interrupt-s" fn riscv_s_ret_never() -> ! { } #[cfg(any(x64,i686))] -extern "x86-interrupt" fn x86_ret_never() -> ! { +extern "x86-interrupt" fn x86_ret_never(_p: *const u8) -> ! { loop {} } @@ -83,7 +83,7 @@ extern "riscv-interrupt-s" fn riscv_s_ret_unit() -> () { } #[cfg(any(x64,i686))] -extern "x86-interrupt" fn x86_ret_unit() -> () { +extern "x86-interrupt" fn x86_ret_unit(_x: *const u8) -> () { () } diff --git a/tests/ui/abi/simd-abi-checks-s390x.rs b/tests/ui/abi/simd-abi-checks-s390x.rs index 2d4eb7a350f..877a25e8b08 100644 --- a/tests/ui/abi/simd-abi-checks-s390x.rs +++ b/tests/ui/abi/simd-abi-checks-s390x.rs @@ -110,47 +110,47 @@ extern "C" fn vector_transparent_wrapper_ret_large( #[no_mangle] extern "C" fn vector_arg_small(x: i8x8) -> i64 { //~^ ERROR requires the `vector` target feature, which is not enabled - unsafe { *(&x as *const i8x8 as *const i64) } + unsafe { *(&raw const x as *const i64) } } #[no_mangle] extern "C" fn vector_arg(x: i8x16) -> i64 { //~^ ERROR requires the `vector` target feature, which is not enabled - unsafe { *(&x as *const i8x16 as *const i64) } + unsafe { *(&raw const x as *const i64) } } #[no_mangle] extern "C" fn vector_arg_large(x: i8x32) -> i64 { // Ok - unsafe { *(&x as *const i8x32 as *const i64) } + unsafe { *(&raw const x as *const i64) } } #[no_mangle] extern "C" fn vector_wrapper_arg_small(x: Wrapper<i8x8>) -> i64 { //~^ ERROR requires the `vector` target feature, which is not enabled - unsafe { *(&x as *const Wrapper<i8x8> as *const i64) } + unsafe { *(&raw const x as *const i64) } } #[no_mangle] extern "C" fn vector_wrapper_arg(x: Wrapper<i8x16>) -> i64 { //~^ ERROR requires the `vector` target feature, which is not enabled - unsafe { *(&x as *const Wrapper<i8x16> as *const i64) } + unsafe { *(&raw const x as *const i64) } } #[no_mangle] extern "C" fn vector_wrapper_arg_large(x: Wrapper<i8x32>) -> i64 { // Ok - unsafe { *(&x as *const Wrapper<i8x32> as *const i64) } + unsafe { *(&raw const x as *const i64) } } #[no_mangle] extern "C" fn vector_transparent_wrapper_arg_small(x: TransparentWrapper<i8x8>) -> i64 { //~^ ERROR requires the `vector` target feature, which is not enabled - unsafe { *(&x as *const TransparentWrapper<i8x8> as *const i64) } + unsafe { *(&raw const x as *const i64) } } #[no_mangle] extern "C" fn vector_transparent_wrapper_arg(x: TransparentWrapper<i8x16>) -> i64 { //~^ ERROR requires the `vector` target feature, which is not enabled - unsafe { *(&x as *const TransparentWrapper<i8x16> as *const i64) } + unsafe { *(&raw const x as *const i64) } } #[no_mangle] extern "C" fn vector_transparent_wrapper_arg_large(x: TransparentWrapper<i8x32>) -> i64 { // Ok - unsafe { *(&x as *const TransparentWrapper<i8x32> as *const i64) } + unsafe { *(&raw const x as *const i64) } } diff --git a/tests/ui/abi/unsupported.aarch64.stderr b/tests/ui/abi/unsupported.aarch64.stderr index 61d07f29fd7..f2b14e0707b 100644 --- a/tests/ui/abi/unsupported.aarch64.stderr +++ b/tests/ui/abi/unsupported.aarch64.stderr @@ -165,7 +165,7 @@ LL | fn cdecl_ptr(f: extern "cdecl" 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 #137018 <https://github.com/rust-lang/rust/issues/137018> = help: use `extern "C"` instead - = note: `#[warn(unsupported_calling_conventions)]` on by default + = note: `#[warn(unsupported_calling_conventions)]` (part of `#[warn(future_incompatible)]`) on by default warning: "cdecl" is not a supported ABI for the current target --> $DIR/unsupported.rs:104:1 diff --git a/tests/ui/abi/unsupported.arm.stderr b/tests/ui/abi/unsupported.arm.stderr index 37b6e2316b0..bc666b7ced1 100644 --- a/tests/ui/abi/unsupported.arm.stderr +++ b/tests/ui/abi/unsupported.arm.stderr @@ -147,7 +147,7 @@ LL | fn cdecl_ptr(f: extern "cdecl" 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 #137018 <https://github.com/rust-lang/rust/issues/137018> = help: use `extern "C"` instead - = note: `#[warn(unsupported_calling_conventions)]` on by default + = note: `#[warn(unsupported_calling_conventions)]` (part of `#[warn(future_incompatible)]`) on by default warning: "cdecl" is not a supported ABI for the current target --> $DIR/unsupported.rs:104:1 diff --git a/tests/ui/abi/unsupported.riscv32.stderr b/tests/ui/abi/unsupported.riscv32.stderr index d7eb222eb76..722b1ec7713 100644 --- a/tests/ui/abi/unsupported.riscv32.stderr +++ b/tests/ui/abi/unsupported.riscv32.stderr @@ -159,7 +159,7 @@ LL | fn cdecl_ptr(f: extern "cdecl" 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 #137018 <https://github.com/rust-lang/rust/issues/137018> = help: use `extern "C"` instead - = note: `#[warn(unsupported_calling_conventions)]` on by default + = note: `#[warn(unsupported_calling_conventions)]` (part of `#[warn(future_incompatible)]`) on by default warning: "cdecl" is not a supported ABI for the current target --> $DIR/unsupported.rs:104:1 diff --git a/tests/ui/abi/unsupported.riscv64.stderr b/tests/ui/abi/unsupported.riscv64.stderr index d7eb222eb76..722b1ec7713 100644 --- a/tests/ui/abi/unsupported.riscv64.stderr +++ b/tests/ui/abi/unsupported.riscv64.stderr @@ -159,7 +159,7 @@ LL | fn cdecl_ptr(f: extern "cdecl" 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 #137018 <https://github.com/rust-lang/rust/issues/137018> = help: use `extern "C"` instead - = note: `#[warn(unsupported_calling_conventions)]` on by default + = note: `#[warn(unsupported_calling_conventions)]` (part of `#[warn(future_incompatible)]`) on by default warning: "cdecl" is not a supported ABI for the current target --> $DIR/unsupported.rs:104:1 diff --git a/tests/ui/abi/unsupported.x64.stderr b/tests/ui/abi/unsupported.x64.stderr index cf04680b587..3bf19f9f19d 100644 --- a/tests/ui/abi/unsupported.x64.stderr +++ b/tests/ui/abi/unsupported.x64.stderr @@ -141,7 +141,7 @@ LL | fn cdecl_ptr(f: extern "cdecl" 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 #137018 <https://github.com/rust-lang/rust/issues/137018> = help: use `extern "C"` instead - = note: `#[warn(unsupported_calling_conventions)]` on by default + = note: `#[warn(unsupported_calling_conventions)]` (part of `#[warn(future_incompatible)]`) on by default warning: "cdecl" is not a supported ABI for the current target --> $DIR/unsupported.rs:104:1 diff --git a/tests/ui/abi/unsupported.x64_win.stderr b/tests/ui/abi/unsupported.x64_win.stderr index d383a4df732..70f63a14d76 100644 --- a/tests/ui/abi/unsupported.x64_win.stderr +++ b/tests/ui/abi/unsupported.x64_win.stderr @@ -109,7 +109,7 @@ 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 #137018 <https://github.com/rust-lang/rust/issues/137018> = help: if you need `extern "stdcall"` on win32 and `extern "C"` everywhere else, use `extern "system"` - = note: `#[warn(unsupported_calling_conventions)]` on by default + = note: `#[warn(unsupported_calling_conventions)]` (part of `#[warn(future_incompatible)]`) on by default warning: "stdcall" is not a supported ABI for the current target --> $DIR/unsupported.rs:87:1 diff --git a/tests/ui/issues/issue-7784.rs b/tests/ui/array-slice-vec/fixed-length-vector-pattern-matching-7784.rs index 90b88ae5727..7d987e92b63 100644 --- a/tests/ui/issues/issue-7784.rs +++ b/tests/ui/array-slice-vec/fixed-length-vector-pattern-matching-7784.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/7784 //@ run-pass use std::ops::Add; diff --git a/tests/ui/array-slice-vec/slice-mut-2.stderr b/tests/ui/array-slice-vec/slice-mut-2.stderr index 8cc2c6e0397..228417c873d 100644 --- a/tests/ui/array-slice-vec/slice-mut-2.stderr +++ b/tests/ui/array-slice-vec/slice-mut-2.stderr @@ -4,10 +4,10 @@ error[E0596]: cannot borrow `*x` as mutable, as it is behind a `&` reference LL | let _ = &mut x[2..4]; | ^ `x` is a `&` reference, so the data it refers to cannot be borrowed as mutable | -help: consider changing this to be a mutable reference +help: consider changing this binding's type | -LL | let x: &[isize] = &mut [1, 2, 3, 4, 5]; - | +++ +LL | let x: &mut [isize] = &[1, 2, 3, 4, 5]; + | +++ error: aborting due to 1 previous error diff --git a/tests/ui/issues/issue-8498.rs b/tests/ui/array-slice-vec/vector-slice-matching-8498.rs index 92904e2198f..e243a247ed5 100644 --- a/tests/ui/issues/issue-8498.rs +++ b/tests/ui/array-slice-vec/vector-slice-matching-8498.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/8498 //@ run-pass pub fn main() { diff --git a/tests/ui/asm/naked-invalid-attr.stderr b/tests/ui/asm/naked-invalid-attr.stderr index 936a36cd92e..33bbfc885da 100644 --- a/tests/ui/asm/naked-invalid-attr.stderr +++ b/tests/ui/asm/naked-invalid-attr.stderr @@ -18,7 +18,7 @@ error: `#[naked]` attribute cannot be used on foreign functions LL | #[unsafe(naked)] | ^^^^^^^^^^^^^^^^ | - = help: `#[naked]` can be applied to methods, functions + = help: `#[naked]` can be applied to methods and functions error: `#[naked]` attribute cannot be used on structs --> $DIR/naked-invalid-attr.rs:13:1 @@ -42,7 +42,7 @@ error: `#[naked]` attribute cannot be used on required trait methods LL | #[unsafe(naked)] | ^^^^^^^^^^^^^^^^ | - = help: `#[naked]` can be applied to functions, inherent methods, provided trait methods, trait methods in impl blocks + = help: `#[naked]` can be applied to functions, inherent methods, provided trait methods, and trait methods in impl blocks error: `#[naked]` attribute cannot be used on closures --> $DIR/naked-invalid-attr.rs:51:5 @@ -50,7 +50,7 @@ error: `#[naked]` attribute cannot be used on closures LL | #[unsafe(naked)] | ^^^^^^^^^^^^^^^^ | - = help: `#[naked]` can be applied to methods, functions + = help: `#[naked]` can be applied to methods and functions error[E0736]: attribute incompatible with `#[unsafe(naked)]` --> $DIR/naked-invalid-attr.rs:56:3 diff --git a/tests/ui/issues/issue-78622.rs b/tests/ui/associated-consts/ambiguous-associated-type-error-78622.rs index c00fd266063..9763be1ecb2 100644 --- a/tests/ui/issues/issue-78622.rs +++ b/tests/ui/associated-consts/ambiguous-associated-type-error-78622.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/78622 #![crate_type = "lib"] struct S; diff --git a/tests/ui/issues/issue-78622.stderr b/tests/ui/associated-consts/ambiguous-associated-type-error-78622.stderr index 432913a0fc9..4dff1364af7 100644 --- a/tests/ui/issues/issue-78622.stderr +++ b/tests/ui/associated-consts/ambiguous-associated-type-error-78622.stderr @@ -1,5 +1,5 @@ error[E0223]: ambiguous associated type - --> $DIR/issue-78622.rs:5:5 + --> $DIR/ambiguous-associated-type-error-78622.rs:6:5 | LL | S::A::<f> {} | ^^^^ diff --git a/tests/ui/associated-consts/associated-const-type-parameters.stderr b/tests/ui/associated-consts/associated-const-type-parameters.stderr index 6ee2a5de1b6..c94cffd69c1 100644 --- a/tests/ui/associated-consts/associated-const-type-parameters.stderr +++ b/tests/ui/associated-consts/associated-const-type-parameters.stderr @@ -4,7 +4,7 @@ warning: trait `Bar` is never used LL | trait Bar: Foo { | ^^^ | - = note: `#[warn(dead_code)]` on by default + = note: `#[warn(dead_code)]` (part of `#[warn(unused)]`) on by default warning: 1 warning emitted diff --git a/tests/ui/associated-consts/issue-105330.stderr b/tests/ui/associated-consts/issue-105330.stderr index 72527193555..5d6dc48e36c 100644 --- a/tests/ui/associated-consts/issue-105330.stderr +++ b/tests/ui/associated-consts/issue-105330.stderr @@ -53,8 +53,13 @@ error[E0277]: the trait bound `Demo: TraitWAssocConst` is not satisfied --> $DIR/issue-105330.rs:12:11 | LL | foo::<Demo>()(); - | ^^^^ the trait `TraitWAssocConst` is not implemented for `Demo` + | ^^^^ unsatisfied trait bound | +help: the trait `TraitWAssocConst` is not implemented for `Demo` + --> $DIR/issue-105330.rs:4:1 + | +LL | pub struct Demo {} + | ^^^^^^^^^^^^^^^ note: required by a bound in `foo` --> $DIR/issue-105330.rs:11:11 | @@ -75,8 +80,13 @@ error[E0277]: the trait bound `Demo: TraitWAssocConst` is not satisfied --> $DIR/issue-105330.rs:20:11 | LL | foo::<Demo>(); - | ^^^^ the trait `TraitWAssocConst` is not implemented for `Demo` + | ^^^^ unsatisfied trait bound + | +help: the trait `TraitWAssocConst` is not implemented for `Demo` + --> $DIR/issue-105330.rs:4:1 | +LL | pub struct Demo {} + | ^^^^^^^^^^^^^^^ note: required by a bound in `foo` --> $DIR/issue-105330.rs:11:11 | diff --git a/tests/ui/associated-inherent-types/issue-111404-1.stderr b/tests/ui/associated-inherent-types/issue-111404-1.stderr index ce49126c316..9a5b69497c0 100644 --- a/tests/ui/associated-inherent-types/issue-111404-1.stderr +++ b/tests/ui/associated-inherent-types/issue-111404-1.stderr @@ -32,12 +32,10 @@ LL | fn bar(_: fn(Foo<for<'b> fn(Foo<fn(&'b ())>::Assoc)>::Assoc)) {} = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error: higher-ranked subtype error - --> $DIR/issue-111404-1.rs:10:1 + --> $DIR/issue-111404-1.rs:10:8 | 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 diff --git a/tests/ui/associated-type-bounds/rpit.stderr b/tests/ui/associated-type-bounds/rpit.stderr index 1091a4c573b..4c959456932 100644 --- a/tests/ui/associated-type-bounds/rpit.stderr +++ b/tests/ui/associated-type-bounds/rpit.stderr @@ -6,7 +6,7 @@ LL | trait Tr2<'a> { fn tr2(self) -> &'a Self; } | | | method in this trait | - = note: `#[warn(dead_code)]` on by default + = note: `#[warn(dead_code)]` (part of `#[warn(unused)]`) on by default warning: 1 warning emitted diff --git a/tests/ui/associated-types/associated-types-issue-20220.stderr b/tests/ui/associated-types/associated-types-issue-20220.stderr index c682f46e140..572889bbe74 100644 --- a/tests/ui/associated-types/associated-types-issue-20220.stderr +++ b/tests/ui/associated-types/associated-types-issue-20220.stderr @@ -4,7 +4,7 @@ warning: trait `IntoIteratorX` is never used LL | trait IntoIteratorX { | ^^^^^^^^^^^^^ | - = note: `#[warn(dead_code)]` on by default + = note: `#[warn(dead_code)]` (part of `#[warn(unused)]`) on by default warning: 1 warning emitted diff --git a/tests/ui/associated-types/associated-types-nested-projections.stderr b/tests/ui/associated-types/associated-types-nested-projections.stderr index 1b69fcfacf5..e360d337639 100644 --- a/tests/ui/associated-types/associated-types-nested-projections.stderr +++ b/tests/ui/associated-types/associated-types-nested-projections.stderr @@ -7,7 +7,7 @@ LL | trait IntoIterator { LL | fn into_iter(self) -> Self::Iter; | ^^^^^^^^^ | - = note: `#[warn(dead_code)]` on by default + = note: `#[warn(dead_code)]` (part of `#[warn(unused)]`) on by default warning: 1 warning emitted diff --git a/tests/ui/associated-types/associated-types-projection-from-known-type-in-impl.stderr b/tests/ui/associated-types/associated-types-projection-from-known-type-in-impl.stderr index c26ed79a026..ddfe9eb6967 100644 --- a/tests/ui/associated-types/associated-types-projection-from-known-type-in-impl.stderr +++ b/tests/ui/associated-types/associated-types-projection-from-known-type-in-impl.stderr @@ -7,7 +7,7 @@ LL | trait Int LL | fn dummy(&self) { } | ^^^^^ | - = note: `#[warn(dead_code)]` on by default + = note: `#[warn(dead_code)]` (part of `#[warn(unused)]`) on by default warning: 1 warning emitted diff --git a/tests/ui/associated-types/defaults-suitability.current.stderr b/tests/ui/associated-types/defaults-suitability.current.stderr index 5e19674250f..0018181f480 100644 --- a/tests/ui/associated-types/defaults-suitability.current.stderr +++ b/tests/ui/associated-types/defaults-suitability.current.stderr @@ -73,8 +73,13 @@ error[E0277]: the trait bound `NotClone: IsU8<NotClone>` is not satisfied --> $DIR/defaults-suitability.rs:59:18 | LL | type Assoc = NotClone; - | ^^^^^^^^ the trait `IsU8<NotClone>` is not implemented for `NotClone` + | ^^^^^^^^ unsatisfied trait bound | +help: the trait `IsU8<NotClone>` is not implemented for `NotClone` + --> $DIR/defaults-suitability.rs:12:1 + | +LL | struct NotClone; + | ^^^^^^^^^^^^^^^ note: required by a bound in `D::Assoc` --> $DIR/defaults-suitability.rs:56:18 | diff --git a/tests/ui/associated-types/defaults-suitability.next.stderr b/tests/ui/associated-types/defaults-suitability.next.stderr index 5e19674250f..0018181f480 100644 --- a/tests/ui/associated-types/defaults-suitability.next.stderr +++ b/tests/ui/associated-types/defaults-suitability.next.stderr @@ -73,8 +73,13 @@ error[E0277]: the trait bound `NotClone: IsU8<NotClone>` is not satisfied --> $DIR/defaults-suitability.rs:59:18 | LL | type Assoc = NotClone; - | ^^^^^^^^ the trait `IsU8<NotClone>` is not implemented for `NotClone` + | ^^^^^^^^ unsatisfied trait bound | +help: the trait `IsU8<NotClone>` is not implemented for `NotClone` + --> $DIR/defaults-suitability.rs:12:1 + | +LL | struct NotClone; + | ^^^^^^^^^^^^^^^ note: required by a bound in `D::Assoc` --> $DIR/defaults-suitability.rs:56:18 | diff --git a/tests/ui/associated-types/issue-64855.stderr b/tests/ui/associated-types/issue-64855.stderr index d8ba1a9d07e..4358ab47365 100644 --- a/tests/ui/associated-types/issue-64855.stderr +++ b/tests/ui/associated-types/issue-64855.stderr @@ -2,8 +2,13 @@ error[E0277]: the trait bound `Bar<T>: Foo` is not satisfied --> $DIR/issue-64855.rs:9:19 | LL | pub struct Bar<T>(<Self as Foo>::Type) where Self: ; - | ^^^^^^^^^^^^^^^^^^^ the trait `Foo` is not implemented for `Bar<T>` + | ^^^^^^^^^^^^^^^^^^^ unsatisfied trait bound | +help: the trait `Foo` is not implemented for `Bar<T>` + --> $DIR/issue-64855.rs:9:1 + | +LL | pub struct Bar<T>(<Self as Foo>::Type) where Self: ; + | ^^^^^^^^^^^^^^^^^ help: this trait has no implementations, consider adding one --> $DIR/issue-64855.rs:5:1 | diff --git a/tests/ui/associated-types/issue-65774-1.stderr b/tests/ui/associated-types/issue-65774-1.stderr index 9c77a25c432..3c8da092158 100644 --- a/tests/ui/associated-types/issue-65774-1.stderr +++ b/tests/ui/associated-types/issue-65774-1.stderr @@ -2,8 +2,13 @@ error[E0277]: the trait bound `T: MyDisplay` is not satisfied --> $DIR/issue-65774-1.rs:10:33 | LL | type MpuConfig: MyDisplay = T; - | ^ the trait `MyDisplay` is not implemented for `T` + | ^ unsatisfied trait bound | +help: the trait `MyDisplay` is not implemented for `T` + --> $DIR/issue-65774-1.rs:7:1 + | +LL | struct T; + | ^^^^^^^^ = help: the trait `MyDisplay` is implemented for `&'a mut T` note: required by a bound in `MPU::MpuConfig` --> $DIR/issue-65774-1.rs:10:21 @@ -15,8 +20,13 @@ error[E0277]: the trait bound `T: MyDisplay` is not satisfied --> $DIR/issue-65774-1.rs:44:76 | LL | let closure = |config: &mut <S as MPU>::MpuConfig| writer.my_write(&config); - | ^^^^^^^ the trait `MyDisplay` is not implemented for `T` + | ^^^^^^^ unsatisfied trait bound + | +help: the trait `MyDisplay` is not implemented for `T` + --> $DIR/issue-65774-1.rs:7:1 | +LL | struct T; + | ^^^^^^^^ = help: the trait `MyDisplay` is implemented for `&'a mut T` note: required for `&mut T` to implement `MyDisplay` --> $DIR/issue-65774-1.rs:5:24 diff --git a/tests/ui/associated-types/issue-65774-2.stderr b/tests/ui/associated-types/issue-65774-2.stderr index ca8a727f0fe..82210b84992 100644 --- a/tests/ui/associated-types/issue-65774-2.stderr +++ b/tests/ui/associated-types/issue-65774-2.stderr @@ -2,8 +2,13 @@ error[E0277]: the trait bound `T: MyDisplay` is not satisfied --> $DIR/issue-65774-2.rs:10:33 | LL | type MpuConfig: MyDisplay = T; - | ^ the trait `MyDisplay` is not implemented for `T` + | ^ unsatisfied trait bound | +help: the trait `MyDisplay` is not implemented for `T` + --> $DIR/issue-65774-2.rs:7:1 + | +LL | struct T; + | ^^^^^^^^ = help: the trait `MyDisplay` is implemented for `&'a mut T` note: required by a bound in `MPU::MpuConfig` --> $DIR/issue-65774-2.rs:10:21 @@ -15,8 +20,13 @@ error[E0277]: the trait bound `T: MyDisplay` is not satisfied --> $DIR/issue-65774-2.rs:39:25 | LL | writer.my_write(valref) - | ^^^^^^ the trait `MyDisplay` is not implemented for `T` + | ^^^^^^ unsatisfied trait bound + | +help: the trait `MyDisplay` is not implemented for `T` + --> $DIR/issue-65774-2.rs:7:1 | +LL | struct T; + | ^^^^^^^^ = help: the trait `MyDisplay` is implemented for `&'a mut T` = note: required for the cast from `&mut T` to `&dyn MyDisplay` diff --git a/tests/ui/async-await/async-borrowck-escaping-block-error.stderr b/tests/ui/async-await/async-borrowck-escaping-block-error.stderr index 8410e7eca57..6ea03c99aa0 100644 --- a/tests/ui/async-await/async-borrowck-escaping-block-error.stderr +++ b/tests/ui/async-await/async-borrowck-escaping-block-error.stderr @@ -6,11 +6,7 @@ LL | Box::new(async { x } ) | | | may outlive borrowed value `x` | -note: async block is returned here - --> $DIR/async-borrowck-escaping-block-error.rs:6:5 - | -LL | Box::new(async { x } ) - | ^^^^^^^^^^^^^^^^^^^^^^ + = note: async blocks are not executed immediately and must either take a reference or ownership of outside variables they use help: to force the async block to take ownership of `x` (and any other referenced variables), use the `move` keyword | LL | Box::new(async move { x } ) diff --git a/tests/ui/async-await/async-closures/type-name.rs b/tests/ui/async-await/async-closures/type-name.rs new file mode 100644 index 00000000000..12daad5a609 --- /dev/null +++ b/tests/ui/async-await/async-closures/type-name.rs @@ -0,0 +1,18 @@ +//@ run-pass +//@ edition: 2024 + +fn once<F: FnOnce() -> T, T>(f: F) -> T { + f() +} + +fn main() { + let closure = async || {}; + + // Name of future when called normally. + let name = std::any::type_name_of_val(&closure()); + assert_eq!(name, "type_name::main::{{closure}}::{{closure}}"); + + // Name of future when closure is called via its FnOnce shim. + let name = std::any::type_name_of_val(&once(closure)); + assert_eq!(name, "type_name::main::{{closure}}::{{closure}}::{{call_once}}"); +} diff --git a/tests/ui/async-await/async-fn/impl-header.stderr b/tests/ui/async-await/async-fn/impl-header.stderr index 2fc7a900a1e..d0cf0d822f2 100644 --- a/tests/ui/async-await/async-fn/impl-header.stderr +++ b/tests/ui/async-await/async-fn/impl-header.stderr @@ -36,7 +36,11 @@ error[E0277]: expected a `FnMut()` closure, found `F` LL | impl async Fn<()> for F {} | ^ expected an `FnMut()` closure, found `F` | - = help: the trait `FnMut()` is not implemented for `F` +help: the trait `FnMut()` is not implemented for `F` + --> $DIR/impl-header.rs:3:1 + | +LL | struct F; + | ^^^^^^^^ = note: wrap the `F` in a closure with no arguments: `|| { /* code */ }` note: required by a bound in `Fn` --> $SRC_DIR/core/src/ops/function.rs:LL:COL diff --git a/tests/ui/async-await/in-trait/dont-project-to-specializable-projection.stderr b/tests/ui/async-await/in-trait/dont-project-to-specializable-projection.stderr index 3d82f572a1a..823d8d5b92f 100644 --- a/tests/ui/async-await/in-trait/dont-project-to-specializable-projection.stderr +++ b/tests/ui/async-await/in-trait/dont-project-to-specializable-projection.stderr @@ -25,6 +25,7 @@ error[E0599]: no method named `poll` found for struct `Pin<&mut impl Future<Outp | LL | match fut.as_mut().poll(ctx) { | ^^^^ method not found in `Pin<&mut impl Future<Output = ()>>` + | --> $SRC_DIR/core/src/future/future.rs:LL:COL | = note: the method is available for `Pin<&mut impl Future<Output = ()>>` here diff --git a/tests/ui/async-await/issue-61076.rs b/tests/ui/async-await/issue-61076.rs index f78abfd6d0f..0a679a95970 100644 --- a/tests/ui/async-await/issue-61076.rs +++ b/tests/ui/async-await/issue-61076.rs @@ -4,7 +4,7 @@ use core::future::Future; use core::pin::Pin; use core::task::{Context, Poll}; -struct T; +struct T; //~ HELP the trait `Try` is not implemented for `T` struct Tuple(i32); @@ -61,11 +61,9 @@ async fn baz() -> Result<(), ()> { let t = T; t?; //~ ERROR the `?` operator can only be applied to values that implement `Try` //~^ NOTE the `?` operator cannot be applied to type `T` - //~| HELP the trait `Try` is not implemented for `T` //~| HELP consider `await`ing on the `Future` //~| NOTE in this expansion of desugaring of operator `?` //~| NOTE in this expansion of desugaring of operator `?` - //~| NOTE in this expansion of desugaring of operator `?` let _: i32 = tuple().0; //~ ERROR no field `0` diff --git a/tests/ui/async-await/issue-61076.stderr b/tests/ui/async-await/issue-61076.stderr index b8478c8d138..7d46abe4a66 100644 --- a/tests/ui/async-await/issue-61076.stderr +++ b/tests/ui/async-await/issue-61076.stderr @@ -16,14 +16,18 @@ error[E0277]: the `?` operator can only be applied to values that implement `Try LL | t?; | ^^ the `?` operator cannot be applied to type `T` | - = help: the trait `Try` is not implemented for `T` +help: the trait `Try` is not implemented for `T` + --> $DIR/issue-61076.rs:7:1 + | +LL | struct T; + | ^^^^^^^^ help: consider `await`ing on the `Future` | LL | t.await?; | ++++++ error[E0609]: no field `0` on type `impl Future<Output = Tuple>` - --> $DIR/issue-61076.rs:71:26 + --> $DIR/issue-61076.rs:69:26 | LL | let _: i32 = tuple().0; | ^ field not available in `impl Future`, but it is available in its `Output` @@ -34,7 +38,7 @@ LL | let _: i32 = tuple().await.0; | ++++++ error[E0609]: no field `a` on type `impl Future<Output = Struct>` - --> $DIR/issue-61076.rs:75:28 + --> $DIR/issue-61076.rs:73:28 | LL | let _: i32 = struct_().a; | ^ field not available in `impl Future`, but it is available in its `Output` @@ -45,7 +49,7 @@ LL | let _: i32 = struct_().await.a; | ++++++ error[E0599]: no method named `method` found for opaque type `impl Future<Output = Struct>` in the current scope - --> $DIR/issue-61076.rs:79:15 + --> $DIR/issue-61076.rs:77:15 | LL | struct_().method(); | ^^^^^^ method not found in `impl Future<Output = Struct>` @@ -56,7 +60,7 @@ LL | struct_().await.method(); | ++++++ error[E0308]: mismatched types - --> $DIR/issue-61076.rs:88:9 + --> $DIR/issue-61076.rs:86:9 | LL | match tuple() { | ------- this expression has type `impl Future<Output = Tuple>` diff --git a/tests/ui/async-await/issue-64130-1-sync.stderr b/tests/ui/async-await/issue-64130-1-sync.stderr index 5428d7ef71b..6bc4810daad 100644 --- a/tests/ui/async-await/issue-64130-1-sync.stderr +++ b/tests/ui/async-await/issue-64130-1-sync.stderr @@ -4,7 +4,11 @@ error: future cannot be shared between threads safely LL | is_sync(bar()); | ^^^^^ future returned by `bar` is not `Sync` | - = help: within `impl Future<Output = ()>`, the trait `Sync` is not implemented for `Foo` +help: within `impl Future<Output = ()>`, the trait `Sync` is not implemented for `Foo` + --> $DIR/issue-64130-1-sync.rs:7:1 + | +LL | struct Foo; + | ^^^^^^^^^^ note: future is not `Sync` as this value is used across an await --> $DIR/issue-64130-1-sync.rs:15:11 | diff --git a/tests/ui/async-await/issue-64130-2-send.stderr b/tests/ui/async-await/issue-64130-2-send.stderr index f05e954d2d7..99c249843b8 100644 --- a/tests/ui/async-await/issue-64130-2-send.stderr +++ b/tests/ui/async-await/issue-64130-2-send.stderr @@ -4,7 +4,11 @@ error: future cannot be sent between threads safely LL | is_send(bar()); | ^^^^^ future returned by `bar` is not `Send` | - = help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `Foo` +help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `Foo` + --> $DIR/issue-64130-2-send.rs:7:1 + | +LL | struct Foo; + | ^^^^^^^^^^ note: future is not `Send` as this value is used across an await --> $DIR/issue-64130-2-send.rs:15:11 | diff --git a/tests/ui/async-await/issue-64130-3-other.stderr b/tests/ui/async-await/issue-64130-3-other.stderr index 3ac30bdc23e..d683366ed47 100644 --- a/tests/ui/async-await/issue-64130-3-other.stderr +++ b/tests/ui/async-await/issue-64130-3-other.stderr @@ -5,8 +5,13 @@ LL | async fn bar() { | -------------- within this `impl Future<Output = ()>` ... LL | is_qux(bar()); - | ^^^^^ within `impl Future<Output = ()>`, the trait `Qux` is not implemented for `Foo` + | ^^^^^ unsatisfied trait bound | +help: within `impl Future<Output = ()>`, the trait `Qux` is not implemented for `Foo` + --> $DIR/issue-64130-3-other.rs:10:1 + | +LL | struct Foo; + | ^^^^^^^^^^ note: future does not implement `Qux` as this value is used across an await --> $DIR/issue-64130-3-other.rs:18:11 | diff --git a/tests/ui/async-await/partial-drop-partial-reinit.stderr b/tests/ui/async-await/partial-drop-partial-reinit.stderr index 042ed18984e..cef835f7aed 100644 --- a/tests/ui/async-await/partial-drop-partial-reinit.stderr +++ b/tests/ui/async-await/partial-drop-partial-reinit.stderr @@ -9,7 +9,11 @@ LL | gimme_send(foo()); LL | async fn foo() { | -------------- within this `impl Future<Output = ()>` | - = help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `NotSend` +help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `NotSend` + --> $DIR/partial-drop-partial-reinit.rs:19:1 + | +LL | struct NotSend {} + | ^^^^^^^^^^^^^^ = note: required because it appears within the type `(NotSend,)` note: required because it's used within this `async` fn body --> $DIR/partial-drop-partial-reinit.rs:27:16 diff --git a/tests/ui/async-await/recursive-async-auto-trait-overflow-only-parent-args.rs b/tests/ui/async-await/recursive-async-auto-trait-overflow-only-parent-args.rs new file mode 100644 index 00000000000..9681f66412a --- /dev/null +++ b/tests/ui/async-await/recursive-async-auto-trait-overflow-only-parent-args.rs @@ -0,0 +1,17 @@ +// Regression test for #145288. This is the same issue as #145151 +// which we fixed in #145194. However in that PR we accidentally created +// a `CoroutineWitness` which referenced all generic arguments of the +// coroutine, including upvars and the signature. + +//@ edition: 2024 +//@ check-pass + +async fn process<'a>(x: &'a u32) { + Box::pin(process(x)).await; +} + +fn require_send(_: impl Send) {} + +fn main() { + require_send(process(&1)); +} diff --git a/tests/ui/attributes/attr-on-mac-call.rs b/tests/ui/attributes/attr-on-mac-call.rs new file mode 100644 index 00000000000..a23ced123ef --- /dev/null +++ b/tests/ui/attributes/attr-on-mac-call.rs @@ -0,0 +1,73 @@ +//@ check-pass +// Regression test for https://github.com/rust-lang/rust/issues/145779 +#![warn(unused_attributes)] + +fn main() { + #[export_name = "x"] + //~^ WARN attribute cannot be used on macro calls + //~| WARN previously accepted + #[unsafe(naked)] + //~^ WARN attribute cannot be used on macro calls + //~| WARN previously accepted + #[track_caller] + //~^ WARN attribute cannot be used on macro calls + //~| WARN previously accepted + #[used] + //~^ WARN attribute cannot be used on macro calls + //~| WARN previously accepted + #[target_feature(enable = "x")] + //~^ WARN attribute cannot be used on macro calls + //~| WARN previously accepted + #[deprecated] + //~^ WARN attribute cannot be used on macro calls + //~| WARN previously accepted + #[inline] + //~^ WARN attribute cannot be used on macro calls + //~| WARN previously accepted + #[link_name = "x"] + //~^ WARN attribute cannot be used on macro calls + //~| WARN previously accepted + #[link_section = "x"] + //~^ WARN attribute cannot be used on macro calls + //~| WARN previously accepted + #[link_ordinal(42)] + //~^ WARN attribute cannot be used on macro calls + //~| WARN previously accepted + #[non_exhaustive] + //~^ WARN attribute cannot be used on macro calls + //~| WARN previously accepted + #[proc_macro] + //~^ WARN attribute cannot be used on macro calls + //~| WARN previously accepted + #[cold] + //~^ WARN attribute cannot be used on macro calls + //~| WARN previously accepted + #[no_mangle] + //~^ WARN attribute cannot be used on macro calls + //~| WARN previously accepted + #[deprecated] + //~^ WARN attribute cannot be used on macro calls + //~| WARN previously accepted + #[automatically_derived] + //~^ WARN attribute cannot be used on macro calls + //~| WARN previously accepted + #[macro_use] + //~^ WARN attribute cannot be used on macro calls + //~| WARN previously accepted + #[must_use] + //~^ WARN attribute cannot be used on macro calls + //~| WARN previously accepted + #[no_implicit_prelude] + //~^ WARN attribute cannot be used on macro calls + //~| WARN previously accepted + #[path = ""] + //~^ WARN attribute cannot be used on macro calls + //~| WARN previously accepted + #[ignore] + //~^ WARN attribute cannot be used on macro calls + //~| WARN previously accepted + #[should_panic] + //~^ WARN attribute cannot be used on macro calls + //~| WARN previously accepted + unreachable!(); +} diff --git a/tests/ui/attributes/attr-on-mac-call.stderr b/tests/ui/attributes/attr-on-mac-call.stderr new file mode 100644 index 00000000000..a08d3059168 --- /dev/null +++ b/tests/ui/attributes/attr-on-mac-call.stderr @@ -0,0 +1,205 @@ +warning: `#[export_name]` attribute cannot be used on macro calls + --> $DIR/attr-on-mac-call.rs:6:5 + | +LL | #[export_name = "x"] + | ^^^^^^^^^^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = help: `#[export_name]` can be applied to functions and statics +note: the lint level is defined here + --> $DIR/attr-on-mac-call.rs:3:9 + | +LL | #![warn(unused_attributes)] + | ^^^^^^^^^^^^^^^^^ + +warning: `#[naked]` attribute cannot be used on macro calls + --> $DIR/attr-on-mac-call.rs:9:5 + | +LL | #[unsafe(naked)] + | ^^^^^^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = help: `#[naked]` can only be applied to functions + +warning: `#[track_caller]` attribute cannot be used on macro calls + --> $DIR/attr-on-mac-call.rs:12:5 + | +LL | #[track_caller] + | ^^^^^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = help: `#[track_caller]` can only be applied to functions + +warning: `#[used]` attribute cannot be used on macro calls + --> $DIR/attr-on-mac-call.rs:15:5 + | +LL | #[used] + | ^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = help: `#[used]` can only be applied to statics + +warning: `#[target_feature]` attribute cannot be used on macro calls + --> $DIR/attr-on-mac-call.rs:18:5 + | +LL | #[target_feature(enable = "x")] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = help: `#[target_feature]` can only be applied to functions + +warning: `#[deprecated]` attribute cannot be used on macro calls + --> $DIR/attr-on-mac-call.rs:21:5 + | +LL | #[deprecated] + | ^^^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = help: `#[deprecated]` can be applied to functions, data types, modules, unions, constants, statics, macro defs, type aliases, use statements, foreign statics, struct fields, traits, associated types, associated consts, enum variants, inherent impl blocks, and crates + +warning: `#[inline]` attribute cannot be used on macro calls + --> $DIR/attr-on-mac-call.rs:24:5 + | +LL | #[inline] + | ^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = help: `#[inline]` can only be applied to functions + +warning: `#[link_name]` attribute cannot be used on macro calls + --> $DIR/attr-on-mac-call.rs:27:5 + | +LL | #[link_name = "x"] + | ^^^^^^^^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = help: `#[link_name]` can be applied to foreign functions and foreign statics + +warning: `#[link_section]` attribute cannot be used on macro calls + --> $DIR/attr-on-mac-call.rs:30:5 + | +LL | #[link_section = "x"] + | ^^^^^^^^^^^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = help: `#[link_section]` can be applied to statics and functions + +warning: `#[link_ordinal]` attribute cannot be used on macro calls + --> $DIR/attr-on-mac-call.rs:33:5 + | +LL | #[link_ordinal(42)] + | ^^^^^^^^^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = help: `#[link_ordinal]` can be applied to foreign functions and foreign statics + +warning: `#[non_exhaustive]` attribute cannot be used on macro calls + --> $DIR/attr-on-mac-call.rs:36:5 + | +LL | #[non_exhaustive] + | ^^^^^^^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = help: `#[non_exhaustive]` can be applied to data types and enum variants + +warning: `#[proc_macro]` attribute cannot be used on macro calls + --> $DIR/attr-on-mac-call.rs:39:5 + | +LL | #[proc_macro] + | ^^^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = help: `#[proc_macro]` can only be applied to functions + +warning: `#[cold]` attribute cannot be used on macro calls + --> $DIR/attr-on-mac-call.rs:42:5 + | +LL | #[cold] + | ^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = help: `#[cold]` can only be applied to functions + +warning: `#[no_mangle]` attribute cannot be used on macro calls + --> $DIR/attr-on-mac-call.rs:45:5 + | +LL | #[no_mangle] + | ^^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = help: `#[no_mangle]` can be applied to functions and statics + +warning: `#[deprecated]` attribute cannot be used on macro calls + --> $DIR/attr-on-mac-call.rs:48:5 + | +LL | #[deprecated] + | ^^^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = help: `#[deprecated]` can be applied to functions, data types, modules, unions, constants, statics, macro defs, type aliases, use statements, foreign statics, struct fields, traits, associated types, associated consts, enum variants, inherent impl blocks, and crates + +warning: `#[automatically_derived]` attribute cannot be used on macro calls + --> $DIR/attr-on-mac-call.rs:51:5 + | +LL | #[automatically_derived] + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = help: `#[automatically_derived]` can only be applied to trait impl blocks + +warning: `#[macro_use]` attribute cannot be used on macro calls + --> $DIR/attr-on-mac-call.rs:54:5 + | +LL | #[macro_use] + | ^^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = help: `#[macro_use]` can be applied to modules, extern crates, and crates + +warning: `#[must_use]` attribute cannot be used on macro calls + --> $DIR/attr-on-mac-call.rs:57:5 + | +LL | #[must_use] + | ^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = help: `#[must_use]` can be applied to functions, data types, unions, and traits + +warning: `#[no_implicit_prelude]` attribute cannot be used on macro calls + --> $DIR/attr-on-mac-call.rs:60:5 + | +LL | #[no_implicit_prelude] + | ^^^^^^^^^^^^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = help: `#[no_implicit_prelude]` can be applied to modules and crates + +warning: `#[path]` attribute cannot be used on macro calls + --> $DIR/attr-on-mac-call.rs:63:5 + | +LL | #[path = ""] + | ^^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = help: `#[path]` can only be applied to modules + +warning: `#[ignore]` attribute cannot be used on macro calls + --> $DIR/attr-on-mac-call.rs:66:5 + | +LL | #[ignore] + | ^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = help: `#[ignore]` can only be applied to functions + +warning: `#[should_panic]` attribute cannot be used on macro calls + --> $DIR/attr-on-mac-call.rs:69:5 + | +LL | #[should_panic] + | ^^^^^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = help: `#[should_panic]` can only be applied to functions + +warning: 22 warnings emitted + diff --git a/tests/ui/attributes/crate-name-empty.stderr b/tests/ui/attributes/crate-name-empty.stderr index 509a42d05f7..31d9dd0e948 100644 --- a/tests/ui/attributes/crate-name-empty.stderr +++ b/tests/ui/attributes/crate-name-empty.stderr @@ -1,8 +1,8 @@ error: crate name must not be empty - --> $DIR/crate-name-empty.rs:3:1 + --> $DIR/crate-name-empty.rs:3:17 | LL | #![crate_name = ""] - | ^^^^^^^^^^^^^^^^^^^ + | ^^ error: aborting due to 1 previous error diff --git a/tests/ui/attributes/crate-name-macro-call.rs b/tests/ui/attributes/crate-name-macro-call.rs index 1aae2e506e2..61076349cc3 100644 --- a/tests/ui/attributes/crate-name-macro-call.rs +++ b/tests/ui/attributes/crate-name-macro-call.rs @@ -1,6 +1,6 @@ // issue: rust-lang/rust#122001 // Ensure we reject macro calls inside `#![crate_name]` as their result wouldn't get honored anyway. -#![crate_name = concat!("my", "crate")] //~ ERROR malformed `crate_name` attribute input +#![crate_name = concat!("my", "crate")] //~ ERROR attribute value must be a literal fn main() {} diff --git a/tests/ui/attributes/crate-name-macro-call.stderr b/tests/ui/attributes/crate-name-macro-call.stderr index 56827aa11a4..e988b8461d7 100644 --- a/tests/ui/attributes/crate-name-macro-call.stderr +++ b/tests/ui/attributes/crate-name-macro-call.stderr @@ -1,10 +1,8 @@ -error: malformed `crate_name` attribute input - --> $DIR/crate-name-macro-call.rs:4:1 +error: attribute value must be a literal + --> $DIR/crate-name-macro-call.rs:4:17 | LL | #![crate_name = concat!("my", "crate")] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: must be of the form: `#![crate_name = "name"]` - | - = note: for more information, visit <https://doc.rust-lang.org/reference/crates-and-source-files.html#the-crate_name-attribute> + | ^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 1 previous error diff --git a/tests/ui/attributes/crate-name-mismatch.stderr b/tests/ui/attributes/crate-name-mismatch.stderr index 4021fbe7c18..6416ad2d41a 100644 --- a/tests/ui/attributes/crate-name-mismatch.stderr +++ b/tests/ui/attributes/crate-name-mismatch.stderr @@ -1,8 +1,8 @@ error: `--crate-name` and `#[crate_name]` are required to match, but `foo` != `bar` - --> $DIR/crate-name-mismatch.rs:5:1 + --> $DIR/crate-name-mismatch.rs:5:17 | LL | #![crate_name = "bar"] - | ^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^ error: aborting due to 1 previous error diff --git a/tests/ui/attributes/crate-only-as-outer.rs b/tests/ui/attributes/crate-only-as-outer.rs new file mode 100644 index 00000000000..5a7d916c90d --- /dev/null +++ b/tests/ui/attributes/crate-only-as-outer.rs @@ -0,0 +1,10 @@ +#![deny(unused)] +#[crate_name = "owo"] +//~^ ERROR: crate-level attribute should be an inner attribute: add an exclamation mark: `#![crate_name]` + +fn main() {} + +mod inner { + #![crate_name = "iwi"] + //~^ ERROR: the `#![crate_name]` attribute can only be used at the crate root +} diff --git a/tests/ui/attributes/crate-only-as-outer.stderr b/tests/ui/attributes/crate-only-as-outer.stderr new file mode 100644 index 00000000000..270f02af987 --- /dev/null +++ b/tests/ui/attributes/crate-only-as-outer.stderr @@ -0,0 +1,26 @@ +error: crate-level attribute should be an inner attribute: add an exclamation mark: `#![crate_name]` + --> $DIR/crate-only-as-outer.rs:2:1 + | +LL | #[crate_name = "owo"] + | ^^^^^^^^^^^^^^^^^^^^^ + | +note: This attribute does not have an `!`, which means it is applied to this function + --> $DIR/crate-only-as-outer.rs:5:1 + | +LL | fn main() {} + | ^^^^^^^^^^^^ +note: the lint level is defined here + --> $DIR/crate-only-as-outer.rs:1:9 + | +LL | #![deny(unused)] + | ^^^^^^ + = note: `#[deny(unused_attributes)]` implied by `#[deny(unused)]` + +error: the `#![crate_name]` attribute can only be used at the crate root + --> $DIR/crate-only-as-outer.rs:8:5 + | +LL | #![crate_name = "iwi"] + | ^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to 2 previous errors + diff --git a/tests/ui/issues/issue-78957.rs b/tests/ui/attributes/invalid-attributes-on-const-params-78957.rs index 2ff92612e18..106b9ae2690 100644 --- a/tests/ui/issues/issue-78957.rs +++ b/tests/ui/attributes/invalid-attributes-on-const-params-78957.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/78957 #![deny(unused_attributes)] use std::marker::PhantomData; diff --git a/tests/ui/issues/issue-78957.stderr b/tests/ui/attributes/invalid-attributes-on-const-params-78957.stderr index d271b1840fb..f8010b4ea68 100644 --- a/tests/ui/issues/issue-78957.stderr +++ b/tests/ui/attributes/invalid-attributes-on-const-params-78957.stderr @@ -1,5 +1,5 @@ error: `#[inline]` attribute cannot be used on function params - --> $DIR/issue-78957.rs:5:16 + --> $DIR/invalid-attributes-on-const-params-78957.rs:6:16 | LL | pub struct Foo<#[inline] const N: usize>; | ^^^^^^^^^ @@ -7,7 +7,7 @@ LL | pub struct Foo<#[inline] const N: usize>; = help: `#[inline]` can only be applied to functions error: `#[inline]` attribute cannot be used on function params - --> $DIR/issue-78957.rs:13:17 + --> $DIR/invalid-attributes-on-const-params-78957.rs:14:17 | LL | pub struct Foo2<#[inline] 'a>(PhantomData<&'a ()>); | ^^^^^^^^^ @@ -15,7 +15,7 @@ LL | pub struct Foo2<#[inline] 'a>(PhantomData<&'a ()>); = help: `#[inline]` can only be applied to functions error: `#[inline]` attribute cannot be used on function params - --> $DIR/issue-78957.rs:21:17 + --> $DIR/invalid-attributes-on-const-params-78957.rs:22:17 | LL | pub struct Foo3<#[inline] T>(PhantomData<T>); | ^^^^^^^^^ @@ -23,25 +23,25 @@ LL | pub struct Foo3<#[inline] T>(PhantomData<T>); = help: `#[inline]` can only be applied to functions error[E0517]: attribute should be applied to a struct, enum, or union - --> $DIR/issue-78957.rs:10:23 + --> $DIR/invalid-attributes-on-const-params-78957.rs:11:23 | LL | pub struct Baz<#[repr(C)] const N: usize>; | ^ -------------- not a struct, enum, or union error[E0517]: attribute should be applied to a struct, enum, or union - --> $DIR/issue-78957.rs:18:24 + --> $DIR/invalid-attributes-on-const-params-78957.rs:19:24 | LL | pub struct Baz2<#[repr(C)] 'a>(PhantomData<&'a ()>); | ^ -- not a struct, enum, or union error[E0517]: attribute should be applied to a struct, enum, or union - --> $DIR/issue-78957.rs:26:24 + --> $DIR/invalid-attributes-on-const-params-78957.rs:27:24 | LL | pub struct Baz3<#[repr(C)] T>(PhantomData<T>); | ^ - not a struct, enum, or union error: `#[cold]` attribute cannot be used on function params - --> $DIR/issue-78957.rs:7:16 + --> $DIR/invalid-attributes-on-const-params-78957.rs:8:16 | LL | pub struct Bar<#[cold] const N: usize>; | ^^^^^^^ @@ -49,13 +49,13 @@ LL | pub struct Bar<#[cold] const N: usize>; = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = help: `#[cold]` can only be applied to functions note: the lint level is defined here - --> $DIR/issue-78957.rs:1:9 + --> $DIR/invalid-attributes-on-const-params-78957.rs:2:9 | LL | #![deny(unused_attributes)] | ^^^^^^^^^^^^^^^^^ error: `#[cold]` attribute cannot be used on function params - --> $DIR/issue-78957.rs:15:17 + --> $DIR/invalid-attributes-on-const-params-78957.rs:16:17 | LL | pub struct Bar2<#[cold] 'a>(PhantomData<&'a ()>); | ^^^^^^^ @@ -64,7 +64,7 @@ LL | pub struct Bar2<#[cold] 'a>(PhantomData<&'a ()>); = help: `#[cold]` can only be applied to functions error: `#[cold]` attribute cannot be used on function params - --> $DIR/issue-78957.rs:23:17 + --> $DIR/invalid-attributes-on-const-params-78957.rs:24:17 | LL | pub struct Bar3<#[cold] T>(PhantomData<T>); | ^^^^^^^ diff --git a/tests/ui/attributes/key-value-expansion-scope.stderr b/tests/ui/attributes/key-value-expansion-scope.stderr index 29b48ca4ce6..71a83d80617 100644 --- a/tests/ui/attributes/key-value-expansion-scope.stderr +++ b/tests/ui/attributes/key-value-expansion-scope.stderr @@ -135,7 +135,7 @@ LL | #![doc = in_root!()] = 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 #124535 <https://github.com/rust-lang/rust/issues/124535> = help: import `macro_rules` with `use` to make it callable above its definition - = note: `#[deny(out_of_scope_macro_calls)]` on by default + = note: `#[deny(out_of_scope_macro_calls)]` (part of `#[deny(future_incompatible)]`) on by default error: cannot find macro `in_mod_escape` in the current scope when looking from the crate root --> $DIR/key-value-expansion-scope.rs:4:10 @@ -199,7 +199,7 @@ LL | #![doc = in_root!()] = 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 #124535 <https://github.com/rust-lang/rust/issues/124535> = help: import `macro_rules` with `use` to make it callable above its definition - = note: `#[deny(out_of_scope_macro_calls)]` on by default + = note: `#[deny(out_of_scope_macro_calls)]` (part of `#[deny(future_incompatible)]`) on by default Future breakage diagnostic: error: cannot find macro `in_mod_escape` in the current scope when looking from the crate root @@ -211,7 +211,7 @@ LL | #![doc = in_mod_escape!()] = 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 #124535 <https://github.com/rust-lang/rust/issues/124535> = help: import `macro_rules` with `use` to make it callable above its definition - = note: `#[deny(out_of_scope_macro_calls)]` on by default + = note: `#[deny(out_of_scope_macro_calls)]` (part of `#[deny(future_incompatible)]`) on by default Future breakage diagnostic: error: cannot find macro `in_mod` in the current scope when looking from module `macros_stay` @@ -223,7 +223,7 @@ LL | #[doc = in_mod!()] = 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 #124535 <https://github.com/rust-lang/rust/issues/124535> = help: import `macro_rules` with `use` to make it callable above its definition - = note: `#[deny(out_of_scope_macro_calls)]` on by default + = note: `#[deny(out_of_scope_macro_calls)]` (part of `#[deny(future_incompatible)]`) on by default Future breakage diagnostic: error: cannot find macro `in_mod` in the current scope when looking from module `macros_stay` @@ -235,7 +235,7 @@ LL | #![doc = in_mod!()] = 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 #124535 <https://github.com/rust-lang/rust/issues/124535> = help: import `macro_rules` with `use` to make it callable above its definition - = note: `#[deny(out_of_scope_macro_calls)]` on by default + = note: `#[deny(out_of_scope_macro_calls)]` (part of `#[deny(future_incompatible)]`) on by default Future breakage diagnostic: error: cannot find macro `in_mod_escape` in the current scope when looking from module `macros_escape` @@ -247,7 +247,7 @@ LL | #[doc = in_mod_escape!()] = 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 #124535 <https://github.com/rust-lang/rust/issues/124535> = help: import `macro_rules` with `use` to make it callable above its definition - = note: `#[deny(out_of_scope_macro_calls)]` on by default + = note: `#[deny(out_of_scope_macro_calls)]` (part of `#[deny(future_incompatible)]`) on by default Future breakage diagnostic: error: cannot find macro `in_mod_escape` in the current scope when looking from module `macros_escape` @@ -259,5 +259,5 @@ LL | #![doc = in_mod_escape!()] = 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 #124535 <https://github.com/rust-lang/rust/issues/124535> = help: import `macro_rules` with `use` to make it callable above its definition - = note: `#[deny(out_of_scope_macro_calls)]` on by default + = note: `#[deny(out_of_scope_macro_calls)]` (part of `#[deny(future_incompatible)]`) on by default diff --git a/tests/ui/attributes/key-value-expansion.stderr b/tests/ui/attributes/key-value-expansion.stderr index 54d79c5bebb..d785bf97819 100644 --- a/tests/ui/attributes/key-value-expansion.stderr +++ b/tests/ui/attributes/key-value-expansion.stderr @@ -1,10 +1,4 @@ error: attribute value must be a literal - --> $DIR/key-value-expansion.rs:21:6 - | -LL | bug!((column!())); - | ^^^^^^^^^^^ - -error: attribute value must be a literal --> $DIR/key-value-expansion.rs:27:14 | LL | bug!("bug" + stringify!(found)); @@ -26,5 +20,11 @@ LL | some_macro!(u8); | = note: this error originates in the macro `some_macro` (in Nightly builds, run with -Z macro-backtrace for more info) +error: attribute value must be a literal + --> $DIR/key-value-expansion.rs:21:6 + | +LL | bug!((column!())); + | ^^^^^^^^^^^ + error: aborting due to 3 previous errors diff --git a/tests/ui/attributes/linkage.stderr b/tests/ui/attributes/linkage.stderr index 2e7ff0e7936..d2aee384058 100644 --- a/tests/ui/attributes/linkage.stderr +++ b/tests/ui/attributes/linkage.stderr @@ -4,7 +4,7 @@ error: `#[linkage]` attribute cannot be used on type aliases LL | #[linkage = "weak"] | ^^^^^^^^^^^^^^^^^^^ | - = help: `#[linkage]` can be applied to functions, statics, foreign statics + = help: `#[linkage]` can be applied to functions, statics, and foreign statics error: `#[linkage]` attribute cannot be used on modules --> $DIR/linkage.rs:9:1 @@ -12,7 +12,7 @@ error: `#[linkage]` attribute cannot be used on modules LL | #[linkage = "weak"] | ^^^^^^^^^^^^^^^^^^^ | - = help: `#[linkage]` can be applied to functions, statics, foreign statics + = help: `#[linkage]` can be applied to functions, statics, and foreign statics error: `#[linkage]` attribute cannot be used on structs --> $DIR/linkage.rs:12:1 @@ -20,7 +20,7 @@ error: `#[linkage]` attribute cannot be used on structs LL | #[linkage = "weak"] | ^^^^^^^^^^^^^^^^^^^ | - = help: `#[linkage]` can be applied to functions, statics, foreign statics + = help: `#[linkage]` can be applied to functions, statics, and foreign statics error: `#[linkage]` attribute cannot be used on inherent impl blocks --> $DIR/linkage.rs:15:1 @@ -28,7 +28,7 @@ error: `#[linkage]` attribute cannot be used on inherent impl blocks LL | #[linkage = "weak"] | ^^^^^^^^^^^^^^^^^^^ | - = help: `#[linkage]` can be applied to functions, statics, foreign statics + = help: `#[linkage]` can be applied to functions, statics, and foreign statics error: `#[linkage]` attribute cannot be used on expressions --> $DIR/linkage.rs:23:5 @@ -36,7 +36,7 @@ error: `#[linkage]` attribute cannot be used on expressions LL | #[linkage = "weak"] | ^^^^^^^^^^^^^^^^^^^ | - = help: `#[linkage]` can be applied to functions, statics, foreign statics + = help: `#[linkage]` can be applied to functions, statics, and foreign statics error: `#[linkage]` attribute cannot be used on closures --> $DIR/linkage.rs:39:13 @@ -44,7 +44,7 @@ error: `#[linkage]` attribute cannot be used on closures LL | let _ = #[linkage = "weak"] | ^^^^^^^^^^^^^^^^^^^ | - = help: `#[linkage]` can be applied to methods, functions, statics, foreign statics, foreign functions + = help: `#[linkage]` can be applied to methods, functions, statics, foreign statics, and foreign functions error: aborting due to 6 previous errors diff --git a/tests/ui/attributes/lint_on_root.rs b/tests/ui/attributes/lint_on_root.rs index bafdb46883f..6cec7508560 100644 --- a/tests/ui/attributes/lint_on_root.rs +++ b/tests/ui/attributes/lint_on_root.rs @@ -1,7 +1,7 @@ // NOTE: this used to panic in debug builds (by a sanity assertion) // and not emit any lint on release builds. See https://github.com/rust-lang/rust/issues/142891. #![inline = ""] -//~^ ERROR: valid forms for the attribute are `#[inline(always)]`, `#[inline(never)]`, and `#[inline]` [ill_formed_attribute_input] +//~^ ERROR: valid forms for the attribute are `#![inline(always)]`, `#![inline(never)]`, and `#![inline]` [ill_formed_attribute_input] //~| WARN this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! //~| ERROR attribute cannot be used on diff --git a/tests/ui/attributes/lint_on_root.stderr b/tests/ui/attributes/lint_on_root.stderr index 9d8d1495c1b..46b0b613a2f 100644 --- a/tests/ui/attributes/lint_on_root.stderr +++ b/tests/ui/attributes/lint_on_root.stderr @@ -6,7 +6,7 @@ LL | #![inline = ""] | = help: `#[inline]` can only be applied to functions -error: valid forms for the attribute are `#[inline(always)]`, `#[inline(never)]`, and `#[inline]` +error: valid forms for the attribute are `#![inline(always)]`, `#![inline(never)]`, and `#![inline]` --> $DIR/lint_on_root.rs:3:1 | LL | #![inline = ""] @@ -14,12 +14,12 @@ LL | #![inline = ""] | = 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 #57571 <https://github.com/rust-lang/rust/issues/57571> - = note: `#[deny(ill_formed_attribute_input)]` on by default + = note: `#[deny(ill_formed_attribute_input)]` (part of `#[deny(future_incompatible)]`) on by default error: aborting due to 2 previous errors Future incompatibility report: Future breakage diagnostic: -error: valid forms for the attribute are `#[inline(always)]`, `#[inline(never)]`, and `#[inline]` +error: valid forms for the attribute are `#![inline(always)]`, `#![inline(never)]`, and `#![inline]` --> $DIR/lint_on_root.rs:3:1 | LL | #![inline = ""] @@ -27,5 +27,5 @@ LL | #![inline = ""] | = 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 #57571 <https://github.com/rust-lang/rust/issues/57571> - = note: `#[deny(ill_formed_attribute_input)]` on by default + = note: `#[deny(ill_formed_attribute_input)]` (part of `#[deny(future_incompatible)]`) on by default diff --git a/tests/ui/attributes/malformed-attrs.rs b/tests/ui/attributes/malformed-attrs.rs index 3293f75fba9..932aaf7a9e2 100644 --- a/tests/ui/attributes/malformed-attrs.rs +++ b/tests/ui/attributes/malformed-attrs.rs @@ -12,7 +12,7 @@ #![feature(min_generic_const_args)] #![feature(ffi_const, ffi_pure)] #![feature(coverage_attribute)] -#![feature(no_sanitize)] +#![feature(sanitize)] #![feature(marker_trait_attr)] #![feature(thread_local)] #![feature(must_not_suspend)] @@ -81,15 +81,14 @@ #[export_stable = 1] //~^ ERROR malformed #[link] -//~^ ERROR valid forms for the attribute are -//~| WARN this was previously accepted by the compiler +//~^ ERROR malformed #[link_name] //~^ ERROR malformed #[link_section] //~^ ERROR malformed #[coverage] //~^ ERROR malformed `coverage` attribute input -#[no_sanitize] +#[sanitize] //~^ ERROR malformed #[ignore()] //~^ ERROR valid forms for the attribute are diff --git a/tests/ui/attributes/malformed-attrs.stderr b/tests/ui/attributes/malformed-attrs.stderr index 9c31765149b..b85864b401e 100644 --- a/tests/ui/attributes/malformed-attrs.stderr +++ b/tests/ui/attributes/malformed-attrs.stderr @@ -1,5 +1,5 @@ error[E0539]: malformed `cfg` attribute input - --> $DIR/malformed-attrs.rs:102:1 + --> $DIR/malformed-attrs.rs:101:1 | LL | #[cfg] | ^^^^^^ @@ -10,7 +10,7 @@ LL | #[cfg] = note: for more information, visit <https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg-attribute> error: malformed `cfg_attr` attribute input - --> $DIR/malformed-attrs.rs:104:1 + --> $DIR/malformed-attrs.rs:103:1 | LL | #[cfg_attr] | ^^^^^^^^^^^ @@ -22,7 +22,7 @@ LL | #[cfg_attr(condition, attribute, other_attribute, ...)] | ++++++++++++++++++++++++++++++++++++++++++++ error[E0463]: can't find crate for `wloop` - --> $DIR/malformed-attrs.rs:211:1 + --> $DIR/malformed-attrs.rs:210:1 | LL | extern crate wloop; | ^^^^^^^^^^^^^^^^^^^ can't find crate @@ -41,22 +41,8 @@ LL | #![windows_subsystem = "console"] LL | #![windows_subsystem = "windows"] | +++++++++++ -error: malformed `crate_name` attribute input - --> $DIR/malformed-attrs.rs:74:1 - | -LL | #[crate_name] - | ^^^^^^^^^^^^^ help: must be of the form: `#[crate_name = "name"]` - | - = note: for more information, visit <https://doc.rust-lang.org/reference/crates-and-source-files.html#the-crate_name-attribute> - -error: malformed `no_sanitize` attribute input - --> $DIR/malformed-attrs.rs:92:1 - | -LL | #[no_sanitize] - | ^^^^^^^^^^^^^^ help: must be of the form: `#[no_sanitize(address, kcfi, memory, thread)]` - error: malformed `instruction_set` attribute input - --> $DIR/malformed-attrs.rs:106:1 + --> $DIR/malformed-attrs.rs:105:1 | LL | #[instruction_set] | ^^^^^^^^^^^^^^^^^^ help: must be of the form: `#[instruction_set(set)]` @@ -64,13 +50,13 @@ LL | #[instruction_set] = note: for more information, visit <https://doc.rust-lang.org/reference/attributes/codegen.html#the-instruction_set-attribute> error: malformed `patchable_function_entry` attribute input - --> $DIR/malformed-attrs.rs:108:1 + --> $DIR/malformed-attrs.rs:107:1 | LL | #[patchable_function_entry] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: must be of the form: `#[patchable_function_entry(prefix_nops = m, entry_nops = n)]` error: malformed `must_not_suspend` attribute input - --> $DIR/malformed-attrs.rs:132:1 + --> $DIR/malformed-attrs.rs:131:1 | LL | #[must_not_suspend()] | ^^^^^^^^^^^^^^^^^^^^^ @@ -85,13 +71,13 @@ LL + #[must_not_suspend] | error: malformed `cfi_encoding` attribute input - --> $DIR/malformed-attrs.rs:134:1 + --> $DIR/malformed-attrs.rs:133:1 | LL | #[cfi_encoding] | ^^^^^^^^^^^^^^^ help: must be of the form: `#[cfi_encoding = "encoding"]` error: malformed `allow` attribute input - --> $DIR/malformed-attrs.rs:178:1 + --> $DIR/malformed-attrs.rs:177:1 | LL | #[allow] | ^^^^^^^^ @@ -107,7 +93,7 @@ LL | #[allow(lint1, lint2, lint3, reason = "...")] | +++++++++++++++++++++++++++++++++++++ error: malformed `expect` attribute input - --> $DIR/malformed-attrs.rs:180:1 + --> $DIR/malformed-attrs.rs:179:1 | LL | #[expect] | ^^^^^^^^^ @@ -123,7 +109,7 @@ LL | #[expect(lint1, lint2, lint3, reason = "...")] | +++++++++++++++++++++++++++++++++++++ error: malformed `warn` attribute input - --> $DIR/malformed-attrs.rs:182:1 + --> $DIR/malformed-attrs.rs:181:1 | LL | #[warn] | ^^^^^^^ @@ -139,7 +125,7 @@ LL | #[warn(lint1, lint2, lint3, reason = "...")] | +++++++++++++++++++++++++++++++++++++ error: malformed `deny` attribute input - --> $DIR/malformed-attrs.rs:184:1 + --> $DIR/malformed-attrs.rs:183:1 | LL | #[deny] | ^^^^^^^ @@ -155,7 +141,7 @@ LL | #[deny(lint1, lint2, lint3, reason = "...")] | +++++++++++++++++++++++++++++++++++++ error: malformed `forbid` attribute input - --> $DIR/malformed-attrs.rs:186:1 + --> $DIR/malformed-attrs.rs:185:1 | LL | #[forbid] | ^^^^^^^^^ @@ -171,7 +157,7 @@ LL | #[forbid(lint1, lint2, lint3, reason = "...")] | +++++++++++++++++++++++++++++++++++++ error: malformed `debugger_visualizer` attribute input - --> $DIR/malformed-attrs.rs:188:1 + --> $DIR/malformed-attrs.rs:187:1 | LL | #[debugger_visualizer] | ^^^^^^^^^^^^^^^^^^^^^^ help: must be of the form: `#[debugger_visualizer(natvis_file = "...", gdb_script_file = "...")]` @@ -179,13 +165,13 @@ LL | #[debugger_visualizer] = note: for more information, visit <https://doc.rust-lang.org/reference/attributes/debugger.html#the-debugger_visualizer-attribute> error: malformed `thread_local` attribute input - --> $DIR/malformed-attrs.rs:203:1 + --> $DIR/malformed-attrs.rs:202:1 | LL | #[thread_local()] | ^^^^^^^^^^^^^^^^^ help: must be of the form: `#[thread_local]` error: malformed `no_link` attribute input - --> $DIR/malformed-attrs.rs:207:1 + --> $DIR/malformed-attrs.rs:206:1 | LL | #[no_link()] | ^^^^^^^^^^^^ help: must be of the form: `#[no_link]` @@ -193,7 +179,7 @@ LL | #[no_link()] = note: for more information, visit <https://doc.rust-lang.org/reference/items/extern-crates.html#the-no_link-attribute> error: malformed `macro_export` attribute input - --> $DIR/malformed-attrs.rs:214:1 + --> $DIR/malformed-attrs.rs:213:1 | LL | #[macro_export = 18] | ^^^^^^^^^^^^^^^^^^^^ @@ -209,25 +195,25 @@ LL + #[macro_export] | error: the `#[proc_macro]` attribute is only usable with crates of the `proc-macro` crate type - --> $DIR/malformed-attrs.rs:99:1 + --> $DIR/malformed-attrs.rs:98:1 | LL | #[proc_macro = 18] | ^^^^^^^^^^^^^^^^^^ error: the `#[proc_macro_attribute]` attribute is only usable with crates of the `proc-macro` crate type - --> $DIR/malformed-attrs.rs:116:1 + --> $DIR/malformed-attrs.rs:115:1 | LL | #[proc_macro_attribute = 19] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: the `#[proc_macro_derive]` attribute is only usable with crates of the `proc-macro` crate type - --> $DIR/malformed-attrs.rs:123:1 + --> $DIR/malformed-attrs.rs:122:1 | LL | #[proc_macro_derive] | ^^^^^^^^^^^^^^^^^^^^ error[E0658]: allow_internal_unsafe side-steps the unsafe_code lint - --> $DIR/malformed-attrs.rs:216:1 + --> $DIR/malformed-attrs.rs:215:1 | LL | #[allow_internal_unsafe = 1] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -244,7 +230,7 @@ LL | #[doc] = 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 #57571 <https://github.com/rust-lang/rust/issues/57571> = note: for more information, visit <https://doc.rust-lang.org/rustdoc/write-documentation/the-doc-attribute.html> - = note: `#[deny(ill_formed_attribute_input)]` on by default + = note: `#[deny(ill_formed_attribute_input)]` (part of `#[deny(future_incompatible)]`) on by default error: valid forms for the attribute are `#[doc(hidden)]`, `#[doc(inline)]`, and `#[doc = "string"]` --> $DIR/malformed-attrs.rs:76:1 @@ -256,18 +242,8 @@ LL | #[doc] = note: for more information, see issue #57571 <https://github.com/rust-lang/rust/issues/57571> = note: for more information, visit <https://doc.rust-lang.org/rustdoc/write-documentation/the-doc-attribute.html> -error: valid forms for the attribute are `#[link(name = "...")]`, `#[link(name = "...", kind = "dylib|static|...")]`, `#[link(name = "...", wasm_import_module = "...")]`, `#[link(name = "...", import_name_type = "decorated|noprefix|undecorated")]`, and `#[link(name = "...", kind = "dylib|static|...", wasm_import_module = "...", import_name_type = "decorated|noprefix|undecorated")]` - --> $DIR/malformed-attrs.rs:83:1 - | -LL | #[link] - | ^^^^^^^ - | - = 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 #57571 <https://github.com/rust-lang/rust/issues/57571> - = note: for more information, visit <https://doc.rust-lang.org/reference/items/external-blocks.html#the-link-attribute> - error: invalid argument - --> $DIR/malformed-attrs.rs:188:1 + --> $DIR/malformed-attrs.rs:187:1 | LL | #[debugger_visualizer] | ^^^^^^^^^^^^^^^^^^^^^^ @@ -484,6 +460,12 @@ LL | #[used()] | = help: `#[used]` can only be applied to statics +error[E0539]: malformed `crate_name` attribute input + --> $DIR/malformed-attrs.rs:74:1 + | +LL | #[crate_name] + | ^^^^^^^^^^^^^ help: must be of the form: `#[crate_name = "name"]` + error[E0539]: malformed `target_feature` attribute input --> $DIR/malformed-attrs.rs:79:1 | @@ -502,8 +484,27 @@ LL | #[export_stable = 1] | | didn't expect any arguments here | help: must be of the form: `#[export_stable]` +error[E0539]: malformed `link` attribute input + --> $DIR/malformed-attrs.rs:83:1 + | +LL | #[link] + | ^^^^^^^ expected this to be a list + | + = note: for more information, visit <https://doc.rust-lang.org/reference/items/external-blocks.html#the-link-attribute> +help: try changing it to one of the following valid forms of the attribute + | +LL | #[link(name = "...")] + | ++++++++++++++ +LL | #[link(name = "...", import_name_type = "decorated|noprefix|undecorated")] + | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +LL | #[link(name = "...", kind = "dylib|static|...")] + | +++++++++++++++++++++++++++++++++++++++++ +LL | #[link(name = "...", kind = "dylib|static|...", wasm_import_module = "...", import_name_type = "decorated|noprefix|undecorated")] + | ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + = and 1 other candidate + error[E0539]: malformed `link_name` attribute input - --> $DIR/malformed-attrs.rs:86:1 + --> $DIR/malformed-attrs.rs:85:1 | LL | #[link_name] | ^^^^^^^^^^^^ help: must be of the form: `#[link_name = "name"]` @@ -511,7 +512,7 @@ LL | #[link_name] = note: for more information, visit <https://doc.rust-lang.org/reference/items/external-blocks.html#the-link_name-attribute> error[E0539]: malformed `link_section` attribute input - --> $DIR/malformed-attrs.rs:88:1 + --> $DIR/malformed-attrs.rs:87:1 | LL | #[link_section] | ^^^^^^^^^^^^^^^ help: must be of the form: `#[link_section = "name"]` @@ -519,7 +520,7 @@ LL | #[link_section] = note: for more information, visit <https://doc.rust-lang.org/reference/abi.html#the-link_section-attribute> error[E0539]: malformed `coverage` attribute input - --> $DIR/malformed-attrs.rs:90:1 + --> $DIR/malformed-attrs.rs:89:1 | LL | #[coverage] | ^^^^^^^^^^^ this attribute is only valid with either `on` or `off` as an argument @@ -531,8 +532,26 @@ LL | #[coverage(off)] LL | #[coverage(on)] | ++++ +error[E0539]: malformed `sanitize` attribute input + --> $DIR/malformed-attrs.rs:91:1 + | +LL | #[sanitize] + | ^^^^^^^^^^^ expected this to be a list + | +help: try changing it to one of the following valid forms of the attribute + | +LL | #[sanitize(address = "on|off")] + | ++++++++++++++++++++ +LL | #[sanitize(cfi = "on|off")] + | ++++++++++++++++ +LL | #[sanitize(hwaddress = "on|off")] + | ++++++++++++++++++++++ +LL | #[sanitize(kcfi = "on|off")] + | +++++++++++++++++ + = and 5 other candidates + error[E0565]: malformed `no_implicit_prelude` attribute input - --> $DIR/malformed-attrs.rs:97:1 + --> $DIR/malformed-attrs.rs:96:1 | LL | #[no_implicit_prelude = 23] | ^^^^^^^^^^^^^^^^^^^^^^----^ @@ -541,7 +560,7 @@ LL | #[no_implicit_prelude = 23] | help: must be of the form: `#[no_implicit_prelude]` error[E0565]: malformed `proc_macro` attribute input - --> $DIR/malformed-attrs.rs:99:1 + --> $DIR/malformed-attrs.rs:98:1 | LL | #[proc_macro = 18] | ^^^^^^^^^^^^^----^ @@ -550,7 +569,7 @@ LL | #[proc_macro = 18] | help: must be of the form: `#[proc_macro]` error[E0565]: malformed `coroutine` attribute input - --> $DIR/malformed-attrs.rs:111:5 + --> $DIR/malformed-attrs.rs:110:5 | LL | #[coroutine = 63] || {} | ^^^^^^^^^^^^----^ @@ -559,7 +578,7 @@ LL | #[coroutine = 63] || {} | help: must be of the form: `#[coroutine]` error[E0565]: malformed `proc_macro_attribute` attribute input - --> $DIR/malformed-attrs.rs:116:1 + --> $DIR/malformed-attrs.rs:115:1 | LL | #[proc_macro_attribute = 19] | ^^^^^^^^^^^^^^^^^^^^^^^----^ @@ -568,7 +587,7 @@ LL | #[proc_macro_attribute = 19] | help: must be of the form: `#[proc_macro_attribute]` error[E0539]: malformed `must_use` attribute input - --> $DIR/malformed-attrs.rs:119:1 + --> $DIR/malformed-attrs.rs:118:1 | LL | #[must_use = 1] | ^^^^^^^^^^^^^-^ @@ -586,7 +605,7 @@ LL + #[must_use] | error[E0539]: malformed `proc_macro_derive` attribute input - --> $DIR/malformed-attrs.rs:123:1 + --> $DIR/malformed-attrs.rs:122:1 | LL | #[proc_macro_derive] | ^^^^^^^^^^^^^^^^^^^^ expected this to be a list @@ -600,7 +619,7 @@ LL | #[proc_macro_derive(TraitName, attributes(name1, name2, ...))] | ++++++++++++++++++++++++++++++++++++++++++ error[E0539]: malformed `rustc_layout_scalar_valid_range_start` attribute input - --> $DIR/malformed-attrs.rs:128:1 + --> $DIR/malformed-attrs.rs:127:1 | LL | #[rustc_layout_scalar_valid_range_start] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -609,7 +628,7 @@ LL | #[rustc_layout_scalar_valid_range_start] | help: must be of the form: `#[rustc_layout_scalar_valid_range_start(start)]` error[E0539]: malformed `rustc_layout_scalar_valid_range_end` attribute input - --> $DIR/malformed-attrs.rs:130:1 + --> $DIR/malformed-attrs.rs:129:1 | LL | #[rustc_layout_scalar_valid_range_end] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -618,7 +637,7 @@ LL | #[rustc_layout_scalar_valid_range_end] | help: must be of the form: `#[rustc_layout_scalar_valid_range_end(end)]` error[E0565]: malformed `marker` attribute input - --> $DIR/malformed-attrs.rs:155:1 + --> $DIR/malformed-attrs.rs:154:1 | LL | #[marker = 3] | ^^^^^^^^^---^ @@ -627,7 +646,7 @@ LL | #[marker = 3] | help: must be of the form: `#[marker]` error[E0565]: malformed `fundamental` attribute input - --> $DIR/malformed-attrs.rs:157:1 + --> $DIR/malformed-attrs.rs:156:1 | LL | #[fundamental()] | ^^^^^^^^^^^^^--^ @@ -636,7 +655,7 @@ LL | #[fundamental()] | help: must be of the form: `#[fundamental]` error[E0565]: malformed `ffi_pure` attribute input - --> $DIR/malformed-attrs.rs:165:5 + --> $DIR/malformed-attrs.rs:164:5 | LL | #[unsafe(ffi_pure = 1)] | ^^^^^^^^^^^^^^^^^^---^^ @@ -645,7 +664,7 @@ LL | #[unsafe(ffi_pure = 1)] | help: must be of the form: `#[ffi_pure]` error[E0539]: malformed `link_ordinal` attribute input - --> $DIR/malformed-attrs.rs:167:5 + --> $DIR/malformed-attrs.rs:166:5 | LL | #[link_ordinal] | ^^^^^^^^^^^^^^^ @@ -656,7 +675,7 @@ LL | #[link_ordinal] = note: for more information, visit <https://doc.rust-lang.org/reference/items/external-blocks.html#the-link_ordinal-attribute> error[E0565]: malformed `ffi_const` attribute input - --> $DIR/malformed-attrs.rs:171:5 + --> $DIR/malformed-attrs.rs:170:5 | LL | #[unsafe(ffi_const = 1)] | ^^^^^^^^^^^^^^^^^^^---^^ @@ -665,7 +684,7 @@ LL | #[unsafe(ffi_const = 1)] | help: must be of the form: `#[ffi_const]` error[E0539]: malformed `linkage` attribute input - --> $DIR/malformed-attrs.rs:173:5 + --> $DIR/malformed-attrs.rs:172:5 | LL | #[linkage] | ^^^^^^^^^^ expected this to be of the form `linkage = "..."` @@ -683,7 +702,7 @@ LL | #[linkage = "external"] = and 5 other candidates error[E0565]: malformed `automatically_derived` attribute input - --> $DIR/malformed-attrs.rs:191:1 + --> $DIR/malformed-attrs.rs:190:1 | LL | #[automatically_derived = 18] | ^^^^^^^^^^^^^^^^^^^^^^^^----^ @@ -692,7 +711,7 @@ LL | #[automatically_derived = 18] | help: must be of the form: `#[automatically_derived]` error[E0565]: malformed `non_exhaustive` attribute input - --> $DIR/malformed-attrs.rs:197:1 + --> $DIR/malformed-attrs.rs:196:1 | LL | #[non_exhaustive = 1] | ^^^^^^^^^^^^^^^^^---^ @@ -701,13 +720,13 @@ LL | #[non_exhaustive = 1] | help: must be of the form: `#[non_exhaustive]` error: valid forms for the attribute are `#[macro_use(name1, name2, ...)]` and `#[macro_use]` - --> $DIR/malformed-attrs.rs:209:1 + --> $DIR/malformed-attrs.rs:208:1 | LL | #[macro_use = 1] | ^^^^^^^^^^^^^^^^ error[E0565]: malformed `allow_internal_unsafe` attribute input - --> $DIR/malformed-attrs.rs:216:1 + --> $DIR/malformed-attrs.rs:215:1 | LL | #[allow_internal_unsafe = 1] | ^^^^^^^^^^^^^^^^^^^^^^^^---^ @@ -716,7 +735,7 @@ LL | #[allow_internal_unsafe = 1] | help: must be of the form: `#[allow_internal_unsafe]` error[E0565]: malformed `type_const` attribute input - --> $DIR/malformed-attrs.rs:143:5 + --> $DIR/malformed-attrs.rs:142:5 | LL | #[type_const = 1] | ^^^^^^^^^^^^^---^ @@ -749,15 +768,15 @@ LL | #[repr] | ^^^^^^^ warning: `#[diagnostic::do_not_recommend]` does not expect any arguments - --> $DIR/malformed-attrs.rs:149:1 + --> $DIR/malformed-attrs.rs:148:1 | LL | #[diagnostic::do_not_recommend()] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: `#[warn(malformed_diagnostic_attributes)]` on by default + = note: `#[warn(malformed_diagnostic_attributes)]` (part of `#[warn(unknown_or_malformed_diagnostic_attributes)]`) on by default warning: missing options for `on_unimplemented` attribute - --> $DIR/malformed-attrs.rs:138:1 + --> $DIR/malformed-attrs.rs:137:1 | LL | #[diagnostic::on_unimplemented] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -765,7 +784,7 @@ LL | #[diagnostic::on_unimplemented] = help: at least one of the `message`, `note` and `label` options are expected warning: malformed `on_unimplemented` attribute - --> $DIR/malformed-attrs.rs:140:1 + --> $DIR/malformed-attrs.rs:139:1 | LL | #[diagnostic::on_unimplemented = 1] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ invalid option found here @@ -782,7 +801,7 @@ LL | #[inline = 5] = note: for more information, see issue #57571 <https://github.com/rust-lang/rust/issues/57571> error: valid forms for the attribute are `#[ignore = "reason"]` and `#[ignore]` - --> $DIR/malformed-attrs.rs:94:1 + --> $DIR/malformed-attrs.rs:93:1 | LL | #[ignore()] | ^^^^^^^^^^^ @@ -791,7 +810,7 @@ LL | #[ignore()] = note: for more information, see issue #57571 <https://github.com/rust-lang/rust/issues/57571> error: valid forms for the attribute are `#[ignore = "reason"]` and `#[ignore]` - --> $DIR/malformed-attrs.rs:223:1 + --> $DIR/malformed-attrs.rs:222:1 | LL | #[ignore = 1] | ^^^^^^^^^^^^^ @@ -800,7 +819,7 @@ LL | #[ignore = 1] = note: for more information, see issue #57571 <https://github.com/rust-lang/rust/issues/57571> error[E0308]: mismatched types - --> $DIR/malformed-attrs.rs:111:23 + --> $DIR/malformed-attrs.rs:110:23 | LL | fn test() { | - help: a return type might be missing here: `-> _` @@ -808,7 +827,7 @@ LL | #[coroutine = 63] || {} | ^^^^^ expected `()`, found coroutine | = note: expected unit type `()` - found coroutine `{coroutine@$DIR/malformed-attrs.rs:111:23: 111:25}` + found coroutine `{coroutine@$DIR/malformed-attrs.rs:110:23: 110:25}` error: aborting due to 77 previous errors; 3 warnings emitted @@ -824,7 +843,7 @@ LL | #[doc] = 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 #57571 <https://github.com/rust-lang/rust/issues/57571> = note: for more information, visit <https://doc.rust-lang.org/rustdoc/write-documentation/the-doc-attribute.html> - = note: `#[deny(ill_formed_attribute_input)]` on by default + = note: `#[deny(ill_formed_attribute_input)]` (part of `#[deny(future_incompatible)]`) on by default Future breakage diagnostic: error: valid forms for the attribute are `#[doc(hidden)]`, `#[doc(inline)]`, and `#[doc = "string"]` @@ -836,19 +855,7 @@ LL | #[doc] = 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 #57571 <https://github.com/rust-lang/rust/issues/57571> = note: for more information, visit <https://doc.rust-lang.org/rustdoc/write-documentation/the-doc-attribute.html> - = note: `#[deny(ill_formed_attribute_input)]` on by default - -Future breakage diagnostic: -error: valid forms for the attribute are `#[link(name = "...")]`, `#[link(name = "...", kind = "dylib|static|...")]`, `#[link(name = "...", wasm_import_module = "...")]`, `#[link(name = "...", import_name_type = "decorated|noprefix|undecorated")]`, and `#[link(name = "...", kind = "dylib|static|...", wasm_import_module = "...", import_name_type = "decorated|noprefix|undecorated")]` - --> $DIR/malformed-attrs.rs:83:1 - | -LL | #[link] - | ^^^^^^^ - | - = 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 #57571 <https://github.com/rust-lang/rust/issues/57571> - = note: for more information, visit <https://doc.rust-lang.org/reference/items/external-blocks.html#the-link-attribute> - = note: `#[deny(ill_formed_attribute_input)]` on by default + = note: `#[deny(ill_formed_attribute_input)]` (part of `#[deny(future_incompatible)]`) on by default Future breakage diagnostic: error: valid forms for the attribute are `#[inline(always)]`, `#[inline(never)]`, and `#[inline]` @@ -859,27 +866,27 @@ LL | #[inline = 5] | = 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 #57571 <https://github.com/rust-lang/rust/issues/57571> - = note: `#[deny(ill_formed_attribute_input)]` on by default + = note: `#[deny(ill_formed_attribute_input)]` (part of `#[deny(future_incompatible)]`) on by default Future breakage diagnostic: error: valid forms for the attribute are `#[ignore = "reason"]` and `#[ignore]` - --> $DIR/malformed-attrs.rs:94:1 + --> $DIR/malformed-attrs.rs:93:1 | LL | #[ignore()] | ^^^^^^^^^^^ | = 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 #57571 <https://github.com/rust-lang/rust/issues/57571> - = note: `#[deny(ill_formed_attribute_input)]` on by default + = note: `#[deny(ill_formed_attribute_input)]` (part of `#[deny(future_incompatible)]`) on by default Future breakage diagnostic: error: valid forms for the attribute are `#[ignore = "reason"]` and `#[ignore]` - --> $DIR/malformed-attrs.rs:223:1 + --> $DIR/malformed-attrs.rs:222:1 | LL | #[ignore = 1] | ^^^^^^^^^^^^^ | = 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 #57571 <https://github.com/rust-lang/rust/issues/57571> - = note: `#[deny(ill_formed_attribute_input)]` on by default + = note: `#[deny(ill_formed_attribute_input)]` (part of `#[deny(future_incompatible)]`) on by default diff --git a/tests/ui/attributes/malformed-fn-align.rs b/tests/ui/attributes/malformed-fn-align.rs index adce84763ab..c76eda65a75 100644 --- a/tests/ui/attributes/malformed-fn-align.rs +++ b/tests/ui/attributes/malformed-fn-align.rs @@ -26,7 +26,7 @@ fn f3() {} #[repr(align(16))] //~ ERROR `#[repr(align(...))]` is not supported on functions fn f4() {} -#[rustc_align(-1)] //~ ERROR expected unsuffixed literal, found `-` +#[rustc_align(-1)] //~ ERROR expected a literal (`1u8`, `1.0f32`, `"string"`, etc.) here, found `-` fn f5() {} #[rustc_align(3)] //~ ERROR invalid alignment value: not a power of two diff --git a/tests/ui/attributes/malformed-fn-align.stderr b/tests/ui/attributes/malformed-fn-align.stderr index 346fe2b4b7f..33f789b6269 100644 --- a/tests/ui/attributes/malformed-fn-align.stderr +++ b/tests/ui/attributes/malformed-fn-align.stderr @@ -1,17 +1,3 @@ -error: expected unsuffixed literal, found `-` - --> $DIR/malformed-fn-align.rs:29:15 - | -LL | #[rustc_align(-1)] - | ^ - -error: suffixed literals are not allowed in attributes - --> $DIR/malformed-fn-align.rs:35:15 - | -LL | #[rustc_align(4usize)] - | ^^^^^^ - | - = help: instead of using a suffixed literal (`1u8`, `1.0f32`, etc.), use an unsuffixed version (`1`, `1.0`, etc.) - error[E0539]: malformed `rustc_align` attribute input --> $DIR/malformed-fn-align.rs:10:5 | @@ -51,12 +37,32 @@ error[E0589]: invalid alignment value: not a power of two LL | #[rustc_align(0)] | ^ +error: expected a literal (`1u8`, `1.0f32`, `"string"`, etc.) here, found `-` + --> $DIR/malformed-fn-align.rs:29:15 + | +LL | #[rustc_align(-1)] + | ^ + | +help: negative numbers are not literals, try removing the `-` sign + | +LL - #[rustc_align(-1)] +LL + #[rustc_align(1)] + | + error[E0589]: invalid alignment value: not a power of two --> $DIR/malformed-fn-align.rs:32:15 | LL | #[rustc_align(3)] | ^ +error: suffixed literals are not allowed in attributes + --> $DIR/malformed-fn-align.rs:35:15 + | +LL | #[rustc_align(4usize)] + | ^^^^^^ + | + = help: instead of using a suffixed literal (`1u8`, `1.0f32`, etc.), use an unsuffixed version (`1`, `1.0`, etc.) + error[E0589]: invalid alignment value: not an unsuffixed integer --> $DIR/malformed-fn-align.rs:35:15 | diff --git a/tests/ui/attributes/malformed-never-type-options.rs b/tests/ui/attributes/malformed-never-type-options.rs new file mode 100644 index 00000000000..0c384be0e22 --- /dev/null +++ b/tests/ui/attributes/malformed-never-type-options.rs @@ -0,0 +1,8 @@ +//! Regression test for #124352 +//! The `rustc_*` attribute is malformed, but ICEing without a `feature(rustc_attrs)` is still bad. + +#![rustc_never_type_options(: Unsize<U> = "hi")] +//~^ ERROR expected unsuffixed literal, found `:` +//~| ERROR use of an internal attribute + +fn main() {} diff --git a/tests/ui/attributes/malformed-never-type-options.stderr b/tests/ui/attributes/malformed-never-type-options.stderr new file mode 100644 index 00000000000..0d2ff4881f2 --- /dev/null +++ b/tests/ui/attributes/malformed-never-type-options.stderr @@ -0,0 +1,19 @@ +error: expected unsuffixed literal, found `:` + --> $DIR/malformed-never-type-options.rs:4:29 + | +LL | #![rustc_never_type_options(: Unsize<U> = "hi")] + | ^ + +error[E0658]: use of an internal attribute + --> $DIR/malformed-never-type-options.rs:4:1 + | +LL | #![rustc_never_type_options(: Unsize<U> = "hi")] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: add `#![feature(rustc_attrs)]` to the crate attributes to enable + = note: the `#[rustc_never_type_options]` attribute is an internal implementation detail that will never be stable + = note: `rustc_never_type_options` is used to experiment with never type fallback and work on never type stabilization + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0658`. diff --git a/tests/ui/attributes/malformed-reprs.stderr b/tests/ui/attributes/malformed-reprs.stderr index 43085b9c341..3a788999542 100644 --- a/tests/ui/attributes/malformed-reprs.stderr +++ b/tests/ui/attributes/malformed-reprs.stderr @@ -7,18 +7,14 @@ LL | #![repr] = note: for more information, visit <https://doc.rust-lang.org/reference/type-layout.html#representations> help: try changing it to one of the following valid forms of the attribute | -LL - #![repr] -LL + #[repr(<integer type>)] - | -LL - #![repr] -LL + #[repr(C)] - | -LL - #![repr] -LL + #[repr(Rust)] - | -LL - #![repr] -LL + #[repr(align(...))] - | +LL | #![repr(<integer type>)] + | ++++++++++++++++ +LL | #![repr(C)] + | +++ +LL | #![repr(Rust)] + | ++++++ +LL | #![repr(align(...))] + | ++++++++++++ = and 2 other candidates error[E0589]: invalid `repr(align)` attribute: not a power of two diff --git a/tests/ui/attributes/no-sanitize.rs b/tests/ui/attributes/no-sanitize.rs deleted file mode 100644 index ddf909be63a..00000000000 --- a/tests/ui/attributes/no-sanitize.rs +++ /dev/null @@ -1,45 +0,0 @@ -#![feature(no_sanitize)] -#![feature(stmt_expr_attributes)] -#![deny(unused_attributes)] -#![allow(dead_code)] - -fn invalid() { - #[no_sanitize(memory)] //~ ERROR `#[no_sanitize(memory)]` should be applied to a function - { - 1 - }; -} - -#[no_sanitize(memory)] //~ ERROR `#[no_sanitize(memory)]` should be applied to a function -type InvalidTy = (); - -#[no_sanitize(memory)] //~ ERROR `#[no_sanitize(memory)]` should be applied to a function -mod invalid_module {} - -fn main() { - let _ = #[no_sanitize(memory)] //~ ERROR `#[no_sanitize(memory)]` should be applied to a function - (|| 1); -} - -#[no_sanitize(memory)] //~ ERROR `#[no_sanitize(memory)]` should be applied to a function -struct F; - -#[no_sanitize(memory)] //~ ERROR `#[no_sanitize(memory)]` should be applied to a function -impl F { - #[no_sanitize(memory)] - fn valid(&self) {} -} - -#[no_sanitize(address, memory)] //~ ERROR `#[no_sanitize(memory)]` should be applied to a function -static INVALID : i32 = 0; - -#[no_sanitize(memory)] -fn valid() {} - -#[no_sanitize(address)] -static VALID : i32 = 0; - -#[no_sanitize("address")] -//~^ ERROR `#[no_sanitize(...)]` should be applied to a function -//~| ERROR invalid argument for `no_sanitize` -static VALID2 : i32 = 0; diff --git a/tests/ui/attributes/no-sanitize.stderr b/tests/ui/attributes/no-sanitize.stderr deleted file mode 100644 index 8d5fbb109ea..00000000000 --- a/tests/ui/attributes/no-sanitize.stderr +++ /dev/null @@ -1,80 +0,0 @@ -error: `#[no_sanitize(memory)]` should be applied to a function - --> $DIR/no-sanitize.rs:7:19 - | -LL | #[no_sanitize(memory)] - | ^^^^^^ -LL | / { -LL | | 1 -LL | | }; - | |_____- not a function - -error: `#[no_sanitize(memory)]` should be applied to a function - --> $DIR/no-sanitize.rs:13:15 - | -LL | #[no_sanitize(memory)] - | ^^^^^^ -LL | type InvalidTy = (); - | -------------------- not a function - -error: `#[no_sanitize(memory)]` should be applied to a function - --> $DIR/no-sanitize.rs:16:15 - | -LL | #[no_sanitize(memory)] - | ^^^^^^ -LL | mod invalid_module {} - | --------------------- not a function - -error: `#[no_sanitize(memory)]` should be applied to a function - --> $DIR/no-sanitize.rs:20:27 - | -LL | let _ = #[no_sanitize(memory)] - | ^^^^^^ -LL | (|| 1); - | ------ not a function - -error: `#[no_sanitize(memory)]` should be applied to a function - --> $DIR/no-sanitize.rs:24:15 - | -LL | #[no_sanitize(memory)] - | ^^^^^^ -LL | struct F; - | --------- not a function - -error: `#[no_sanitize(memory)]` should be applied to a function - --> $DIR/no-sanitize.rs:27:15 - | -LL | #[no_sanitize(memory)] - | ^^^^^^ -LL | / impl F { -LL | | #[no_sanitize(memory)] -LL | | fn valid(&self) {} -LL | | } - | |_- not a function - -error: `#[no_sanitize(memory)]` should be applied to a function - --> $DIR/no-sanitize.rs:33:24 - | -LL | #[no_sanitize(address, memory)] - | ^^^^^^ -LL | static INVALID : i32 = 0; - | ------------------------- not a function - -error: `#[no_sanitize(...)]` should be applied to a function - --> $DIR/no-sanitize.rs:42:15 - | -LL | #[no_sanitize("address")] - | ^^^^^^^^^ -... -LL | static VALID2 : i32 = 0; - | ------------------------ not a function - -error: invalid argument for `no_sanitize` - --> $DIR/no-sanitize.rs:42:15 - | -LL | #[no_sanitize("address")] - | ^^^^^^^^^ - | - = note: expected one of: `address`, `cfi`, `hwaddress`, `kcfi`, `memory`, `memtag`, `shadow-call-stack`, or `thread` - -error: aborting due to 9 previous errors - diff --git a/tests/ui/attributes/nonterminal-expansion.rs b/tests/ui/attributes/nonterminal-expansion.rs index 004a8a23fd6..ff2b36f7d27 100644 --- a/tests/ui/attributes/nonterminal-expansion.rs +++ b/tests/ui/attributes/nonterminal-expansion.rs @@ -5,7 +5,7 @@ macro_rules! pass_nonterminal { ($n:expr) => { #[repr(align($n))] - //~^ ERROR expected unsuffixed literal, found `expr` metavariable + //~^ ERROR expected a literal (`1u8`, `1.0f32`, `"string"`, etc.) here, found `expr` metavariable struct S; }; } @@ -15,6 +15,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 9c6cb98f619..21912de2106 100644 --- a/tests/ui/attributes/nonterminal-expansion.stderr +++ b/tests/ui/attributes/nonterminal-expansion.stderr @@ -1,4 +1,4 @@ -error: expected unsuffixed literal, found `expr` metavariable +error: expected a literal (`1u8`, `1.0f32`, `"string"`, etc.) here, found `expr` metavariable --> $DIR/nonterminal-expansion.rs:7:22 | LL | #[repr(align($n))] @@ -9,12 +9,5 @@ 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 - | -LL | pass_nonterminal!(n!()); - | ^ - -error: aborting due to 2 previous errors +error: aborting due to 1 previous error -For more information about this error, try `rustc --explain E0693`. diff --git a/tests/ui/attributes/rustc_confusables.rs b/tests/ui/attributes/rustc_confusables.rs index 91c66a75cc3..14aed092694 100644 --- a/tests/ui/attributes/rustc_confusables.rs +++ b/tests/ui/attributes/rustc_confusables.rs @@ -45,4 +45,5 @@ impl Bar { #[rustc_confusables("blah")] //~^ ERROR attribute cannot be used on //~| HELP can only be applied to +//~| HELP remove the attribute fn not_inherent_impl_method() {} diff --git a/tests/ui/attributes/unsafe/proc-unsafe-attributes.stderr b/tests/ui/attributes/unsafe/proc-unsafe-attributes.stderr index 107e053ae0c..94edb263a6a 100644 --- a/tests/ui/attributes/unsafe/proc-unsafe-attributes.stderr +++ b/tests/ui/attributes/unsafe/proc-unsafe-attributes.stderr @@ -28,17 +28,6 @@ LL | #[unsafe(proc_macro_derive(Foo))] | = note: extraneous unsafe is not allowed in attributes -error: expected identifier, found keyword `unsafe` - --> $DIR/proc-unsafe-attributes.rs:12:21 - | -LL | #[proc_macro_derive(unsafe(Foo))] - | ^^^^^^ expected identifier, found keyword - | -help: escape `unsafe` to use it as an identifier - | -LL | #[proc_macro_derive(r#unsafe(Foo))] - | ++ - error: `proc_macro_attribute` is not an unsafe attribute --> $DIR/proc-unsafe-attributes.rs:18:3 | @@ -114,6 +103,17 @@ LL | #[unsafe(allow(unsafe(dead_code)))] | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` +error: expected identifier, found keyword `unsafe` + --> $DIR/proc-unsafe-attributes.rs:12:21 + | +LL | #[proc_macro_derive(unsafe(Foo))] + | ^^^^^^ expected identifier, found keyword + | +help: escape `unsafe` to use it as an identifier + | +LL | #[proc_macro_derive(r#unsafe(Foo))] + | ++ + error[E0565]: malformed `proc_macro_derive` attribute input --> $DIR/proc-unsafe-attributes.rs:12:1 | diff --git a/tests/ui/auto-traits/auto-traits.stderr b/tests/ui/auto-traits/auto-traits.stderr index 34be8d3f67b..1ac1a992200 100644 --- a/tests/ui/auto-traits/auto-traits.stderr +++ b/tests/ui/auto-traits/auto-traits.stderr @@ -4,7 +4,7 @@ warning: trait `AutoInner` is never used LL | auto trait AutoInner {} | ^^^^^^^^^ | - = note: `#[warn(dead_code)]` on by default + = note: `#[warn(dead_code)]` (part of `#[warn(unused)]`) on by default warning: trait `AutoUnsafeInner` is never used --> $DIR/auto-traits.rs:23:23 diff --git a/tests/ui/auto-traits/issue-83857-ub.stderr b/tests/ui/auto-traits/issue-83857-ub.stderr index 3536450c75b..9bfdecf6f54 100644 --- a/tests/ui/auto-traits/issue-83857-ub.stderr +++ b/tests/ui/auto-traits/issue-83857-ub.stderr @@ -4,7 +4,11 @@ error[E0277]: `Foo<T, U>` cannot be sent between threads safely LL | fn generic<T, U>(v: Foo<T, U>, f: fn(<Foo<T, U> as WithAssoc>::Output) -> i32) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `Foo<T, U>` cannot be sent between threads safely | - = help: the trait `Send` is not implemented for `Foo<T, U>` +help: the trait `Send` is not implemented for `Foo<T, U>` + --> $DIR/issue-83857-ub.rs:6:1 + | +LL | struct Foo<T, U>(Always<T, U>); + | ^^^^^^^^^^^^^^^^ note: required for `Foo<T, U>` to implement `WithAssoc` --> $DIR/issue-83857-ub.rs:14:15 | @@ -23,7 +27,11 @@ error[E0277]: `Foo<T, U>` cannot be sent between threads safely LL | fn generic<T, U>(v: Foo<T, U>, f: fn(<Foo<T, U> as WithAssoc>::Output) -> i32) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `Foo<T, U>` cannot be sent between threads safely | - = help: the trait `Send` is not implemented for `Foo<T, U>` +help: the trait `Send` is not implemented for `Foo<T, U>` + --> $DIR/issue-83857-ub.rs:6:1 + | +LL | struct Foo<T, U>(Always<T, U>); + | ^^^^^^^^^^^^^^^^ note: required for `Foo<T, U>` to implement `WithAssoc` --> $DIR/issue-83857-ub.rs:14:15 | @@ -44,7 +52,11 @@ LL | f(foo(v)); | | | required by a bound introduced by this call | - = help: the trait `Send` is not implemented for `Foo<T, U>` +help: the trait `Send` is not implemented for `Foo<T, U>` + --> $DIR/issue-83857-ub.rs:6:1 + | +LL | struct Foo<T, U>(Always<T, U>); + | ^^^^^^^^^^^^^^^^ note: required by a bound in `foo` --> $DIR/issue-83857-ub.rs:28:11 | diff --git a/tests/ui/auto-traits/typeck-default-trait-impl-constituent-types-2.stderr b/tests/ui/auto-traits/typeck-default-trait-impl-constituent-types-2.stderr index aa5585a5371..c948e1b1051 100644 --- a/tests/ui/auto-traits/typeck-default-trait-impl-constituent-types-2.stderr +++ b/tests/ui/auto-traits/typeck-default-trait-impl-constituent-types-2.stderr @@ -2,8 +2,13 @@ error[E0277]: the trait bound `MyS2: MyTrait` is not satisfied in `(MyS2, MyS)` --> $DIR/typeck-default-trait-impl-constituent-types-2.rs:17:18 | LL | is_mytrait::<(MyS2, MyS)>(); - | ^^^^^^^^^^^ within `(MyS2, MyS)`, the trait `MyTrait` is not implemented for `MyS2` + | ^^^^^^^^^^^ unsatisfied trait bound | +help: within `(MyS2, MyS)`, the trait `MyTrait` is not implemented for `MyS2` + --> $DIR/typeck-default-trait-impl-constituent-types-2.rs:8:1 + | +LL | struct MyS2; + | ^^^^^^^^^^^ = note: required because it appears within the type `(MyS2, MyS)` note: required by a bound in `is_mytrait` --> $DIR/typeck-default-trait-impl-constituent-types-2.rs:12:18 diff --git a/tests/ui/auto-traits/typeck-default-trait-impl-constituent-types.stderr b/tests/ui/auto-traits/typeck-default-trait-impl-constituent-types.stderr index 668cbc8aeb4..ae33aeff6e2 100644 --- a/tests/ui/auto-traits/typeck-default-trait-impl-constituent-types.stderr +++ b/tests/ui/auto-traits/typeck-default-trait-impl-constituent-types.stderr @@ -2,8 +2,13 @@ error[E0277]: the trait bound `MyS2: MyTrait` is not satisfied --> $DIR/typeck-default-trait-impl-constituent-types.rs:21:18 | LL | is_mytrait::<MyS2>(); - | ^^^^ the trait `MyTrait` is not implemented for `MyS2` + | ^^^^ unsatisfied trait bound | +help: the trait `MyTrait` is not implemented for `MyS2` + --> $DIR/typeck-default-trait-impl-constituent-types.rs:10:1 + | +LL | struct MyS2; + | ^^^^^^^^^^^ note: required by a bound in `is_mytrait` --> $DIR/typeck-default-trait-impl-constituent-types.rs:16:18 | diff --git a/tests/ui/auto-traits/typeck-default-trait-impl-negation.stderr b/tests/ui/auto-traits/typeck-default-trait-impl-negation.stderr index fa8dd41da23..4b10262c2e2 100644 --- a/tests/ui/auto-traits/typeck-default-trait-impl-negation.stderr +++ b/tests/ui/auto-traits/typeck-default-trait-impl-negation.stderr @@ -2,8 +2,13 @@ error[E0277]: the trait bound `ThisImplsUnsafeTrait: MyTrait` is not satisfied --> $DIR/typeck-default-trait-impl-negation.rs:22:19 | LL | is_my_trait::<ThisImplsUnsafeTrait>(); - | ^^^^^^^^^^^^^^^^^^^^ the trait `MyTrait` is not implemented for `ThisImplsUnsafeTrait` + | ^^^^^^^^^^^^^^^^^^^^ unsatisfied trait bound | +help: the trait `MyTrait` is not implemented for `ThisImplsUnsafeTrait` + --> $DIR/typeck-default-trait-impl-negation.rs:13:1 + | +LL | struct ThisImplsUnsafeTrait; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ note: required by a bound in `is_my_trait` --> $DIR/typeck-default-trait-impl-negation.rs:17:19 | @@ -14,8 +19,13 @@ error[E0277]: the trait bound `ThisImplsTrait: MyUnsafeTrait` is not satisfied --> $DIR/typeck-default-trait-impl-negation.rs:25:26 | LL | is_my_unsafe_trait::<ThisImplsTrait>(); - | ^^^^^^^^^^^^^^ the trait `MyUnsafeTrait` is not implemented for `ThisImplsTrait` + | ^^^^^^^^^^^^^^ unsatisfied trait bound + | +help: the trait `MyUnsafeTrait` is not implemented for `ThisImplsTrait` + --> $DIR/typeck-default-trait-impl-negation.rs:8:1 | +LL | struct ThisImplsTrait; + | ^^^^^^^^^^^^^^^^^^^^^ note: required by a bound in `is_my_unsafe_trait` --> $DIR/typeck-default-trait-impl-negation.rs:18:26 | diff --git a/tests/ui/issues/issue-77218/issue-77218.fixed b/tests/ui/binding/invalid-assignment-in-while-loop-77218.fixed index 6ce9dd1c2c5..aa662ead21a 100644 --- a/tests/ui/issues/issue-77218/issue-77218.fixed +++ b/tests/ui/binding/invalid-assignment-in-while-loop-77218.fixed @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/77218 //@ run-rustfix fn main() { let value = [7u8]; diff --git a/tests/ui/issues/issue-77218/issue-77218.rs b/tests/ui/binding/invalid-assignment-in-while-loop-77218.rs index 14edc065d0e..9f249180e83 100644 --- a/tests/ui/issues/issue-77218/issue-77218.rs +++ b/tests/ui/binding/invalid-assignment-in-while-loop-77218.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/77218 //@ run-rustfix fn main() { let value = [7u8]; diff --git a/tests/ui/issues/issue-77218/issue-77218.stderr b/tests/ui/binding/invalid-assignment-in-while-loop-77218.stderr index e98e69314d9..e6baf349d28 100644 --- a/tests/ui/issues/issue-77218/issue-77218.stderr +++ b/tests/ui/binding/invalid-assignment-in-while-loop-77218.stderr @@ -1,5 +1,5 @@ error[E0070]: invalid left-hand side of assignment - --> $DIR/issue-77218.rs:4:19 + --> $DIR/invalid-assignment-in-while-loop-77218.rs:5:19 | LL | while Some(0) = value.get(0) {} | - ^ diff --git a/tests/ui/issues/issue-8391.rs b/tests/ui/binding/match-with-at-binding-8391.rs index 20698eed18b..bc4e7be7989 100644 --- a/tests/ui/issues/issue-8391.rs +++ b/tests/ui/binding/match-with-at-binding-8391.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/8391 //@ run-pass fn main() { diff --git a/tests/ui/issues/issue-7092.rs b/tests/ui/binding/method-call-nonsensical-pattern-binding-7092.rs index fab18bd7cf7..4cb04cdf5be 100644 --- a/tests/ui/issues/issue-7092.rs +++ b/tests/ui/binding/method-call-nonsensical-pattern-binding-7092.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/7092 enum Whatever { } diff --git a/tests/ui/issues/issue-7092.stderr b/tests/ui/binding/method-call-nonsensical-pattern-binding-7092.stderr index e2e57486746..1f8ff2d8df1 100644 --- a/tests/ui/issues/issue-7092.stderr +++ b/tests/ui/binding/method-call-nonsensical-pattern-binding-7092.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/issue-7092.rs:6:9 + --> $DIR/method-call-nonsensical-pattern-binding-7092.rs:7:9 | LL | match x { | - this expression has type `Whatever` diff --git a/tests/ui/issues/issue-8860.rs b/tests/ui/binding/ref-pattern-drop-behavior-8860.rs index 3af61576fe1..1a67caf021c 100644 --- a/tests/ui/issues/issue-8860.rs +++ b/tests/ui/binding/ref-pattern-drop-behavior-8860.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/8860 //@ run-pass // FIXME(static_mut_refs): this could use an atomic #![allow(static_mut_refs)] diff --git a/tests/ui/binop/binops.rs b/tests/ui/binop/binops.rs index 7142190a45b..702e9a61345 100644 --- a/tests/ui/binop/binops.rs +++ b/tests/ui/binop/binops.rs @@ -35,6 +35,7 @@ fn test_bool() { assert_eq!(true ^ true, false); } +#[allow(integer_to_ptr_transmutes)] fn test_ptr() { unsafe { let p1: *const u8 = ::std::mem::transmute(0_usize); diff --git a/tests/ui/issues/issue-6738.rs b/tests/ui/binop/struct-field-generic-type-binary-assignment-error-6738.rs index a2f8dfe9c49..856caa2b297 100644 --- a/tests/ui/issues/issue-6738.rs +++ b/tests/ui/binop/struct-field-generic-type-binary-assignment-error-6738.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/6738 struct Foo<T> { x: T, } diff --git a/tests/ui/issues/issue-6738.stderr b/tests/ui/binop/struct-field-generic-type-binary-assignment-error-6738.stderr index f22d6a2e468..060d33079d3 100644 --- a/tests/ui/issues/issue-6738.stderr +++ b/tests/ui/binop/struct-field-generic-type-binary-assignment-error-6738.stderr @@ -1,5 +1,5 @@ error[E0368]: binary assignment operation `+=` cannot be applied to type `T` - --> $DIR/issue-6738.rs:6:9 + --> $DIR/struct-field-generic-type-binary-assignment-error-6738.rs:7:9 | LL | self.x += v.x; | ------^^^^^^^ diff --git a/tests/ui/issues/auxiliary/issue-5518.rs b/tests/ui/borrowck/auxiliary/aux-5518.rs index bfe96552a5c..bfe96552a5c 100644 --- a/tests/ui/issues/auxiliary/issue-5518.rs +++ b/tests/ui/borrowck/auxiliary/aux-5518.rs diff --git a/tests/ui/borrowck/borrow-raw-address-of-deref-mutability.stderr b/tests/ui/borrowck/borrow-raw-address-of-deref-mutability.stderr index ac0241cf9a7..0a32cccff1d 100644 --- a/tests/ui/borrowck/borrow-raw-address-of-deref-mutability.stderr +++ b/tests/ui/borrowck/borrow-raw-address-of-deref-mutability.stderr @@ -15,10 +15,10 @@ error[E0596]: cannot borrow `*x` as mutable, as it is behind a `*const` pointer LL | let q = &raw mut *x; | ^^^^^^^^^^^ `x` is a `*const` pointer, so the data it refers to cannot be borrowed as mutable | -help: consider changing this to be a mutable pointer +help: consider specifying this binding's type | -LL | let x = &mut 0 as *const i32; - | +++ +LL | let x: *mut i32 = &0 as *const i32; + | ++++++++++ error: aborting due to 2 previous errors diff --git a/tests/ui/borrowck/borrowck-access-permissions.stderr b/tests/ui/borrowck/borrowck-access-permissions.stderr index ade10dbbfbd..87717a53290 100644 --- a/tests/ui/borrowck/borrowck-access-permissions.stderr +++ b/tests/ui/borrowck/borrowck-access-permissions.stderr @@ -43,10 +43,11 @@ error[E0596]: cannot borrow `*ptr_x` as mutable, as it is behind a `*const` poin LL | let _y1 = &mut *ptr_x; | ^^^^^^^^^^^ `ptr_x` is a `*const` pointer, so the data it refers to cannot be borrowed as mutable | -help: consider changing this to be a mutable pointer +help: consider changing this binding's type + | +LL - let ptr_x: *const _ = &x; +LL + let ptr_x: *mut i32 = &x; | -LL | let ptr_x: *const _ = &mut x; - | +++ error[E0596]: cannot borrow `*foo_ref.f` as mutable, as it is behind a `&` reference --> $DIR/borrowck-access-permissions.rs:59:18 diff --git a/tests/ui/borrowck/borrowck-unsafe-static-mutable-borrows.stderr b/tests/ui/borrowck/borrowck-unsafe-static-mutable-borrows.stderr index c55923097fc..709cf76b444 100644 --- a/tests/ui/borrowck/borrowck-unsafe-static-mutable-borrows.stderr +++ b/tests/ui/borrowck/borrowck-unsafe-static-mutable-borrows.stderr @@ -6,7 +6,7 @@ LL | let sfoo: *mut Foo = &mut SFOO; | = note: for more information, see <https://doc.rust-lang.org/edition-guide/rust-2024/static-mut-references.html> = note: mutable references to mutable statics are dangerous; it's undefined behavior if any other pointer to the static is used or if any other reference is created for the static while the mutable reference lives - = note: `#[warn(static_mut_refs)]` on by default + = note: `#[warn(static_mut_refs)]` (part of `#[warn(rust_2024_compatibility)]`) on by default help: use `&raw mut` instead to create a raw pointer | LL | let sfoo: *mut Foo = &raw mut SFOO; diff --git a/tests/ui/issues/issue-5884.rs b/tests/ui/borrowck/borrowed-pointer-in-struct-5884.rs index 559b897395d..d2f17cf905d 100644 --- a/tests/ui/issues/issue-5884.rs +++ b/tests/ui/borrowck/borrowed-pointer-in-struct-5884.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/5884 //@ build-pass #![allow(dead_code)] diff --git a/tests/ui/borrowck/ice-mutability-error-slicing-121807.stderr b/tests/ui/borrowck/ice-mutability-error-slicing-121807.stderr index 02d5231f713..8e1cd800b37 100644 --- a/tests/ui/borrowck/ice-mutability-error-slicing-121807.stderr +++ b/tests/ui/borrowck/ice-mutability-error-slicing-121807.stderr @@ -21,7 +21,7 @@ LL | extern "C" fn read_dword(Self::Assoc<'_>) -> u16; | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! = note: for more information, see issue #41686 <https://github.com/rust-lang/rust/issues/41686> - = note: `#[warn(anonymous_parameters)]` on by default + = note: `#[warn(anonymous_parameters)]` (part of `#[warn(rust_2018_compatibility)]`) on by default error[E0185]: method `read_dword` has a `&self` declaration in the impl, but not in the trait --> $DIR/ice-mutability-error-slicing-121807.rs:17:5 diff --git a/tests/ui/borrowck/implementation-not-general-enough-ice-133252.stderr b/tests/ui/borrowck/implementation-not-general-enough-ice-133252.stderr index 4ec4d2138db..5389226f7a7 100644 --- a/tests/ui/borrowck/implementation-not-general-enough-ice-133252.stderr +++ b/tests/ui/borrowck/implementation-not-general-enough-ice-133252.stderr @@ -22,12 +22,6 @@ LL | force_send(async_load(¬_static)); ... LL | } | - `not_static` dropped here while still borrowed - | -note: due to current limitations in the borrow checker, this implies a `'static` lifetime - --> $DIR/implementation-not-general-enough-ice-133252.rs:16:18 - | -LL | fn force_send<T: Send>(_: T) {} - | ^^^^ error: aborting due to 2 previous errors diff --git a/tests/ui/issues/issue-5550.rs b/tests/ui/borrowck/incorrect-loan-error-on-local-update-5550.rs index 41de8ee5d32..2258d768657 100644 --- a/tests/ui/issues/issue-5550.rs +++ b/tests/ui/borrowck/incorrect-loan-error-on-local-update-5550.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/5550 //@ run-pass #![allow(unused_assignments)] diff --git a/tests/ui/issues/issue-78192.rs b/tests/ui/borrowck/incorrect-use-after-storage-end-78192.rs index bec2a82910c..99a1d37eb4d 100644 --- a/tests/ui/issues/issue-78192.rs +++ b/tests/ui/borrowck/incorrect-use-after-storage-end-78192.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/78192 //@ run-pass #![allow(unused_assignments)] diff --git a/tests/ui/issues/issue-7660.rs b/tests/ui/borrowck/rvalue-lifetime-match-equivalence-7660.rs index 104cdad8f7b..90526de14e7 100644 --- a/tests/ui/issues/issue-7660.rs +++ b/tests/ui/borrowck/rvalue-lifetime-match-equivalence-7660.rs @@ -1,9 +1,9 @@ +// https://github.com/rust-lang/rust/issues/7660 //@ run-pass #![allow(unused_variables)] // Regression test for issue 7660 // rvalue lifetime too short when equivalent `match` works - use std::collections::HashMap; struct A(isize, isize); diff --git a/tests/ui/issues/issue-5708.rs b/tests/ui/borrowck/struct-with-reference-to-trait-5708.rs index 6fa3cfa4724..5157a3bf36b 100644 --- a/tests/ui/issues/issue-5708.rs +++ b/tests/ui/borrowck/struct-with-reference-to-trait-5708.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/5708 //@ run-pass #![allow(unused_variables)] /* @@ -10,7 +11,6 @@ This does not occur with concrete types, only with references to traits. */ - // original trait Inner { fn print(&self); @@ -38,7 +38,6 @@ pub fn main() { outer.inner.print(); } - // minimal pub trait MyTrait<T> { fn dummy(&self, t: T) -> T { panic!() } diff --git a/tests/ui/borrowck/suggestions/overloaded-index-not-mut-but-should-be-mut.fixed b/tests/ui/borrowck/suggestions/overloaded-index-not-mut-but-should-be-mut.fixed new file mode 100644 index 00000000000..6303733967b --- /dev/null +++ b/tests/ui/borrowck/suggestions/overloaded-index-not-mut-but-should-be-mut.fixed @@ -0,0 +1,21 @@ +//@ run-rustfix +fn main() { + let mut map = std::collections::BTreeMap::new(); + map.insert(0, "string".to_owned()); + + let string = map.get_mut(&0).unwrap(); + string.push_str("test"); + //~^ ERROR cannot borrow `*string` as mutable, as it is behind a `&` reference + + let mut map = std::collections::HashMap::new(); + map.insert(0, "string".to_owned()); + + let string = map.get_mut(&0).unwrap(); + string.push_str("test"); + //~^ ERROR cannot borrow `*string` as mutable, as it is behind a `&` reference + + let mut vec = vec![String::new(), String::new()]; + let string = &mut vec[0]; + string.push_str("test"); + //~^ ERROR cannot borrow `*string` as mutable, as it is behind a `&` reference +} diff --git a/tests/ui/borrowck/suggestions/overloaded-index-not-mut-but-should-be-mut.rs b/tests/ui/borrowck/suggestions/overloaded-index-not-mut-but-should-be-mut.rs new file mode 100644 index 00000000000..be1a63a5e69 --- /dev/null +++ b/tests/ui/borrowck/suggestions/overloaded-index-not-mut-but-should-be-mut.rs @@ -0,0 +1,21 @@ +//@ run-rustfix +fn main() { + let mut map = std::collections::BTreeMap::new(); + map.insert(0, "string".to_owned()); + + let string = &map[&0]; + string.push_str("test"); + //~^ ERROR cannot borrow `*string` as mutable, as it is behind a `&` reference + + let mut map = std::collections::HashMap::new(); + map.insert(0, "string".to_owned()); + + let string = &map[&0]; + string.push_str("test"); + //~^ ERROR cannot borrow `*string` as mutable, as it is behind a `&` reference + + let mut vec = vec![String::new(), String::new()]; + let string = &vec[0]; + string.push_str("test"); + //~^ ERROR cannot borrow `*string` as mutable, as it is behind a `&` reference +} diff --git a/tests/ui/borrowck/suggestions/overloaded-index-not-mut-but-should-be-mut.stderr b/tests/ui/borrowck/suggestions/overloaded-index-not-mut-but-should-be-mut.stderr new file mode 100644 index 00000000000..44cc9aefcf1 --- /dev/null +++ b/tests/ui/borrowck/suggestions/overloaded-index-not-mut-but-should-be-mut.stderr @@ -0,0 +1,38 @@ +error[E0596]: cannot borrow `*string` as mutable, as it is behind a `&` reference + --> $DIR/overloaded-index-not-mut-but-should-be-mut.rs:7:5 + | +LL | string.push_str("test"); + | ^^^^^^ `string` is a `&` reference, so the data it refers to cannot be borrowed as mutable + | +help: consider using `get_mut` + | +LL - let string = &map[&0]; +LL + let string = map.get_mut(&0).unwrap(); + | + +error[E0596]: cannot borrow `*string` as mutable, as it is behind a `&` reference + --> $DIR/overloaded-index-not-mut-but-should-be-mut.rs:14:5 + | +LL | string.push_str("test"); + | ^^^^^^ `string` is a `&` reference, so the data it refers to cannot be borrowed as mutable + | +help: consider using `get_mut` + | +LL - let string = &map[&0]; +LL + let string = map.get_mut(&0).unwrap(); + | + +error[E0596]: cannot borrow `*string` as mutable, as it is behind a `&` reference + --> $DIR/overloaded-index-not-mut-but-should-be-mut.rs:19:5 + | +LL | string.push_str("test"); + | ^^^^^^ `string` is a `&` reference, so the data it refers to cannot be borrowed as mutable + | +help: consider changing this to be a mutable reference + | +LL | let string = &mut vec[0]; + | +++ + +error: aborting due to 3 previous errors + +For more information about this error, try `rustc --explain E0596`. diff --git a/tests/ui/borrowck/suggestions/overloaded-index-without-indexmut.rs b/tests/ui/borrowck/suggestions/overloaded-index-without-indexmut.rs new file mode 100644 index 00000000000..06eb5b52e5f --- /dev/null +++ b/tests/ui/borrowck/suggestions/overloaded-index-without-indexmut.rs @@ -0,0 +1,16 @@ +use std::ops::Index; + +struct MyType; +impl Index<usize> for MyType { + type Output = String; + fn index(&self, _idx: usize) -> &String { + const { &String::new() } + } +} + +fn main() { + let x = MyType; + let y = &x[0]; + y.push_str(""); + //~^ ERROR cannot borrow `*y` as mutable, as it is behind a `&` reference +} diff --git a/tests/ui/borrowck/suggestions/overloaded-index-without-indexmut.stderr b/tests/ui/borrowck/suggestions/overloaded-index-without-indexmut.stderr new file mode 100644 index 00000000000..6a46332a5d7 --- /dev/null +++ b/tests/ui/borrowck/suggestions/overloaded-index-without-indexmut.stderr @@ -0,0 +1,9 @@ +error[E0596]: cannot borrow `*y` as mutable, as it is behind a `&` reference + --> $DIR/overloaded-index-without-indexmut.rs:14:5 + | +LL | y.push_str(""); + | ^ `y` is a `&` reference, so the data it refers to cannot be borrowed as mutable + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0596`. diff --git a/tests/ui/borrowck/trait-impl-argument-difference-ice.stderr b/tests/ui/borrowck/trait-impl-argument-difference-ice.stderr index a656bb67bcb..3d54d5269ae 100644 --- a/tests/ui/borrowck/trait-impl-argument-difference-ice.stderr +++ b/tests/ui/borrowck/trait-impl-argument-difference-ice.stderr @@ -6,7 +6,7 @@ LL | extern "C" fn read_dword(Self::Assoc<'_>) -> u16; | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! = note: for more information, see issue #41686 <https://github.com/rust-lang/rust/issues/41686> - = note: `#[warn(anonymous_parameters)]` on by default + = note: `#[warn(anonymous_parameters)]` (part of `#[warn(rust_2018_compatibility)]`) on by default error[E0185]: method `read_dword` has a `&self` declaration in the impl, but not in the trait --> $DIR/trait-impl-argument-difference-ice.rs:14:5 diff --git a/tests/ui/borrowck/trait-method-lifetime-substitution-5518.rs b/tests/ui/borrowck/trait-method-lifetime-substitution-5518.rs new file mode 100644 index 00000000000..f254030a011 --- /dev/null +++ b/tests/ui/borrowck/trait-method-lifetime-substitution-5518.rs @@ -0,0 +1,7 @@ +// https://github.com/rust-lang/rust/issues/5518 +//@ run-pass +//@ aux-build:aux-5518.rs + +extern crate aux_5518 as other; + +fn main() {} diff --git a/tests/ui/issues/issue-6557.rs b/tests/ui/box/box-patterns-feature-usage-6557.rs index 64a025a294f..e0d9b25c366 100644 --- a/tests/ui/issues/issue-6557.rs +++ b/tests/ui/box/box-patterns-feature-usage-6557.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/6557 //@ check-pass #![allow(dead_code)] diff --git a/tests/ui/c-variadic/issue-86053-1.stderr b/tests/ui/c-variadic/issue-86053-1.stderr index dc323f9a234..3bf8b7ba5d8 100644 --- a/tests/ui/c-variadic/issue-86053-1.stderr +++ b/tests/ui/c-variadic/issue-86053-1.stderr @@ -57,10 +57,10 @@ error[E0412]: cannot find type `F` in this scope | LL | self , ... , self , self , ... ) where F : FnOnce ( & 'a & 'b usize ) { | ^ + | --> $SRC_DIR/core/src/ops/function.rs:LL:COL | = note: similarly named trait `Fn` defined here - | help: a trait with a similar name exists | LL | self , ... , self , self , ... ) where Fn : FnOnce ( & 'a & 'b usize ) { diff --git a/tests/ui/c-variadic/same-program-multiple-abis-arm.rs b/tests/ui/c-variadic/same-program-multiple-abis-arm.rs new file mode 100644 index 00000000000..1b0bdecabfb --- /dev/null +++ b/tests/ui/c-variadic/same-program-multiple-abis-arm.rs @@ -0,0 +1,77 @@ +#![feature(extended_varargs_abi_support)] +//@ run-pass +//@ only-arm +//@ ignore-thumb (this test uses arm assembly) +//@ only-eabihf (the assembly below requires float hardware support) + +// Check that multiple c-variadic calling conventions can be used in the same program. +// +// Clang and gcc reject defining functions with a non-default calling convention and a variable +// argument list, so C programs that use multiple c-variadic calling conventions are unlikely +// to come up. Here we validate that our codegen backends do in fact generate correct code. + +extern "C" { + fn variadic_c(_: f64, _: ...) -> f64; +} + +extern "aapcs" { + fn variadic_aapcs(_: f64, _: ...) -> f64; +} + +fn main() { + unsafe { + assert_eq!(variadic_c(1.0, 2.0, 3.0), 1.0 + 2.0 + 3.0); + assert_eq!(variadic_aapcs(1.0, 2.0, 3.0), 1.0 + 2.0 + 3.0); + } +} + +// This assembly was generated using https://godbolt.org/z/xcW6a1Tj5, and corresponds to the +// following code compiled for the `armv7-unknown-linux-gnueabihf` target: +// +// ```rust +// #![feature(c_variadic)] +// +// #[unsafe(no_mangle)] +// unsafe extern "C" fn variadic(a: f64, mut args: ...) -> f64 { +// let b = args.arg::<f64>(); +// let c = args.arg::<f64>(); +// +// a + b + c +// } +// ``` +// +// This function uses floats (and passes one normal float argument) because the aapcs and C calling +// conventions differ in how floats are passed, e.g. https://godbolt.org/z/sz799f51x. However, for +// c-variadic functions, both ABIs actually behave the same, based on: +// +// https://github.com/ARM-software/abi-aa/blob/main/aapcs32/aapcs32.rst#65parameter-passing +// +// > A variadic function is always marshaled as for the base standard. +// +// https://github.com/ARM-software/abi-aa/blob/main/aapcs32/aapcs32.rst#7the-standard-variants +// +// > This section applies only to non-variadic functions. For a variadic function the base standard +// > is always used both for argument passing and result return. +core::arch::global_asm!( + r#" +{variadic_c}: +{variadic_aapcs}: + sub sp, sp, #12 + stmib sp, {{r2, r3}} + vmov d0, r0, r1 + add r0, sp, #4 + vldr d1, [sp, #4] + add r0, r0, #15 + bic r0, r0, #7 + vadd.f64 d0, d0, d1 + add r1, r0, #8 + str r1, [sp] + vldr d1, [r0] + vadd.f64 d0, d0, d1 + vmov r0, r1, d0 + add sp, sp, #12 + bx lr + "#, + variadic_c = sym variadic_c, + variadic_aapcs = sym variadic_aapcs, +); diff --git a/tests/ui/c-variadic/same-program-multiple-abis.rs b/tests/ui/c-variadic/same-program-multiple-abis-x86_64.rs index b21accb999e..b21accb999e 100644 --- a/tests/ui/c-variadic/same-program-multiple-abis.rs +++ b/tests/ui/c-variadic/same-program-multiple-abis-x86_64.rs diff --git a/tests/ui/issues/issue-54094.rs b/tests/ui/cast/associated-type-bounds-cast-54094.rs index 4ca7d1d81b6..c9f307e95b9 100644 --- a/tests/ui/issues/issue-54094.rs +++ b/tests/ui/cast/associated-type-bounds-cast-54094.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/54094 //@ check-pass trait Zoo { type X; diff --git a/tests/ui/cast/cast-rfc0401-vtable-kinds.stderr b/tests/ui/cast/cast-rfc0401-vtable-kinds.stderr index 01277fd632e..5f5238dd891 100644 --- a/tests/ui/cast/cast-rfc0401-vtable-kinds.stderr +++ b/tests/ui/cast/cast-rfc0401-vtable-kinds.stderr @@ -4,7 +4,7 @@ warning: trait `Bar` is never used LL | trait Bar { | ^^^ | - = note: `#[warn(dead_code)]` on by default + = note: `#[warn(dead_code)]` (part of `#[warn(unused)]`) on by default warning: 1 warning emitted diff --git a/tests/ui/cast/coercion-as-explicit-cast.stderr b/tests/ui/cast/coercion-as-explicit-cast.stderr index d66298c7d44..9553ddd6567 100644 --- a/tests/ui/cast/coercion-as-explicit-cast.stderr +++ b/tests/ui/cast/coercion-as-explicit-cast.stderr @@ -6,7 +6,7 @@ LL | trait Foo { LL | fn foo(&self) {} | ^^^ | - = note: `#[warn(dead_code)]` on by default + = note: `#[warn(dead_code)]` (part of `#[warn(unused)]`) on by default warning: 1 warning emitted diff --git a/tests/ui/cast/fat-ptr-cast-rpass.stderr b/tests/ui/cast/fat-ptr-cast-rpass.stderr index d01688e0cc3..b314f397c4f 100644 --- a/tests/ui/cast/fat-ptr-cast-rpass.stderr +++ b/tests/ui/cast/fat-ptr-cast-rpass.stderr @@ -6,7 +6,7 @@ LL | trait Foo { LL | fn foo(&self) {} | ^^^ | - = note: `#[warn(dead_code)]` on by default + = note: `#[warn(dead_code)]` (part of `#[warn(unused)]`) on by default warning: 1 warning emitted diff --git a/tests/ui/issues/issue-6318.rs b/tests/ui/cast/owned-struct-to-trait-cast-6318.rs index d3f08285a93..8cfc77c4274 100644 --- a/tests/ui/issues/issue-6318.rs +++ b/tests/ui/cast/owned-struct-to-trait-cast-6318.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/6318 //@ run-pass pub enum Thing { diff --git a/tests/ui/check-cfg/target_feature.stderr b/tests/ui/check-cfg/target_feature.stderr index 5dd81f486c8..258f2132466 100644 --- a/tests/ui/check-cfg/target_feature.stderr +++ b/tests/ui/check-cfg/target_feature.stderr @@ -6,6 +6,7 @@ LL | cfg!(target_feature = "_UNEXPECTED_VALUE"); | = note: expected values for `target_feature` are: `10e60` `2e3` +`32s` `3e3r1` `3e3r2` `3e3r3` @@ -242,6 +243,7 @@ LL | cfg!(target_feature = "_UNEXPECTED_VALUE"); `relax` `relaxed-simd` `rtm` +`rva23u64` `sb` `scq` `sha` @@ -303,6 +305,7 @@ LL | cfg!(target_feature = "_UNEXPECTED_VALUE"); `ssve-fp8dot2` `ssve-fp8dot4` `ssve-fp8fma` +`supm` `sve` `sve-b16b16` `sve2` diff --git a/tests/ui/closures/2229_closure_analysis/diagnostics/borrowck/borrowck-4.rs b/tests/ui/closures/2229_closure_analysis/diagnostics/borrowck/borrowck-4.rs index c7a37a81848..123e23d6107 100644 --- a/tests/ui/closures/2229_closure_analysis/diagnostics/borrowck/borrowck-4.rs +++ b/tests/ui/closures/2229_closure_analysis/diagnostics/borrowck/borrowck-4.rs @@ -5,12 +5,12 @@ struct Point { x: i32, y: i32, } -fn foo () -> impl FnMut()->() { +fn foo () -> impl FnMut() { let mut p = Point {x: 1, y: 2 }; let mut c = || { - //~^ ERROR closure may outlive the current function, but it borrows `p` - p.x+=5; + p.x += 5; println!("{:?}", p); + //~^ ERROR `p` does not live long enough }; c } diff --git a/tests/ui/closures/2229_closure_analysis/diagnostics/borrowck/borrowck-4.stderr b/tests/ui/closures/2229_closure_analysis/diagnostics/borrowck/borrowck-4.stderr index d47f0539b84..96910375e09 100644 --- a/tests/ui/closures/2229_closure_analysis/diagnostics/borrowck/borrowck-4.stderr +++ b/tests/ui/closures/2229_closure_analysis/diagnostics/borrowck/borrowck-4.stderr @@ -1,22 +1,23 @@ -error[E0373]: closure may outlive the current function, but it borrows `p`, which is owned by the current function - --> $DIR/borrowck-4.rs:10:17 +error[E0597]: `p` does not live long enough + --> $DIR/borrowck-4.rs:12:25 | -LL | let mut c = || { - | ^^ may outlive borrowed value `p` -... -LL | println!("{:?}", p); - | - `p` is borrowed here - | -note: closure is returned here - --> $DIR/borrowck-4.rs:15:5 - | -LL | c - | ^ -help: to force the closure to take ownership of `p` (and any other referenced variables), use the `move` keyword - | -LL | let mut c = move || { - | ++++ +LL | let mut p = Point {x: 1, y: 2 }; + | ----- binding `p` declared here +LL | let mut c = || { + | -- + | | + | _________________value captured here + | | +LL | | p.x += 5; +LL | | println!("{:?}", p); + | | ^ borrowed value does not live long enough +LL | | +LL | | }; + | |_____- assignment requires that `p` is borrowed for `'static` +LL | c +LL | } + | - `p` dropped here while still borrowed error: aborting due to 1 previous error -For more information about this error, try `rustc --explain E0373`. +For more information about this error, try `rustc --explain E0597`. diff --git a/tests/ui/closures/2229_closure_analysis/match/issue-87097.stderr b/tests/ui/closures/2229_closure_analysis/match/issue-87097.stderr index 39ec71ba22a..df6e84c0f65 100644 --- a/tests/ui/closures/2229_closure_analysis/match/issue-87097.stderr +++ b/tests/ui/closures/2229_closure_analysis/match/issue-87097.stderr @@ -7,7 +7,7 @@ LL | A, LL | B, | ^ | - = note: `#[warn(dead_code)]` on by default + = note: `#[warn(dead_code)]` (part of `#[warn(unused)]`) on by default warning: unused closure that must be used --> $DIR/issue-87097.rs:17:5 @@ -19,7 +19,7 @@ LL | | }; | |_____^ | = note: closures are lazy and do nothing unless called - = note: `#[warn(unused_must_use)]` on by default + = note: `#[warn(unused_must_use)]` (part of `#[warn(unused)]`) on by default warning: unused closure that must be used --> $DIR/issue-87097.rs:26:5 diff --git a/tests/ui/issues/issue-6153.rs b/tests/ui/closures/closure-mut-argument-6153.rs index cd78c85d94b..ac19c2bd15f 100644 --- a/tests/ui/issues/issue-6153.rs +++ b/tests/ui/closures/closure-mut-argument-6153.rs @@ -1,6 +1,6 @@ +// https://github.com/rust-lang/rust/issues/6153 //@ run-pass - fn swap<F>(f: F) -> Vec<isize> where F: FnOnce(Vec<isize>) -> Vec<isize> { let x = vec![1, 2, 3]; f(x) diff --git a/tests/ui/closures/issue-1460.stderr b/tests/ui/closures/issue-1460.stderr index 15eaf7a9a11..8d6851640f9 100644 --- a/tests/ui/closures/issue-1460.stderr +++ b/tests/ui/closures/issue-1460.stderr @@ -5,7 +5,7 @@ LL | {|i: u32| if 1 == i { }}; | ^^^^^^^^^^^^^^^^^^^^^^ | = note: closures are lazy and do nothing unless called - = note: `#[warn(unused_must_use)]` on by default + = note: `#[warn(unused_must_use)]` (part of `#[warn(unused)]`) on by default warning: 1 warning emitted diff --git a/tests/ui/closures/issue-52437.rs b/tests/ui/closures/issue-52437.rs index 6ac5380a5aa..98b04d179af 100644 --- a/tests/ui/closures/issue-52437.rs +++ b/tests/ui/closures/issue-52437.rs @@ -1,5 +1,5 @@ fn main() { [(); &(&'static: loop { |x| {}; }) as *const _ as usize] - //~^ ERROR: invalid label name `'static` + //~^ ERROR: labels cannot use keyword names //~| ERROR: type annotations needed } diff --git a/tests/ui/closures/issue-52437.stderr b/tests/ui/closures/issue-52437.stderr index 9ba24c7a886..8c6fa097ec5 100644 --- a/tests/ui/closures/issue-52437.stderr +++ b/tests/ui/closures/issue-52437.stderr @@ -1,4 +1,4 @@ -error: invalid label name `'static` +error: labels cannot use keyword names --> $DIR/issue-52437.rs:2:13 | LL | [(); &(&'static: loop { |x| {}; }) as *const _ as usize] diff --git a/tests/ui/closures/issue-78720.stderr b/tests/ui/closures/issue-78720.stderr index 3e95fab441a..987625d22c9 100644 --- a/tests/ui/closures/issue-78720.stderr +++ b/tests/ui/closures/issue-78720.stderr @@ -9,10 +9,10 @@ error[E0412]: cannot find type `F` in this scope | LL | _func: F, | ^ + | --> $SRC_DIR/core/src/ops/function.rs:LL:COL | = note: similarly named trait `Fn` defined here - | help: a trait with a similar name exists | LL | _func: Fn, diff --git a/tests/ui/closures/issue-90871.stderr b/tests/ui/closures/issue-90871.stderr index ef1cb213f73..12020226680 100644 --- a/tests/ui/closures/issue-90871.stderr +++ b/tests/ui/closures/issue-90871.stderr @@ -3,6 +3,7 @@ error[E0412]: cannot find type `n` in this scope | LL | type_ascribe!(2, n([u8; || 1])) | ^ help: a trait with a similar name exists: `Fn` + | --> $SRC_DIR/core/src/ops/function.rs:LL:COL | = note: similarly named trait `Fn` defined here diff --git a/tests/ui/closures/moved-upvar-mut-rebind-11958.stderr b/tests/ui/closures/moved-upvar-mut-rebind-11958.stderr index b12bbcad925..1bf8a8b23a1 100644 --- a/tests/ui/closures/moved-upvar-mut-rebind-11958.stderr +++ b/tests/ui/closures/moved-upvar-mut-rebind-11958.stderr @@ -5,7 +5,7 @@ LL | let _thunk = Box::new(move|| { x = 2; }); | ^ | = help: maybe it is overwritten before being read? - = note: `#[warn(unused_assignments)]` on by default + = note: `#[warn(unused_assignments)]` (part of `#[warn(unused)]`) on by default warning: unused variable: `x` --> $DIR/moved-upvar-mut-rebind-11958.rs:10:36 @@ -14,7 +14,7 @@ LL | let _thunk = Box::new(move|| { x = 2; }); | ^ | = help: did you mean to capture by reference instead? - = note: `#[warn(unused_variables)]` on by default + = note: `#[warn(unused_variables)]` (part of `#[warn(unused)]`) on by default warning: 2 warnings emitted diff --git a/tests/ui/closures/old-closure-expr-precedence.stderr b/tests/ui/closures/old-closure-expr-precedence.stderr index fabece1ad4a..2ab1995075f 100644 --- a/tests/ui/closures/old-closure-expr-precedence.stderr +++ b/tests/ui/closures/old-closure-expr-precedence.stderr @@ -4,7 +4,7 @@ warning: unnecessary trailing semicolons LL | if (true) { 12; };;; -num; | ^^ help: remove these semicolons | - = note: `#[warn(redundant_semicolons)]` on by default + = note: `#[warn(redundant_semicolons)]` (part of `#[warn(unused)]`) on by default warning: 1 warning emitted diff --git a/tests/ui/closures/unused-closure-ice-16256.stderr b/tests/ui/closures/unused-closure-ice-16256.stderr index 9df433add5d..a00b9fbac8e 100644 --- a/tests/ui/closures/unused-closure-ice-16256.stderr +++ b/tests/ui/closures/unused-closure-ice-16256.stderr @@ -5,7 +5,7 @@ LL | |c: u8| buf.push(c); | ^^^^^^^^^^^^^^^^^^^ | = note: closures are lazy and do nothing unless called - = note: `#[warn(unused_must_use)]` on by default + = note: `#[warn(unused_must_use)]` (part of `#[warn(unused)]`) on by default warning: 1 warning emitted diff --git a/tests/ui/codegen/equal-pointers-unequal/as-cast/segfault.rs b/tests/ui/codegen/equal-pointers-unequal/as-cast/segfault.rs index 70cbb9a52f7..c69565a81f2 100644 --- a/tests/ui/codegen/equal-pointers-unequal/as-cast/segfault.rs +++ b/tests/ui/codegen/equal-pointers-unequal/as-cast/segfault.rs @@ -55,6 +55,7 @@ fn main() { // The `Box` has been deallocated by now, so this is a dangling reference! let r: &u8 = &*r; println!("{:p}", r); + println!("{}", i); // The following might segfault. Or it might not. // Depends on the platform semantics diff --git a/tests/ui/codegen/equal-pointers-unequal/exposed-provenance/segfault.rs b/tests/ui/codegen/equal-pointers-unequal/exposed-provenance/segfault.rs index ad1d7b56c8c..b74f85290a7 100644 --- a/tests/ui/codegen/equal-pointers-unequal/exposed-provenance/segfault.rs +++ b/tests/ui/codegen/equal-pointers-unequal/exposed-provenance/segfault.rs @@ -58,6 +58,7 @@ fn main() { // The `Box` has been deallocated by now, so this is a dangling reference! let r: &u8 = &*r; println!("{:p}", r); + println!("{}", i); // The following might segfault. Or it might not. // Depends on the platform semantics diff --git a/tests/ui/codegen/equal-pointers-unequal/strict-provenance/segfault.rs b/tests/ui/codegen/equal-pointers-unequal/strict-provenance/segfault.rs index 637f0042ada..18d5bd33355 100644 --- a/tests/ui/codegen/equal-pointers-unequal/strict-provenance/segfault.rs +++ b/tests/ui/codegen/equal-pointers-unequal/strict-provenance/segfault.rs @@ -58,6 +58,7 @@ fn main() { // The `Box` has been deallocated by now, so this is a dangling reference! let r: &u8 = &*r; println!("{:p}", r); + println!("{}", i); // The following might segfault. Or it might not. // Depends on the platform semantics diff --git a/tests/ui/issues/issue-76042.rs b/tests/ui/codegen/i128-shift-overflow-check-76042.rs index 279e860459d..7ae0806216c 100644 --- a/tests/ui/issues/issue-76042.rs +++ b/tests/ui/codegen/i128-shift-overflow-check-76042.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/76042 //@ run-pass //@ compile-flags: -Coverflow-checks=off -Ccodegen-units=1 -Copt-level=0 diff --git a/tests/ui/codegen/indirect-nocapture.rs b/tests/ui/codegen/indirect-nocapture.rs new file mode 100644 index 00000000000..78024a94c0d --- /dev/null +++ b/tests/ui/codegen/indirect-nocapture.rs @@ -0,0 +1,15 @@ +// Regression test for issue #137668 where an indirect argument have been marked as nocapture +// despite the fact that callee did in fact capture the address. +// +//@ run-pass +//@ compile-flags: -Copt-level=2 + +#[inline(never)] +pub fn f(a: [u32; 64], b: [u32; 64]) -> bool { + &a as *const _ as usize != &b as *const _ as usize +} + +fn main() { + static S: [u32; 64] = [0; 64]; + assert!(f(S, S)); +} diff --git a/tests/ui/issues/issue-54462-mutable-noalias-correctness.rs b/tests/ui/codegen/matrix-row-swap-54462.rs index 70d0bee7332..6bfc600399a 100644 --- a/tests/ui/issues/issue-54462-mutable-noalias-correctness.rs +++ b/tests/ui/codegen/matrix-row-swap-54462.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/54462 //@ run-pass // //@ compile-flags: -Ccodegen-units=1 -O diff --git a/tests/ui/issues/issue-7012.rs b/tests/ui/codegen/static-array-comparison-7012.rs index 69b881e2a43..c08b1c0059b 100644 --- a/tests/ui/issues/issue-7012.rs +++ b/tests/ui/codegen/static-array-comparison-7012.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/7012 //@ run-pass #![allow(non_camel_case_types)] #![allow(non_upper_case_globals)] diff --git a/tests/ui/issues/issue-8248.rs b/tests/ui/coercion/coerce-mut-trait-object-8248.rs index 95f626658cc..a45a4d94315 100644 --- a/tests/ui/issues/issue-8248.rs +++ b/tests/ui/coercion/coerce-mut-trait-object-8248.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/8248 //@ run-pass trait A { diff --git a/tests/ui/issues/issue-8248.stderr b/tests/ui/coercion/coerce-mut-trait-object-8248.stderr index 8570bfaefad..c3b35a7063c 100644 --- a/tests/ui/issues/issue-8248.stderr +++ b/tests/ui/coercion/coerce-mut-trait-object-8248.stderr @@ -1,12 +1,12 @@ warning: method `dummy` is never used - --> $DIR/issue-8248.rs:4:8 + --> $DIR/coerce-mut-trait-object-8248.rs:5:8 | LL | trait A { | - method in this trait LL | fn dummy(&self) { } | ^^^^^ | - = note: `#[warn(dead_code)]` on by default + = note: `#[warn(dead_code)]` (part of `#[warn(unused)]`) on by default warning: 1 warning emitted diff --git a/tests/ui/coercion/fake-sized-ptr-cast.rs b/tests/ui/coercion/fake-sized-ptr-cast.rs new file mode 100644 index 00000000000..4b6bf0eb516 --- /dev/null +++ b/tests/ui/coercion/fake-sized-ptr-cast.rs @@ -0,0 +1,16 @@ +// Make sure borrowck doesn't ICE because it thinks a pointer cast is a metadata-preserving +// wide-to-wide ptr cast when it's actually (falsely) a wide-to-thin ptr cast due to an +// impossible dyn sized bound. + +//@ check-pass + +trait Trait<T> {} + +fn func<'a>(x: *const (dyn Trait<()> + 'a)) +where + dyn Trait<u8> + 'a: Sized, +{ + let _x: *const dyn Trait<u8> = x as _; +} + +fn main() {} diff --git a/tests/ui/coercion/issue-14589.stderr b/tests/ui/coercion/issue-14589.stderr index 5d7b840a8d7..b98444ab7e4 100644 --- a/tests/ui/coercion/issue-14589.stderr +++ b/tests/ui/coercion/issue-14589.stderr @@ -6,7 +6,7 @@ LL | trait Foo { fn dummy(&self) { }} | | | method in this trait | - = note: `#[warn(dead_code)]` on by default + = note: `#[warn(dead_code)]` (part of `#[warn(unused)]`) on by default warning: 1 warning emitted diff --git a/tests/ui/coercion/method-return-trait-object-14399.stderr b/tests/ui/coercion/method-return-trait-object-14399.stderr index 1aa87f53ff8..283358cb77d 100644 --- a/tests/ui/coercion/method-return-trait-object-14399.stderr +++ b/tests/ui/coercion/method-return-trait-object-14399.stderr @@ -6,7 +6,7 @@ LL | trait A { fn foo(&self) {} } | | | method in this trait | - = note: `#[warn(dead_code)]` on by default + = note: `#[warn(dead_code)]` (part of `#[warn(unused)]`) on by default warning: 1 warning emitted diff --git a/tests/ui/issues/issue-8398.rs b/tests/ui/coercion/mut-trait-object-coercion-8398.rs index 7d100b855fd..d87d27582ba 100644 --- a/tests/ui/issues/issue-8398.rs +++ b/tests/ui/coercion/mut-trait-object-coercion-8398.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/8398 //@ check-pass #![allow(dead_code)] diff --git a/tests/ui/coercion/trait-object-coercion-distribution-9951.stderr b/tests/ui/coercion/trait-object-coercion-distribution-9951.stderr index 0c672aa9b33..04e05ed8d6b 100644 --- a/tests/ui/coercion/trait-object-coercion-distribution-9951.stderr +++ b/tests/ui/coercion/trait-object-coercion-distribution-9951.stderr @@ -6,7 +6,7 @@ LL | trait Bar { LL | fn noop(&self); | ^^^^ | - = note: `#[warn(dead_code)]` on by default + = note: `#[warn(dead_code)]` (part of `#[warn(unused)]`) on by default warning: 1 warning emitted diff --git a/tests/ui/coherence/coherence-fn-covariant-bound-vs-static.stderr b/tests/ui/coherence/coherence-fn-covariant-bound-vs-static.stderr index 01694eaf5d1..41164e99e6d 100644 --- a/tests/ui/coherence/coherence-fn-covariant-bound-vs-static.stderr +++ b/tests/ui/coherence/coherence-fn-covariant-bound-vs-static.stderr @@ -9,7 +9,7 @@ LL | impl<'a> Trait for fn(fn(&'a ())) {} = warning: the behavior may change in a future release = note: for more information, see issue #56105 <https://github.com/rust-lang/rust/issues/56105> = note: this behavior recently changed as a result of a bug fix; see rust-lang/rust#56105 for details - = note: `#[warn(coherence_leak_check)]` on by default + = note: `#[warn(coherence_leak_check)]` (part of `#[warn(future_incompatible)]`) on by default warning: 1 warning emitted diff --git a/tests/ui/coherence/coherence-fn-inputs.stderr b/tests/ui/coherence/coherence-fn-inputs.stderr index 56f3a14833e..75df33913a9 100644 --- a/tests/ui/coherence/coherence-fn-inputs.stderr +++ b/tests/ui/coherence/coherence-fn-inputs.stderr @@ -9,7 +9,7 @@ LL | impl Trait for for<'c> fn(&'c u32, &'c u32) { = warning: the behavior may change in a future release = note: for more information, see issue #56105 <https://github.com/rust-lang/rust/issues/56105> = note: this behavior recently changed as a result of a bug fix; see rust-lang/rust#56105 for details - = note: `#[warn(coherence_leak_check)]` on by default + = note: `#[warn(coherence_leak_check)]` (part of `#[warn(future_incompatible)]`) on by default warning: 1 warning emitted diff --git a/tests/ui/coherence/coherence-subtyping.stderr b/tests/ui/coherence/coherence-subtyping.stderr index 42f256ace78..f380ea87829 100644 --- a/tests/ui/coherence/coherence-subtyping.stderr +++ b/tests/ui/coherence/coherence-subtyping.stderr @@ -10,7 +10,7 @@ LL | impl TheTrait for for<'a> fn(&'a u8, &'a u8) -> &'a u8 { = warning: the behavior may change in a future release = note: for more information, see issue #56105 <https://github.com/rust-lang/rust/issues/56105> = note: this behavior recently changed as a result of a bug fix; see rust-lang/rust#56105 for details - = note: `#[warn(coherence_leak_check)]` on by default + = note: `#[warn(coherence_leak_check)]` (part of `#[warn(future_incompatible)]`) on by default warning: 1 warning emitted diff --git a/tests/ui/coherence/fuzzing/best-obligation-ICE.stderr b/tests/ui/coherence/fuzzing/best-obligation-ICE.stderr index fe28f4ff136..dedc8951041 100644 --- a/tests/ui/coherence/fuzzing/best-obligation-ICE.stderr +++ b/tests/ui/coherence/fuzzing/best-obligation-ICE.stderr @@ -11,8 +11,13 @@ error[E0277]: the trait bound `W<W<T>>: Trait` is not satisfied --> $DIR/best-obligation-ICE.rs:10:19 | LL | impl<T> Trait for W<W<W<T>>> {} - | ^^^^^^^^^^ the trait `Trait` is not implemented for `W<W<T>>` + | ^^^^^^^^^^ unsatisfied trait bound | +help: the trait `Trait` is not implemented for `W<W<T>>` + --> $DIR/best-obligation-ICE.rs:9:1 + | +LL | struct W<T: Trait>(*mut T); + | ^^^^^^^^^^^^^^^^^^ note: required by a bound in `W` --> $DIR/best-obligation-ICE.rs:9:13 | @@ -27,8 +32,13 @@ error[E0277]: the trait bound `W<T>: Trait` is not satisfied --> $DIR/best-obligation-ICE.rs:10:19 | LL | impl<T> Trait for W<W<W<T>>> {} - | ^^^^^^^^^^ the trait `Trait` is not implemented for `W<T>` + | ^^^^^^^^^^ unsatisfied trait bound | +help: the trait `Trait` is not implemented for `W<T>` + --> $DIR/best-obligation-ICE.rs:9:1 + | +LL | struct W<T: Trait>(*mut T); + | ^^^^^^^^^^^^^^^^^^ note: required by a bound in `W` --> $DIR/best-obligation-ICE.rs:9:13 | diff --git a/tests/ui/coherence/orphan-check-alias.classic.stderr b/tests/ui/coherence/orphan-check-alias.classic.stderr index 3fd62b05b4d..25fde6ee1d2 100644 --- a/tests/ui/coherence/orphan-check-alias.classic.stderr +++ b/tests/ui/coherence/orphan-check-alias.classic.stderr @@ -8,7 +8,7 @@ LL | impl<T> foreign::Trait2<B, T> for <T as Id>::Assoc { = note: for more information, see issue #124559 <https://github.com/rust-lang/rust/issues/124559> = note: implementing a foreign trait is only possible if at least one of the types for which it is implemented is local, and no uncovered type parameters appear before that first local type = note: in this case, 'before' refers to the following order: `impl<..> ForeignTrait<T1, ..., Tn> for T0`, where `T0` is the first and `Tn` is the last - = note: `#[warn(uncovered_param_in_projection)]` on by default + = note: `#[warn(uncovered_param_in_projection)]` (part of `#[warn(future_incompatible)]`) on by default warning: 1 warning emitted diff --git a/tests/ui/coherence/orphan-check-alias.next.stderr b/tests/ui/coherence/orphan-check-alias.next.stderr index 3fd62b05b4d..25fde6ee1d2 100644 --- a/tests/ui/coherence/orphan-check-alias.next.stderr +++ b/tests/ui/coherence/orphan-check-alias.next.stderr @@ -8,7 +8,7 @@ LL | impl<T> foreign::Trait2<B, T> for <T as Id>::Assoc { = note: for more information, see issue #124559 <https://github.com/rust-lang/rust/issues/124559> = note: implementing a foreign trait is only possible if at least one of the types for which it is implemented is local, and no uncovered type parameters appear before that first local type = note: in this case, 'before' refers to the following order: `impl<..> ForeignTrait<T1, ..., Tn> for T0`, where `T0` is the first and `Tn` is the last - = note: `#[warn(uncovered_param_in_projection)]` on by default + = note: `#[warn(uncovered_param_in_projection)]` (part of `#[warn(future_incompatible)]`) on by default warning: 1 warning emitted diff --git a/tests/ui/coherence/orphan-check-projections-not-covering-ambiguity.classic.stderr b/tests/ui/coherence/orphan-check-projections-not-covering-ambiguity.classic.stderr index d83a56c0bd0..464413e9f38 100644 --- a/tests/ui/coherence/orphan-check-projections-not-covering-ambiguity.classic.stderr +++ b/tests/ui/coherence/orphan-check-projections-not-covering-ambiguity.classic.stderr @@ -8,7 +8,7 @@ LL | impl<T> foreign::Trait1<Local, T> for <T as Project>::Output {} = note: for more information, see issue #124559 <https://github.com/rust-lang/rust/issues/124559> = note: implementing a foreign trait is only possible if at least one of the types for which it is implemented is local, and no uncovered type parameters appear before that first local type = note: in this case, 'before' refers to the following order: `impl<..> ForeignTrait<T1, ..., Tn> for T0`, where `T0` is the first and `Tn` is the last - = note: `#[warn(uncovered_param_in_projection)]` on by default + = note: `#[warn(uncovered_param_in_projection)]` (part of `#[warn(future_incompatible)]`) on by default warning: 1 warning emitted diff --git a/tests/ui/coherence/orphan-check-projections-not-covering-ambiguity.next.stderr b/tests/ui/coherence/orphan-check-projections-not-covering-ambiguity.next.stderr index d83a56c0bd0..464413e9f38 100644 --- a/tests/ui/coherence/orphan-check-projections-not-covering-ambiguity.next.stderr +++ b/tests/ui/coherence/orphan-check-projections-not-covering-ambiguity.next.stderr @@ -8,7 +8,7 @@ LL | impl<T> foreign::Trait1<Local, T> for <T as Project>::Output {} = note: for more information, see issue #124559 <https://github.com/rust-lang/rust/issues/124559> = note: implementing a foreign trait is only possible if at least one of the types for which it is implemented is local, and no uncovered type parameters appear before that first local type = note: in this case, 'before' refers to the following order: `impl<..> ForeignTrait<T1, ..., Tn> for T0`, where `T0` is the first and `Tn` is the last - = note: `#[warn(uncovered_param_in_projection)]` on by default + = note: `#[warn(uncovered_param_in_projection)]` (part of `#[warn(future_incompatible)]`) on by default warning: 1 warning emitted diff --git a/tests/ui/coherence/orphan-check-projections-not-covering-multiple-params.classic.stderr b/tests/ui/coherence/orphan-check-projections-not-covering-multiple-params.classic.stderr index 8964fefedd4..0465fad2119 100644 --- a/tests/ui/coherence/orphan-check-projections-not-covering-multiple-params.classic.stderr +++ b/tests/ui/coherence/orphan-check-projections-not-covering-multiple-params.classic.stderr @@ -8,7 +8,7 @@ LL | impl<T, U> foreign::Trait0<LocalTy, T, U> for <() as Trait<T, U>>::Assoc {} = note: for more information, see issue #124559 <https://github.com/rust-lang/rust/issues/124559> = note: implementing a foreign trait is only possible if at least one of the types for which it is implemented is local, and no uncovered type parameters appear before that first local type = note: in this case, 'before' refers to the following order: `impl<..> ForeignTrait<T1, ..., Tn> for T0`, where `T0` is the first and `Tn` is the last - = note: `#[warn(uncovered_param_in_projection)]` on by default + = note: `#[warn(uncovered_param_in_projection)]` (part of `#[warn(future_incompatible)]`) on by default warning[E0210]: type parameter `U` must be covered by another type when it appears before the first local type (`LocalTy`) --> $DIR/orphan-check-projections-not-covering-multiple-params.rs:17:9 diff --git a/tests/ui/coherence/orphan-check-projections-not-covering-multiple-params.next.stderr b/tests/ui/coherence/orphan-check-projections-not-covering-multiple-params.next.stderr index 8964fefedd4..0465fad2119 100644 --- a/tests/ui/coherence/orphan-check-projections-not-covering-multiple-params.next.stderr +++ b/tests/ui/coherence/orphan-check-projections-not-covering-multiple-params.next.stderr @@ -8,7 +8,7 @@ LL | impl<T, U> foreign::Trait0<LocalTy, T, U> for <() as Trait<T, U>>::Assoc {} = note: for more information, see issue #124559 <https://github.com/rust-lang/rust/issues/124559> = note: implementing a foreign trait is only possible if at least one of the types for which it is implemented is local, and no uncovered type parameters appear before that first local type = note: in this case, 'before' refers to the following order: `impl<..> ForeignTrait<T1, ..., Tn> for T0`, where `T0` is the first and `Tn` is the last - = note: `#[warn(uncovered_param_in_projection)]` on by default + = note: `#[warn(uncovered_param_in_projection)]` (part of `#[warn(future_incompatible)]`) on by default warning[E0210]: type parameter `U` must be covered by another type when it appears before the first local type (`LocalTy`) --> $DIR/orphan-check-projections-not-covering-multiple-params.rs:17:9 diff --git a/tests/ui/coherence/orphan-check-projections-not-covering.classic.stderr b/tests/ui/coherence/orphan-check-projections-not-covering.classic.stderr index 28b8c3f4a94..de34ef7cfd3 100644 --- a/tests/ui/coherence/orphan-check-projections-not-covering.classic.stderr +++ b/tests/ui/coherence/orphan-check-projections-not-covering.classic.stderr @@ -8,7 +8,7 @@ LL | impl<T> foreign::Trait0<Local, T, ()> for <T as Identity>::Output {} = note: for more information, see issue #124559 <https://github.com/rust-lang/rust/issues/124559> = note: implementing a foreign trait is only possible if at least one of the types for which it is implemented is local, and no uncovered type parameters appear before that first local type = note: in this case, 'before' refers to the following order: `impl<..> ForeignTrait<T1, ..., Tn> for T0`, where `T0` is the first and `Tn` is the last - = note: `#[warn(uncovered_param_in_projection)]` on by default + = note: `#[warn(uncovered_param_in_projection)]` (part of `#[warn(future_incompatible)]`) on by default warning[E0210]: type parameter `T` must be covered by another type when it appears before the first local type (`Local`) --> $DIR/orphan-check-projections-not-covering.rs:27:6 diff --git a/tests/ui/coherence/orphan-check-projections-not-covering.next.stderr b/tests/ui/coherence/orphan-check-projections-not-covering.next.stderr index 28b8c3f4a94..de34ef7cfd3 100644 --- a/tests/ui/coherence/orphan-check-projections-not-covering.next.stderr +++ b/tests/ui/coherence/orphan-check-projections-not-covering.next.stderr @@ -8,7 +8,7 @@ LL | impl<T> foreign::Trait0<Local, T, ()> for <T as Identity>::Output {} = note: for more information, see issue #124559 <https://github.com/rust-lang/rust/issues/124559> = note: implementing a foreign trait is only possible if at least one of the types for which it is implemented is local, and no uncovered type parameters appear before that first local type = note: in this case, 'before' refers to the following order: `impl<..> ForeignTrait<T1, ..., Tn> for T0`, where `T0` is the first and `Tn` is the last - = note: `#[warn(uncovered_param_in_projection)]` on by default + = note: `#[warn(uncovered_param_in_projection)]` (part of `#[warn(future_incompatible)]`) on by default warning[E0210]: type parameter `T` must be covered by another type when it appears before the first local type (`Local`) --> $DIR/orphan-check-projections-not-covering.rs:27:6 diff --git a/tests/ui/coherence/orphan-check-projections-unsat-bounds.classic.stderr b/tests/ui/coherence/orphan-check-projections-unsat-bounds.classic.stderr index 0346a9d665c..e729bcf225e 100644 --- a/tests/ui/coherence/orphan-check-projections-unsat-bounds.classic.stderr +++ b/tests/ui/coherence/orphan-check-projections-unsat-bounds.classic.stderr @@ -8,7 +8,7 @@ LL | impl<T> foreign::Trait1<LocalTy, T> for <Wrapper<T> as Discard>::Output = note: for more information, see issue #124559 <https://github.com/rust-lang/rust/issues/124559> = note: implementing a foreign trait is only possible if at least one of the types for which it is implemented is local, and no uncovered type parameters appear before that first local type = note: in this case, 'before' refers to the following order: `impl<..> ForeignTrait<T1, ..., Tn> for T0`, where `T0` is the first and `Tn` is the last - = note: `#[warn(uncovered_param_in_projection)]` on by default + = note: `#[warn(uncovered_param_in_projection)]` (part of `#[warn(future_incompatible)]`) on by default warning: 1 warning emitted diff --git a/tests/ui/coherence/orphan-check-projections-unsat-bounds.next.stderr b/tests/ui/coherence/orphan-check-projections-unsat-bounds.next.stderr index 0346a9d665c..e729bcf225e 100644 --- a/tests/ui/coherence/orphan-check-projections-unsat-bounds.next.stderr +++ b/tests/ui/coherence/orphan-check-projections-unsat-bounds.next.stderr @@ -8,7 +8,7 @@ LL | impl<T> foreign::Trait1<LocalTy, T> for <Wrapper<T> as Discard>::Output = note: for more information, see issue #124559 <https://github.com/rust-lang/rust/issues/124559> = note: implementing a foreign trait is only possible if at least one of the types for which it is implemented is local, and no uncovered type parameters appear before that first local type = note: in this case, 'before' refers to the following order: `impl<..> ForeignTrait<T1, ..., Tn> for T0`, where `T0` is the first and `Tn` is the last - = note: `#[warn(uncovered_param_in_projection)]` on by default + = note: `#[warn(uncovered_param_in_projection)]` (part of `#[warn(future_incompatible)]`) on by default warning: 1 warning emitted diff --git a/tests/ui/issues/issue-54477-reduced-2.rs b/tests/ui/collections/vecdeque-append-operation-54477.rs index 5f65e545182..7680fd0bb01 100644 --- a/tests/ui/issues/issue-54477-reduced-2.rs +++ b/tests/ui/collections/vecdeque-append-operation-54477.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/54477 //@ run-pass // rust-lang/rust#54477: runtime bug in the VecDeque library that was // exposed by this test case, derived from test suite of crates.io diff --git a/tests/ui/conditional-compilation/cfg-attr-syntax-validation.rs b/tests/ui/conditional-compilation/cfg-attr-syntax-validation.rs index 126a534dc6f..2c84a966f90 100644 --- a/tests/ui/conditional-compilation/cfg-attr-syntax-validation.rs +++ b/tests/ui/conditional-compilation/cfg-attr-syntax-validation.rs @@ -43,7 +43,7 @@ struct S9; macro_rules! generate_s10 { ($expr: expr) => { #[cfg(feature = $expr)] - //~^ ERROR expected unsuffixed literal, found `expr` metavariable + //~^ ERROR expected a literal (`1u8`, `1.0f32`, `"string"`, etc.) here, found `expr` metavariable 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 6acde758ea5..59ff611e066 100644 --- a/tests/ui/conditional-compilation/cfg-attr-syntax-validation.stderr +++ b/tests/ui/conditional-compilation/cfg-attr-syntax-validation.stderr @@ -81,7 +81,7 @@ LL | #[cfg(a = b"hi")] | = note: expected a normal string literal, not a byte string literal -error: expected unsuffixed literal, found `expr` metavariable +error: expected a literal (`1u8`, `1.0f32`, `"string"`, etc.) here, found `expr` metavariable --> $DIR/cfg-attr-syntax-validation.rs:45:25 | LL | #[cfg(feature = $expr)] diff --git a/tests/ui/const-generics/adt_const_params/const_param_ty_bad.stderr b/tests/ui/const-generics/adt_const_params/const_param_ty_bad.stderr index 4c8a5e46751..c05584ef909 100644 --- a/tests/ui/const-generics/adt_const_params/const_param_ty_bad.stderr +++ b/tests/ui/const-generics/adt_const_params/const_param_ty_bad.stderr @@ -32,8 +32,9 @@ LL | fn check(_: impl std::marker::UnsizedConstParamTy) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `check` help: use parentheses to call this closure | -LL | check(|| {}()); - | ++ +LL - check(|| {}); +LL + check((|| {})()); + | error[E0277]: `fn()` can't be used as a const parameter type --> $DIR/const_param_ty_bad.rs:9:11 diff --git a/tests/ui/const-generics/adt_const_params/const_param_ty_bad_empty_array.stderr b/tests/ui/const-generics/adt_const_params/const_param_ty_bad_empty_array.stderr index 9220cd1f94e..373ac9435da 100644 --- a/tests/ui/const-generics/adt_const_params/const_param_ty_bad_empty_array.stderr +++ b/tests/ui/const-generics/adt_const_params/const_param_ty_bad_empty_array.stderr @@ -2,8 +2,13 @@ error[E0277]: `NotParam` can't be used as a const parameter type --> $DIR/const_param_ty_bad_empty_array.rs:10:13 | LL | check::<[NotParam; 0]>(); - | ^^^^^^^^^^^^^ the trait `ConstParamTy_` is not implemented for `NotParam` + | ^^^^^^^^^^^^^ unsatisfied trait bound | +help: the trait `ConstParamTy_` is not implemented for `NotParam` + --> $DIR/const_param_ty_bad_empty_array.rs:5:1 + | +LL | struct NotParam; + | ^^^^^^^^^^^^^^^ = note: required for `[NotParam; 0]` to implement `ConstParamTy_` note: required by a bound in `check` --> $DIR/const_param_ty_bad_empty_array.rs:7:13 diff --git a/tests/ui/const-generics/adt_const_params/const_param_ty_generic_bounds_do_not_hold.stderr b/tests/ui/const-generics/adt_const_params/const_param_ty_generic_bounds_do_not_hold.stderr index d01aaffe8ae..158e76630f3 100644 --- a/tests/ui/const-generics/adt_const_params/const_param_ty_generic_bounds_do_not_hold.stderr +++ b/tests/ui/const-generics/adt_const_params/const_param_ty_generic_bounds_do_not_hold.stderr @@ -2,8 +2,13 @@ error[E0277]: `NotParam` can't be used as a const parameter type --> $DIR/const_param_ty_generic_bounds_do_not_hold.rs:10:13 | LL | check::<&NotParam>(); - | ^^^^^^^^^ the trait `UnsizedConstParamTy` is not implemented for `NotParam` + | ^^^^^^^^^ unsatisfied trait bound | +help: the trait `UnsizedConstParamTy` is not implemented for `NotParam` + --> $DIR/const_param_ty_generic_bounds_do_not_hold.rs:5:1 + | +LL | struct NotParam; + | ^^^^^^^^^^^^^^^ = note: required for `&NotParam` to implement `UnsizedConstParamTy` note: required by a bound in `check` --> $DIR/const_param_ty_generic_bounds_do_not_hold.rs:7:13 @@ -15,8 +20,13 @@ error[E0277]: `NotParam` can't be used as a const parameter type --> $DIR/const_param_ty_generic_bounds_do_not_hold.rs:11:13 | LL | check::<[NotParam]>(); - | ^^^^^^^^^^ the trait `UnsizedConstParamTy` is not implemented for `NotParam` + | ^^^^^^^^^^ unsatisfied trait bound + | +help: the trait `UnsizedConstParamTy` is not implemented for `NotParam` + --> $DIR/const_param_ty_generic_bounds_do_not_hold.rs:5:1 | +LL | struct NotParam; + | ^^^^^^^^^^^^^^^ = note: required for `[NotParam]` to implement `UnsizedConstParamTy` note: required by a bound in `check` --> $DIR/const_param_ty_generic_bounds_do_not_hold.rs:7:13 @@ -28,8 +38,13 @@ error[E0277]: `NotParam` can't be used as a const parameter type --> $DIR/const_param_ty_generic_bounds_do_not_hold.rs:12:13 | LL | check::<[NotParam; 17]>(); - | ^^^^^^^^^^^^^^ the trait `UnsizedConstParamTy` is not implemented for `NotParam` + | ^^^^^^^^^^^^^^ unsatisfied trait bound + | +help: the trait `UnsizedConstParamTy` is not implemented for `NotParam` + --> $DIR/const_param_ty_generic_bounds_do_not_hold.rs:5:1 | +LL | struct NotParam; + | ^^^^^^^^^^^^^^^ = note: required for `[NotParam; 17]` to implement `UnsizedConstParamTy` note: required by a bound in `check` --> $DIR/const_param_ty_generic_bounds_do_not_hold.rs:7:13 diff --git a/tests/ui/const-generics/adt_const_params/const_param_ty_impl_no_structural_eq.stderr b/tests/ui/const-generics/adt_const_params/const_param_ty_impl_no_structural_eq.stderr index b651cca3216..d3141381db8 100644 --- a/tests/ui/const-generics/adt_const_params/const_param_ty_impl_no_structural_eq.stderr +++ b/tests/ui/const-generics/adt_const_params/const_param_ty_impl_no_structural_eq.stderr @@ -16,8 +16,13 @@ error[E0277]: the type `CantParam` does not `#[derive(PartialEq)]` --> $DIR/const_param_ty_impl_no_structural_eq.rs:10:43 | LL | impl std::marker::UnsizedConstParamTy for CantParam {} - | ^^^^^^^^^ the trait `StructuralPartialEq` is not implemented for `CantParam` + | ^^^^^^^^^ unsatisfied trait bound | +help: the trait `StructuralPartialEq` is not implemented for `CantParam` + --> $DIR/const_param_ty_impl_no_structural_eq.rs:8:1 + | +LL | struct CantParam(ImplementsConstParamTy); + | ^^^^^^^^^^^^^^^^ note: required by a bound in `UnsizedConstParamTy` --> $SRC_DIR/core/src/marker.rs:LL:COL @@ -39,8 +44,13 @@ error[E0277]: the type `CantParamDerive` does not `#[derive(PartialEq)]` --> $DIR/const_param_ty_impl_no_structural_eq.rs:14:10 | LL | #[derive(std::marker::UnsizedConstParamTy)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `StructuralPartialEq` is not implemented for `CantParamDerive` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unsatisfied trait bound | +help: the trait `StructuralPartialEq` is not implemented for `CantParamDerive` + --> $DIR/const_param_ty_impl_no_structural_eq.rs:17:1 + | +LL | struct CantParamDerive(ImplementsConstParamTy); + | ^^^^^^^^^^^^^^^^^^^^^^ note: required by a bound in `UnsizedConstParamTy` --> $SRC_DIR/core/src/marker.rs:LL:COL diff --git a/tests/ui/const-generics/defaults/rp_impl_trait_fail.stderr b/tests/ui/const-generics/defaults/rp_impl_trait_fail.stderr index e36f645b263..65c480d7c49 100644 --- a/tests/ui/const-generics/defaults/rp_impl_trait_fail.stderr +++ b/tests/ui/const-generics/defaults/rp_impl_trait_fail.stderr @@ -2,11 +2,16 @@ error[E0277]: the trait bound `Uwu<10, 12>: Trait` is not satisfied --> $DIR/rp_impl_trait_fail.rs:6:14 | LL | fn rawr() -> impl Trait { - | ^^^^^^^^^^ the trait `Trait` is not implemented for `Uwu<10, 12>` + | ^^^^^^^^^^ unsatisfied trait bound LL | LL | Uwu::<10, 12> | ------------- return type was inferred to be `Uwu<10, 12>` here | +help: the trait `Trait` is not implemented for `Uwu<10, 12>` + --> $DIR/rp_impl_trait_fail.rs:1:1 + | +LL | struct Uwu<const N: u32 = 1, const M: u32 = N>; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = help: the trait `Trait` is implemented for `Uwu<N>` error[E0277]: the trait bound `u32: Traitor<N>` is not satisfied diff --git a/tests/ui/const-generics/dyn-supertraits.stderr b/tests/ui/const-generics/dyn-supertraits.stderr index 38b67ef4403..2b59cdb9418 100644 --- a/tests/ui/const-generics/dyn-supertraits.stderr +++ b/tests/ui/const-generics/dyn-supertraits.stderr @@ -4,7 +4,7 @@ warning: trait `Baz` is never used LL | trait Baz: Foo<3> {} | ^^^ | - = note: `#[warn(dead_code)]` on by default + = note: `#[warn(dead_code)]` (part of `#[warn(unused)]`) on by default warning: trait `Boz` is never used --> $DIR/dyn-supertraits.rs:26:7 diff --git a/tests/ui/const-generics/generic_const_exprs/dependence_lint.full.stderr b/tests/ui/const-generics/generic_const_exprs/dependence_lint.full.stderr index 6b095f3818a..23e126d8702 100644 --- a/tests/ui/const-generics/generic_const_exprs/dependence_lint.full.stderr +++ b/tests/ui/const-generics/generic_const_exprs/dependence_lint.full.stderr @@ -24,7 +24,7 @@ LL | [0; size_of::<*mut T>()]; // lint on stable, error with `generic_const_ | = 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 #76200 <https://github.com/rust-lang/rust/issues/76200> - = note: `#[warn(const_evaluatable_unchecked)]` on by default + = note: `#[warn(const_evaluatable_unchecked)]` (part of `#[warn(future_incompatible)]`) on by default warning: cannot use constants which depend on generic parameters in types --> $DIR/dependence_lint.rs:18:9 diff --git a/tests/ui/const-generics/generic_const_exprs/expected-type-of-closure-body-to-be-a-closure-or-coroutine-ice-113776.stderr b/tests/ui/const-generics/generic_const_exprs/expected-type-of-closure-body-to-be-a-closure-or-coroutine-ice-113776.stderr index b9db7461699..c9c8115660f 100644 --- a/tests/ui/const-generics/generic_const_exprs/expected-type-of-closure-body-to-be-a-closure-or-coroutine-ice-113776.stderr +++ b/tests/ui/const-generics/generic_const_exprs/expected-type-of-closure-body-to-be-a-closure-or-coroutine-ice-113776.stderr @@ -3,10 +3,10 @@ error[E0412]: cannot find type `F` in this scope | LL | let f: F = async { 1 }; | ^ + | --> $SRC_DIR/core/src/ops/function.rs:LL:COL | = note: similarly named trait `Fn` defined here - | help: a trait with a similar name exists | LL | let f: Fn = async { 1 }; diff --git a/tests/ui/const-generics/generic_const_exprs/function-call.stderr b/tests/ui/const-generics/generic_const_exprs/function-call.stderr index 84abfe57876..806bc3e89a9 100644 --- a/tests/ui/const-generics/generic_const_exprs/function-call.stderr +++ b/tests/ui/const-generics/generic_const_exprs/function-call.stderr @@ -6,7 +6,7 @@ LL | let _ = [0; foo::<T>()]; | = 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 #76200 <https://github.com/rust-lang/rust/issues/76200> - = note: `#[warn(const_evaluatable_unchecked)]` on by default + = note: `#[warn(const_evaluatable_unchecked)]` (part of `#[warn(future_incompatible)]`) on by default warning: 1 warning emitted 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 cf0bdd0e9a1..453079e3c15 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 @@ -46,7 +46,7 @@ warning: type `v11` should have an upper camel case name LL | pub type v11 = [[usize; v4]; v4]; | ^^^ help: convert the identifier to upper camel case (notice the capitalization): `V11` | - = note: `#[warn(non_camel_case_types)]` on by default + = note: `#[warn(non_camel_case_types)]` (part of `#[warn(nonstandard_style)]`) on by default warning: type `v17` should have an upper camel case name --> $DIR/unevaluated-const-ice-119731.rs:16:16 diff --git a/tests/ui/const-generics/invariant.stderr b/tests/ui/const-generics/invariant.stderr index b4e46e55268..095219f6e5f 100644 --- a/tests/ui/const-generics/invariant.stderr +++ b/tests/ui/const-generics/invariant.stderr @@ -10,7 +10,7 @@ LL | impl SadBee for fn(&'static ()) { = warning: the behavior may change in a future release = note: for more information, see issue #56105 <https://github.com/rust-lang/rust/issues/56105> = note: this behavior recently changed as a result of a bug fix; see rust-lang/rust#56105 for details - = note: `#[warn(coherence_leak_check)]` on by default + = note: `#[warn(coherence_leak_check)]` (part of `#[warn(future_incompatible)]`) on by default error[E0308]: mismatched types --> $DIR/invariant.rs:25:5 diff --git a/tests/ui/const-generics/issues/issue-69654-run-pass.stderr b/tests/ui/const-generics/issues/issue-69654-run-pass.stderr index 7b3cd4f375f..abde9a95f89 100644 --- a/tests/ui/const-generics/issues/issue-69654-run-pass.stderr +++ b/tests/ui/const-generics/issues/issue-69654-run-pass.stderr @@ -4,7 +4,7 @@ warning: trait `Bar` is never used LL | trait Bar<T> {} | ^^^ | - = note: `#[warn(dead_code)]` on by default + = note: `#[warn(dead_code)]` (part of `#[warn(unused)]`) on by default warning: 1 warning emitted diff --git a/tests/ui/const-generics/issues/issue-83466.stderr b/tests/ui/const-generics/issues/issue-83466.stderr index 91451a799b0..5a0f5cbd131 100644 --- a/tests/ui/const-generics/issues/issue-83466.stderr +++ b/tests/ui/const-generics/issues/issue-83466.stderr @@ -9,7 +9,7 @@ LL | S.func::<'a, 10_u32>() | = 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 #42868 <https://github.com/rust-lang/rust/issues/42868> - = note: `#[warn(late_bound_lifetime_arguments)]` on by default + = note: `#[warn(late_bound_lifetime_arguments)]` (part of `#[warn(future_incompatible)]`) on by default error[E0747]: constant provided when a type was expected --> $DIR/issue-83466.rs:11:18 diff --git a/tests/ui/const-generics/issues/issue-86535-2.stderr b/tests/ui/const-generics/issues/issue-86535-2.stderr index 0ba74836575..870d97d7d2e 100644 --- a/tests/ui/const-generics/issues/issue-86535-2.stderr +++ b/tests/ui/const-generics/issues/issue-86535-2.stderr @@ -4,7 +4,7 @@ warning: struct `Bar` is never constructed LL | struct Bar<const N: &'static ()>; | ^^^ | - = note: `#[warn(dead_code)]` on by default + = note: `#[warn(dead_code)]` (part of `#[warn(unused)]`) on by default warning: 1 warning emitted diff --git a/tests/ui/const-generics/issues/issue-86535.stderr b/tests/ui/const-generics/issues/issue-86535.stderr index 84d6c1c11ff..6bb362de261 100644 --- a/tests/ui/const-generics/issues/issue-86535.stderr +++ b/tests/ui/const-generics/issues/issue-86535.stderr @@ -4,7 +4,7 @@ warning: struct `F` is never constructed LL | struct F<const S: &'static str>; | ^ | - = note: `#[warn(dead_code)]` on by default + = note: `#[warn(dead_code)]` (part of `#[warn(unused)]`) on by default warning: 1 warning emitted diff --git a/tests/ui/const-generics/min_const_generics/complex-expression.stderr b/tests/ui/const-generics/min_const_generics/complex-expression.stderr index 35039bb4109..ed3fa840cdf 100644 --- a/tests/ui/const-generics/min_const_generics/complex-expression.stderr +++ b/tests/ui/const-generics/min_const_generics/complex-expression.stderr @@ -69,7 +69,7 @@ LL | let _ = [0; size_of::<*mut T>() + 1]; | = 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 #76200 <https://github.com/rust-lang/rust/issues/76200> - = note: `#[warn(const_evaluatable_unchecked)]` on by default + = note: `#[warn(const_evaluatable_unchecked)]` (part of `#[warn(future_incompatible)]`) on by default error: aborting due to 7 previous errors; 1 warning emitted diff --git a/tests/ui/const-generics/min_const_generics/const-evaluatable-unchecked.stderr b/tests/ui/const-generics/min_const_generics/const-evaluatable-unchecked.stderr index 8003dfa4071..cf72c0aa0df 100644 --- a/tests/ui/const-generics/min_const_generics/const-evaluatable-unchecked.stderr +++ b/tests/ui/const-generics/min_const_generics/const-evaluatable-unchecked.stderr @@ -6,7 +6,7 @@ LL | [0; std::mem::size_of::<*mut T>()]; | = 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 #76200 <https://github.com/rust-lang/rust/issues/76200> - = note: `#[warn(const_evaluatable_unchecked)]` on by default + = note: `#[warn(const_evaluatable_unchecked)]` (part of `#[warn(future_incompatible)]`) on by default warning: cannot use constants which depend on generic parameters in types --> $DIR/const-evaluatable-unchecked.rs:17:21 diff --git a/tests/ui/const-generics/occurs-check/unused-substs-1.stderr b/tests/ui/const-generics/occurs-check/unused-substs-1.stderr index 07e86aa17f2..70fc71c99b9 100644 --- a/tests/ui/const-generics/occurs-check/unused-substs-1.stderr +++ b/tests/ui/const-generics/occurs-check/unused-substs-1.stderr @@ -2,7 +2,7 @@ error[E0277]: the trait bound `A<_>: Bar<_>` is not satisfied --> $DIR/unused-substs-1.rs:12:13 | LL | let _ = A; - | ^ the trait `Bar<_>` is not implemented for `A<_>` + | ^ unsatisfied trait bound | = help: the trait `Bar<_>` is not implemented for `A<_>` but it is implemented for `A<{ 6 + 1 }>` diff --git a/tests/ui/const-generics/transmute-fail.stderr b/tests/ui/const-generics/transmute-fail.stderr index 0e26daa3a0f..953119a8c34 100644 --- a/tests/ui/const-generics/transmute-fail.stderr +++ b/tests/ui/const-generics/transmute-fail.stderr @@ -6,6 +6,14 @@ LL | fn bar<const W: bool, const H: usize>(v: [[u32; H]; W]) -> [[u32; W]; H] { | = note: the length of array `[[u32; H]; W]` must be type `usize` +error: the constant `W` is not of type `usize` + --> $DIR/transmute-fail.rs:19:9 + | +LL | std::mem::transmute(v) + | ^^^^^^^^^^^^^^^^^^^ expected `usize`, found `bool` + | + = note: the length of array `[[u32; H]; W]` must be type `usize` + error[E0512]: cannot transmute between types of different sizes, or dependently-sized types --> $DIR/transmute-fail.rs:11:9 | @@ -15,14 +23,6 @@ LL | std::mem::transmute(v) = note: source type: `[[u32; H + 1]; W]` (size can vary because of [u32; H + 1]) = note: target type: `[[u32; W + 1]; H]` (size can vary because of [u32; W + 1]) -error: the constant `W` is not of type `usize` - --> $DIR/transmute-fail.rs:19:9 - | -LL | std::mem::transmute(v) - | ^^^^^^^^^^^^^^^^^^^ expected `usize`, found `bool` - | - = note: the length of array `[[u32; H]; W]` must be type `usize` - error[E0512]: cannot transmute between types of different sizes, or dependently-sized types --> $DIR/transmute-fail.rs:26:9 | diff --git a/tests/ui/const-generics/type-dependent/issue-71348.full.stderr b/tests/ui/const-generics/type-dependent/issue-71348.full.stderr index 32fa46b92b3..299ae680093 100644 --- a/tests/ui/const-generics/type-dependent/issue-71348.full.stderr +++ b/tests/ui/const-generics/type-dependent/issue-71348.full.stderr @@ -1,8 +1,8 @@ warning: hiding a lifetime that's named elsewhere is confusing - --> $DIR/issue-71348.rs:18:40 + --> $DIR/issue-71348.rs:18:56 | LL | fn ask<'a, const N: &'static str>(&'a self) -> &'a <Self as Get<N>>::Target - | ^^ -- ------------------------ the same lifetime is hidden here + | -- -- ^^^^^^^^^^^^^^^^^^^^^^^^ the same lifetime is hidden here | | | | | the same lifetime is named here | the lifetime is named here diff --git a/tests/ui/consts/const-block-item.stderr b/tests/ui/consts/const-block-item.stderr index 04658742b56..b325976a60b 100644 --- a/tests/ui/consts/const-block-item.stderr +++ b/tests/ui/consts/const-block-item.stderr @@ -4,7 +4,7 @@ warning: trait `Value` is never used LL | pub trait Value { | ^^^^^ | - = note: `#[warn(dead_code)]` on by default + = note: `#[warn(dead_code)]` (part of `#[warn(unused)]`) on by default warning: 1 warning emitted diff --git a/tests/ui/consts/const-eval/const_panic_stability.e2018.stderr b/tests/ui/consts/const-eval/const_panic_stability.e2018.stderr index b3ccd2459aa..943695d75fc 100644 --- a/tests/ui/consts/const-eval/const_panic_stability.e2018.stderr +++ b/tests/ui/consts/const-eval/const_panic_stability.e2018.stderr @@ -6,7 +6,7 @@ LL | panic!({ "foo" }); | = note: this usage of `panic!()` is deprecated; it will be a hard error in Rust 2021 = note: for more information, see <https://doc.rust-lang.org/edition-guide/rust-2021/panic-macro-consistency.html> - = note: `#[warn(non_fmt_panics)]` on by default + = note: `#[warn(non_fmt_panics)]` (part of `#[warn(rust_2021_compatibility)]`) on by default help: add a "{}" format string to `Display` the message | LL | panic!("{}", { "foo" }); diff --git a/tests/ui/consts/const-eval/heap/ptr_not_made_global.stderr b/tests/ui/consts/const-eval/heap/ptr_not_made_global.stderr index cb2bb1e8cd8..e5b108df298 100644 --- a/tests/ui/consts/const-eval/heap/ptr_not_made_global.stderr +++ b/tests/ui/consts/const-eval/heap/ptr_not_made_global.stderr @@ -4,7 +4,7 @@ error: encountered `const_allocate` pointer in final value that was not made glo LL | const FOO: &i32 = foo(); | ^^^^^^^^^^^^^^^ | - = note: use `const_make_global` to make allocated pointers immutable before returning + = note: use `const_make_global` to turn allocated pointers into immutable globals before returning error: encountered `const_allocate` pointer in final value that was not made global --> $DIR/ptr_not_made_global.rs:12:1 @@ -12,7 +12,7 @@ error: encountered `const_allocate` pointer in final value that was not made glo LL | const FOO_RAW: *const i32 = foo(); | ^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: use `const_make_global` to make allocated pointers immutable before returning + = note: use `const_make_global` to turn allocated pointers into immutable globals before returning error: aborting due to 2 previous errors diff --git a/tests/ui/consts/const-eval/heap/ptr_not_made_global_mut.stderr b/tests/ui/consts/const-eval/heap/ptr_not_made_global_mut.stderr index 2445ce633d6..2d1993f96d3 100644 --- a/tests/ui/consts/const-eval/heap/ptr_not_made_global_mut.stderr +++ b/tests/ui/consts/const-eval/heap/ptr_not_made_global_mut.stderr @@ -4,7 +4,7 @@ error: encountered `const_allocate` pointer in final value that was not made glo LL | const BAR: *mut i32 = unsafe { intrinsics::const_allocate(4, 4) as *mut i32 }; | ^^^^^^^^^^^^^^^^^^^ | - = note: use `const_make_global` to make allocated pointers immutable before returning + = note: use `const_make_global` to turn allocated pointers into immutable globals before returning error: aborting due to 1 previous error diff --git a/tests/ui/consts/const-eval/partial_ptr_overwrite.rs b/tests/ui/consts/const-eval/partial_ptr_overwrite.rs deleted file mode 100644 index bd97bec0f71..00000000000 --- a/tests/ui/consts/const-eval/partial_ptr_overwrite.rs +++ /dev/null @@ -1,12 +0,0 @@ -// Test for the behavior described in <https://github.com/rust-lang/rust/issues/87184>. - -const PARTIAL_OVERWRITE: () = { - let mut p = &42; - unsafe { - let ptr: *mut _ = &mut p; - *(ptr as *mut u8) = 123; //~ ERROR unable to overwrite parts of a pointer - } - let x = *p; -}; - -fn main() {} diff --git a/tests/ui/consts/const-eval/partial_ptr_overwrite.stderr b/tests/ui/consts/const-eval/partial_ptr_overwrite.stderr deleted file mode 100644 index 6ef1cfd35c8..00000000000 --- a/tests/ui/consts/const-eval/partial_ptr_overwrite.stderr +++ /dev/null @@ -1,12 +0,0 @@ -error[E0080]: unable to overwrite parts of a pointer in memory at ALLOC0 - --> $DIR/partial_ptr_overwrite.rs:7:9 - | -LL | *(ptr as *mut u8) = 123; - | ^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `PARTIAL_OVERWRITE` failed here - | - = 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 - -error: aborting due to 1 previous error - -For more information about this error, try `rustc --explain E0080`. diff --git a/tests/ui/consts/const-eval/ptr_fragments.rs b/tests/ui/consts/const-eval/ptr_fragments.rs new file mode 100644 index 00000000000..04dcbe55590 --- /dev/null +++ b/tests/ui/consts/const-eval/ptr_fragments.rs @@ -0,0 +1,63 @@ +//! Test that various operations involving pointer fragments work as expected. +//@ run-pass + +use std::mem::{self, MaybeUninit, transmute}; +use std::ptr; + +type Byte = MaybeUninit<u8>; + +const unsafe fn memcpy(dst: *mut Byte, src: *const Byte, n: usize) { + let mut i = 0; + while i < n { + *dst.add(i) = *src.add(i); + i += 1; + } +} + +const _MEMCPY: () = unsafe { + let ptr = &42; + let mut ptr2 = ptr::null::<i32>(); + memcpy(&mut ptr2 as *mut _ as *mut _, &ptr as *const _ as *const _, mem::size_of::<&i32>()); + assert!(*ptr2 == 42); +}; +const _MEMCPY_OFFSET: () = unsafe { + // Same as above, but the pointer has a non-zero offset so not all the data bytes are the same. + let ptr = &(42, 18); + let ptr = &ptr.1; + let mut ptr2 = ptr::null::<i32>(); + memcpy(&mut ptr2 as *mut _ as *mut _, &ptr as *const _ as *const _, mem::size_of::<&i32>()); + assert!(*ptr2 == 18); +}; + +const MEMCPY_RET: MaybeUninit<*const i32> = unsafe { + let ptr = &42; + let mut ptr2 = MaybeUninit::new(ptr::null::<i32>()); + memcpy(&mut ptr2 as *mut _ as *mut _, &ptr as *const _ as *const _, mem::size_of::<&i32>()); + // Return in a MaybeUninit so it does not get treated as a scalar. + ptr2 +}; + +#[allow(dead_code)] +fn reassemble_ptr_fragments_in_static() { + static DATA: i32 = 1i32; + + #[cfg(target_pointer_width = "64")] + struct Thing { + x: MaybeUninit<u32>, + y: MaybeUninit<u32>, + } + #[cfg(target_pointer_width = "32")] + struct Thing { + x: MaybeUninit<u16>, + y: MaybeUninit<u16>, + } + + static X: Thing = unsafe { + let Thing { x, y } = transmute(&raw const DATA); + Thing { x, y } + }; +} + +fn main() { + assert_eq!(unsafe { MEMCPY_RET.assume_init().read() }, 42); +} diff --git a/tests/ui/consts/const-eval/ptr_fragments_in_final.rs b/tests/ui/consts/const-eval/ptr_fragments_in_final.rs new file mode 100644 index 00000000000..e2f3f51b086 --- /dev/null +++ b/tests/ui/consts/const-eval/ptr_fragments_in_final.rs @@ -0,0 +1,25 @@ +//! Test that we properly error when there is a pointer fragment in the final value. + +use std::{mem::{self, MaybeUninit}, ptr}; + +type Byte = MaybeUninit<u8>; + +const unsafe fn memcpy(dst: *mut Byte, src: *const Byte, n: usize) { + let mut i = 0; + while i < n { + dst.add(i).write(src.add(i).read()); + i += 1; + } +} + +const MEMCPY_RET: MaybeUninit<*const i32> = unsafe { //~ERROR: partial pointer in final value + let ptr = &42; + let mut ptr2 = MaybeUninit::new(ptr::null::<i32>()); + memcpy(&mut ptr2 as *mut _ as *mut _, &ptr as *const _ as *const _, mem::size_of::<&i32>() / 2); + // Return in a MaybeUninit so it does not get treated as a scalar. + ptr2 +}; + +fn main() { + assert_eq!(unsafe { MEMCPY_RET.assume_init().read() }, 42); +} diff --git a/tests/ui/consts/const-eval/ptr_fragments_in_final.stderr b/tests/ui/consts/const-eval/ptr_fragments_in_final.stderr new file mode 100644 index 00000000000..628bf2566e5 --- /dev/null +++ b/tests/ui/consts/const-eval/ptr_fragments_in_final.stderr @@ -0,0 +1,10 @@ +error: encountered partial pointer in final value of constant + --> $DIR/ptr_fragments_in_final.rs:15:1 + | +LL | const MEMCPY_RET: MaybeUninit<*const i32> = unsafe { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: while pointers can be broken apart into individual bytes during const-evaluation, only complete pointers (with all their bytes in the right order) are supported in the final value + +error: aborting due to 1 previous error + diff --git a/tests/ui/consts/const-eval/read_partial_ptr.rs b/tests/ui/consts/const-eval/read_partial_ptr.rs new file mode 100644 index 00000000000..bccef9c0bc6 --- /dev/null +++ b/tests/ui/consts/const-eval/read_partial_ptr.rs @@ -0,0 +1,49 @@ +//! Ensure we error when trying to load from a pointer whose provenance has been messed with. + +const PARTIAL_OVERWRITE: () = { + let mut p = &42; + // Overwrite one byte with a no-provenance value. + unsafe { + let ptr: *mut _ = &mut p; + *(ptr as *mut u8) = 123; + } + let x = *p; //~ ERROR: unable to read parts of a pointer +}; + +const PTR_BYTES_SWAP: () = { + let mut p = &42; + // Swap the first two bytes. + unsafe { + let ptr = &mut p as *mut _ as *mut std::mem::MaybeUninit<u8>; + let byte0 = ptr.read(); + let byte1 = ptr.add(1).read(); + ptr.write(byte1); + ptr.add(1).write(byte0); + } + let x = *p; //~ ERROR: unable to read parts of a pointer +}; + +const PTR_BYTES_REPEAT: () = { + let mut p = &42; + // Duplicate the first byte over the second. + unsafe { + let ptr = &mut p as *mut _ as *mut std::mem::MaybeUninit<u8>; + let byte0 = ptr.read(); + ptr.add(1).write(byte0); + } + let x = *p; //~ ERROR: unable to read parts of a pointer +}; + +const PTR_BYTES_MIX: () = { + let mut p = &42; + let q = &43; + // Overwrite the first byte of p with the first byte of q. + unsafe { + let ptr = &mut p as *mut _ as *mut std::mem::MaybeUninit<u8>; + let qtr = &q as *const _ as *const std::mem::MaybeUninit<u8>; + ptr.write(qtr.read()); + } + let x = *p; //~ ERROR: unable to read parts of a pointer +}; + +fn main() {} diff --git a/tests/ui/consts/const-eval/read_partial_ptr.stderr b/tests/ui/consts/const-eval/read_partial_ptr.stderr new file mode 100644 index 00000000000..196606c77a3 --- /dev/null +++ b/tests/ui/consts/const-eval/read_partial_ptr.stderr @@ -0,0 +1,39 @@ +error[E0080]: unable to read parts of a pointer from memory at ALLOC0 + --> $DIR/read_partial_ptr.rs:10:13 + | +LL | let x = *p; + | ^^ evaluation of `PARTIAL_OVERWRITE` failed here + | + = 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 + +error[E0080]: unable to read parts of a pointer from memory at ALLOC1 + --> $DIR/read_partial_ptr.rs:23:13 + | +LL | let x = *p; + | ^^ evaluation of `PTR_BYTES_SWAP` failed here + | + = 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 + +error[E0080]: unable to read parts of a pointer from memory at ALLOC2 + --> $DIR/read_partial_ptr.rs:34:13 + | +LL | let x = *p; + | ^^ evaluation of `PTR_BYTES_REPEAT` failed here + | + = 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 + +error[E0080]: unable to read parts of a pointer from memory at ALLOC3 + --> $DIR/read_partial_ptr.rs:46:13 + | +LL | let x = *p; + | ^^ evaluation of `PTR_BYTES_MIX` failed here + | + = 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 + +error: aborting due to 4 previous errors + +For more information about this error, try `rustc --explain E0080`. diff --git a/tests/ui/issues/issue-76191.rs b/tests/ui/consts/const-range-matching-76191.rs index d2de44380c3..b579a4b3258 100644 --- a/tests/ui/issues/issue-76191.rs +++ b/tests/ui/consts/const-range-matching-76191.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/76191 // Regression test for diagnostic issue #76191 #![allow(non_snake_case)] diff --git a/tests/ui/issues/issue-76191.stderr b/tests/ui/consts/const-range-matching-76191.stderr index d8b54be88f4..5c358d0fa1c 100644 --- a/tests/ui/issues/issue-76191.stderr +++ b/tests/ui/consts/const-range-matching-76191.stderr @@ -1,11 +1,11 @@ error[E0080]: evaluation panicked: explicit panic - --> $DIR/issue-76191.rs:8:37 + --> $DIR/const-range-matching-76191.rs:9:37 | LL | const RANGE2: RangeInclusive<i32> = panic!(); | ^^^^^^^^ evaluation of `RANGE2` failed here error[E0308]: mismatched types - --> $DIR/issue-76191.rs:14:9 + --> $DIR/const-range-matching-76191.rs:15:9 | LL | const RANGE: RangeInclusive<i32> = 0..=255; | -------------------------------- constant defined here @@ -27,7 +27,7 @@ LL + 0..=255 => {} | error[E0308]: mismatched types - --> $DIR/issue-76191.rs:16:9 + --> $DIR/const-range-matching-76191.rs:17:9 | LL | const RANGE2: RangeInclusive<i32> = panic!(); | --------------------------------- constant defined here diff --git a/tests/ui/consts/const_let_assign2.stderr b/tests/ui/consts/const_let_assign2.stderr index e8bed6d0724..ad3587b7134 100644 --- a/tests/ui/consts/const_let_assign2.stderr +++ b/tests/ui/consts/const_let_assign2.stderr @@ -6,7 +6,7 @@ LL | let ptr = unsafe { &mut BB }; | = note: for more information, see <https://doc.rust-lang.org/edition-guide/rust-2024/static-mut-references.html> = note: mutable references to mutable statics are dangerous; it's undefined behavior if any other pointer to the static is used or if any other reference is created for the static while the mutable reference lives - = note: `#[warn(static_mut_refs)]` on by default + = note: `#[warn(static_mut_refs)]` (part of `#[warn(rust_2024_compatibility)]`) on by default help: use `&raw mut` instead to create a raw pointer | LL | let ptr = unsafe { &raw mut BB }; 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 e354110f293..ea3daca51ef 100644 --- a/tests/ui/consts/const_refs_to_static-ice-121413.stderr +++ b/tests/ui/consts/const_refs_to_static-ice-121413.stderr @@ -17,7 +17,7 @@ LL | static FOO: Sync = AtomicUsize::new(0); | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! = note: for more information, see <https://doc.rust-lang.org/edition-guide/rust-2021/warnings-promoted-to-error.html> - = note: `#[warn(bare_trait_objects)]` on by default + = note: `#[warn(bare_trait_objects)]` (part of `#[warn(rust_2021_compatibility)]`) on by default help: if this is a dyn-compatible trait, use `dyn` | LL | static FOO: dyn Sync = AtomicUsize::new(0); diff --git a/tests/ui/consts/issue-89088.stderr b/tests/ui/consts/issue-89088.stderr index 56025e0d9b2..5008a2eada8 100644 --- a/tests/ui/consts/issue-89088.stderr +++ b/tests/ui/consts/issue-89088.stderr @@ -6,6 +6,7 @@ LL | const FOO: &A = &A::Field(Cow::Borrowed("foo")); ... LL | FOO => todo!(), | ^^^ constant of non-structural type + | --> $SRC_DIR/alloc/src/borrow.rs:LL:COL | = note: `Cow<'_, str>` must be annotated with `#[derive(PartialEq)]` to be usable in patterns diff --git a/tests/ui/consts/missing_span_in_backtrace.rs b/tests/ui/consts/missing_span_in_backtrace.rs index 4f3f9aa6ada..09a11c75fd7 100644 --- a/tests/ui/consts/missing_span_in_backtrace.rs +++ b/tests/ui/consts/missing_span_in_backtrace.rs @@ -1,3 +1,4 @@ +//! Check what happens when the error occurs inside a std function that we can't print the span of. //@ ignore-backends: gcc //@ compile-flags: -Z ui-testing=no @@ -7,15 +8,15 @@ use std::{ }; const X: () = { - let mut ptr1 = &1; - let mut ptr2 = &2; + let mut x1 = 1; + let mut x2 = 2; // Swap them, bytewise. unsafe { - ptr::swap_nonoverlapping( //~ ERROR unable to copy parts of a pointer - &mut ptr1 as *mut _ as *mut MaybeUninit<u8>, - &mut ptr2 as *mut _ as *mut MaybeUninit<u8>, - mem::size_of::<&i32>(), + ptr::swap_nonoverlapping( //~ ERROR beyond the end of the allocation + &mut x1 as *mut _ as *mut MaybeUninit<u8>, + &mut x2 as *mut _ as *mut MaybeUninit<u8>, + 10, ); } }; diff --git a/tests/ui/consts/missing_span_in_backtrace.stderr b/tests/ui/consts/missing_span_in_backtrace.stderr index 0ac1e281107..55dde635828 100644 --- a/tests/ui/consts/missing_span_in_backtrace.stderr +++ b/tests/ui/consts/missing_span_in_backtrace.stderr @@ -1,15 +1,13 @@ -error[E0080]: unable to copy parts of a pointer from memory at ALLOC0 - --> $DIR/missing_span_in_backtrace.rs:15:9 +error[E0080]: memory access failed: attempting to access 1 byte, but got ALLOC0+0x4 which is at or beyond the end of the allocation of size 4 bytes + --> $DIR/missing_span_in_backtrace.rs:16:9 | -15 | / ptr::swap_nonoverlapping( -16 | | &mut ptr1 as *mut _ as *mut MaybeUninit<u8>, -17 | | &mut ptr2 as *mut _ as *mut MaybeUninit<u8>, -18 | | mem::size_of::<&i32>(), -19 | | ); +16 | / ptr::swap_nonoverlapping( +17 | | &mut x1 as *mut _ as *mut MaybeUninit<u8>, +18 | | &mut x2 as *mut _ as *mut MaybeUninit<u8>, +19 | | 10, +20 | | ); | |_________^ evaluation of `X` failed inside this call | - = 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: inside `swap_nonoverlapping::compiletime::<MaybeUninit<u8>>` --> $SRC_DIR/core/src/ptr/mod.rs:LL:COL note: inside `std::ptr::swap_nonoverlapping_const::<MaybeUninit<u8>>` diff --git a/tests/ui/consts/packed_pattern.stderr b/tests/ui/consts/packed_pattern.stderr index dc26078fb63..83bb3e5b6a7 100644 --- a/tests/ui/consts/packed_pattern.stderr +++ b/tests/ui/consts/packed_pattern.stderr @@ -6,7 +6,7 @@ LL | Foo { field: (5, 6, 7, 8) } => {}, LL | FOO => unreachable!(), | ^^^ no value can reach this | - = note: `#[warn(unreachable_patterns)]` on by default + = note: `#[warn(unreachable_patterns)]` (part of `#[warn(unused)]`) on by default warning: 1 warning emitted diff --git a/tests/ui/consts/packed_pattern2.stderr b/tests/ui/consts/packed_pattern2.stderr index 013f61f733c..8a09e708cb7 100644 --- a/tests/ui/consts/packed_pattern2.stderr +++ b/tests/ui/consts/packed_pattern2.stderr @@ -6,7 +6,7 @@ LL | Bar { a: Foo { field: (5, 6) } } => {}, LL | FOO => unreachable!(), | ^^^ no value can reach this | - = note: `#[warn(unreachable_patterns)]` on by default + = note: `#[warn(unreachable_patterns)]` (part of `#[warn(unused)]`) on by default warning: 1 warning emitted diff --git a/tests/ui/consts/ptr_comparisons.rs b/tests/ui/consts/ptr_comparisons.rs index e142ab3a754..b8d809475cf 100644 --- a/tests/ui/consts/ptr_comparisons.rs +++ b/tests/ui/consts/ptr_comparisons.rs @@ -1,43 +1,205 @@ //@ compile-flags: --crate-type=lib //@ check-pass +//@ edition: 2024 +#![feature(const_raw_ptr_comparison)] +#![feature(fn_align)] +// Generally: +// For any `Some` return, `None` would also be valid, unless otherwise noted. +// For any `None` return, only `None` is valid, unless otherwise noted. -#![feature( - core_intrinsics, - const_raw_ptr_comparison, -)] +macro_rules! do_test { + ($a:expr, $b:expr, $expected:pat) => { + const _: () = { + let a: *const _ = $a; + let b: *const _ = $b; + assert!(matches!(<*const u8>::guaranteed_eq(a.cast(), b.cast()), $expected)); + }; + }; +} -const FOO: &usize = &42; +#[repr(align(2))] +struct T(#[allow(unused)] u16); -macro_rules! check { - (eq, $a:expr, $b:expr) => { - pub const _: () = - assert!(std::intrinsics::ptr_guaranteed_cmp($a as *const u8, $b as *const u8) == 1); - }; - (ne, $a:expr, $b:expr) => { - pub const _: () = - assert!(std::intrinsics::ptr_guaranteed_cmp($a as *const u8, $b as *const u8) == 0); +#[repr(align(2))] +struct AlignedZst; + +static A: T = T(42); +static B: T = T(42); +static mut MUT_STATIC: T = T(42); +static ZST: () = (); +static ALIGNED_ZST: AlignedZst = AlignedZst; +static LARGE_WORD_ALIGNED: [usize; 2] = [0, 1]; +static mut MUT_LARGE_WORD_ALIGNED: [usize; 2] = [0, 1]; + +const FN_PTR: *const () = { + fn foo() {} + unsafe { std::mem::transmute(foo as fn()) } +}; + +const ALIGNED_FN_PTR: *const () = { + #[rustc_align(2)] + fn aligned_foo() {} + unsafe { std::mem::transmute(aligned_foo as fn()) } +}; + +trait Trait { + #[allow(unused)] + fn method(&self) -> u8; +} +impl Trait for u32 { + fn method(&self) -> u8 { 1 } +} +impl Trait for i32 { + fn method(&self) -> u8 { 2 } +} + +const VTABLE_PTR_1: *const () = { + let [_data, vtable] = unsafe { + std::mem::transmute::<&dyn Trait, [*const (); 2]>(&42_u32 as &dyn Trait) }; - (!, $a:expr, $b:expr) => { - pub const _: () = - assert!(std::intrinsics::ptr_guaranteed_cmp($a as *const u8, $b as *const u8) == 2); + vtable +}; +const VTABLE_PTR_2: *const () = { + let [_data, vtable] = unsafe { + std::mem::transmute::<&dyn Trait, [*const (); 2]>(&42_i32 as &dyn Trait) }; -} + vtable +}; -check!(eq, 0, 0); -check!(ne, 0, 1); -check!(ne, FOO as *const _, 0); -check!(ne, unsafe { (FOO as *const usize).offset(1) }, 0); -check!(ne, unsafe { (FOO as *const usize as *const u8).offset(3) }, 0); +// Cannot be `None`: `is_null` is stable with strong guarantees about integer-valued pointers. +do_test!(0 as *const u8, 0 as *const u8, Some(true)); +do_test!(0 as *const u8, 1 as *const u8, Some(false)); -// We want pointers to be equal to themselves, but aren't checking this yet because -// there are some open questions (e.g. whether function pointers to the same function -// compare equal: they don't necessarily do at runtime). -check!(!, FOO as *const _, FOO as *const _); +// Integer-valued pointers can always be compared. +do_test!(1 as *const u8, 1 as *const u8, Some(true)); +do_test!(1 as *const u8, 2 as *const u8, Some(false)); + +// Cannot be `None`: `static`s' addresses, references, (and within and one-past-the-end of those), +// and `fn` pointers cannot be null, and `is_null` is stable with strong guarantees, and +// `is_null` is implemented using `guaranteed_cmp`. +do_test!(&A, 0 as *const u8, Some(false)); +do_test!((&raw const A).cast::<u8>().wrapping_add(1), 0 as *const u8, Some(false)); +do_test!((&raw const A).wrapping_add(1), 0 as *const u8, Some(false)); +do_test!(&ZST, 0 as *const u8, Some(false)); +do_test!(&(), 0 as *const u8, Some(false)); +do_test!(const { &() }, 0 as *const u8, Some(false)); +do_test!(FN_PTR, 0 as *const u8, Some(false)); + +// This pointer is out-of-bounds, but still cannot be equal to 0 because of alignment. +do_test!((&raw const A).cast::<u8>().wrapping_add(size_of::<T>() + 1), 0 as *const u8, Some(false)); // aside from 0, these pointers might end up pretty much anywhere. -check!(!, FOO as *const _, 1); // this one could be `ne` by taking into account alignment -check!(!, FOO as *const _, 1024); +do_test!(&A, align_of::<T>() as *const u8, None); +do_test!((&raw const A).wrapping_byte_add(1), (align_of::<T>() + 1) as *const u8, None); + +// except that they must still be aligned +do_test!(&A, 1 as *const u8, Some(false)); +do_test!((&raw const A).wrapping_byte_add(1), align_of::<T>() as *const u8, Some(false)); + +// If `ptr.wrapping_sub(int)` cannot be null (because it is in-bounds or one-past-the-end of +// `ptr`'s allocation, or because it is misaligned from `ptr`'s allocation), then we know that +// `ptr != int`, even if `ptr` itself is out-of-bounds or one-past-the-end of its allocation. +do_test!((&raw const A).wrapping_byte_add(1), 1 as *const u8, Some(false)); +do_test!((&raw const A).wrapping_byte_add(2), 2 as *const u8, Some(false)); +do_test!((&raw const A).wrapping_byte_add(3), 1 as *const u8, Some(false)); +do_test!((&raw const ZST).wrapping_byte_add(1), 1 as *const u8, Some(false)); +do_test!(VTABLE_PTR_1.wrapping_byte_add(1), 1 as *const u8, Some(false)); +do_test!(FN_PTR.wrapping_byte_add(1), 1 as *const u8, Some(false)); +do_test!(&A, size_of::<T>().wrapping_neg() as *const u8, Some(false)); +do_test!(&LARGE_WORD_ALIGNED, size_of::<usize>().wrapping_neg() as *const u8, Some(false)); +// (`ptr - int != 0` due to misalignment) +do_test!((&raw const A).wrapping_byte_add(2), 1 as *const u8, Some(false)); +do_test!((&raw const ALIGNED_ZST).wrapping_byte_add(2), 1 as *const u8, Some(false)); // When pointers go out-of-bounds, they *might* become null, so these comparions cannot work. -check!(!, unsafe { (FOO as *const usize).wrapping_add(2) }, 0); -check!(!, unsafe { (FOO as *const usize).wrapping_sub(1) }, 0); +do_test!((&raw const A).wrapping_add(2), 0 as *const u8, None); +do_test!((&raw const A).wrapping_sub(1), 0 as *const u8, None); + +// Statics cannot be duplicated +do_test!(&A, &A, Some(true)); + +// Two non-ZST statics cannot have the same address +do_test!(&A, &B, Some(false)); +do_test!(&A, &raw const MUT_STATIC, Some(false)); + +// One-past-the-end of one static can be equal to the address of another static. +do_test!(&A, (&raw const B).wrapping_add(1), None); + +// Cannot know if ZST static is at the same address with anything non-null (if alignment allows). +do_test!(&A, &ZST, None); +do_test!(&A, &ALIGNED_ZST, None); + +// Unclear if ZST statics can be placed "in the middle of" non-ZST statics. +// For now, we conservatively say they could, and return None here. +do_test!(&ZST, (&raw const A).wrapping_byte_add(1), None); + +// As per https://doc.rust-lang.org/nightly/reference/items/static-items.html#r-items.static.storage-disjointness +// immutable statics are allowed to overlap with const items and promoteds. +do_test!(&A, &T(42), None); +do_test!(&A, const { &T(42) }, None); +do_test!(&A, { const X: T = T(42); &X }, None); + +// These could return Some(false), since only immutable statics can overlap with const items +// and promoteds. +do_test!(&raw const MUT_STATIC, &T(42), None); +do_test!(&raw const MUT_STATIC, const { &T(42) }, None); +do_test!(&raw const MUT_STATIC, { const X: T = T(42); &X }, None); + +// An odd offset from a 2-aligned allocation can never be equal to an even offset from a +// 2-aligned allocation, even if the offsets are out-of-bounds. +do_test!(&A, (&raw const B).wrapping_byte_add(1), Some(false)); +do_test!(&A, (&raw const B).wrapping_byte_add(5), Some(false)); +do_test!(&A, (&raw const ALIGNED_ZST).wrapping_byte_add(1), Some(false)); +do_test!(&ALIGNED_ZST, (&raw const A).wrapping_byte_add(1), Some(false)); +do_test!(&A, (&T(42) as *const T).wrapping_byte_add(1), Some(false)); +do_test!(&A, (const { &T(42) } as *const T).wrapping_byte_add(1), Some(false)); +do_test!(&A, ({ const X: T = T(42); &X } as *const T).wrapping_byte_add(1), Some(false)); + +// We could return `Some(false)` for these, as pointers to different statics can never be equal if +// that would require the statics to overlap, even if the pointers themselves are offset out of +// bounds or one-past-the-end. We currently only check strictly in-bounds pointers when comparing +// pointers to different statics, however. +do_test!((&raw const A).wrapping_add(1), (&raw const B).wrapping_add(1), None); +do_test!( + (&raw const LARGE_WORD_ALIGNED).cast::<usize>().wrapping_add(2), + (&raw const MUT_LARGE_WORD_ALIGNED).cast::<usize>().wrapping_add(1), + None +); + +// Pointers into the same static are equal if and only if their offset is the same, +// even if either is out-of-bounds. +do_test!(&A, &A, Some(true)); +do_test!(&A, &A.0, Some(true)); +do_test!(&A, (&raw const A).wrapping_byte_add(1), Some(false)); +do_test!(&A, (&raw const A).wrapping_byte_add(2), Some(false)); +do_test!(&A, (&raw const A).wrapping_byte_add(51), Some(false)); +do_test!((&raw const A).wrapping_byte_add(51), (&raw const A).wrapping_byte_add(51), Some(true)); + +// Pointers to the same fn may be unequal, since `fn`s can be duplicated. +do_test!(FN_PTR, FN_PTR, None); +do_test!(ALIGNED_FN_PTR, ALIGNED_FN_PTR, None); + +// Pointers to different fns may be equal, since `fn`s can be deduplicated. +do_test!(FN_PTR, ALIGNED_FN_PTR, None); + +// Pointers to the same vtable may be unequal, since vtables can be duplicated. +do_test!(VTABLE_PTR_1, VTABLE_PTR_1, None); + +// Pointers to different vtables may be equal, since vtables can be deduplicated. +do_test!(VTABLE_PTR_1, VTABLE_PTR_2, None); + +// Function pointers to aligned function allocations are not necessarily actually aligned, +// due to platform-specific semantics. +// See https://github.com/rust-lang/rust/issues/144661 +// FIXME: This could return `Some` on platforms where function pointers' addresses actually +// correspond to function addresses including alignment, or on platforms where all functions +// are aligned to some amount (e.g. ARM where a32 function pointers are at least 4-aligned, +// and t32 function pointers are 2-aligned-offset-by-1). +do_test!(ALIGNED_FN_PTR, ALIGNED_FN_PTR.wrapping_byte_offset(1), None); + +// Conservatively say we don't know. +do_test!(FN_PTR, VTABLE_PTR_1, None); +do_test!((&raw const LARGE_WORD_ALIGNED).cast::<usize>().wrapping_add(1), VTABLE_PTR_1, None); +do_test!((&raw const MUT_LARGE_WORD_ALIGNED).cast::<usize>().wrapping_add(1), VTABLE_PTR_1, None); +do_test!((&raw const LARGE_WORD_ALIGNED).cast::<usize>().wrapping_add(1), FN_PTR, None); +do_test!((&raw const MUT_LARGE_WORD_ALIGNED).cast::<usize>().wrapping_add(1), FN_PTR, None); diff --git a/tests/ui/consts/transmute-size-mismatch-before-typeck.rs b/tests/ui/consts/transmute-size-mismatch-before-typeck.rs index ffb143da2d4..4e0b12b9021 100644 --- a/tests/ui/consts/transmute-size-mismatch-before-typeck.rs +++ b/tests/ui/consts/transmute-size-mismatch-before-typeck.rs @@ -1,5 +1,9 @@ +//@ normalize-stderr-64bit: "8-byte" -> "word size" +//@ normalize-stderr-32bit: "4-byte" -> "word size" //@ normalize-stderr-64bit: "64 bits" -> "word size" //@ normalize-stderr-32bit: "32 bits" -> "word size" +//@ normalize-stderr-64bit: "16-byte" -> "2 * word size" +//@ normalize-stderr-32bit: "8-byte" -> "2 * word size" //@ normalize-stderr-64bit: "128 bits" -> "2 * word size" //@ normalize-stderr-32bit: "64 bits" -> "2 * word size" @@ -10,4 +14,5 @@ fn main() { } const ZST: &[u8] = unsafe { std::mem::transmute(1usize) }; -//~^ ERROR cannot transmute between types of different sizes +//~^ ERROR transmuting from +//~| ERROR cannot transmute between types of different sizes diff --git a/tests/ui/consts/transmute-size-mismatch-before-typeck.stderr b/tests/ui/consts/transmute-size-mismatch-before-typeck.stderr index 6bc7e7203aa..bb847f79ace 100644 --- a/tests/ui/consts/transmute-size-mismatch-before-typeck.stderr +++ b/tests/ui/consts/transmute-size-mismatch-before-typeck.stderr @@ -1,5 +1,11 @@ +error[E0080]: transmuting from word size type to 2 * word size type: `usize` -> `&[u8]` + --> $DIR/transmute-size-mismatch-before-typeck.rs:16:29 + | +LL | const ZST: &[u8] = unsafe { std::mem::transmute(1usize) }; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `ZST` failed here + error[E0512]: cannot transmute between types of different sizes, or dependently-sized types - --> $DIR/transmute-size-mismatch-before-typeck.rs:12:29 + --> $DIR/transmute-size-mismatch-before-typeck.rs:16:29 | LL | const ZST: &[u8] = unsafe { std::mem::transmute(1usize) }; | ^^^^^^^^^^^^^^^^^^^ @@ -7,6 +13,7 @@ LL | const ZST: &[u8] = unsafe { std::mem::transmute(1usize) }; = note: source type: `usize` (word size) = note: target type: `&[u8]` (2 * word size) -error: aborting due to 1 previous error +error: aborting due to 2 previous errors -For more information about this error, try `rustc --explain E0512`. +Some errors have detailed explanations: E0080, E0512. +For more information about an error, try `rustc --explain E0080`. diff --git a/tests/ui/coroutine/drop-tracking-parent-expression.stderr b/tests/ui/coroutine/drop-tracking-parent-expression.stderr index 2f5fe882f6e..fe8c17c1294 100644 --- a/tests/ui/coroutine/drop-tracking-parent-expression.stderr +++ b/tests/ui/coroutine/drop-tracking-parent-expression.stderr @@ -12,7 +12,11 @@ LL | | }; LL | | ); | |_____- in this macro invocation | - = help: within `{coroutine@$DIR/drop-tracking-parent-expression.rs:19:34: 19:41}`, the trait `Send` is not implemented for `derived_drop::Client` +help: within `{coroutine@$DIR/drop-tracking-parent-expression.rs:19:34: 19:41}`, the trait `Send` is not implemented for `derived_drop::Client` + --> $DIR/drop-tracking-parent-expression.rs:51:46 + | +LL | derived_drop => { #[derive(Default)] pub struct Client { pub nickname: String } }; + | ^^^^^^^^^^^^^^^^^ note: coroutine is not `Send` as this value is used across a yield --> $DIR/drop-tracking-parent-expression.rs:23:22 | @@ -50,7 +54,11 @@ LL | | }; LL | | ); | |_____- in this macro invocation | - = help: within `{coroutine@$DIR/drop-tracking-parent-expression.rs:19:34: 19:41}`, the trait `Send` is not implemented for `significant_drop::Client` +help: within `{coroutine@$DIR/drop-tracking-parent-expression.rs:19:34: 19:41}`, the trait `Send` is not implemented for `significant_drop::Client` + --> $DIR/drop-tracking-parent-expression.rs:55:13 + | +LL | pub struct Client; + | ^^^^^^^^^^^^^^^^^ note: coroutine is not `Send` as this value is used across a yield --> $DIR/drop-tracking-parent-expression.rs:23:22 | @@ -88,7 +96,11 @@ LL | | }; LL | | ); | |_____- in this macro invocation | - = help: within `{coroutine@$DIR/drop-tracking-parent-expression.rs:19:34: 19:41}`, the trait `Send` is not implemented for `insignificant_dtor::Client` +help: within `{coroutine@$DIR/drop-tracking-parent-expression.rs:19:34: 19:41}`, the trait `Send` is not implemented for `insignificant_dtor::Client` + --> $DIR/drop-tracking-parent-expression.rs:64:13 + | +LL | pub struct Client; + | ^^^^^^^^^^^^^^^^^ note: coroutine is not `Send` as this value is used across a yield --> $DIR/drop-tracking-parent-expression.rs:23:22 | diff --git a/tests/ui/coroutine/drop-yield-twice.stderr b/tests/ui/coroutine/drop-yield-twice.stderr index c5da35d9736..5ac2b471cb6 100644 --- a/tests/ui/coroutine/drop-yield-twice.stderr +++ b/tests/ui/coroutine/drop-yield-twice.stderr @@ -9,7 +9,11 @@ LL | | yield; LL | | }) | |______^ coroutine is not `Send` | - = help: within `{coroutine@$DIR/drop-yield-twice.rs:7:30: 7:32}`, the trait `Send` is not implemented for `Foo` +help: within `{coroutine@$DIR/drop-yield-twice.rs:7:30: 7:32}`, the trait `Send` is not implemented for `Foo` + --> $DIR/drop-yield-twice.rs:3:1 + | +LL | struct Foo(i32); + | ^^^^^^^^^^ note: coroutine is not `Send` as this value is used across a yield --> $DIR/drop-yield-twice.rs:9:9 | diff --git a/tests/ui/coroutine/gen_block_panic.stderr b/tests/ui/coroutine/gen_block_panic.stderr index a0a6d1063c4..a43c9e03691 100644 --- a/tests/ui/coroutine/gen_block_panic.stderr +++ b/tests/ui/coroutine/gen_block_panic.stderr @@ -6,7 +6,7 @@ LL | panic!("foo"); LL | yield 69; | ^^^^^^^^^ unreachable statement | - = note: `#[warn(unreachable_code)]` on by default + = note: `#[warn(unreachable_code)]` (part of `#[warn(unused)]`) on by default warning: 1 warning emitted diff --git a/tests/ui/coroutine/issue-52398.stderr b/tests/ui/coroutine/issue-52398.stderr index 806690cc332..b3bf2e4a4e6 100644 --- a/tests/ui/coroutine/issue-52398.stderr +++ b/tests/ui/coroutine/issue-52398.stderr @@ -8,7 +8,7 @@ LL | | }; | |_____^ | = note: coroutines are lazy and do nothing unless resumed - = note: `#[warn(unused_must_use)]` on by default + = note: `#[warn(unused_must_use)]` (part of `#[warn(unused)]`) on by default warning: unused coroutine that must be used --> $DIR/issue-52398.rs:24:18 diff --git a/tests/ui/coroutine/issue-57084.stderr b/tests/ui/coroutine/issue-57084.stderr index 81bd27da919..0e2359f2f81 100644 --- a/tests/ui/coroutine/issue-57084.stderr +++ b/tests/ui/coroutine/issue-57084.stderr @@ -11,7 +11,7 @@ LL | | }; | |_____^ | = note: coroutines are lazy and do nothing unless resumed - = note: `#[warn(unused_must_use)]` on by default + = note: `#[warn(unused_must_use)]` (part of `#[warn(unused)]`) on by default warning: 1 warning emitted diff --git a/tests/ui/coroutine/match-bindings.stderr b/tests/ui/coroutine/match-bindings.stderr index 1318e6931f5..98877bbcba5 100644 --- a/tests/ui/coroutine/match-bindings.stderr +++ b/tests/ui/coroutine/match-bindings.stderr @@ -11,7 +11,7 @@ LL | | }; | |_____^ | = note: coroutines are lazy and do nothing unless resumed - = note: `#[warn(unused_must_use)]` on by default + = note: `#[warn(unused_must_use)]` (part of `#[warn(unused)]`) on by default warning: 1 warning emitted diff --git a/tests/ui/coroutine/not-send-sync.stderr b/tests/ui/coroutine/not-send-sync.stderr index c6d2ac0a557..16277edd66a 100644 --- a/tests/ui/coroutine/not-send-sync.stderr +++ b/tests/ui/coroutine/not-send-sync.stderr @@ -9,7 +9,11 @@ LL | | drop(a); LL | | }); | |______^ coroutine is not `Sync` | - = help: within `{coroutine@$DIR/not-send-sync.rs:14:30: 14:32}`, the trait `Sync` is not implemented for `NotSync` +help: within `{coroutine@$DIR/not-send-sync.rs:14:30: 14:32}`, the trait `Sync` is not implemented for `NotSync` + --> $DIR/not-send-sync.rs:5:1 + | +LL | struct NotSync; + | ^^^^^^^^^^^^^^ note: coroutine is not `Sync` as this value is used across a yield --> $DIR/not-send-sync.rs:17:9 | @@ -34,7 +38,11 @@ LL | | drop(a); LL | | }); | |______^ coroutine is not `Send` | - = help: within `{coroutine@$DIR/not-send-sync.rs:21:30: 21:32}`, the trait `Send` is not implemented for `NotSend` +help: within `{coroutine@$DIR/not-send-sync.rs:21:30: 21:32}`, the trait `Send` is not implemented for `NotSend` + --> $DIR/not-send-sync.rs:4:1 + | +LL | struct NotSend; + | ^^^^^^^^^^^^^^ note: coroutine is not `Send` as this value is used across a yield --> $DIR/not-send-sync.rs:24:9 | diff --git a/tests/ui/coroutine/parent-expression.stderr b/tests/ui/coroutine/parent-expression.stderr index f14bf05ed09..0dd97c538a8 100644 --- a/tests/ui/coroutine/parent-expression.stderr +++ b/tests/ui/coroutine/parent-expression.stderr @@ -12,7 +12,11 @@ LL | | }; LL | | ); | |_____- in this macro invocation | - = help: within `{coroutine@$DIR/parent-expression.rs:19:34: 19:41}`, the trait `Send` is not implemented for `derived_drop::Client` +help: within `{coroutine@$DIR/parent-expression.rs:19:34: 19:41}`, the trait `Send` is not implemented for `derived_drop::Client` + --> $DIR/parent-expression.rs:51:46 + | +LL | derived_drop => { #[derive(Default)] pub struct Client { pub nickname: String } }; + | ^^^^^^^^^^^^^^^^^ note: coroutine is not `Send` as this value is used across a yield --> $DIR/parent-expression.rs:23:22 | @@ -50,7 +54,11 @@ LL | | }; LL | | ); | |_____- in this macro invocation | - = help: within `{coroutine@$DIR/parent-expression.rs:19:34: 19:41}`, the trait `Send` is not implemented for `significant_drop::Client` +help: within `{coroutine@$DIR/parent-expression.rs:19:34: 19:41}`, the trait `Send` is not implemented for `significant_drop::Client` + --> $DIR/parent-expression.rs:55:13 + | +LL | pub struct Client; + | ^^^^^^^^^^^^^^^^^ note: coroutine is not `Send` as this value is used across a yield --> $DIR/parent-expression.rs:23:22 | @@ -88,7 +96,11 @@ LL | | }; LL | | ); | |_____- in this macro invocation | - = help: within `{coroutine@$DIR/parent-expression.rs:19:34: 19:41}`, the trait `Send` is not implemented for `insignificant_dtor::Client` +help: within `{coroutine@$DIR/parent-expression.rs:19:34: 19:41}`, the trait `Send` is not implemented for `insignificant_dtor::Client` + --> $DIR/parent-expression.rs:64:13 + | +LL | pub struct Client; + | ^^^^^^^^^^^^^^^^^ note: coroutine is not `Send` as this value is used across a yield --> $DIR/parent-expression.rs:23:22 | diff --git a/tests/ui/coroutine/print/coroutine-print-verbose-2.stderr b/tests/ui/coroutine/print/coroutine-print-verbose-2.stderr index 11b78e3bcf8..d27660c67d9 100644 --- a/tests/ui/coroutine/print/coroutine-print-verbose-2.stderr +++ b/tests/ui/coroutine/print/coroutine-print-verbose-2.stderr @@ -9,7 +9,11 @@ LL | | drop(a); LL | | }); | |______^ coroutine is not `Sync` | - = help: within `{main::{closure#0} upvar_tys=() resume_ty=() yield_ty=() return_ty=()}`, the trait `Sync` is not implemented for `NotSync` +help: within `{main::{closure#0} upvar_tys=() resume_ty=() yield_ty=() return_ty=()}`, the trait `Sync` is not implemented for `NotSync` + --> $DIR/coroutine-print-verbose-2.rs:8:1 + | +LL | struct NotSync; + | ^^^^^^^^^^^^^^ note: coroutine is not `Sync` as this value is used across a yield --> $DIR/coroutine-print-verbose-2.rs:20:9 | @@ -34,7 +38,11 @@ LL | | drop(a); LL | | }); | |______^ coroutine is not `Send` | - = help: within `{main::{closure#1} upvar_tys=() resume_ty=() yield_ty=() return_ty=()}`, the trait `Send` is not implemented for `NotSend` +help: within `{main::{closure#1} upvar_tys=() resume_ty=() yield_ty=() return_ty=()}`, the trait `Send` is not implemented for `NotSend` + --> $DIR/coroutine-print-verbose-2.rs:7:1 + | +LL | struct NotSend; + | ^^^^^^^^^^^^^^ note: coroutine is not `Send` as this value is used across a yield --> $DIR/coroutine-print-verbose-2.rs:27:9 | diff --git a/tests/ui/coroutine/reborrow-mut-upvar.stderr b/tests/ui/coroutine/reborrow-mut-upvar.stderr index a05e84c5f3e..a77121a25dc 100644 --- a/tests/ui/coroutine/reborrow-mut-upvar.stderr +++ b/tests/ui/coroutine/reborrow-mut-upvar.stderr @@ -12,7 +12,7 @@ LL | | }; | |_____^ | = note: coroutines are lazy and do nothing unless resumed - = note: `#[warn(unused_must_use)]` on by default + = note: `#[warn(unused_must_use)]` (part of `#[warn(unused)]`) on by default warning: 1 warning emitted diff --git a/tests/ui/coroutine/static-closure-unexpanded.rs b/tests/ui/coroutine/static-closure-unexpanded.rs new file mode 100644 index 00000000000..7cf24774ded --- /dev/null +++ b/tests/ui/coroutine/static-closure-unexpanded.rs @@ -0,0 +1,10 @@ +// Tests that static closures are not stable in the parser grammar unless the +// coroutine feature is enabled. + +#[cfg(any())] +fn foo() { + let _ = static || {}; + //~^ ERROR coroutine syntax is experimental +} + +fn main() {} diff --git a/tests/ui/coroutine/static-closure-unexpanded.stderr b/tests/ui/coroutine/static-closure-unexpanded.stderr new file mode 100644 index 00000000000..f08bafd368f --- /dev/null +++ b/tests/ui/coroutine/static-closure-unexpanded.stderr @@ -0,0 +1,13 @@ +error[E0658]: coroutine syntax is experimental + --> $DIR/static-closure-unexpanded.rs:6:13 + | +LL | let _ = static || {}; + | ^^^^^^ + | + = 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: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0658`. diff --git a/tests/ui/coroutine/too-live-local-in-immovable-gen.stderr b/tests/ui/coroutine/too-live-local-in-immovable-gen.stderr index 4fad4036300..0bc6cb60370 100644 --- a/tests/ui/coroutine/too-live-local-in-immovable-gen.stderr +++ b/tests/ui/coroutine/too-live-local-in-immovable-gen.stderr @@ -9,7 +9,7 @@ LL | | }; | |_________^ | = note: coroutines are lazy and do nothing unless resumed - = note: `#[warn(unused_must_use)]` on by default + = note: `#[warn(unused_must_use)]` (part of `#[warn(unused)]`) on by default warning: 1 warning emitted diff --git a/tests/ui/coroutine/yield-in-args-rev.stderr b/tests/ui/coroutine/yield-in-args-rev.stderr index 10829d66185..d1650cee6cb 100644 --- a/tests/ui/coroutine/yield-in-args-rev.stderr +++ b/tests/ui/coroutine/yield-in-args-rev.stderr @@ -9,7 +9,7 @@ LL | | }; | |_____^ | = note: coroutines are lazy and do nothing unless resumed - = note: `#[warn(unused_must_use)]` on by default + = note: `#[warn(unused_must_use)]` (part of `#[warn(unused)]`) on by default warning: 1 warning emitted diff --git a/tests/ui/coroutine/yield-in-initializer.stderr b/tests/ui/coroutine/yield-in-initializer.stderr index eff5a0fdccf..a01be9e8e73 100644 --- a/tests/ui/coroutine/yield-in-initializer.stderr +++ b/tests/ui/coroutine/yield-in-initializer.stderr @@ -9,7 +9,7 @@ LL | | }; | |_____^ | = note: coroutines are lazy and do nothing unless resumed - = note: `#[warn(unused_must_use)]` on by default + = note: `#[warn(unused_must_use)]` (part of `#[warn(unused)]`) on by default warning: 1 warning emitted diff --git a/tests/ui/coroutine/yield-subtype.stderr b/tests/ui/coroutine/yield-subtype.stderr index 973415327a5..b2bf219822b 100644 --- a/tests/ui/coroutine/yield-subtype.stderr +++ b/tests/ui/coroutine/yield-subtype.stderr @@ -9,7 +9,7 @@ LL | | }; | |_____^ | = note: coroutines are lazy and do nothing unless resumed - = note: `#[warn(unused_must_use)]` on by default + = note: `#[warn(unused_must_use)]` (part of `#[warn(unused)]`) on by default warning: 1 warning emitted diff --git a/tests/ui/coverage-attr/allowed-positions.stderr b/tests/ui/coverage-attr/allowed-positions.stderr index aaef3ad0203..1690d089a8c 100644 --- a/tests/ui/coverage-attr/allowed-positions.stderr +++ b/tests/ui/coverage-attr/allowed-positions.stderr @@ -14,7 +14,7 @@ error: `#[coverage]` attribute cannot be used on type aliases LL | #[coverage(off)] | ^^^^^^^^^^^^^^^^ | - = help: `#[coverage]` can be applied to functions, impl blocks, modules, crates + = help: `#[coverage]` can be applied to functions, impl blocks, modules, and crates error: `#[coverage]` attribute cannot be used on traits --> $DIR/allowed-positions.rs:17:1 @@ -22,7 +22,7 @@ error: `#[coverage]` attribute cannot be used on traits LL | #[coverage(off)] | ^^^^^^^^^^^^^^^^ | - = help: `#[coverage]` can be applied to functions, impl blocks, modules, crates + = help: `#[coverage]` can be applied to functions, impl blocks, modules, and crates error: `#[coverage]` attribute cannot be used on associated consts --> $DIR/allowed-positions.rs:19:5 @@ -30,7 +30,7 @@ error: `#[coverage]` attribute cannot be used on associated consts LL | #[coverage(off)] | ^^^^^^^^^^^^^^^^ | - = help: `#[coverage]` can be applied to functions, impl blocks, modules, crates + = help: `#[coverage]` can be applied to functions, impl blocks, modules, and crates error: `#[coverage]` attribute cannot be used on associated types --> $DIR/allowed-positions.rs:22:5 @@ -38,7 +38,7 @@ error: `#[coverage]` attribute cannot be used on associated types LL | #[coverage(off)] | ^^^^^^^^^^^^^^^^ | - = help: `#[coverage]` can be applied to functions, impl blocks, modules, crates + = help: `#[coverage]` can be applied to functions, impl blocks, modules, and crates error: `#[coverage]` attribute cannot be used on required trait methods --> $DIR/allowed-positions.rs:25:5 @@ -46,7 +46,7 @@ error: `#[coverage]` attribute cannot be used on required trait methods LL | #[coverage(off)] | ^^^^^^^^^^^^^^^^ | - = help: `#[coverage]` can be applied to impl blocks, functions, closures, provided trait methods, trait methods in impl blocks, inherent methods, modules, crates + = help: `#[coverage]` can be applied to impl blocks, functions, closures, provided trait methods, trait methods in impl blocks, inherent methods, modules, and crates error: `#[coverage]` attribute cannot be used on required trait methods --> $DIR/allowed-positions.rs:31:5 @@ -54,7 +54,7 @@ error: `#[coverage]` attribute cannot be used on required trait methods LL | #[coverage(off)] | ^^^^^^^^^^^^^^^^ | - = help: `#[coverage]` can be applied to impl blocks, functions, closures, provided trait methods, trait methods in impl blocks, inherent methods, modules, crates + = help: `#[coverage]` can be applied to impl blocks, functions, closures, provided trait methods, trait methods in impl blocks, inherent methods, modules, and crates error: `#[coverage]` attribute cannot be used on associated types --> $DIR/allowed-positions.rs:39:5 @@ -62,7 +62,7 @@ error: `#[coverage]` attribute cannot be used on associated types LL | #[coverage(off)] | ^^^^^^^^^^^^^^^^ | - = help: `#[coverage]` can be applied to functions, impl blocks, modules, crates + = help: `#[coverage]` can be applied to functions, impl blocks, modules, and crates error: `#[coverage]` attribute cannot be used on associated types --> $DIR/allowed-positions.rs:56:5 @@ -70,7 +70,7 @@ error: `#[coverage]` attribute cannot be used on associated types LL | #[coverage(off)] | ^^^^^^^^^^^^^^^^ | - = help: `#[coverage]` can be applied to functions, impl blocks, modules, crates + = help: `#[coverage]` can be applied to functions, impl blocks, modules, and crates error: `#[coverage]` attribute cannot be used on structs --> $DIR/allowed-positions.rs:61:1 @@ -78,7 +78,7 @@ error: `#[coverage]` attribute cannot be used on structs LL | #[coverage(off)] | ^^^^^^^^^^^^^^^^ | - = help: `#[coverage]` can be applied to functions, impl blocks, modules, crates + = help: `#[coverage]` can be applied to functions, impl blocks, modules, and crates error: `#[coverage]` attribute cannot be used on struct fields --> $DIR/allowed-positions.rs:63:5 @@ -86,7 +86,7 @@ error: `#[coverage]` attribute cannot be used on struct fields LL | #[coverage(off)] | ^^^^^^^^^^^^^^^^ | - = help: `#[coverage]` can be applied to functions, impl blocks, modules, crates + = help: `#[coverage]` can be applied to functions, impl blocks, modules, and crates error: `#[coverage]` attribute cannot be used on foreign statics --> $DIR/allowed-positions.rs:76:5 @@ -94,7 +94,7 @@ error: `#[coverage]` attribute cannot be used on foreign statics LL | #[coverage(off)] | ^^^^^^^^^^^^^^^^ | - = help: `#[coverage]` can be applied to functions, impl blocks, modules, crates + = help: `#[coverage]` can be applied to functions, impl blocks, modules, and crates error: `#[coverage]` attribute cannot be used on foreign types --> $DIR/allowed-positions.rs:79:5 @@ -102,7 +102,7 @@ error: `#[coverage]` attribute cannot be used on foreign types LL | #[coverage(off)] | ^^^^^^^^^^^^^^^^ | - = help: `#[coverage]` can be applied to functions, impl blocks, modules, crates + = help: `#[coverage]` can be applied to functions, impl blocks, modules, and crates error: `#[coverage]` attribute cannot be used on foreign functions --> $DIR/allowed-positions.rs:82:5 @@ -110,7 +110,7 @@ error: `#[coverage]` attribute cannot be used on foreign functions LL | #[coverage(off)] | ^^^^^^^^^^^^^^^^ | - = help: `#[coverage]` can be applied to methods, impl blocks, functions, closures, modules, crates + = help: `#[coverage]` can be applied to methods, impl blocks, functions, closures, modules, and crates error: `#[coverage]` attribute cannot be used on statements --> $DIR/allowed-positions.rs:88:5 @@ -118,7 +118,7 @@ error: `#[coverage]` attribute cannot be used on statements LL | #[coverage(off)] | ^^^^^^^^^^^^^^^^ | - = help: `#[coverage]` can be applied to functions, impl blocks, modules, crates + = help: `#[coverage]` can be applied to functions, impl blocks, modules, and crates error: `#[coverage]` attribute cannot be used on statements --> $DIR/allowed-positions.rs:94:5 @@ -126,7 +126,7 @@ error: `#[coverage]` attribute cannot be used on statements LL | #[coverage(off)] | ^^^^^^^^^^^^^^^^ | - = help: `#[coverage]` can be applied to functions, impl blocks, modules, crates + = help: `#[coverage]` can be applied to functions, impl blocks, modules, and crates error: `#[coverage]` attribute cannot be used on match arms --> $DIR/allowed-positions.rs:110:9 @@ -134,7 +134,7 @@ error: `#[coverage]` attribute cannot be used on match arms LL | #[coverage(off)] | ^^^^^^^^^^^^^^^^ | - = help: `#[coverage]` can be applied to functions, impl blocks, modules, crates + = help: `#[coverage]` can be applied to functions, impl blocks, modules, and crates error: `#[coverage]` attribute cannot be used on expressions --> $DIR/allowed-positions.rs:114:5 @@ -142,7 +142,7 @@ error: `#[coverage]` attribute cannot be used on expressions LL | #[coverage(off)] | ^^^^^^^^^^^^^^^^ | - = help: `#[coverage]` can be applied to functions, impl blocks, modules, crates + = help: `#[coverage]` can be applied to functions, impl blocks, modules, and crates error: aborting due to 18 previous errors diff --git a/tests/ui/coverage-attr/bad-syntax.stderr b/tests/ui/coverage-attr/bad-syntax.stderr index 927f61da08d..ecf3ed83bca 100644 --- a/tests/ui/coverage-attr/bad-syntax.stderr +++ b/tests/ui/coverage-attr/bad-syntax.stderr @@ -1,15 +1,3 @@ -error: expected identifier, found `,` - --> $DIR/bad-syntax.rs:44:12 - | -LL | #[coverage(,off)] - | ^ expected identifier - | -help: remove this comma - | -LL - #[coverage(,off)] -LL + #[coverage(off)] - | - error: multiple `coverage` attributes --> $DIR/bad-syntax.rs:9:1 | @@ -162,6 +150,18 @@ LL - #[coverage(off, bogus)] LL + #[coverage(on)] | +error: expected identifier, found `,` + --> $DIR/bad-syntax.rs:44:12 + | +LL | #[coverage(,off)] + | ^ expected identifier + | +help: remove this comma + | +LL - #[coverage(,off)] +LL + #[coverage(off)] + | + error: aborting due to 11 previous errors Some errors have detailed explanations: E0539, E0805. diff --git a/tests/ui/coverage-attr/name-value.stderr b/tests/ui/coverage-attr/name-value.stderr index 2dac2401e3c..77abaa42e31 100644 --- a/tests/ui/coverage-attr/name-value.stderr +++ b/tests/ui/coverage-attr/name-value.stderr @@ -22,10 +22,10 @@ LL | #![coverage = "off"] help: try changing it to one of the following valid forms of the attribute | LL - #![coverage = "off"] -LL + #[coverage(off)] +LL + #![coverage(off)] | LL - #![coverage = "off"] -LL + #[coverage(on)] +LL + #![coverage(on)] | error[E0539]: malformed `coverage` attribute input @@ -49,7 +49,7 @@ error: `#[coverage]` attribute cannot be used on structs LL | #[coverage = "off"] | ^^^^^^^^^^^^^^^^^^^ | - = help: `#[coverage]` can be applied to functions, impl blocks, modules, crates + = help: `#[coverage]` can be applied to functions, impl blocks, modules, and crates error[E0539]: malformed `coverage` attribute input --> $DIR/name-value.rs:26:1 @@ -87,7 +87,7 @@ error: `#[coverage]` attribute cannot be used on associated consts LL | #[coverage = "off"] | ^^^^^^^^^^^^^^^^^^^ | - = help: `#[coverage]` can be applied to functions, impl blocks, modules, crates + = help: `#[coverage]` can be applied to functions, impl blocks, modules, and crates error[E0539]: malformed `coverage` attribute input --> $DIR/name-value.rs:35:1 @@ -110,7 +110,7 @@ error: `#[coverage]` attribute cannot be used on traits LL | #[coverage = "off"] | ^^^^^^^^^^^^^^^^^^^ | - = help: `#[coverage]` can be applied to functions, impl blocks, modules, crates + = help: `#[coverage]` can be applied to functions, impl blocks, modules, and crates error[E0539]: malformed `coverage` attribute input --> $DIR/name-value.rs:39:5 @@ -133,7 +133,7 @@ error: `#[coverage]` attribute cannot be used on associated consts LL | #[coverage = "off"] | ^^^^^^^^^^^^^^^^^^^ | - = help: `#[coverage]` can be applied to functions, impl blocks, modules, crates + = help: `#[coverage]` can be applied to functions, impl blocks, modules, and crates error[E0539]: malformed `coverage` attribute input --> $DIR/name-value.rs:44:5 @@ -156,7 +156,7 @@ error: `#[coverage]` attribute cannot be used on associated types LL | #[coverage = "off"] | ^^^^^^^^^^^^^^^^^^^ | - = help: `#[coverage]` can be applied to functions, impl blocks, modules, crates + = help: `#[coverage]` can be applied to functions, impl blocks, modules, and crates error[E0539]: malformed `coverage` attribute input --> $DIR/name-value.rs:50:1 @@ -194,7 +194,7 @@ error: `#[coverage]` attribute cannot be used on associated consts LL | #[coverage = "off"] | ^^^^^^^^^^^^^^^^^^^ | - = help: `#[coverage]` can be applied to functions, impl blocks, modules, crates + = help: `#[coverage]` can be applied to functions, impl blocks, modules, and crates error[E0539]: malformed `coverage` attribute input --> $DIR/name-value.rs:58:5 @@ -217,7 +217,7 @@ error: `#[coverage]` attribute cannot be used on associated types LL | #[coverage = "off"] | ^^^^^^^^^^^^^^^^^^^ | - = help: `#[coverage]` can be applied to functions, impl blocks, modules, crates + = help: `#[coverage]` can be applied to functions, impl blocks, modules, and crates error[E0539]: malformed `coverage` attribute input --> $DIR/name-value.rs:64:1 diff --git a/tests/ui/coverage-attr/word-only.stderr b/tests/ui/coverage-attr/word-only.stderr index e916a817e36..5fcffacc7fa 100644 --- a/tests/ui/coverage-attr/word-only.stderr +++ b/tests/ui/coverage-attr/word-only.stderr @@ -19,12 +19,10 @@ LL | #![coverage] | help: try changing it to one of the following valid forms of the attribute | -LL - #![coverage] -LL + #[coverage(off)] - | -LL - #![coverage] -LL + #[coverage(on)] - | +LL | #![coverage(off)] + | +++++ +LL | #![coverage(on)] + | ++++ error[E0539]: malformed `coverage` attribute input --> $DIR/word-only.rs:21:1 @@ -45,7 +43,7 @@ error: `#[coverage]` attribute cannot be used on structs LL | #[coverage] | ^^^^^^^^^^^ | - = help: `#[coverage]` can be applied to functions, impl blocks, modules, crates + = help: `#[coverage]` can be applied to functions, impl blocks, modules, and crates error[E0539]: malformed `coverage` attribute input --> $DIR/word-only.rs:26:1 @@ -79,7 +77,7 @@ error: `#[coverage]` attribute cannot be used on associated consts LL | #[coverage] | ^^^^^^^^^^^ | - = help: `#[coverage]` can be applied to functions, impl blocks, modules, crates + = help: `#[coverage]` can be applied to functions, impl blocks, modules, and crates error[E0539]: malformed `coverage` attribute input --> $DIR/word-only.rs:35:1 @@ -100,7 +98,7 @@ error: `#[coverage]` attribute cannot be used on traits LL | #[coverage] | ^^^^^^^^^^^ | - = help: `#[coverage]` can be applied to functions, impl blocks, modules, crates + = help: `#[coverage]` can be applied to functions, impl blocks, modules, and crates error[E0539]: malformed `coverage` attribute input --> $DIR/word-only.rs:39:5 @@ -121,7 +119,7 @@ error: `#[coverage]` attribute cannot be used on associated consts LL | #[coverage] | ^^^^^^^^^^^ | - = help: `#[coverage]` can be applied to functions, impl blocks, modules, crates + = help: `#[coverage]` can be applied to functions, impl blocks, modules, and crates error[E0539]: malformed `coverage` attribute input --> $DIR/word-only.rs:44:5 @@ -142,7 +140,7 @@ error: `#[coverage]` attribute cannot be used on associated types LL | #[coverage] | ^^^^^^^^^^^ | - = help: `#[coverage]` can be applied to functions, impl blocks, modules, crates + = help: `#[coverage]` can be applied to functions, impl blocks, modules, and crates error[E0539]: malformed `coverage` attribute input --> $DIR/word-only.rs:50:1 @@ -176,7 +174,7 @@ error: `#[coverage]` attribute cannot be used on associated consts LL | #[coverage] | ^^^^^^^^^^^ | - = help: `#[coverage]` can be applied to functions, impl blocks, modules, crates + = help: `#[coverage]` can be applied to functions, impl blocks, modules, and crates error[E0539]: malformed `coverage` attribute input --> $DIR/word-only.rs:58:5 @@ -197,7 +195,7 @@ error: `#[coverage]` attribute cannot be used on associated types LL | #[coverage] | ^^^^^^^^^^^ | - = help: `#[coverage]` can be applied to functions, impl blocks, modules, crates + = help: `#[coverage]` can be applied to functions, impl blocks, modules, and crates error[E0539]: malformed `coverage` attribute input --> $DIR/word-only.rs:64:1 diff --git a/tests/ui/issues/auxiliary/issue-7178.rs b/tests/ui/cross-crate/auxiliary/aux-7178.rs index 56ae5139af4..56ae5139af4 100644 --- a/tests/ui/issues/auxiliary/issue-7178.rs +++ b/tests/ui/cross-crate/auxiliary/aux-7178.rs diff --git a/tests/ui/issues/auxiliary/issue-7899.rs b/tests/ui/cross-crate/auxiliary/aux-7899.rs index 3af6e871661..3af6e871661 100644 --- a/tests/ui/issues/auxiliary/issue-7899.rs +++ b/tests/ui/cross-crate/auxiliary/aux-7899.rs diff --git a/tests/ui/issues/auxiliary/issue-8259.rs b/tests/ui/cross-crate/auxiliary/aux-8259.rs index 891aee099dc..891aee099dc 100644 --- a/tests/ui/issues/auxiliary/issue-8259.rs +++ b/tests/ui/cross-crate/auxiliary/aux-8259.rs diff --git a/tests/ui/cross-crate/static-method-returning-self-with-generics-7178.rs b/tests/ui/cross-crate/static-method-returning-self-with-generics-7178.rs new file mode 100644 index 00000000000..3888d3bdaa9 --- /dev/null +++ b/tests/ui/cross-crate/static-method-returning-self-with-generics-7178.rs @@ -0,0 +1,9 @@ +// https://github.com/rust-lang/rust/issues/7178 +//@ run-pass +//@ aux-build:aux-7178.rs + +extern crate aux_7178 as cross_crate_self; + +pub fn main() { + let _ = cross_crate_self::Foo::new(&1); +} diff --git a/tests/ui/issues/issue-8259.rs b/tests/ui/cross-crate/static-with-cross-crate-regions-8259.rs index e843f7f9c50..347cfa2aee1 100644 --- a/tests/ui/issues/issue-8259.rs +++ b/tests/ui/cross-crate/static-with-cross-crate-regions-8259.rs @@ -1,11 +1,11 @@ +// https://github.com/rust-lang/rust/issues/8259 //@ run-pass #![allow(dead_code)] #![allow(non_upper_case_globals)] -//@ aux-build:issue-8259.rs +//@ aux-build:aux-8259.rs - -extern crate issue_8259 as other; +extern crate aux_8259 as other; static a: other::Foo<'static> = other::Foo::A; pub fn main() {} diff --git a/tests/ui/cross-crate/tuple-like-structs-cross-crate-7899.rs b/tests/ui/cross-crate/tuple-like-structs-cross-crate-7899.rs new file mode 100644 index 00000000000..ce3ea7dd579 --- /dev/null +++ b/tests/ui/cross-crate/tuple-like-structs-cross-crate-7899.rs @@ -0,0 +1,10 @@ +// https://github.com/rust-lang/rust/issues/7899 +//@ run-pass +#![allow(unused_variables)] +//@ aux-build:aux-7899.rs + +extern crate aux_7899 as testcrate; + +fn main() { + let f = testcrate::V2(1.0f32, 2.0f32); +} diff --git a/tests/ui/cross-crate/tuple-struct-cross-crate-7899.rs b/tests/ui/cross-crate/tuple-struct-cross-crate-7899.rs new file mode 100644 index 00000000000..ce3ea7dd579 --- /dev/null +++ b/tests/ui/cross-crate/tuple-struct-cross-crate-7899.rs @@ -0,0 +1,10 @@ +// https://github.com/rust-lang/rust/issues/7899 +//@ run-pass +#![allow(unused_variables)] +//@ aux-build:aux-7899.rs + +extern crate aux_7899 as testcrate; + +fn main() { + let f = testcrate::V2(1.0f32, 2.0f32); +} diff --git a/tests/ui/delegation/explicit-paths.stderr b/tests/ui/delegation/explicit-paths.stderr index 8098ea8c54f..29f87cf1457 100644 --- a/tests/ui/delegation/explicit-paths.stderr +++ b/tests/ui/delegation/explicit-paths.stderr @@ -89,8 +89,13 @@ error[E0277]: the trait bound `S2: Trait` is not satisfied --> $DIR/explicit-paths.rs:76:16 | LL | reuse <S2 as Trait>::foo1; - | ^^ the trait `Trait` is not implemented for `S2` + | ^^ unsatisfied trait bound | +help: the trait `Trait` is not implemented for `S2` + --> $DIR/explicit-paths.rs:73:5 + | +LL | struct S2; + | ^^^^^^^^^ = help: the following other types implement trait `Trait`: F S diff --git a/tests/ui/delegation/generics/impl-to-trait-method.stderr b/tests/ui/delegation/generics/impl-to-trait-method.stderr index aeba30de043..2c0b466dba3 100644 --- a/tests/ui/delegation/generics/impl-to-trait-method.stderr +++ b/tests/ui/delegation/generics/impl-to-trait-method.stderr @@ -2,8 +2,13 @@ error[E0277]: the trait bound `bounds::S: Trait0` is not satisfied --> $DIR/impl-to-trait-method.rs:12:19 | LL | Self: Trait0, - | ^^^^^^ the trait `Trait0` is not implemented for `bounds::S` + | ^^^^^^ unsatisfied trait bound | +help: the trait `Trait0` is not implemented for `bounds::S` + --> $DIR/impl-to-trait-method.rs:21:5 + | +LL | struct S(F); + | ^^^^^^^^ help: this trait has no implementations, consider adding one --> $DIR/impl-to-trait-method.rs:5:5 | @@ -19,10 +24,15 @@ error[E0277]: the trait bound `bounds::F: Trait0` is not satisfied --> $DIR/impl-to-trait-method.rs:24:34 | LL | reuse Trait1::<T>::foo { &self.0 } - | --- ^^^^^^^ the trait `Trait0` is not implemented for `bounds::F` + | --- ^^^^^^^ unsatisfied trait bound | | | required by a bound introduced by this call | +help: the trait `Trait0` is not implemented for `bounds::F` + --> $DIR/impl-to-trait-method.rs:18:5 + | +LL | struct F; + | ^^^^^^^^ help: this trait has no implementations, consider adding one --> $DIR/impl-to-trait-method.rs:5:5 | diff --git a/tests/ui/delegation/ice-issue-122550.stderr b/tests/ui/delegation/ice-issue-122550.stderr index 1a01bee3e1e..01355c8ad92 100644 --- a/tests/ui/delegation/ice-issue-122550.stderr +++ b/tests/ui/delegation/ice-issue-122550.stderr @@ -8,8 +8,13 @@ error[E0277]: the trait bound `S: Trait` is not satisfied --> $DIR/ice-issue-122550.rs:13:12 | LL | reuse <S as Trait>::description { &self.0 } - | ^ the trait `Trait` is not implemented for `S` + | ^ unsatisfied trait bound | +help: the trait `Trait` is not implemented for `S` + --> $DIR/ice-issue-122550.rs:10:1 + | +LL | struct S(F); + | ^^^^^^^^ help: this trait has no implementations, consider adding one --> $DIR/ice-issue-122550.rs:4:1 | diff --git a/tests/ui/delegation/target-expr-pass.stderr b/tests/ui/delegation/target-expr-pass.stderr index c8d73ec6e5a..4924d95208a 100644 --- a/tests/ui/delegation/target-expr-pass.stderr +++ b/tests/ui/delegation/target-expr-pass.stderr @@ -4,7 +4,7 @@ warning: trait `Trait` is never used LL | trait Trait { | ^^^^^ | - = note: `#[warn(dead_code)]` on by default + = note: `#[warn(dead_code)]` (part of `#[warn(unused)]`) on by default warning: struct `F` is never constructed --> $DIR/target-expr-pass.rs:21:8 diff --git a/tests/ui/deprecation/deprecation-sanity.rs b/tests/ui/deprecation/deprecation-sanity.rs index 9698a376025..45ee91741e5 100644 --- a/tests/ui/deprecation/deprecation-sanity.rs +++ b/tests/ui/deprecation/deprecation-sanity.rs @@ -42,4 +42,9 @@ impl Default for X { } } +unsafe extern "C" { + #[deprecated] + static FOO: std::ffi::c_int; +} + fn main() { } diff --git a/tests/ui/deprecation/deprecation-sanity.stderr b/tests/ui/deprecation/deprecation-sanity.stderr index 1d44215731d..ea021b71e14 100644 --- a/tests/ui/deprecation/deprecation-sanity.stderr +++ b/tests/ui/deprecation/deprecation-sanity.stderr @@ -177,7 +177,7 @@ LL | #[deprecated = "hello"] | ^^^^^^^^^^^^^^^^^^^^^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = help: `#[deprecated]` can be applied to functions, data types, modules, unions, constants, statics, macro defs, type aliases, use statements, struct fields, traits, associated types, associated consts, enum variants, inherent impl blocks, crates + = help: `#[deprecated]` can be applied to functions, data types, modules, unions, constants, statics, macro defs, type aliases, use statements, foreign statics, struct fields, traits, associated types, associated consts, enum variants, inherent impl blocks, and crates = note: `#[deny(useless_deprecated)]` on by default error: aborting due to 10 previous errors 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 c5433151a8f..378d0a3e723 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,9 +3,9 @@ // was a well-formed `MetaItem`. fn main() { - foo() //~ WARNING use of deprecated function `foo` + foo() } #[deprecated(note = test)] -//~^ ERROR expected unsuffixed literal, found `test` +//~^ ERROR expected a literal (`1u8`, `1.0f32`, `"string"`, etc.) here, found `test` fn foo() {} 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 2ff8534b276..cd985ab5a18 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 @@ -1,4 +1,4 @@ -error: expected unsuffixed literal, found `test` +error: expected a literal (`1u8`, `1.0f32`, `"string"`, etc.) here, found `test` --> $DIR/issue-66340-deprecated-attr-non-meta-grammar.rs:9:21 | LL | #[deprecated(note = test)] @@ -9,13 +9,5 @@ help: surround the identifier with quotation marks to make it into a string lite LL | #[deprecated(note = "test")] | + + -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 +error: aborting due to 1 previous error diff --git a/tests/ui/derives/deriving-meta-unknown-trait.stderr b/tests/ui/derives/deriving-meta-unknown-trait.stderr index 28753b8f9f2..7ee90ae9eb0 100644 --- a/tests/ui/derives/deriving-meta-unknown-trait.stderr +++ b/tests/ui/derives/deriving-meta-unknown-trait.stderr @@ -3,6 +3,7 @@ error: cannot find derive macro `Eqr` in this scope | LL | #[derive(Eqr)] | ^^^ help: a derive macro with a similar name exists: `Eq` + | --> $SRC_DIR/core/src/cmp.rs:LL:COL | = note: similarly named derive macro `Eq` defined here @@ -12,6 +13,7 @@ error: cannot find derive macro `Eqr` in this scope | LL | #[derive(Eqr)] | ^^^ help: a derive macro with a similar name exists: `Eq` + | --> $SRC_DIR/core/src/cmp.rs:LL:COL | = note: similarly named derive macro `Eq` defined here diff --git a/tests/ui/deriving/deriving-all-codegen.rs b/tests/ui/deriving/deriving-all-codegen.rs index e2b6804fbd1..db58f12d60c 100644 --- a/tests/ui/deriving/deriving-all-codegen.rs +++ b/tests/ui/deriving/deriving-all-codegen.rs @@ -16,6 +16,9 @@ #![crate_type = "lib"] #![allow(dead_code)] #![allow(deprecated)] +#![feature(derive_from)] + +use std::from::From; // Empty struct. #[derive(Clone, Copy, Debug, Default, Hash, PartialEq, Eq, PartialOrd, Ord)] @@ -38,11 +41,26 @@ struct PackedPoint { y: u32, } +#[derive(Clone, Copy, Debug, Default, From, Hash, PartialEq, Eq, PartialOrd, Ord)] +struct TupleSingleField(u32); + +#[derive(Clone, Copy, Debug, Default, From, Hash, PartialEq, Eq, PartialOrd, Ord)] +struct SingleField { + foo: bool, +} + // A large struct. Note: because this derives `Copy`, it gets the simple // `clone` implemention that just does `*self`. #[derive(Clone, Copy, Debug, Default, Hash, PartialEq, Eq, PartialOrd, Ord)] struct Big { - b1: u32, b2: u32, b3: u32, b4: u32, b5: u32, b6: u32, b7: u32, b8: u32, + b1: u32, + b2: u32, + b3: u32, + b4: u32, + b5: u32, + b6: u32, + b7: u32, + b8: u32, } // It is more efficient to compare scalar types before non-scalar types. @@ -86,7 +104,7 @@ struct PackedManualCopy(u32); impl Copy for PackedManualCopy {} // A struct with an unsized field. Some derives are not usable in this case. -#[derive(Debug, Hash, PartialEq, Eq, PartialOrd, Ord)] +#[derive(Debug, From, Hash, PartialEq, Eq, PartialOrd, Ord)] struct Unsized([u32]); trait Trait { @@ -117,7 +135,7 @@ enum Enum0 {} // A single-variant enum. #[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)] enum Enum1 { - Single { x: u32 } + Single { x: u32 }, } // A C-like, fieldless enum with a single variant. @@ -143,7 +161,10 @@ enum Mixed { P, Q, R(u32), - S { d1: Option<u32>, d2: Option<i32> }, + S { + d1: Option<u32>, + d2: Option<i32>, + }, } // When comparing enum variant it is more efficient to compare scalar types before non-scalar types. diff --git a/tests/ui/deriving/deriving-all-codegen.stdout b/tests/ui/deriving/deriving-all-codegen.stdout index 0e4bfa30257..4c60b1cf427 100644 --- a/tests/ui/deriving/deriving-all-codegen.stdout +++ b/tests/ui/deriving/deriving-all-codegen.stdout @@ -17,11 +17,14 @@ #![crate_type = "lib"] #![allow(dead_code)] #![allow(deprecated)] +#![feature(derive_from)] #[macro_use] extern crate std; #[prelude_import] use std::prelude::rust_2021::*; +use std::from::From; + // Empty struct. struct Empty; #[automatically_derived] @@ -249,6 +252,148 @@ impl ::core::cmp::Ord for PackedPoint { } } +struct TupleSingleField(u32); +#[automatically_derived] +impl ::core::clone::Clone for TupleSingleField { + #[inline] + fn clone(&self) -> TupleSingleField { + let _: ::core::clone::AssertParamIsClone<u32>; + *self + } +} +#[automatically_derived] +impl ::core::marker::Copy for TupleSingleField { } +#[automatically_derived] +impl ::core::fmt::Debug for TupleSingleField { + #[inline] + fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { + ::core::fmt::Formatter::debug_tuple_field1_finish(f, + "TupleSingleField", &&self.0) + } +} +#[automatically_derived] +impl ::core::default::Default for TupleSingleField { + #[inline] + fn default() -> TupleSingleField { + TupleSingleField(::core::default::Default::default()) + } +} +#[automatically_derived] +impl ::core::convert::From<u32> for TupleSingleField { + #[inline] + fn from(value: u32) -> TupleSingleField { Self(value) } +} +#[automatically_derived] +impl ::core::hash::Hash for TupleSingleField { + #[inline] + fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { + ::core::hash::Hash::hash(&self.0, state) + } +} +#[automatically_derived] +impl ::core::marker::StructuralPartialEq for TupleSingleField { } +#[automatically_derived] +impl ::core::cmp::PartialEq for TupleSingleField { + #[inline] + fn eq(&self, other: &TupleSingleField) -> bool { self.0 == other.0 } +} +#[automatically_derived] +impl ::core::cmp::Eq for TupleSingleField { + #[inline] + #[doc(hidden)] + #[coverage(off)] + fn assert_receiver_is_total_eq(&self) -> () { + let _: ::core::cmp::AssertParamIsEq<u32>; + } +} +#[automatically_derived] +impl ::core::cmp::PartialOrd for TupleSingleField { + #[inline] + fn partial_cmp(&self, other: &TupleSingleField) + -> ::core::option::Option<::core::cmp::Ordering> { + ::core::cmp::PartialOrd::partial_cmp(&self.0, &other.0) + } +} +#[automatically_derived] +impl ::core::cmp::Ord for TupleSingleField { + #[inline] + fn cmp(&self, other: &TupleSingleField) -> ::core::cmp::Ordering { + ::core::cmp::Ord::cmp(&self.0, &other.0) + } +} + +struct SingleField { + foo: bool, +} +#[automatically_derived] +impl ::core::clone::Clone for SingleField { + #[inline] + fn clone(&self) -> SingleField { + let _: ::core::clone::AssertParamIsClone<bool>; + *self + } +} +#[automatically_derived] +impl ::core::marker::Copy for SingleField { } +#[automatically_derived] +impl ::core::fmt::Debug for SingleField { + #[inline] + fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { + ::core::fmt::Formatter::debug_struct_field1_finish(f, "SingleField", + "foo", &&self.foo) + } +} +#[automatically_derived] +impl ::core::default::Default for SingleField { + #[inline] + fn default() -> SingleField { + SingleField { foo: ::core::default::Default::default() } + } +} +#[automatically_derived] +impl ::core::convert::From<bool> for SingleField { + #[inline] + fn from(value: bool) -> SingleField { Self { foo: value } } +} +#[automatically_derived] +impl ::core::hash::Hash for SingleField { + #[inline] + fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { + ::core::hash::Hash::hash(&self.foo, state) + } +} +#[automatically_derived] +impl ::core::marker::StructuralPartialEq for SingleField { } +#[automatically_derived] +impl ::core::cmp::PartialEq for SingleField { + #[inline] + fn eq(&self, other: &SingleField) -> bool { self.foo == other.foo } +} +#[automatically_derived] +impl ::core::cmp::Eq for SingleField { + #[inline] + #[doc(hidden)] + #[coverage(off)] + fn assert_receiver_is_total_eq(&self) -> () { + let _: ::core::cmp::AssertParamIsEq<bool>; + } +} +#[automatically_derived] +impl ::core::cmp::PartialOrd for SingleField { + #[inline] + fn partial_cmp(&self, other: &SingleField) + -> ::core::option::Option<::core::cmp::Ordering> { + ::core::cmp::PartialOrd::partial_cmp(&self.foo, &other.foo) + } +} +#[automatically_derived] +impl ::core::cmp::Ord for SingleField { + #[inline] + fn cmp(&self, other: &SingleField) -> ::core::cmp::Ordering { + ::core::cmp::Ord::cmp(&self.foo, &other.foo) + } +} + // A large struct. Note: because this derives `Copy`, it gets the simple // `clone` implemention that just does `*self`. struct Big { @@ -572,6 +717,11 @@ impl ::core::fmt::Debug for Unsized { } } #[automatically_derived] +impl ::core::convert::From<[u32]> for Unsized { + #[inline] + fn from(value: [u32]) -> Unsized { Self(value) } +} +#[automatically_derived] impl ::core::hash::Hash for Unsized { #[inline] fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { diff --git a/tests/ui/deriving/deriving-from-wrong-target.rs b/tests/ui/deriving/deriving-from-wrong-target.rs new file mode 100644 index 00000000000..d0cab937b5d --- /dev/null +++ b/tests/ui/deriving/deriving-from-wrong-target.rs @@ -0,0 +1,37 @@ +//@ check-fail + +#![feature(derive_from)] +#![allow(dead_code)] + +use std::from::From; + +#[derive(From)] +//~^ ERROR `#[derive(From)]` used on a struct with no fields +struct S1; + +#[derive(From)] +//~^ ERROR `#[derive(From)]` used on a struct with no fields +struct S2 {} + +#[derive(From)] +//~^ ERROR `#[derive(From)]` used on a struct with multiple fields +struct S3(u32, bool); + +#[derive(From)] +//~^ ERROR `#[derive(From)]` used on a struct with multiple fields +struct S4 { + a: u32, + b: bool, +} + +#[derive(From)] +//~^ ERROR `#[derive(From)]` used on an enum +enum E1 {} + +#[derive(From)] +struct SUnsizedField<T: ?Sized> { + last: T, + //~^ ERROR the size for values of type `T` cannot be known at compilation time [E0277] +} + +fn main() {} diff --git a/tests/ui/deriving/deriving-from-wrong-target.stderr b/tests/ui/deriving/deriving-from-wrong-target.stderr new file mode 100644 index 00000000000..4547cea5ba6 --- /dev/null +++ b/tests/ui/deriving/deriving-from-wrong-target.stderr @@ -0,0 +1,77 @@ +error: `#[derive(From)]` used on a struct with no fields + --> $DIR/deriving-from-wrong-target.rs:8:10 + | +LL | #[derive(From)] + | ^^^^ +LL | +LL | struct S1; + | ^^ + | + = note: `#[derive(From)]` can only be used on structs with exactly one field + +error: `#[derive(From)]` used on a struct with no fields + --> $DIR/deriving-from-wrong-target.rs:12:10 + | +LL | #[derive(From)] + | ^^^^ +LL | +LL | struct S2 {} + | ^^ + | + = note: `#[derive(From)]` can only be used on structs with exactly one field + +error: `#[derive(From)]` used on a struct with multiple fields + --> $DIR/deriving-from-wrong-target.rs:16:10 + | +LL | #[derive(From)] + | ^^^^ +LL | +LL | struct S3(u32, bool); + | ^^ + | + = note: `#[derive(From)]` can only be used on structs with exactly one field + +error: `#[derive(From)]` used on a struct with multiple fields + --> $DIR/deriving-from-wrong-target.rs:20:10 + | +LL | #[derive(From)] + | ^^^^ +LL | +LL | struct S4 { + | ^^ + | + = note: `#[derive(From)]` can only be used on structs with exactly one field + +error: `#[derive(From)]` used on an enum + --> $DIR/deriving-from-wrong-target.rs:27:10 + | +LL | #[derive(From)] + | ^^^^ +LL | +LL | enum E1 {} + | ^^ + | + = note: `#[derive(From)]` can only be used on structs with exactly one field + +error[E0277]: the size for values of type `T` cannot be known at compilation time + --> $DIR/deriving-from-wrong-target.rs:33:11 + | +LL | struct SUnsizedField<T: ?Sized> { + | - this type parameter needs to be `Sized` +LL | last: T, + | ^ doesn't have a size known at compile-time + | + = help: unsized fn params are gated as an unstable feature +help: consider removing the `?Sized` bound to make the type parameter `Sized` + | +LL - struct SUnsizedField<T: ?Sized> { +LL + struct SUnsizedField<T> { + | +help: function arguments must have a statically known size, borrowed types always have a known size + | +LL | last: &T, + | + + +error: aborting due to 6 previous errors + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/deriving/deriving-from.rs b/tests/ui/deriving/deriving-from.rs new file mode 100644 index 00000000000..75988ba974d --- /dev/null +++ b/tests/ui/deriving/deriving-from.rs @@ -0,0 +1,60 @@ +//@ edition: 2021 +//@ run-pass + +#![feature(derive_from)] + +use core::from::From; + +#[derive(From)] +struct TupleSimple(u32); + +#[derive(From)] +struct TupleNonPathType([u32; 4]); + +#[derive(From)] +struct TupleWithRef<'a, T>(&'a T); + +#[derive(From)] +struct TupleSWithBound<T: std::fmt::Debug>(T); + +#[derive(From)] +struct RawIdentifier { + r#use: u32, +} + +#[derive(From)] +struct Field { + foo: bool, +} + +#[derive(From)] +struct Const<const C: usize> { + foo: [u32; C], +} + +fn main() { + let a = 42u32; + let b: [u32; 4] = [0, 1, 2, 3]; + let c = true; + + let s1: TupleSimple = a.into(); + assert_eq!(s1.0, a); + + let s2: TupleNonPathType = b.into(); + assert_eq!(s2.0, b); + + let s3: TupleWithRef<u32> = (&a).into(); + assert_eq!(s3.0, &a); + + let s4: TupleSWithBound<u32> = a.into(); + assert_eq!(s4.0, a); + + let s5: RawIdentifier = a.into(); + assert_eq!(s5.r#use, a); + + let s6: Field = c.into(); + assert_eq!(s6.foo, c); + + let s7: Const<4> = b.into(); + assert_eq!(s7.foo, b); +} diff --git a/tests/ui/diagnostic-flags/colored-session-opt-error.rs b/tests/ui/diagnostic-flags/colored-session-opt-error.rs index e850345fbf1..1c411048385 100644 --- a/tests/ui/diagnostic-flags/colored-session-opt-error.rs +++ b/tests/ui/diagnostic-flags/colored-session-opt-error.rs @@ -1,4 +1,8 @@ //@ check-pass //@ ignore-windows //@ compile-flags: -Cremark=foo --error-format=human --color=always + +// FIXME(#61117): Respect debuginfo-level-tests, do not force debuginfo-level=0 +//@ compile-flags: -Cdebuginfo=0 + fn main() {} diff --git a/tests/ui/diagnostic_namespace/do_not_recommend/does_not_acccept_args.current.stderr b/tests/ui/diagnostic_namespace/do_not_recommend/does_not_acccept_args.current.stderr index 9d1556ee0c1..2af24130a1e 100644 --- a/tests/ui/diagnostic_namespace/do_not_recommend/does_not_acccept_args.current.stderr +++ b/tests/ui/diagnostic_namespace/do_not_recommend/does_not_acccept_args.current.stderr @@ -4,7 +4,7 @@ warning: `#[diagnostic::do_not_recommend]` does not expect any arguments LL | #[diagnostic::do_not_recommend(not_accepted)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: `#[warn(malformed_diagnostic_attributes)]` on by default + = note: `#[warn(malformed_diagnostic_attributes)]` (part of `#[warn(unknown_or_malformed_diagnostic_attributes)]`) on by default warning: `#[diagnostic::do_not_recommend]` does not expect any arguments --> $DIR/does_not_acccept_args.rs:15:1 diff --git a/tests/ui/diagnostic_namespace/do_not_recommend/does_not_acccept_args.next.stderr b/tests/ui/diagnostic_namespace/do_not_recommend/does_not_acccept_args.next.stderr index 9d1556ee0c1..2af24130a1e 100644 --- a/tests/ui/diagnostic_namespace/do_not_recommend/does_not_acccept_args.next.stderr +++ b/tests/ui/diagnostic_namespace/do_not_recommend/does_not_acccept_args.next.stderr @@ -4,7 +4,7 @@ warning: `#[diagnostic::do_not_recommend]` does not expect any arguments LL | #[diagnostic::do_not_recommend(not_accepted)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: `#[warn(malformed_diagnostic_attributes)]` on by default + = note: `#[warn(malformed_diagnostic_attributes)]` (part of `#[warn(unknown_or_malformed_diagnostic_attributes)]`) on by default warning: `#[diagnostic::do_not_recommend]` does not expect any arguments --> $DIR/does_not_acccept_args.rs:15:1 diff --git a/tests/ui/diagnostic_namespace/do_not_recommend/incorrect-locations.current.stderr b/tests/ui/diagnostic_namespace/do_not_recommend/incorrect-locations.current.stderr index 29ffbb5bf18..d2ad65b3c79 100644 --- a/tests/ui/diagnostic_namespace/do_not_recommend/incorrect-locations.current.stderr +++ b/tests/ui/diagnostic_namespace/do_not_recommend/incorrect-locations.current.stderr @@ -4,7 +4,7 @@ warning: `#[diagnostic::do_not_recommend]` can only be placed on trait implement LL | #[diagnostic::do_not_recommend] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: `#[warn(misplaced_diagnostic_attributes)]` on by default + = note: `#[warn(misplaced_diagnostic_attributes)]` (part of `#[warn(unknown_or_malformed_diagnostic_attributes)]`) on by default warning: `#[diagnostic::do_not_recommend]` can only be placed on trait implementations --> $DIR/incorrect-locations.rs:11:1 diff --git a/tests/ui/diagnostic_namespace/do_not_recommend/incorrect-locations.next.stderr b/tests/ui/diagnostic_namespace/do_not_recommend/incorrect-locations.next.stderr index 29ffbb5bf18..d2ad65b3c79 100644 --- a/tests/ui/diagnostic_namespace/do_not_recommend/incorrect-locations.next.stderr +++ b/tests/ui/diagnostic_namespace/do_not_recommend/incorrect-locations.next.stderr @@ -4,7 +4,7 @@ warning: `#[diagnostic::do_not_recommend]` can only be placed on trait implement LL | #[diagnostic::do_not_recommend] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: `#[warn(misplaced_diagnostic_attributes)]` on by default + = note: `#[warn(misplaced_diagnostic_attributes)]` (part of `#[warn(unknown_or_malformed_diagnostic_attributes)]`) on by default warning: `#[diagnostic::do_not_recommend]` can only be placed on trait implementations --> $DIR/incorrect-locations.rs:11:1 diff --git a/tests/ui/diagnostic_namespace/non_existing_attributes_accepted.stderr b/tests/ui/diagnostic_namespace/non_existing_attributes_accepted.stderr index 4f9b7ba2bcf..acaa1ac0c56 100644 --- a/tests/ui/diagnostic_namespace/non_existing_attributes_accepted.stderr +++ b/tests/ui/diagnostic_namespace/non_existing_attributes_accepted.stderr @@ -4,7 +4,7 @@ warning: unknown diagnostic attribute LL | #[diagnostic::non_existing_attribute] | ^^^^^^^^^^^^^^^^^^^^^^ | - = note: `#[warn(unknown_diagnostic_attributes)]` on by default + = note: `#[warn(unknown_diagnostic_attributes)]` (part of `#[warn(unknown_or_malformed_diagnostic_attributes)]`) on by default warning: unknown diagnostic attribute --> $DIR/non_existing_attributes_accepted.rs:8:15 diff --git a/tests/ui/diagnostic_namespace/on_unimplemented/broken_format.stderr b/tests/ui/diagnostic_namespace/on_unimplemented/broken_format.stderr index 5002122f8b7..2138d591ca2 100644 --- a/tests/ui/diagnostic_namespace/on_unimplemented/broken_format.stderr +++ b/tests/ui/diagnostic_namespace/on_unimplemented/broken_format.stderr @@ -4,7 +4,7 @@ warning: unmatched `}` found LL | #[diagnostic::on_unimplemented(message = "{{Test } thing")] | ^^^^^^^^^^^^^^^^ | - = note: `#[warn(malformed_diagnostic_format_literals)]` on by default + = note: `#[warn(malformed_diagnostic_format_literals)]` (part of `#[warn(unknown_or_malformed_diagnostic_attributes)]`) on by default warning: positional format arguments are not allowed here --> $DIR/broken_format.rs:7:49 diff --git a/tests/ui/diagnostic_namespace/on_unimplemented/do_not_accept_options_of_the_internal_rustc_attribute.stderr b/tests/ui/diagnostic_namespace/on_unimplemented/do_not_accept_options_of_the_internal_rustc_attribute.stderr index 42f4bc0d8b0..6493a8cf2e1 100644 --- a/tests/ui/diagnostic_namespace/on_unimplemented/do_not_accept_options_of_the_internal_rustc_attribute.stderr +++ b/tests/ui/diagnostic_namespace/on_unimplemented/do_not_accept_options_of_the_internal_rustc_attribute.stderr @@ -4,7 +4,7 @@ warning: `#[diagnostic::on_unimplemented]` can only be applied to trait definiti LL | #[diagnostic::on_unimplemented(message = "Not allowed to apply it on a impl")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: `#[warn(misplaced_diagnostic_attributes)]` on by default + = note: `#[warn(misplaced_diagnostic_attributes)]` (part of `#[warn(unknown_or_malformed_diagnostic_attributes)]`) on by default warning: malformed `on_unimplemented` attribute --> $DIR/do_not_accept_options_of_the_internal_rustc_attribute.rs:6:5 @@ -13,7 +13,7 @@ LL | on(Self = "&str"), | ^^^^^^^^^^^^^^^^^ invalid option found here | = help: only `message`, `note` and `label` are allowed as options - = note: `#[warn(malformed_diagnostic_attributes)]` on by default + = note: `#[warn(malformed_diagnostic_attributes)]` (part of `#[warn(unknown_or_malformed_diagnostic_attributes)]`) on by default warning: malformed `on_unimplemented` attribute --> $DIR/do_not_accept_options_of_the_internal_rustc_attribute.rs:12:5 @@ -46,7 +46,7 @@ LL | message = "{from_desugaring}{direct}{cause}{integral}{integer}", | ^^^^^^^^^^^^^^^ | = help: expect either a generic argument name or `{Self}` as format argument - = note: `#[warn(malformed_diagnostic_format_literals)]` on by default + = note: `#[warn(malformed_diagnostic_format_literals)]` (part of `#[warn(unknown_or_malformed_diagnostic_attributes)]`) on by default warning: there is no parameter `direct` on trait `Baz` --> $DIR/do_not_accept_options_of_the_internal_rustc_attribute.rs:33:34 diff --git a/tests/ui/diagnostic_namespace/on_unimplemented/do_not_fail_parsing_on_invalid_options_1.stderr b/tests/ui/diagnostic_namespace/on_unimplemented/do_not_fail_parsing_on_invalid_options_1.stderr index 85d74fb8955..df5d0d6dccb 100644 --- a/tests/ui/diagnostic_namespace/on_unimplemented/do_not_fail_parsing_on_invalid_options_1.stderr +++ b/tests/ui/diagnostic_namespace/on_unimplemented/do_not_fail_parsing_on_invalid_options_1.stderr @@ -4,7 +4,7 @@ warning: `#[diagnostic::on_unimplemented]` can only be applied to trait definiti LL | #[diagnostic::on_unimplemented(message = "Baz")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: `#[warn(misplaced_diagnostic_attributes)]` on by default + = note: `#[warn(misplaced_diagnostic_attributes)]` (part of `#[warn(unknown_or_malformed_diagnostic_attributes)]`) on by default warning: malformed `on_unimplemented` attribute --> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:3:32 @@ -13,7 +13,7 @@ LL | #[diagnostic::on_unimplemented(unsupported = "foo")] | ^^^^^^^^^^^^^^^^^^^ invalid option found here | = help: only `message`, `note` and `label` are allowed as options - = note: `#[warn(malformed_diagnostic_attributes)]` on by default + = note: `#[warn(malformed_diagnostic_attributes)]` (part of `#[warn(unknown_or_malformed_diagnostic_attributes)]`) on by default warning: malformed `on_unimplemented` attribute --> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:12:50 @@ -62,7 +62,7 @@ LL | #[diagnostic::on_unimplemented(message = "{DoesNotExist}")] | ^^^^^^^^^^^^ | = help: expect either a generic argument name or `{Self}` as format argument - = note: `#[warn(malformed_diagnostic_format_literals)]` on by default + = note: `#[warn(malformed_diagnostic_format_literals)]` (part of `#[warn(unknown_or_malformed_diagnostic_attributes)]`) on by default warning: malformed `on_unimplemented` attribute --> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:3:32 diff --git a/tests/ui/diagnostic_namespace/on_unimplemented/ignore_unsupported_options_and_continue_to_use_fallback.stderr b/tests/ui/diagnostic_namespace/on_unimplemented/ignore_unsupported_options_and_continue_to_use_fallback.stderr index 86fe75a62de..24b3a9c3405 100644 --- a/tests/ui/diagnostic_namespace/on_unimplemented/ignore_unsupported_options_and_continue_to_use_fallback.stderr +++ b/tests/ui/diagnostic_namespace/on_unimplemented/ignore_unsupported_options_and_continue_to_use_fallback.stderr @@ -5,7 +5,7 @@ LL | if(Self = "()"), | ^^^^^^^^^^^^^^^ invalid option found here | = help: only `message`, `note` and `label` are allowed as options - = note: `#[warn(malformed_diagnostic_attributes)]` on by default + = note: `#[warn(malformed_diagnostic_attributes)]` (part of `#[warn(unknown_or_malformed_diagnostic_attributes)]`) on by default warning: `message` is ignored due to previous definition of `message` --> $DIR/ignore_unsupported_options_and_continue_to_use_fallback.rs:10:32 diff --git a/tests/ui/diagnostic_namespace/on_unimplemented/on_impl_trait.stderr b/tests/ui/diagnostic_namespace/on_unimplemented/on_impl_trait.stderr index 69433f91543..e9d0c6e5daf 100644 --- a/tests/ui/diagnostic_namespace/on_unimplemented/on_impl_trait.stderr +++ b/tests/ui/diagnostic_namespace/on_unimplemented/on_impl_trait.stderr @@ -4,7 +4,7 @@ warning: `#[diagnostic::on_unimplemented]` can only be applied to trait definiti LL | #[diagnostic::on_unimplemented(message = "blah", label = "blah", note = "blah")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: `#[warn(misplaced_diagnostic_attributes)]` on by default + = note: `#[warn(misplaced_diagnostic_attributes)]` (part of `#[warn(unknown_or_malformed_diagnostic_attributes)]`) on by default error[E0277]: the trait bound `{integer}: Alias` is not satisfied --> $DIR/on_impl_trait.rs:16:9 diff --git a/tests/ui/diagnostic_namespace/on_unimplemented/report_warning_on_duplicated_options.stderr b/tests/ui/diagnostic_namespace/on_unimplemented/report_warning_on_duplicated_options.stderr index d2e121b61a6..de43656ff08 100644 --- a/tests/ui/diagnostic_namespace/on_unimplemented/report_warning_on_duplicated_options.stderr +++ b/tests/ui/diagnostic_namespace/on_unimplemented/report_warning_on_duplicated_options.stderr @@ -7,7 +7,7 @@ LL | message = "first message", LL | message = "second message", | ^^^^^^^^^^^^^^^^^^^^^^^^^^ `message` is already declared here | - = note: `#[warn(malformed_diagnostic_attributes)]` on by default + = note: `#[warn(malformed_diagnostic_attributes)]` (part of `#[warn(unknown_or_malformed_diagnostic_attributes)]`) on by default warning: `label` is ignored due to previous definition of `label` --> $DIR/report_warning_on_duplicated_options.rs:11:5 diff --git a/tests/ui/did_you_mean/bad-assoc-ty.edition2015.stderr b/tests/ui/did_you_mean/bad-assoc-ty.edition2015.stderr index 416ff358d53..af0a9d064d5 100644 --- a/tests/ui/did_you_mean/bad-assoc-ty.edition2015.stderr +++ b/tests/ui/did_you_mean/bad-assoc-ty.edition2015.stderr @@ -187,7 +187,7 @@ LL | type H = Fn(u8) -> (u8)::Output; | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! = note: for more information, see <https://doc.rust-lang.org/edition-guide/rust-2021/warnings-promoted-to-error.html> - = note: `#[warn(bare_trait_objects)]` on by default + = note: `#[warn(bare_trait_objects)]` (part of `#[warn(rust_2021_compatibility)]`) on by default help: if this is a dyn-compatible trait, use `dyn` | LL | type H = <dyn Fn(u8) -> (u8)>::Output; diff --git a/tests/ui/did_you_mean/issue-21659-show-relevant-trait-impls-1.stderr b/tests/ui/did_you_mean/issue-21659-show-relevant-trait-impls-1.stderr index 9d335b391eb..b754bafb344 100644 --- a/tests/ui/did_you_mean/issue-21659-show-relevant-trait-impls-1.stderr +++ b/tests/ui/did_you_mean/issue-21659-show-relevant-trait-impls-1.stderr @@ -2,10 +2,15 @@ error[E0277]: the trait bound `Bar: Foo<usize>` is not satisfied --> $DIR/issue-21659-show-relevant-trait-impls-1.rs:24:12 | LL | f1.foo(1usize); - | --- ^^^^^^ the trait `Foo<usize>` is not implemented for `Bar` + | --- ^^^^^^ unsatisfied trait bound | | | required by a bound introduced by this call | +help: the trait `Foo<usize>` is not implemented for `Bar` + --> $DIR/issue-21659-show-relevant-trait-impls-1.rs:13:1 + | +LL | struct Bar; + | ^^^^^^^^^^ = help: the following other types implement trait `Foo<A>`: `Bar` implements `Foo<i32>` `Bar` implements `Foo<u8>` diff --git a/tests/ui/did_you_mean/issue-21659-show-relevant-trait-impls-2.stderr b/tests/ui/did_you_mean/issue-21659-show-relevant-trait-impls-2.stderr index f9d71807960..8d1c05e7b54 100644 --- a/tests/ui/did_you_mean/issue-21659-show-relevant-trait-impls-2.stderr +++ b/tests/ui/did_you_mean/issue-21659-show-relevant-trait-impls-2.stderr @@ -2,10 +2,15 @@ error[E0277]: the trait bound `Bar: Foo<usize>` is not satisfied --> $DIR/issue-21659-show-relevant-trait-impls-2.rs:28:12 | LL | f1.foo(1usize); - | --- ^^^^^^ the trait `Foo<usize>` is not implemented for `Bar` + | --- ^^^^^^ unsatisfied trait bound | | | required by a bound introduced by this call | +help: the trait `Foo<usize>` is not implemented for `Bar` + --> $DIR/issue-21659-show-relevant-trait-impls-2.rs:13:1 + | +LL | struct Bar; + | ^^^^^^^^^^ = help: the following other types implement trait `Foo<A>`: `Bar` implements `Foo<i16>` `Bar` implements `Foo<i32>` diff --git a/tests/ui/did_you_mean/println-typo.stderr b/tests/ui/did_you_mean/println-typo.stderr index a1e0b1f1ba4..7dd6fbba620 100644 --- a/tests/ui/did_you_mean/println-typo.stderr +++ b/tests/ui/did_you_mean/println-typo.stderr @@ -3,6 +3,7 @@ error: cannot find macro `prinltn` in this scope | LL | prinltn!(); | ^^^^^^^ help: a macro with a similar name exists: `println` + | --> $SRC_DIR/std/src/macros.rs:LL:COL | = note: similarly named macro `println` defined here diff --git a/tests/ui/drop/drop-struct-as-object.stderr b/tests/ui/drop/drop-struct-as-object.stderr index 16f6d1110ba..bde4e6074f3 100644 --- a/tests/ui/drop/drop-struct-as-object.stderr +++ b/tests/ui/drop/drop-struct-as-object.stderr @@ -6,7 +6,7 @@ LL | trait Dummy { LL | fn get(&self) -> usize; | ^^^ | - = note: `#[warn(dead_code)]` on by default + = note: `#[warn(dead_code)]` (part of `#[warn(unused)]`) on by default warning: 1 warning emitted diff --git a/tests/ui/drop/dropck-normalize-errors.nll.stderr b/tests/ui/drop/dropck-normalize-errors.nll.stderr index b008daa51a3..39ec4033eab 100644 --- a/tests/ui/drop/dropck-normalize-errors.nll.stderr +++ b/tests/ui/drop/dropck-normalize-errors.nll.stderr @@ -2,8 +2,13 @@ error[E0277]: the trait bound `NonImplementedStruct: NonImplementedTrait` is not --> $DIR/dropck-normalize-errors.rs:19:28 | LL | fn make_a_decoder<'a>() -> ADecoder<'a> { - | ^^^^^^^^^^^^ within `ADecoder<'a>`, the trait `NonImplementedTrait` is not implemented for `NonImplementedStruct` + | ^^^^^^^^^^^^ unsatisfied trait bound | +help: within `ADecoder<'a>`, the trait `NonImplementedTrait` is not implemented for `NonImplementedStruct` + --> $DIR/dropck-normalize-errors.rs:14:1 + | +LL | struct NonImplementedStruct; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: this trait has no implementations, consider adding one --> $DIR/dropck-normalize-errors.rs:11:1 | @@ -25,8 +30,13 @@ error[E0277]: the trait bound `NonImplementedStruct: NonImplementedTrait` is not --> $DIR/dropck-normalize-errors.rs:27:20 | LL | type Decoder = BDecoder; - | ^^^^^^^^ within `BDecoder`, the trait `NonImplementedTrait` is not implemented for `NonImplementedStruct` + | ^^^^^^^^ unsatisfied trait bound + | +help: within `BDecoder`, the trait `NonImplementedTrait` is not implemented for `NonImplementedStruct` + --> $DIR/dropck-normalize-errors.rs:14:1 | +LL | struct NonImplementedStruct; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: this trait has no implementations, consider adding one --> $DIR/dropck-normalize-errors.rs:11:1 | @@ -51,8 +61,13 @@ error[E0277]: the trait bound `NonImplementedStruct: NonImplementedTrait` is not --> $DIR/dropck-normalize-errors.rs:31:22 | LL | non_implemented: <NonImplementedStruct as NonImplementedTrait>::Assoc, - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `NonImplementedTrait` is not implemented for `NonImplementedStruct` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unsatisfied trait bound | +help: the trait `NonImplementedTrait` is not implemented for `NonImplementedStruct` + --> $DIR/dropck-normalize-errors.rs:14:1 + | +LL | struct NonImplementedStruct; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: this trait has no implementations, consider adding one --> $DIR/dropck-normalize-errors.rs:11:1 | @@ -63,8 +78,13 @@ error[E0277]: the trait bound `NonImplementedStruct: NonImplementedTrait` is not --> $DIR/dropck-normalize-errors.rs:19:28 | LL | fn make_a_decoder<'a>() -> ADecoder<'a> { - | ^^^^^^^^^^^^ the trait `NonImplementedTrait` is not implemented for `NonImplementedStruct` + | ^^^^^^^^^^^^ unsatisfied trait bound + | +help: the trait `NonImplementedTrait` is not implemented for `NonImplementedStruct` + --> $DIR/dropck-normalize-errors.rs:14:1 | +LL | struct NonImplementedStruct; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: this trait has no implementations, consider adding one --> $DIR/dropck-normalize-errors.rs:11:1 | diff --git a/tests/ui/drop/dropck-normalize-errors.polonius.stderr b/tests/ui/drop/dropck-normalize-errors.polonius.stderr index f8674b8e34a..3d72801b343 100644 --- a/tests/ui/drop/dropck-normalize-errors.polonius.stderr +++ b/tests/ui/drop/dropck-normalize-errors.polonius.stderr @@ -2,8 +2,13 @@ error[E0277]: the trait bound `NonImplementedStruct: NonImplementedTrait` is not --> $DIR/dropck-normalize-errors.rs:19:28 | LL | fn make_a_decoder<'a>() -> ADecoder<'a> { - | ^^^^^^^^^^^^ within `ADecoder<'a>`, the trait `NonImplementedTrait` is not implemented for `NonImplementedStruct` + | ^^^^^^^^^^^^ unsatisfied trait bound | +help: within `ADecoder<'a>`, the trait `NonImplementedTrait` is not implemented for `NonImplementedStruct` + --> $DIR/dropck-normalize-errors.rs:14:1 + | +LL | struct NonImplementedStruct; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: this trait has no implementations, consider adding one --> $DIR/dropck-normalize-errors.rs:11:1 | @@ -25,8 +30,13 @@ error[E0277]: the trait bound `NonImplementedStruct: NonImplementedTrait` is not --> $DIR/dropck-normalize-errors.rs:27:20 | LL | type Decoder = BDecoder; - | ^^^^^^^^ within `BDecoder`, the trait `NonImplementedTrait` is not implemented for `NonImplementedStruct` + | ^^^^^^^^ unsatisfied trait bound + | +help: within `BDecoder`, the trait `NonImplementedTrait` is not implemented for `NonImplementedStruct` + --> $DIR/dropck-normalize-errors.rs:14:1 | +LL | struct NonImplementedStruct; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: this trait has no implementations, consider adding one --> $DIR/dropck-normalize-errors.rs:11:1 | @@ -51,8 +61,13 @@ error[E0277]: the trait bound `NonImplementedStruct: NonImplementedTrait` is not --> $DIR/dropck-normalize-errors.rs:31:22 | LL | non_implemented: <NonImplementedStruct as NonImplementedTrait>::Assoc, - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `NonImplementedTrait` is not implemented for `NonImplementedStruct` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unsatisfied trait bound + | +help: the trait `NonImplementedTrait` is not implemented for `NonImplementedStruct` + --> $DIR/dropck-normalize-errors.rs:14:1 | +LL | struct NonImplementedStruct; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: this trait has no implementations, consider adding one --> $DIR/dropck-normalize-errors.rs:11:1 | diff --git a/tests/ui/drop/generic-drop-trait-bound-15858.stderr b/tests/ui/drop/generic-drop-trait-bound-15858.stderr index 86cd6cb6026..92bcdc1eda8 100644 --- a/tests/ui/drop/generic-drop-trait-bound-15858.stderr +++ b/tests/ui/drop/generic-drop-trait-bound-15858.stderr @@ -6,7 +6,7 @@ LL | trait Bar { LL | fn do_something(&mut self); | ^^^^^^^^^^^^ | - = note: `#[warn(dead_code)]` on by default + = note: `#[warn(dead_code)]` (part of `#[warn(unused)]`) on by default warning: 1 warning emitted diff --git a/tests/ui/dst/dst-bad-coerce1.stderr b/tests/ui/dst/dst-bad-coerce1.stderr index 68456b8642c..223bf9ce08a 100644 --- a/tests/ui/dst/dst-bad-coerce1.stderr +++ b/tests/ui/dst/dst-bad-coerce1.stderr @@ -13,8 +13,13 @@ error[E0277]: the trait bound `Foo: Bar` is not satisfied --> $DIR/dst-bad-coerce1.rs:20:29 | LL | let f3: &Fat<dyn Bar> = f2; - | ^^ the trait `Bar` is not implemented for `Foo` + | ^^ unsatisfied trait bound | +help: the trait `Bar` is not implemented for `Foo` + --> $DIR/dst-bad-coerce1.rs:7:1 + | +LL | struct Foo; + | ^^^^^^^^^^ help: this trait has no implementations, consider adding one --> $DIR/dst-bad-coerce1.rs:8:1 | diff --git a/tests/ui/dyn-compatibility/avoid-ice-on-warning-2.old.stderr b/tests/ui/dyn-compatibility/avoid-ice-on-warning-2.old.stderr index 687799c6688..265bfb01de1 100644 --- a/tests/ui/dyn-compatibility/avoid-ice-on-warning-2.old.stderr +++ b/tests/ui/dyn-compatibility/avoid-ice-on-warning-2.old.stderr @@ -6,7 +6,7 @@ LL | fn id<F>(f: Copy) -> usize { | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! = note: for more information, see <https://doc.rust-lang.org/edition-guide/rust-2021/warnings-promoted-to-error.html> - = note: `#[warn(bare_trait_objects)]` on by default + = note: `#[warn(bare_trait_objects)]` (part of `#[warn(rust_2021_compatibility)]`) on by default help: if this is a dyn-compatible trait, use `dyn` | LL | fn id<F>(f: dyn Copy) -> usize { diff --git a/tests/ui/dyn-compatibility/avoid-ice-on-warning-3.old.stderr b/tests/ui/dyn-compatibility/avoid-ice-on-warning-3.old.stderr index 4cfac943375..7b299fa3cab 100644 --- a/tests/ui/dyn-compatibility/avoid-ice-on-warning-3.old.stderr +++ b/tests/ui/dyn-compatibility/avoid-ice-on-warning-3.old.stderr @@ -6,7 +6,7 @@ LL | trait B { fn f(a: A) -> A; } | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! = note: for more information, see <https://doc.rust-lang.org/edition-guide/rust-2021/warnings-promoted-to-error.html> - = note: `#[warn(bare_trait_objects)]` on by default + = note: `#[warn(bare_trait_objects)]` (part of `#[warn(rust_2021_compatibility)]`) on by default help: if this is a dyn-compatible trait, use `dyn` | LL | trait B { fn f(a: dyn A) -> A; } diff --git a/tests/ui/dyn-compatibility/avoid-ice-on-warning.old.stderr b/tests/ui/dyn-compatibility/avoid-ice-on-warning.old.stderr index 4645b35f8f1..849f2a2ecc4 100644 --- a/tests/ui/dyn-compatibility/avoid-ice-on-warning.old.stderr +++ b/tests/ui/dyn-compatibility/avoid-ice-on-warning.old.stderr @@ -24,7 +24,7 @@ LL | fn call_this<F>(f: F) : Fn(&str) + call_that {} | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! = note: for more information, see <https://doc.rust-lang.org/edition-guide/rust-2021/warnings-promoted-to-error.html> - = note: `#[warn(bare_trait_objects)]` on by default + = note: `#[warn(bare_trait_objects)]` (part of `#[warn(rust_2021_compatibility)]`) on by default help: if this is a dyn-compatible trait, use `dyn` | LL | fn call_this<F>(f: F) : dyn Fn(&str) + call_that {} diff --git a/tests/ui/issues/auxiliary/issue-8401.rs b/tests/ui/dyn-keyword/auxiliary/aux-8401.rs index 7d0eb5cd876..7d0eb5cd876 100644 --- a/tests/ui/issues/auxiliary/issue-8401.rs +++ b/tests/ui/dyn-keyword/auxiliary/aux-8401.rs diff --git a/tests/ui/dyn-keyword/methods-with-mut-trait-and-polymorphic-objects-issue-8401.rs b/tests/ui/dyn-keyword/methods-with-mut-trait-and-polymorphic-objects-issue-8401.rs new file mode 100644 index 00000000000..313c6891720 --- /dev/null +++ b/tests/ui/dyn-keyword/methods-with-mut-trait-and-polymorphic-objects-issue-8401.rs @@ -0,0 +1,7 @@ +//@ run-pass +//@ aux-build:aux-8401.rs +// https://github.com/rust-lang/rust/issues/8401 + +extern crate aux_8401; + +pub fn main() {} diff --git a/tests/ui/dynamically-sized-types/dst-coercions.stderr b/tests/ui/dynamically-sized-types/dst-coercions.stderr index e7c48783df0..ebc025a98cc 100644 --- a/tests/ui/dynamically-sized-types/dst-coercions.stderr +++ b/tests/ui/dynamically-sized-types/dst-coercions.stderr @@ -6,7 +6,7 @@ LL | trait T { fn dummy(&self) { } } | | | method in this trait | - = note: `#[warn(dead_code)]` on by default + = note: `#[warn(dead_code)]` (part of `#[warn(unused)]`) on by default warning: 1 warning emitted diff --git a/tests/ui/editions/never-type-fallback-breaking.e2021.stderr b/tests/ui/editions/never-type-fallback-breaking.e2021.stderr index e30c0adb79d..3d4a10aeaaf 100644 --- a/tests/ui/editions/never-type-fallback-breaking.e2021.stderr +++ b/tests/ui/editions/never-type-fallback-breaking.e2021.stderr @@ -12,7 +12,7 @@ note: in edition 2024, the requirement `!: Default` will fail | LL | true => Default::default(), | ^^^^^^^^^^^^^^^^^^ - = note: `#[warn(dependency_on_unit_never_type_fallback)]` on by default + = note: `#[warn(dependency_on_unit_never_type_fallback)]` (part of `#[warn(rust_2024_compatibility)]`) on by default help: use `()` annotations to avoid fallback changes | LL | let x: () = match true { @@ -111,7 +111,7 @@ note: in edition 2024, the requirement `!: Default` will fail | LL | true => Default::default(), | ^^^^^^^^^^^^^^^^^^ - = note: `#[warn(dependency_on_unit_never_type_fallback)]` on by default + = note: `#[warn(dependency_on_unit_never_type_fallback)]` (part of `#[warn(rust_2024_compatibility)]`) on by default help: use `()` annotations to avoid fallback changes | LL | let x: () = match true { @@ -132,7 +132,7 @@ note: in edition 2024, the requirement `!: Default` will fail | LL | deserialize()?; | ^^^^^^^^^^^^^ - = note: `#[warn(dependency_on_unit_never_type_fallback)]` on by default + = note: `#[warn(dependency_on_unit_never_type_fallback)]` (part of `#[warn(rust_2024_compatibility)]`) on by default help: use `()` annotations to avoid fallback changes | LL | deserialize::<()>()?; @@ -153,7 +153,7 @@ note: in edition 2024, the requirement `(): From<!>` will fail | LL | help(1)?; | ^^^^^^^ - = note: `#[warn(dependency_on_unit_never_type_fallback)]` on by default + = note: `#[warn(dependency_on_unit_never_type_fallback)]` (part of `#[warn(rust_2024_compatibility)]`) on by default help: use `()` annotations to avoid fallback changes | LL | help::<(), _>(1)?; @@ -174,7 +174,7 @@ note: in edition 2024, the requirement `!: Default` will fail | LL | takes_apit(|| Default::default())?; | ^^^^^^^^^^^^^^^^^^ - = note: `#[warn(dependency_on_unit_never_type_fallback)]` on by default + = note: `#[warn(dependency_on_unit_never_type_fallback)]` (part of `#[warn(rust_2024_compatibility)]`) on by default help: use `()` annotations to avoid fallback changes | LL | takes_apit::<()>(|| Default::default())?; @@ -195,7 +195,7 @@ note: in edition 2024, the requirement `!: Default` will fail | LL | takes_apit2(mk()?); | ^^^^^ - = note: `#[warn(dependency_on_unit_never_type_fallback)]` on by default + = note: `#[warn(dependency_on_unit_never_type_fallback)]` (part of `#[warn(rust_2024_compatibility)]`) on by default help: use `()` annotations to avoid fallback changes | LL | takes_apit2(mk::<()>()?); diff --git a/tests/ui/issues/issue-8761.rs b/tests/ui/enum/enum-discriminant-type-mismatch-8761.rs index 5883bb96695..ae09b919dc1 100644 --- a/tests/ui/issues/issue-8761.rs +++ b/tests/ui/enum/enum-discriminant-type-mismatch-8761.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/8761 enum Foo { A = 1i64, //~^ ERROR mismatched types diff --git a/tests/ui/issues/issue-8761.stderr b/tests/ui/enum/enum-discriminant-type-mismatch-8761.stderr index 4a9db568913..f1645183e17 100644 --- a/tests/ui/issues/issue-8761.stderr +++ b/tests/ui/enum/enum-discriminant-type-mismatch-8761.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/issue-8761.rs:2:9 + --> $DIR/enum-discriminant-type-mismatch-8761.rs:3:9 | LL | A = 1i64, | ^^^^ expected `isize`, found `i64` @@ -11,7 +11,7 @@ LL + A = 1isize, | error[E0308]: mismatched types - --> $DIR/issue-8761.rs:5:9 + --> $DIR/enum-discriminant-type-mismatch-8761.rs:6:9 | LL | B = 2u8 | ^^^ expected `isize`, found `u8` diff --git a/tests/ui/issues/issue-5900.rs b/tests/ui/enum/enum-referred-by-submodule-5900.rs index 14b7b8f815a..4ed092670a8 100644 --- a/tests/ui/issues/issue-5900.rs +++ b/tests/ui/enum/enum-referred-by-submodule-5900.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/5900 //@ check-pass #![allow(dead_code)] diff --git a/tests/ui/issues/issue-80607.rs b/tests/ui/enum/enum-variant-field-error-80607.rs index 63f4df359b8..aa3f2f7c526 100644 --- a/tests/ui/issues/issue-80607.rs +++ b/tests/ui/enum/enum-variant-field-error-80607.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/80607 // This tests makes sure the diagnostics print the offending enum variant, not just the type. pub enum Enum { V1(i32), diff --git a/tests/ui/issues/issue-80607.stderr b/tests/ui/enum/enum-variant-field-error-80607.stderr index 8f9f494c8b7..8d088ef04bb 100644 --- a/tests/ui/issues/issue-80607.stderr +++ b/tests/ui/enum/enum-variant-field-error-80607.stderr @@ -1,5 +1,5 @@ error[E0559]: variant `Enum::V1` has no field named `x` - --> $DIR/issue-80607.rs:7:16 + --> $DIR/enum-variant-field-error-80607.rs:8:16 | LL | V1(i32), | -- `Enum::V1` defined here diff --git a/tests/ui/issues/issue-5997-outer-generic-parameter/issue-5997.rs b/tests/ui/enum/enum-with-generic-parameter-5997.rs index 7ed8819f322..fab7ebbbbdc 100644 --- a/tests/ui/issues/issue-5997-outer-generic-parameter/issue-5997.rs +++ b/tests/ui/enum/enum-with-generic-parameter-5997.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/5997 //@ run-pass #![allow(dead_code)] diff --git a/tests/ui/issues/issue-6117.rs b/tests/ui/enum/match-either-enum-variants-6117.rs index 3ccf67b0319..7b395066166 100644 --- a/tests/ui/issues/issue-6117.rs +++ b/tests/ui/enum/match-either-enum-variants-6117.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/6117 //@ run-pass #![allow(dead_code)] diff --git a/tests/ui/issues/issue-8506.rs b/tests/ui/enum/simple-enum-usage-8506.rs index 30a789a3e27..ebe095d84e4 100644 --- a/tests/ui/issues/issue-8506.rs +++ b/tests/ui/enum/simple-enum-usage-8506.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/8506 //@ run-pass #![allow(non_upper_case_globals)] diff --git a/tests/ui/error-codes/E0458.rs b/tests/ui/error-codes/E0458.rs index 35e7e84d479..0e35ba43bfb 100644 --- a/tests/ui/error-codes/E0458.rs +++ b/tests/ui/error-codes/E0458.rs @@ -1,4 +1,4 @@ -#[link(kind = "wonderful_unicorn")] extern "C" {} //~ ERROR E0458 +#[link(kind = "wonderful_unicorn")] extern "C" {} //~ ERROR malformed `link` attribute input [E0539] //~| ERROR E0459 fn main() { diff --git a/tests/ui/error-codes/E0458.stderr b/tests/ui/error-codes/E0458.stderr index c13ae4e7862..524765ea12a 100644 --- a/tests/ui/error-codes/E0458.stderr +++ b/tests/ui/error-codes/E0458.stderr @@ -1,8 +1,27 @@ -error[E0458]: unknown link kind `wonderful_unicorn`, expected one of: static, dylib, framework, raw-dylib, link-arg - --> $DIR/E0458.rs:1:15 +error[E0539]: malformed `link` attribute input + --> $DIR/E0458.rs:1:1 | LL | #[link(kind = "wonderful_unicorn")] extern "C" {} - | ^^^^^^^^^^^^^^^^^^^ unknown link kind + | ^^^^^^^^^^^^^^-------------------^^ + | | + | valid arguments are "static", "dylib", "framework", "raw-dylib" or "link-arg" + | + = note: for more information, visit <https://doc.rust-lang.org/reference/items/external-blocks.html#the-link-attribute> +help: try changing it to one of the following valid forms of the attribute + | +LL - #[link(kind = "wonderful_unicorn")] extern "C" {} +LL + #[link(name = "...")] extern "C" {} + | +LL - #[link(kind = "wonderful_unicorn")] extern "C" {} +LL + #[link(name = "...", import_name_type = "decorated|noprefix|undecorated")] extern "C" {} + | +LL - #[link(kind = "wonderful_unicorn")] extern "C" {} +LL + #[link(name = "...", kind = "dylib|static|...")] extern "C" {} + | +LL - #[link(kind = "wonderful_unicorn")] extern "C" {} +LL + #[link(name = "...", kind = "dylib|static|...", wasm_import_module = "...", import_name_type = "decorated|noprefix|undecorated")] extern "C" {} + | + = and 1 other candidate error[E0459]: `#[link]` attribute requires a `name = "string"` argument --> $DIR/E0458.rs:1:1 @@ -12,5 +31,5 @@ LL | #[link(kind = "wonderful_unicorn")] extern "C" {} error: aborting due to 2 previous errors -Some errors have detailed explanations: E0458, E0459. -For more information about an error, try `rustc --explain E0458`. +Some errors have detailed explanations: E0459, E0539. +For more information about an error, try `rustc --explain E0459`. diff --git a/tests/ui/errors/dynless-turbofish-e0191-issue-91997.stderr b/tests/ui/errors/dynless-turbofish-e0191-issue-91997.stderr index 0004ea82fac..c1584e66e33 100644 --- a/tests/ui/errors/dynless-turbofish-e0191-issue-91997.stderr +++ b/tests/ui/errors/dynless-turbofish-e0191-issue-91997.stderr @@ -6,7 +6,7 @@ LL | let _ = MyIterator::next; | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! = note: for more information, see <https://doc.rust-lang.org/edition-guide/rust-2021/warnings-promoted-to-error.html> - = note: `#[warn(bare_trait_objects)]` on by default + = note: `#[warn(bare_trait_objects)]` (part of `#[warn(rust_2021_compatibility)]`) on by default help: if this is a dyn-compatible trait, use `dyn` | LL | let _ = <dyn MyIterator>::next; diff --git a/tests/ui/errors/issue-89280-emitter-overflow-splice-lines.stderr b/tests/ui/errors/issue-89280-emitter-overflow-splice-lines.stderr index d9acdbea3fc..462819c138f 100644 --- a/tests/ui/errors/issue-89280-emitter-overflow-splice-lines.stderr +++ b/tests/ui/errors/issue-89280-emitter-overflow-splice-lines.stderr @@ -9,7 +9,7 @@ LL | | )) {} | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! = note: for more information, see issue #41686 <https://github.com/rust-lang/rust/issues/41686> - = note: `#[warn(anonymous_parameters)]` on by default + = note: `#[warn(anonymous_parameters)]` (part of `#[warn(rust_2018_compatibility)]`) on by default help: try naming the parameter or explicitly ignoring it | LL | fn test(x: u32, _: ( diff --git a/tests/ui/errors/remap-path-prefix-diagnostics.not-diag-in-deps.stderr b/tests/ui/errors/remap-path-prefix-diagnostics.not-diag-in-deps.stderr index 229bfbe59e5..234e251b2ad 100644 --- a/tests/ui/errors/remap-path-prefix-diagnostics.not-diag-in-deps.stderr +++ b/tests/ui/errors/remap-path-prefix-diagnostics.not-diag-in-deps.stderr @@ -2,8 +2,13 @@ error[E0277]: `A` doesn't implement `std::fmt::Display` --> remapped/errors/remap-path-prefix-diagnostics.rs:LL:COL | LL | impl r#trait::Trait for A {} - | ^ the trait `std::fmt::Display` is not implemented for `A` + | ^ unsatisfied trait bound | +help: the trait `std::fmt::Display` is not implemented for `A` + --> remapped/errors/remap-path-prefix-diagnostics.rs:LL:COL + | +LL | struct A; + | ^^^^^^^^ note: required by a bound in `Trait` --> $DIR/auxiliary/trait.rs:LL:COL | diff --git a/tests/ui/errors/remap-path-prefix-diagnostics.only-debuginfo-in-deps.stderr b/tests/ui/errors/remap-path-prefix-diagnostics.only-debuginfo-in-deps.stderr index a59af3b6a82..3b0d66e75e8 100644 --- a/tests/ui/errors/remap-path-prefix-diagnostics.only-debuginfo-in-deps.stderr +++ b/tests/ui/errors/remap-path-prefix-diagnostics.only-debuginfo-in-deps.stderr @@ -2,8 +2,13 @@ error[E0277]: `A` doesn't implement `std::fmt::Display` --> $DIR/remap-path-prefix-diagnostics.rs:LL:COL | LL | impl r#trait::Trait for A {} - | ^ the trait `std::fmt::Display` is not implemented for `A` + | ^ unsatisfied trait bound | +help: the trait `std::fmt::Display` is not implemented for `A` + --> $DIR/remap-path-prefix-diagnostics.rs:LL:COL + | +LL | struct A; + | ^^^^^^^^ note: required by a bound in `Trait` --> $DIR/auxiliary/trait-debuginfo.rs:LL:COL | diff --git a/tests/ui/errors/remap-path-prefix-diagnostics.only-diag-in-deps.stderr b/tests/ui/errors/remap-path-prefix-diagnostics.only-diag-in-deps.stderr index 18fb9afcf39..e77c0e5f68d 100644 --- a/tests/ui/errors/remap-path-prefix-diagnostics.only-diag-in-deps.stderr +++ b/tests/ui/errors/remap-path-prefix-diagnostics.only-diag-in-deps.stderr @@ -2,8 +2,13 @@ error[E0277]: `A` doesn't implement `std::fmt::Display` --> $DIR/remap-path-prefix-diagnostics.rs:LL:COL | LL | impl r#trait::Trait for A {} - | ^ the trait `std::fmt::Display` is not implemented for `A` + | ^ unsatisfied trait bound | +help: the trait `std::fmt::Display` is not implemented for `A` + --> $DIR/remap-path-prefix-diagnostics.rs:LL:COL + | +LL | struct A; + | ^^^^^^^^ note: required by a bound in `Trait` --> $DIR/auxiliary/trait-diag.rs:LL:COL | diff --git a/tests/ui/errors/remap-path-prefix-diagnostics.only-macro-in-deps.stderr b/tests/ui/errors/remap-path-prefix-diagnostics.only-macro-in-deps.stderr index 9e770f07fba..91c9cd90152 100644 --- a/tests/ui/errors/remap-path-prefix-diagnostics.only-macro-in-deps.stderr +++ b/tests/ui/errors/remap-path-prefix-diagnostics.only-macro-in-deps.stderr @@ -2,8 +2,13 @@ error[E0277]: `A` doesn't implement `std::fmt::Display` --> $DIR/remap-path-prefix-diagnostics.rs:LL:COL | LL | impl r#trait::Trait for A {} - | ^ the trait `std::fmt::Display` is not implemented for `A` + | ^ unsatisfied trait bound | +help: the trait `std::fmt::Display` is not implemented for `A` + --> $DIR/remap-path-prefix-diagnostics.rs:LL:COL + | +LL | struct A; + | ^^^^^^^^ note: required by a bound in `Trait` --> $DIR/auxiliary/trait-macro.rs:LL:COL | diff --git a/tests/ui/errors/remap-path-prefix-diagnostics.with-debuginfo-in-deps.stderr b/tests/ui/errors/remap-path-prefix-diagnostics.with-debuginfo-in-deps.stderr index a59af3b6a82..3b0d66e75e8 100644 --- a/tests/ui/errors/remap-path-prefix-diagnostics.with-debuginfo-in-deps.stderr +++ b/tests/ui/errors/remap-path-prefix-diagnostics.with-debuginfo-in-deps.stderr @@ -2,8 +2,13 @@ error[E0277]: `A` doesn't implement `std::fmt::Display` --> $DIR/remap-path-prefix-diagnostics.rs:LL:COL | LL | impl r#trait::Trait for A {} - | ^ the trait `std::fmt::Display` is not implemented for `A` + | ^ unsatisfied trait bound | +help: the trait `std::fmt::Display` is not implemented for `A` + --> $DIR/remap-path-prefix-diagnostics.rs:LL:COL + | +LL | struct A; + | ^^^^^^^^ note: required by a bound in `Trait` --> $DIR/auxiliary/trait-debuginfo.rs:LL:COL | diff --git a/tests/ui/errors/remap-path-prefix-diagnostics.with-diag-in-deps.stderr b/tests/ui/errors/remap-path-prefix-diagnostics.with-diag-in-deps.stderr index ca6f2b1697a..00a647df61f 100644 --- a/tests/ui/errors/remap-path-prefix-diagnostics.with-diag-in-deps.stderr +++ b/tests/ui/errors/remap-path-prefix-diagnostics.with-diag-in-deps.stderr @@ -2,8 +2,13 @@ error[E0277]: `A` doesn't implement `std::fmt::Display` --> remapped/errors/remap-path-prefix-diagnostics.rs:LL:COL | LL | impl r#trait::Trait for A {} - | ^ the trait `std::fmt::Display` is not implemented for `A` + | ^ unsatisfied trait bound | +help: the trait `std::fmt::Display` is not implemented for `A` + --> remapped/errors/remap-path-prefix-diagnostics.rs:LL:COL + | +LL | struct A; + | ^^^^^^^^ note: required by a bound in `Trait` --> remapped/errors/auxiliary/trait-diag.rs:LL:COL | diff --git a/tests/ui/errors/remap-path-prefix-diagnostics.with-macro-in-deps.stderr b/tests/ui/errors/remap-path-prefix-diagnostics.with-macro-in-deps.stderr index 9e770f07fba..91c9cd90152 100644 --- a/tests/ui/errors/remap-path-prefix-diagnostics.with-macro-in-deps.stderr +++ b/tests/ui/errors/remap-path-prefix-diagnostics.with-macro-in-deps.stderr @@ -2,8 +2,13 @@ error[E0277]: `A` doesn't implement `std::fmt::Display` --> $DIR/remap-path-prefix-diagnostics.rs:LL:COL | LL | impl r#trait::Trait for A {} - | ^ the trait `std::fmt::Display` is not implemented for `A` + | ^ unsatisfied trait bound | +help: the trait `std::fmt::Display` is not implemented for `A` + --> $DIR/remap-path-prefix-diagnostics.rs:LL:COL + | +LL | struct A; + | ^^^^^^^^ note: required by a bound in `Trait` --> $DIR/auxiliary/trait-macro.rs:LL:COL | diff --git a/tests/ui/explicit-tail-calls/ret-ty-hr-mismatch.rs b/tests/ui/explicit-tail-calls/ret-ty-hr-mismatch.rs new file mode 100644 index 00000000000..8ad244568a3 --- /dev/null +++ b/tests/ui/explicit-tail-calls/ret-ty-hr-mismatch.rs @@ -0,0 +1,15 @@ +#![feature(explicit_tail_calls)] +#![expect(incomplete_features)] + +fn foo() -> for<'a> fn(&'a i32) { + become bar(); + //~^ ERROR mismatched signatures +} + +fn bar() -> fn(&'static i32) { + dummy +} + +fn dummy(_: &i32) {} + +fn main() {} diff --git a/tests/ui/explicit-tail-calls/ret-ty-hr-mismatch.stderr b/tests/ui/explicit-tail-calls/ret-ty-hr-mismatch.stderr new file mode 100644 index 00000000000..f6594580ba5 --- /dev/null +++ b/tests/ui/explicit-tail-calls/ret-ty-hr-mismatch.stderr @@ -0,0 +1,12 @@ +error: mismatched signatures + --> $DIR/ret-ty-hr-mismatch.rs:5:5 + | +LL | become bar(); + | ^^^^^^^^^^^^ + | + = note: `become` requires caller and callee to have matching signatures + = note: caller signature: `fn() -> for<'a> fn(&'a i32)` + = note: callee signature: `fn() -> fn(&'static i32)` + +error: aborting due to 1 previous error + diff --git a/tests/ui/explicit-tail-calls/ret-ty-modulo-anonymization.rs b/tests/ui/explicit-tail-calls/ret-ty-modulo-anonymization.rs new file mode 100644 index 00000000000..0cd4e204278 --- /dev/null +++ b/tests/ui/explicit-tail-calls/ret-ty-modulo-anonymization.rs @@ -0,0 +1,16 @@ +// Ensure that we anonymize the output of a function for tail call signature compatibility. + +//@ check-pass + +#![feature(explicit_tail_calls)] +#![expect(incomplete_features)] + +fn foo() -> for<'a> fn(&'a ()) { + become bar(); +} + +fn bar() -> for<'b> fn(&'b ()) { + todo!() +} + +fn main() {} diff --git a/tests/ui/expr/if/if-ret.stderr b/tests/ui/expr/if/if-ret.stderr index e5464affd2f..e53a1e3b081 100644 --- a/tests/ui/expr/if/if-ret.stderr +++ b/tests/ui/expr/if/if-ret.stderr @@ -6,7 +6,7 @@ LL | fn foo() { if (return) { } } | | | any code following this expression is unreachable | - = note: `#[warn(unreachable_code)]` on by default + = note: `#[warn(unreachable_code)]` (part of `#[warn(unused)]`) on by default warning: 1 warning emitted diff --git a/tests/ui/extern/extern-no-mangle.stderr b/tests/ui/extern/extern-no-mangle.stderr index b07cf0d4b4d..69c4fbb935d 100644 --- a/tests/ui/extern/extern-no-mangle.stderr +++ b/tests/ui/extern/extern-no-mangle.stderr @@ -5,7 +5,7 @@ LL | #[no_mangle] | ^^^^^^^^^^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = help: `#[no_mangle]` can be applied to functions, statics + = help: `#[no_mangle]` can be applied to functions and statics note: the lint level is defined here --> $DIR/extern-no-mangle.rs:1:9 | @@ -19,7 +19,7 @@ LL | #[no_mangle] | ^^^^^^^^^^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = help: `#[no_mangle]` can be applied to methods, functions, statics + = help: `#[no_mangle]` can be applied to methods, functions, and statics warning: `#[no_mangle]` attribute cannot be used on statements --> $DIR/extern-no-mangle.rs:24:5 @@ -28,7 +28,7 @@ LL | #[no_mangle] | ^^^^^^^^^^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = help: `#[no_mangle]` can be applied to functions, statics + = help: `#[no_mangle]` can be applied to functions and statics warning: 3 warnings emitted diff --git a/tests/ui/issues/issue-75283.rs b/tests/ui/extern/function-definition-in-extern-block-75283.rs index d556132e47f..e2b7358743b 100644 --- a/tests/ui/issues/issue-75283.rs +++ b/tests/ui/extern/function-definition-in-extern-block-75283.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/75283 extern "C" { fn lol() { //~ ERROR incorrect function inside `extern` block println!(""); diff --git a/tests/ui/issues/issue-75283.stderr b/tests/ui/extern/function-definition-in-extern-block-75283.stderr index 240d9716a55..67be1c29599 100644 --- a/tests/ui/issues/issue-75283.stderr +++ b/tests/ui/extern/function-definition-in-extern-block-75283.stderr @@ -1,5 +1,5 @@ error: incorrect function inside `extern` block - --> $DIR/issue-75283.rs:2:8 + --> $DIR/function-definition-in-extern-block-75283.rs:3:8 | LL | extern "C" { | ---------- `extern` blocks define existing foreign functions and functions inside of them cannot have a body diff --git a/tests/ui/extern/issue-47725.rs b/tests/ui/extern/issue-47725.rs index b0a0af930de..6b4d0dd30e0 100644 --- a/tests/ui/extern/issue-47725.rs +++ b/tests/ui/extern/issue-47725.rs @@ -4,12 +4,14 @@ //~^ WARN attribute cannot be used on //~| WARN previously accepted //~| HELP can be applied to +//~| HELP remove the attribute struct Foo; #[link_name = "foobar"] //~^ WARN attribute cannot be used on //~| WARN previously accepted //~| HELP can be applied to +//~| HELP remove the attribute extern "C" { fn foo() -> u32; } @@ -19,6 +21,7 @@ extern "C" { //~| HELP must be of the form //~| WARN attribute cannot be used on //~| WARN previously accepted +//~| HELP remove the attribute //~| HELP can be applied to //~| NOTE for more information, visit extern "C" { diff --git a/tests/ui/extern/issue-47725.stderr b/tests/ui/extern/issue-47725.stderr index 704b1d81b63..27da18df37c 100644 --- a/tests/ui/extern/issue-47725.stderr +++ b/tests/ui/extern/issue-47725.stderr @@ -1,5 +1,5 @@ error[E0539]: malformed `link_name` attribute input - --> $DIR/issue-47725.rs:17:1 + --> $DIR/issue-47725.rs:19:1 | LL | #[link_name] | ^^^^^^^^^^^^ help: must be of the form: `#[link_name = "name"]` @@ -13,7 +13,7 @@ LL | #[link_name = "foo"] | ^^^^^^^^^^^^^^^^^^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = help: `#[link_name]` can be applied to foreign functions, foreign statics + = help: `#[link_name]` can be applied to foreign functions and foreign statics note: the lint level is defined here --> $DIR/issue-47725.rs:1:9 | @@ -21,22 +21,22 @@ LL | #![warn(unused_attributes)] | ^^^^^^^^^^^^^^^^^ warning: `#[link_name]` attribute cannot be used on foreign modules - --> $DIR/issue-47725.rs:9:1 + --> $DIR/issue-47725.rs:10:1 | LL | #[link_name = "foobar"] | ^^^^^^^^^^^^^^^^^^^^^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = help: `#[link_name]` can be applied to foreign functions, foreign statics + = help: `#[link_name]` can be applied to foreign functions and foreign statics warning: `#[link_name]` attribute cannot be used on foreign modules - --> $DIR/issue-47725.rs:17:1 + --> $DIR/issue-47725.rs:19:1 | LL | #[link_name] | ^^^^^^^^^^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = help: `#[link_name]` can be applied to foreign functions, foreign statics + = help: `#[link_name]` can be applied to foreign functions and foreign statics error: aborting due to 1 previous error; 3 warnings emitted diff --git a/tests/ui/extern/no-mangle-associated-fn.stderr b/tests/ui/extern/no-mangle-associated-fn.stderr index 772cbf6cf7d..79d8144448f 100644 --- a/tests/ui/extern/no-mangle-associated-fn.stderr +++ b/tests/ui/extern/no-mangle-associated-fn.stderr @@ -4,7 +4,7 @@ warning: trait `Bar` is never used LL | trait Bar { | ^^^ | - = note: `#[warn(dead_code)]` on by default + = note: `#[warn(dead_code)]` (part of `#[warn(unused)]`) on by default warning: 1 warning emitted 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 c4fdb5f427c..0abdf0c5309 100644 --- a/tests/ui/feature-gates/feature-gate-abi-x86-interrupt.rs +++ b/tests/ui/feature-gates/feature-gate-abi-x86-interrupt.rs @@ -7,22 +7,22 @@ extern crate minicore; use minicore::*; -extern "x86-interrupt" fn f7() {} //~ ERROR "x86-interrupt" ABI is experimental +extern "x86-interrupt" fn f7(_p: *const u8) {} //~ ERROR "x86-interrupt" ABI is experimental trait Tr { - extern "x86-interrupt" fn m7(); //~ ERROR "x86-interrupt" ABI is experimental - extern "x86-interrupt" fn dm7() {} //~ ERROR "x86-interrupt" ABI is experimental + extern "x86-interrupt" fn m7(_p: *const u8); //~ ERROR "x86-interrupt" ABI is experimental + extern "x86-interrupt" fn dm7(_p: *const u8) {} //~ ERROR "x86-interrupt" ABI is experimental } struct S; // Methods in trait impl impl Tr for S { - extern "x86-interrupt" fn m7() {} //~ ERROR "x86-interrupt" ABI is experimental + extern "x86-interrupt" fn m7(_p: *const u8) {} //~ ERROR "x86-interrupt" ABI is experimental } // Methods in inherent impl impl S { - extern "x86-interrupt" fn im7() {} //~ ERROR "x86-interrupt" ABI is experimental + extern "x86-interrupt" fn im7(_p: *const u8) {} //~ ERROR "x86-interrupt" ABI is experimental } type A7 = extern "x86-interrupt" fn(); //~ ERROR "x86-interrupt" ABI is experimental 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 67211d402c6..b53917dda61 100644 --- a/tests/ui/feature-gates/feature-gate-abi-x86-interrupt.stderr +++ b/tests/ui/feature-gates/feature-gate-abi-x86-interrupt.stderr @@ -1,7 +1,7 @@ error[E0658]: the extern "x86-interrupt" ABI is experimental and subject to change --> $DIR/feature-gate-abi-x86-interrupt.rs:10:8 | -LL | extern "x86-interrupt" fn f7() {} +LL | extern "x86-interrupt" fn f7(_p: *const u8) {} | ^^^^^^^^^^^^^^^ | = note: see issue #40180 <https://github.com/rust-lang/rust/issues/40180> for more information @@ -11,7 +11,7 @@ LL | extern "x86-interrupt" fn f7() {} error[E0658]: the extern "x86-interrupt" ABI is experimental and subject to change --> $DIR/feature-gate-abi-x86-interrupt.rs:12:12 | -LL | extern "x86-interrupt" fn m7(); +LL | extern "x86-interrupt" fn m7(_p: *const u8); | ^^^^^^^^^^^^^^^ | = note: see issue #40180 <https://github.com/rust-lang/rust/issues/40180> for more information @@ -21,7 +21,7 @@ LL | extern "x86-interrupt" fn m7(); error[E0658]: the extern "x86-interrupt" ABI is experimental and subject to change --> $DIR/feature-gate-abi-x86-interrupt.rs:13:12 | -LL | extern "x86-interrupt" fn dm7() {} +LL | extern "x86-interrupt" fn dm7(_p: *const u8) {} | ^^^^^^^^^^^^^^^ | = note: see issue #40180 <https://github.com/rust-lang/rust/issues/40180> for more information @@ -31,7 +31,7 @@ LL | extern "x86-interrupt" fn dm7() {} error[E0658]: the extern "x86-interrupt" ABI is experimental and subject to change --> $DIR/feature-gate-abi-x86-interrupt.rs:20:12 | -LL | extern "x86-interrupt" fn m7() {} +LL | extern "x86-interrupt" fn m7(_p: *const u8) {} | ^^^^^^^^^^^^^^^ | = note: see issue #40180 <https://github.com/rust-lang/rust/issues/40180> for more information @@ -41,7 +41,7 @@ LL | extern "x86-interrupt" fn m7() {} error[E0658]: the extern "x86-interrupt" ABI is experimental and subject to change --> $DIR/feature-gate-abi-x86-interrupt.rs:25:12 | -LL | extern "x86-interrupt" fn im7() {} +LL | extern "x86-interrupt" fn im7(_p: *const u8) {} | ^^^^^^^^^^^^^^^ | = note: see issue #40180 <https://github.com/rust-lang/rust/issues/40180> for more information 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 cb8cf29e99d..42141b891ae 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 @@ -13,7 +13,7 @@ error: `#[allow_internal_unstable]` attribute cannot be used on structs LL | #[allow_internal_unstable(something)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = help: `#[allow_internal_unstable]` can be applied to macro defs, functions + = help: `#[allow_internal_unstable]` can be applied to macro defs and functions error: aborting due to 2 previous errors diff --git a/tests/ui/feature-gates/feature-gate-derive-from.rs b/tests/ui/feature-gates/feature-gate-derive-from.rs new file mode 100644 index 00000000000..0e8c5e4af37 --- /dev/null +++ b/tests/ui/feature-gates/feature-gate-derive-from.rs @@ -0,0 +1,6 @@ +use std::from::From; //~ ERROR use of unstable library feature `derive_from + +#[derive(From)] //~ ERROR use of unstable library feature `derive_from` +struct Foo(u32); + +fn main() {} diff --git a/tests/ui/feature-gates/feature-gate-derive-from.stderr b/tests/ui/feature-gates/feature-gate-derive-from.stderr new file mode 100644 index 00000000000..63216a4cccd --- /dev/null +++ b/tests/ui/feature-gates/feature-gate-derive-from.stderr @@ -0,0 +1,23 @@ +error[E0658]: use of unstable library feature `derive_from` + --> $DIR/feature-gate-derive-from.rs:3:10 + | +LL | #[derive(From)] + | ^^^^ + | + = note: see issue #144889 <https://github.com/rust-lang/rust/issues/144889> for more information + = help: add `#![feature(derive_from)]` 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 `derive_from` + --> $DIR/feature-gate-derive-from.rs:1:5 + | +LL | use std::from::From; + | ^^^^^^^^^^^^^^^ + | + = note: see issue #144889 <https://github.com/rust-lang/rust/issues/144889> for more information + = help: add `#![feature(derive_from)]` 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-effective-target-features.default.stderr b/tests/ui/feature-gates/feature-gate-effective-target-features.default.stderr new file mode 100644 index 00000000000..34a56fe342e --- /dev/null +++ b/tests/ui/feature-gates/feature-gate-effective-target-features.default.stderr @@ -0,0 +1,37 @@ +error[E0658]: the `#[force_target_feature]` attribute is an experimental feature + --> $DIR/feature-gate-effective-target-features.rs:13:5 + | +LL | #[unsafe(force_target_feature(enable = "avx2"))] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #143352 <https://github.com/rust-lang/rust/issues/143352> for more information + = help: add `#![feature(effective_target_features)]` 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: `#[target_feature(..)]` cannot be applied to safe trait method + --> $DIR/feature-gate-effective-target-features.rs:21:5 + | +LL | #[target_feature(enable = "avx2")] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot be applied to safe trait method +LL | +LL | fn foo(&self) {} + | ------------- not an `unsafe` function + +error[E0053]: method `foo` has an incompatible type for trait + --> $DIR/feature-gate-effective-target-features.rs:23:5 + | +LL | fn foo(&self) {} + | ^^^^^^^^^^^^^ expected safe fn, found unsafe fn + | +note: type in trait + --> $DIR/feature-gate-effective-target-features.rs:7:5 + | +LL | fn foo(&self); + | ^^^^^^^^^^^^^^ + = note: expected signature `fn(&Bar2)` + found signature `#[target_features] fn(&Bar2)` + +error: aborting due to 3 previous errors + +Some errors have detailed explanations: E0053, E0658. +For more information about an error, try `rustc --explain E0053`. diff --git a/tests/ui/feature-gates/feature-gate-effective-target-features.feature.stderr b/tests/ui/feature-gates/feature-gate-effective-target-features.feature.stderr new file mode 100644 index 00000000000..d51956fa4d2 --- /dev/null +++ b/tests/ui/feature-gates/feature-gate-effective-target-features.feature.stderr @@ -0,0 +1,35 @@ +warning: the feature `effective_target_features` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/feature-gate-effective-target-features.rs:3:30 + | +LL | #![cfg_attr(feature, feature(effective_target_features))] + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #143352 <https://github.com/rust-lang/rust/issues/143352> for more information + = note: `#[warn(incomplete_features)]` on by default + +error: `#[target_feature(..)]` cannot be applied to safe trait method + --> $DIR/feature-gate-effective-target-features.rs:21:5 + | +LL | #[target_feature(enable = "avx2")] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot be applied to safe trait method +LL | +LL | fn foo(&self) {} + | ------------- not an `unsafe` function + +error[E0053]: method `foo` has an incompatible type for trait + --> $DIR/feature-gate-effective-target-features.rs:23:5 + | +LL | fn foo(&self) {} + | ^^^^^^^^^^^^^ expected safe fn, found unsafe fn + | +note: type in trait + --> $DIR/feature-gate-effective-target-features.rs:7:5 + | +LL | fn foo(&self); + | ^^^^^^^^^^^^^^ + = note: expected signature `fn(&Bar2)` + found signature `#[target_features] fn(&Bar2)` + +error: aborting due to 2 previous errors; 1 warning emitted + +For more information about this error, try `rustc --explain E0053`. diff --git a/tests/ui/feature-gates/feature-gate-effective-target-features.rs b/tests/ui/feature-gates/feature-gate-effective-target-features.rs new file mode 100644 index 00000000000..d383897e438 --- /dev/null +++ b/tests/ui/feature-gates/feature-gate-effective-target-features.rs @@ -0,0 +1,27 @@ +//@ revisions: default feature +//@ only-x86_64 +#![cfg_attr(feature, feature(effective_target_features))] +//[feature]~^ WARN the feature `effective_target_features` is incomplete and may not be safe to use and/or cause compiler crashes + +trait Foo { + fn foo(&self); +} + +struct Bar; + +impl Foo for Bar { + #[unsafe(force_target_feature(enable = "avx2"))] + //[default]~^ ERROR the `#[force_target_feature]` attribute is an experimental feature + fn foo(&self) {} +} + +struct Bar2; + +impl Foo for Bar2 { + #[target_feature(enable = "avx2")] + //~^ ERROR `#[target_feature(..)]` cannot be applied to safe trait method + fn foo(&self) {} + //~^ ERROR method `foo` has an incompatible type for trait +} + +fn main() {} diff --git a/tests/ui/feature-gates/feature-gate-macro-derive.rs b/tests/ui/feature-gates/feature-gate-macro-derive.rs new file mode 100644 index 00000000000..b9d63423061 --- /dev/null +++ b/tests/ui/feature-gates/feature-gate-macro-derive.rs @@ -0,0 +1,4 @@ +#![crate_type = "lib"] + +macro_rules! MyDerive { derive() {} => {} } +//~^ ERROR `macro_rules!` derives are unstable diff --git a/tests/ui/feature-gates/feature-gate-macro-derive.stderr b/tests/ui/feature-gates/feature-gate-macro-derive.stderr new file mode 100644 index 00000000000..b7ca6717bd5 --- /dev/null +++ b/tests/ui/feature-gates/feature-gate-macro-derive.stderr @@ -0,0 +1,13 @@ +error[E0658]: `macro_rules!` derives are unstable + --> $DIR/feature-gate-macro-derive.rs:3:1 + | +LL | macro_rules! MyDerive { derive() {} => {} } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #83527 <https://github.com/rust-lang/rust/issues/83527> for more information + = help: add `#![feature(macro_attr)]` 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-no_sanitize.rs b/tests/ui/feature-gates/feature-gate-no_sanitize.rs deleted file mode 100644 index 5ac014f1c5b..00000000000 --- a/tests/ui/feature-gates/feature-gate-no_sanitize.rs +++ /dev/null @@ -1,4 +0,0 @@ -#[no_sanitize(address)] -//~^ ERROR the `#[no_sanitize]` attribute is an experimental feature -fn main() { -} diff --git a/tests/ui/feature-gates/feature-gate-no_sanitize.stderr b/tests/ui/feature-gates/feature-gate-no_sanitize.stderr deleted file mode 100644 index a33bf6a9e40..00000000000 --- a/tests/ui/feature-gates/feature-gate-no_sanitize.stderr +++ /dev/null @@ -1,13 +0,0 @@ -error[E0658]: the `#[no_sanitize]` attribute is an experimental feature - --> $DIR/feature-gate-no_sanitize.rs:1:1 - | -LL | #[no_sanitize(address)] - | ^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: see issue #39699 <https://github.com/rust-lang/rust/issues/39699> for more information - = help: add `#![feature(no_sanitize)]` 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-reborrow.rs b/tests/ui/feature-gates/feature-gate-reborrow.rs new file mode 100644 index 00000000000..f016f6c6bfa --- /dev/null +++ b/tests/ui/feature-gates/feature-gate-reborrow.rs @@ -0,0 +1,3 @@ +use std::marker::Reborrow; //~ ERROR use of unstable library feature `reborrow` + +fn main() {} diff --git a/tests/ui/feature-gates/feature-gate-reborrow.stderr b/tests/ui/feature-gates/feature-gate-reborrow.stderr new file mode 100644 index 00000000000..5e3033f3bf1 --- /dev/null +++ b/tests/ui/feature-gates/feature-gate-reborrow.stderr @@ -0,0 +1,13 @@ +error[E0658]: use of unstable library feature `reborrow` + --> $DIR/feature-gate-reborrow.rs:1:5 + | +LL | use std::marker::Reborrow; + | ^^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #145612 <https://github.com/rust-lang/rust/issues/145612> for more information + = help: add `#![feature(reborrow)]` 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-repr-simd.stderr b/tests/ui/feature-gates/feature-gate-repr-simd.stderr index 3bf8ec61705..0f1929038fe 100644 --- a/tests/ui/feature-gates/feature-gate-repr-simd.stderr +++ b/tests/ui/feature-gates/feature-gate-repr-simd.stderr @@ -49,7 +49,7 @@ LL | #[repr(simd)] | = 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 #68585 <https://github.com/rust-lang/rust/issues/68585> - = note: `#[deny(conflicting_repr_hints)]` on by default + = note: `#[deny(conflicting_repr_hints)]` (part of `#[deny(future_incompatible)]`) on by default error[E0517]: attribute should be applied to a struct --> $DIR/feature-gate-repr-simd.rs:9:8 @@ -85,5 +85,5 @@ LL | #[repr(simd)] | = 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 #68585 <https://github.com/rust-lang/rust/issues/68585> - = note: `#[deny(conflicting_repr_hints)]` on by default + = note: `#[deny(conflicting_repr_hints)]` (part of `#[deny(future_incompatible)]`) on by default diff --git a/tests/ui/feature-gates/feature-gate-rustdoc_internals.rs b/tests/ui/feature-gates/feature-gate-rustdoc_internals.rs index 57d6b591287..0ad3b2aead4 100644 --- a/tests/ui/feature-gates/feature-gate-rustdoc_internals.rs +++ b/tests/ui/feature-gates/feature-gate-rustdoc_internals.rs @@ -2,6 +2,10 @@ /// wonderful mod foo {} +#[doc(attribute = "repr")] //~ ERROR: `#[doc(attribute)]` is meant for internal use only +/// wonderful +mod foo2 {} + trait Mine {} #[doc(fake_variadic)] //~ ERROR: `#[doc(fake_variadic)]` is meant for internal use only diff --git a/tests/ui/feature-gates/feature-gate-rustdoc_internals.stderr b/tests/ui/feature-gates/feature-gate-rustdoc_internals.stderr index f3c00a2156b..5a6d4d3b45e 100644 --- a/tests/ui/feature-gates/feature-gate-rustdoc_internals.stderr +++ b/tests/ui/feature-gates/feature-gate-rustdoc_internals.stderr @@ -8,8 +8,18 @@ LL | #[doc(keyword = "match")] = help: add `#![feature(rustdoc_internals)]` 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]: `#[doc(attribute)]` is meant for internal use only + --> $DIR/feature-gate-rustdoc_internals.rs:5:1 + | +LL | #[doc(attribute = "repr")] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #90418 <https://github.com/rust-lang/rust/issues/90418> for more information + = help: add `#![feature(rustdoc_internals)]` 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]: `#[doc(fake_variadic)]` is meant for internal use only - --> $DIR/feature-gate-rustdoc_internals.rs:7:1 + --> $DIR/feature-gate-rustdoc_internals.rs:11:1 | LL | #[doc(fake_variadic)] | ^^^^^^^^^^^^^^^^^^^^^ @@ -19,7 +29,7 @@ LL | #[doc(fake_variadic)] = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: `#[doc(search_unbox)]` is meant for internal use only - --> $DIR/feature-gate-rustdoc_internals.rs:10:1 + --> $DIR/feature-gate-rustdoc_internals.rs:14:1 | LL | #[doc(search_unbox)] | ^^^^^^^^^^^^^^^^^^^^ @@ -28,6 +38,6 @@ LL | #[doc(search_unbox)] = help: add `#![feature(rustdoc_internals)]` 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 3 previous errors +error: aborting due to 4 previous errors For more information about this error, try `rustc --explain E0658`. diff --git a/tests/ui/feature-gates/feature-gate-sanitize.rs b/tests/ui/feature-gates/feature-gate-sanitize.rs new file mode 100644 index 00000000000..40098d93272 --- /dev/null +++ b/tests/ui/feature-gates/feature-gate-sanitize.rs @@ -0,0 +1,7 @@ +//@ normalize-stderr: "you are using [0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9]+)?( \([^)]*\))?" -> "you are using $$RUSTC_VERSION" +#![feature(no_sanitize)] //~ ERROR feature has been removed + +#[sanitize(address = "on")] +//~^ ERROR the `#[sanitize]` attribute is an experimental feature +fn main() { +} diff --git a/tests/ui/feature-gates/feature-gate-sanitize.stderr b/tests/ui/feature-gates/feature-gate-sanitize.stderr new file mode 100644 index 00000000000..7c38b351916 --- /dev/null +++ b/tests/ui/feature-gates/feature-gate-sanitize.stderr @@ -0,0 +1,23 @@ +error[E0557]: feature has been removed + --> $DIR/feature-gate-sanitize.rs:2:12 + | +LL | #![feature(no_sanitize)] + | ^^^^^^^^^^^ feature has been removed + | + = note: removed in CURRENT_RUSTC_VERSION; see <https://github.com/rust-lang/rust/pull/142681> for more information + = note: renamed to sanitize(xyz = "on|off") + +error[E0658]: the `#[sanitize]` attribute is an experimental feature + --> $DIR/feature-gate-sanitize.rs:4:1 + | +LL | #[sanitize(address = "on")] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #39699 <https://github.com/rust-lang/rust/issues/39699> for more information + = help: add `#![feature(sanitize)]` 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 + +Some errors have detailed explanations: E0557, E0658. +For more information about an error, try `rustc --explain E0557`. diff --git a/tests/ui/feature-gates/feature-gate-unboxed-closures-manual-impls.stderr b/tests/ui/feature-gates/feature-gate-unboxed-closures-manual-impls.stderr index 334bc63b7ee..b2a2eba9ad1 100644 --- a/tests/ui/feature-gates/feature-gate-unboxed-closures-manual-impls.stderr +++ b/tests/ui/feature-gates/feature-gate-unboxed-closures-manual-impls.stderr @@ -93,7 +93,11 @@ error[E0277]: expected a `FnMut()` closure, found `Foo` LL | impl Fn<()> for Foo { | ^^^ expected an `FnMut()` closure, found `Foo` | - = help: the trait `FnMut()` is not implemented for `Foo` +help: the trait `FnMut()` is not implemented for `Foo` + --> $DIR/feature-gate-unboxed-closures-manual-impls.rs:8:1 + | +LL | struct Foo; + | ^^^^^^^^^^ = note: wrap the `Foo` in a closure with no arguments: `|| { /* code */ }` note: required by a bound in `Fn` --> $SRC_DIR/core/src/ops/function.rs:LL:COL @@ -163,7 +167,11 @@ error[E0277]: expected a `FnOnce()` closure, found `Bar` LL | impl FnMut<()> for Bar { | ^^^ expected an `FnOnce()` closure, found `Bar` | - = help: the trait `FnOnce()` is not implemented for `Bar` +help: the trait `FnOnce()` is not implemented for `Bar` + --> $DIR/feature-gate-unboxed-closures-manual-impls.rs:25:1 + | +LL | struct Bar; + | ^^^^^^^^^^ = note: wrap the `Bar` in a closure with no arguments: `|| { /* code */ }` note: required by a bound in `FnMut` --> $SRC_DIR/core/src/ops/function.rs:LL:COL diff --git a/tests/ui/feature-gates/issue-43106-gating-of-builtin-attrs-error.rs b/tests/ui/feature-gates/issue-43106-gating-of-builtin-attrs-error.rs index 130dd48b0fe..f391cf92fb6 100644 --- a/tests/ui/feature-gates/issue-43106-gating-of-builtin-attrs-error.rs +++ b/tests/ui/feature-gates/issue-43106-gating-of-builtin-attrs-error.rs @@ -40,7 +40,7 @@ mod inline { #[inline = "2100"] fn f() { } //~^ ERROR valid forms for the attribute are //~| WARN this was previously accepted - //~| NOTE #[deny(ill_formed_attribute_input)]` on by default + //~| NOTE `#[deny(ill_formed_attribute_input)]` (part of `#[deny(future_incompatible)]`) on by default //~| NOTE for more information, see issue #57571 <https://github.com/rust-lang/rust/issues/57571> #[inline] struct S; 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 13dce72a882..3b010c3e312 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 @@ -30,7 +30,7 @@ error: `#[export_name]` attribute cannot be used on crates LL | #![export_name = "2200"] | ^^^^^^^^^^^^^^^^^^^^^^^^ | - = help: `#[export_name]` can be applied to functions, statics + = help: `#[export_name]` can be applied to functions and statics error: `#[inline]` attribute cannot be used on crates --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:28:1 @@ -86,7 +86,7 @@ error: `#[export_name]` attribute cannot be used on modules LL | #[export_name = "2200"] | ^^^^^^^^^^^^^^^^^^^^^^^ | - = help: `#[export_name]` can be applied to functions, statics + = help: `#[export_name]` can be applied to functions and statics error: `#[export_name]` attribute cannot be used on modules --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:85:17 @@ -94,7 +94,7 @@ error: `#[export_name]` attribute cannot be used on modules LL | mod inner { #![export_name="2200"] } | ^^^^^^^^^^^^^^^^^^^^^^ | - = help: `#[export_name]` can be applied to functions, statics + = help: `#[export_name]` can be applied to functions and statics error: `#[export_name]` attribute cannot be used on structs --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:90:5 @@ -102,7 +102,7 @@ error: `#[export_name]` attribute cannot be used on structs LL | #[export_name = "2200"] struct S; | ^^^^^^^^^^^^^^^^^^^^^^^ | - = help: `#[export_name]` can be applied to functions, statics + = help: `#[export_name]` can be applied to functions and statics error: `#[export_name]` attribute cannot be used on type aliases --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:93:5 @@ -110,7 +110,7 @@ error: `#[export_name]` attribute cannot be used on type aliases LL | #[export_name = "2200"] type T = S; | ^^^^^^^^^^^^^^^^^^^^^^^ | - = help: `#[export_name]` can be applied to functions, statics + = help: `#[export_name]` can be applied to functions and statics error: `#[export_name]` attribute cannot be used on inherent impl blocks --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:96:5 @@ -118,7 +118,7 @@ error: `#[export_name]` attribute cannot be used on inherent impl blocks LL | #[export_name = "2200"] impl S { } | ^^^^^^^^^^^^^^^^^^^^^^^ | - = help: `#[export_name]` can be applied to functions, statics + = help: `#[export_name]` can be applied to functions and statics error: `#[export_name]` attribute cannot be used on required trait methods --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:100:9 @@ -126,7 +126,7 @@ error: `#[export_name]` attribute cannot be used on required trait methods LL | #[export_name = "2200"] fn foo(); | ^^^^^^^^^^^^^^^^^^^^^^^ | - = help: `#[export_name]` can be applied to statics, functions, inherent methods, provided trait methods, trait methods in impl blocks + = help: `#[export_name]` can be applied to statics, functions, inherent methods, provided trait methods, and trait methods in impl blocks error: attribute should be applied to an `extern crate` item --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:56:1 @@ -305,7 +305,7 @@ LL | #[inline = "2100"] fn f() { } | = 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 #57571 <https://github.com/rust-lang/rust/issues/57571> - = note: `#[deny(ill_formed_attribute_input)]` on by default + = note: `#[deny(ill_formed_attribute_input)]` (part of `#[deny(future_incompatible)]`) on by default error: aborting due to 37 previous errors @@ -320,5 +320,5 @@ LL | #[inline = "2100"] fn f() { } | = 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 #57571 <https://github.com/rust-lang/rust/issues/57571> - = note: `#[deny(ill_formed_attribute_input)]` on by default + = note: `#[deny(ill_formed_attribute_input)]` (part of `#[deny(future_incompatible)]`) on by default diff --git a/tests/ui/feature-gates/issue-43106-gating-of-builtin-attrs.rs b/tests/ui/feature-gates/issue-43106-gating-of-builtin-attrs.rs index 8702d852a89..e5dae4c0069 100644 --- a/tests/ui/feature-gates/issue-43106-gating-of-builtin-attrs.rs +++ b/tests/ui/feature-gates/issue-43106-gating-of-builtin-attrs.rs @@ -50,9 +50,11 @@ #![should_panic] //~ WARN attribute cannot be used on //~| WARN previously accepted //~| HELP can only be applied to +//~| HELP remove the attribute #![ignore] //~ WARN attribute cannot be used on //~| WARN previously accepted //~| HELP can only be applied to +//~| HELP remove the attribute #![no_implicit_prelude] #![reexport_test_harness_main = "2900"] // see gated-link-args.rs @@ -61,22 +63,28 @@ #![proc_macro_derive(Test)] //~ WARN attribute cannot be used on //~| WARN previously accepted //~| HELP can only be applied to +//~| HELP remove the attribute #![doc = "2400"] #![cold] //~ WARN attribute cannot be used on //~| WARN previously accepted //~| HELP can only be applied to -#![link()] //~ WARN attribute should be applied to an `extern` block +//~| HELP remove the attribute +#![link(name = "x")] //~ WARN attribute should be applied to an `extern` block //~^ WARN this was previously accepted #![link_name = "1900"] //~^ WARN attribute cannot be used on //~| WARN previously accepted //~| HELP can be applied to +//~| HELP remove the attribute #![link_section = "1800"] //~^ WARN attribute cannot be used on //~| WARN previously accepted //~| HELP can be applied to +//~| HELP remove the attribute #![must_use] -//~^ WARN `#[must_use]` has no effect +//~^ WARN attribute cannot be used on +//~| WARN previously accepted +//~| HELP can be applied to //~| HELP remove the attribute // see issue-43106-gating-of-stable.rs // see issue-43106-gating-of-unstable.rs @@ -184,21 +192,25 @@ mod macro_use { //~^ WARN attribute cannot be used on //~| WARN previously accepted //~| HELP can be applied to + //~| HELP remove the attribute #[macro_use] struct S; //~^ WARN attribute cannot be used on //~| WARN previously accepted //~| HELP can be applied to + //~| HELP remove the attribute #[macro_use] type T = S; //~^ WARN attribute cannot be used on //~| WARN previously accepted //~| HELP can be applied to + //~| HELP remove the attribute #[macro_use] impl S { } //~^ WARN attribute cannot be used on //~| WARN previously accepted //~| HELP can be applied to + //~| HELP remove the attribute } #[macro_export] @@ -260,57 +272,68 @@ mod path { //~^ WARN attribute cannot be used on //~| WARN previously accepted //~| HELP can only be applied to + //~| HELP remove the attribute #[path = "3800"] struct S; //~^ WARN attribute cannot be used on //~| WARN previously accepted //~| HELP can only be applied to + //~| HELP remove the attribute #[path = "3800"] type T = S; //~^ WARN attribute cannot be used on //~| WARN previously accepted //~| HELP can only be applied to + //~| HELP remove the attribute #[path = "3800"] impl S { } //~^ WARN attribute cannot be used on //~| WARN previously accepted //~| HELP can only be applied to + //~| HELP remove the attribute } #[automatically_derived] //~^ WARN attribute cannot be used on //~| WARN previously accepted //~| HELP can only be applied to +//~| HELP remove the attribute mod automatically_derived { mod inner { #![automatically_derived] } //~^ WARN attribute cannot be used on //~| WARN previously accepted //~| HELP can only be applied to + //~| HELP remove the attribute #[automatically_derived] fn f() { } //~^ WARN attribute cannot be used on //~| WARN previously accepted //~| HELP can only be applied to + //~| HELP remove the attribute #[automatically_derived] struct S; //~^ WARN attribute cannot be used on //~| WARN previously accepted //~| HELP can only be applied to + //~| HELP remove the attribute #[automatically_derived] type T = S; //~^ WARN attribute cannot be used on //~| WARN previously accepted //~| HELP can only be applied to + //~| HELP remove the attribute #[automatically_derived] trait W { } //~^ WARN attribute cannot be used on //~| WARN previously accepted //~| HELP can only be applied to + //~| HELP remove the attribute #[automatically_derived] impl S { } //~^ WARN attribute cannot be used on //~| WARN previously accepted //~| HELP can only be applied to + //~| HELP remove the attribute #[automatically_derived] impl W for S { } } @@ -319,11 +342,13 @@ mod automatically_derived { //~^ WARN attribute cannot be used on //~| WARN previously accepted //~| HELP can be applied to +//~| HELP remove the attribute mod no_mangle { mod inner { #![no_mangle] } //~^ WARN attribute cannot be used on //~| WARN previously accepted //~| HELP can be applied to + //~| HELP remove the attribute #[no_mangle] fn f() { } @@ -331,27 +356,32 @@ mod no_mangle { //~^ WARN attribute cannot be used on //~| WARN previously accepted //~| HELP can be applied to + //~| HELP remove the attribute #[no_mangle] type T = S; //~^ WARN attribute cannot be used on //~| WARN previously accepted //~| HELP can be applied to + //~| HELP remove the attribute #[no_mangle] impl S { } //~^ WARN attribute cannot be used on //~| WARN previously accepted //~| HELP can be applied to + //~| HELP remove the attribute trait Tr { #[no_mangle] fn foo(); //~^ WARN attribute cannot be used on //~| WARN previously accepted //~| HELP can be applied to + //~| HELP remove the attribute #[no_mangle] fn bar() {} //~^ WARN attribute cannot be used on //~| WARN previously accepted //~| HELP can be applied to + //~| HELP remove the attribute } } @@ -359,11 +389,13 @@ mod no_mangle { //~^ WARN attribute cannot be used on //~| WARN previously accepted //~| HELP can only be applied to +//~| HELP remove the attribute mod should_panic { mod inner { #![should_panic] } //~^ WARN attribute cannot be used on //~| WARN previously accepted //~| HELP can only be applied to + //~| HELP remove the attribute #[should_panic] fn f() { } @@ -371,27 +403,32 @@ mod should_panic { //~^ WARN attribute cannot be used on //~| WARN previously accepted //~| HELP can only be applied to + //~| HELP remove the attribute #[should_panic] type T = S; //~^ WARN attribute cannot be used on //~| WARN previously accepted //~| HELP can only be applied to + //~| HELP remove the attribute #[should_panic] impl S { } //~^ WARN attribute cannot be used on //~| WARN previously accepted //~| HELP can only be applied to + //~| HELP remove the attribute } #[ignore] //~^ WARN attribute cannot be used on //~| WARN previously accepted //~| HELP can only be applied to +//~| HELP remove the attribute mod ignore { mod inner { #![ignore] } //~^ WARN attribute cannot be used on //~| WARN previously accepted //~| HELP can only be applied to + //~| HELP remove the attribute #[ignore] fn f() { } @@ -399,16 +436,19 @@ mod ignore { //~^ WARN attribute cannot be used on //~| WARN previously accepted //~| HELP can only be applied to + //~| HELP remove the attribute #[ignore] type T = S; //~^ WARN attribute cannot be used on //~| WARN previously accepted //~| HELP can only be applied to + //~| HELP remove the attribute #[ignore] impl S { } //~^ WARN attribute cannot be used on //~| WARN previously accepted //~| HELP can only be applied to + //~| HELP remove the attribute } #[no_implicit_prelude] @@ -419,40 +459,49 @@ mod no_implicit_prelude { //~^ WARN attribute cannot be used on //~| WARN previously accepted //~| HELP can be applied to + //~| HELP remove the attribute #[no_implicit_prelude] struct S; //~^ WARN attribute cannot be used on //~| WARN previously accepted //~| HELP can be applied to + //~| HELP remove the attribute #[no_implicit_prelude] type T = S; //~^ WARN attribute cannot be used on //~| WARN previously accepted //~| HELP can be applied to + //~| HELP remove the attribute #[no_implicit_prelude] impl S { } //~^ WARN attribute cannot be used on //~| WARN previously accepted //~| HELP can be applied to + //~| HELP remove the attribute } #[reexport_test_harness_main = "2900"] //~^ WARN crate-level attribute should be +//~| HELP add a `!` mod reexport_test_harness_main { mod inner { #![reexport_test_harness_main="2900"] } //~^ WARN crate-level attribute should be #[reexport_test_harness_main = "2900"] fn f() { } //~^ WARN crate-level attribute should be + //~| HELP add a `!` #[reexport_test_harness_main = "2900"] struct S; //~^ WARN crate-level attribute should be + //~| HELP add a `!` #[reexport_test_harness_main = "2900"] type T = S; //~^ WARN crate-level attribute should be + //~| HELP add a `!` #[reexport_test_harness_main = "2900"] impl S { } //~^ WARN crate-level attribute should be + //~| HELP add a `!` } // Cannot feed "2700" to `#[macro_escape]` without signaling an error. @@ -467,40 +516,49 @@ mod macro_escape { //~^ WARN attribute cannot be used on //~| WARN previously accepted //~| HELP can be applied to + //~| HELP remove the attribute #[macro_escape] struct S; //~^ WARN attribute cannot be used on //~| WARN previously accepted //~| HELP can be applied to + //~| HELP remove the attribute #[macro_escape] type T = S; //~^ WARN attribute cannot be used on //~| WARN previously accepted //~| HELP can be applied to + //~| HELP remove the attribute #[macro_escape] impl S { } //~^ WARN attribute cannot be used on //~| WARN previously accepted //~| HELP can be applied to + //~| HELP remove the attribute } #[no_std] //~^ WARN crate-level attribute should be an inner attribute +//~| HELP add a `!` mod no_std { mod inner { #![no_std] } //~^ WARN crate-level attribute should be in the root module #[no_std] fn f() { } //~^ WARN crate-level attribute should be an inner attribute + //~| HELP add a `!` #[no_std] struct S; //~^ WARN crate-level attribute should be an inner attribute + //~| HELP add a `!` #[no_std] type T = S; //~^ WARN crate-level attribute should be an inner attribute + //~| HELP add a `!` #[no_std] impl S { } //~^ WARN crate-level attribute should be an inner attribute + //~| HELP add a `!` } // At time of authorship, #[proc_macro_derive = "2500"] signals error @@ -524,12 +582,14 @@ mod doc { //~^ WARN attribute cannot be used on //~| WARN previously accepted //~| HELP can only be applied to +//~| HELP remove the attribute mod cold { mod inner { #![cold] } //~^ WARN attribute cannot be used on //~| WARN previously accepted //~| HELP can only be applied to + //~| HELP remove the attribute #[cold] fn f() { } @@ -537,64 +597,76 @@ mod cold { //~^ WARN attribute cannot be used on //~| WARN previously accepted //~| HELP can only be applied to + //~| HELP remove the attribute #[cold] type T = S; //~^ WARN attribute cannot be used on //~| WARN previously accepted //~| HELP can only be applied to + //~| HELP remove the attribute #[cold] impl S { } //~^ WARN attribute cannot be used on //~| WARN previously accepted //~| HELP can only be applied to + //~| HELP remove the attribute } #[link_name = "1900"] //~^ WARN attribute cannot be used on //~| WARN previously accepted //~| HELP can be applied to +//~| HELP remove the attribute mod link_name { #[link_name = "1900"] //~^ WARN attribute cannot be used on //~| WARN previously accepted //~| HELP can be applied to + //~| HELP remove the attribute extern "C" { } mod inner { #![link_name="1900"] } //~^ WARN attribute cannot be used on //~| WARN previously accepted //~| HELP can be applied to + //~| HELP remove the attribute #[link_name = "1900"] fn f() { } //~^ WARN attribute cannot be used on //~| WARN previously accepted //~| HELP can be applied to + //~| HELP remove the attribute #[link_name = "1900"] struct S; //~^ WARN attribute cannot be used on //~| WARN previously accepted //~| HELP can be applied to + //~| HELP remove the attribute #[link_name = "1900"] type T = S; //~^ WARN attribute cannot be used on //~| WARN previously accepted //~| HELP can be applied to + //~| HELP remove the attribute #[link_name = "1900"] impl S { } //~^ WARN attribute cannot be used on //~| WARN previously accepted //~| HELP can be applied to + //~| HELP remove the attribute } #[link_section = "1800"] //~^ WARN attribute cannot be used on //~| WARN previously accepted //~| HELP can be applied to +//~| HELP remove the attribute mod link_section { mod inner { #![link_section="1800"] } //~^ WARN attribute cannot be used on //~| WARN previously accepted //~| HELP can be applied to + //~| HELP remove the attribute #[link_section = "1800"] fn f() { } @@ -602,53 +674,56 @@ mod link_section { //~^ WARN attribute cannot be used on //~| WARN previously accepted //~| HELP can be applied to + //~| HELP remove the attribute #[link_section = "1800"] type T = S; //~^ WARN attribute cannot be used on //~| WARN previously accepted //~| HELP can be applied to + //~| HELP remove the attribute #[link_section = "1800"] impl S { } //~^ WARN attribute cannot be used on //~| WARN previously accepted //~| HELP can be applied to + //~| HELP remove the attribute } // Note that this is a `check-pass` test, so it will never invoke the linker. -#[link()] +#[link(name = "x")] //~^ WARN attribute should be applied to an `extern` block //~| WARN this was previously accepted mod link { //~^ NOTE not an `extern` block - mod inner { #![link()] } + mod inner { #![link(name = "x")] } //~^ WARN attribute should be applied to an `extern` block //~| WARN this was previously accepted //~| NOTE not an `extern` block - #[link()] fn f() { } + #[link(name = "x")] fn f() { } //~^ WARN attribute should be applied to an `extern` block //~| WARN this was previously accepted //~| NOTE not an `extern` block - #[link()] struct S; + #[link(name = "x")] struct S; //~^ WARN attribute should be applied to an `extern` block //~| WARN this was previously accepted //~| NOTE not an `extern` block - #[link()] type T = S; + #[link(name = "x")] type T = S; //~^ WARN attribute should be applied to an `extern` block //~| WARN this was previously accepted //~| NOTE not an `extern` block - #[link()] impl S { } + #[link(name = "x")] impl S { } //~^ WARN attribute should be applied to an `extern` block //~| WARN this was previously accepted //~| NOTE not an `extern` block - #[link()] extern "Rust" {} + #[link(name = "x")] extern "Rust" {} //~^ WARN attribute should be applied to an `extern` block //~| WARN this was previously accepted } @@ -668,40 +743,53 @@ mod deprecated { #[deprecated] impl super::StructForDeprecated { } } -#[must_use] //~ WARN `#[must_use]` has no effect -//~^ HELP remove the attribute +#[must_use] //~ WARN attribute cannot be used on +//~| WARN previously accepted +//~| HELP can be applied to +//~| HELP remove the attribute mod must_use { - mod inner { #![must_use] } //~ WARN `#[must_use]` has no effect - //~^ HELP remove the attribute + mod inner { #![must_use] } //~ WARN attribute cannot be used on + //~| WARN previously accepted + //~| HELP can be applied to + //~| HELP remove the attribute #[must_use] fn f() { } #[must_use] struct S; - #[must_use] type T = S; //~ WARN `#[must_use]` has no effect - //~^ HELP remove the attribute + #[must_use] type T = S; //~ WARN attribute cannot be used on + //~| WARN previously accepted + //~| HELP can be applied to + //~| HELP remove the attribute - #[must_use] impl S { } //~ WARN `#[must_use]` has no effect - //~^ HELP remove the attribute + #[must_use] impl S { } //~ WARN attribute cannot be used on + //~| WARN previously accepted + //~| HELP can be applied to + //~| HELP remove the attribute } #[windows_subsystem = "windows"] //~^ WARN crate-level attribute should be an inner attribute +//~| HELP add a `!` mod windows_subsystem { mod inner { #![windows_subsystem="windows"] } //~^ WARN crate-level attribute should be in the root module #[windows_subsystem = "windows"] fn f() { } //~^ WARN crate-level attribute should be an inner attribute + //~| HELP add a `!` #[windows_subsystem = "windows"] struct S; //~^ WARN crate-level attribute should be an inner attribute + //~| HELP add a `!` #[windows_subsystem = "windows"] type T = S; //~^ WARN crate-level attribute should be an inner attribute + //~| HELP add a `!` #[windows_subsystem = "windows"] impl S { } //~^ WARN crate-level attribute should be an inner attribute + //~| HELP add a `!` } // BROKEN USES OF CRATE-LEVEL BUILT-IN ATTRIBUTES @@ -709,135 +797,170 @@ mod windows_subsystem { #[crate_name = "0900"] //~^ WARN crate-level attribute should be an inner attribute mod crate_name { +//~^ NOTE This attribute does not have an `!`, which means it is applied to this module mod inner { #![crate_name="0900"] } -//~^ WARN crate-level attribute should be in the root module +//~^ WARN the `#![crate_name]` attribute can only be used at the crate root #[crate_name = "0900"] fn f() { } //~^ WARN crate-level attribute should be an inner attribute + //~| NOTE This attribute does not have an `!`, which means it is applied to this function #[crate_name = "0900"] struct S; //~^ WARN crate-level attribute should be an inner attribute + //~| NOTE This attribute does not have an `!`, which means it is applied to this struct #[crate_name = "0900"] type T = S; //~^ WARN crate-level attribute should be an inner attribute + //~| NOTE This attribute does not have an `!`, which means it is applied to this type alias #[crate_name = "0900"] impl S { } //~^ WARN crate-level attribute should be an inner attribute + //~| NOTE This attribute does not have an `!`, which means it is applied to this implementation block } #[crate_type = "0800"] //~^ WARN crate-level attribute should be an inner attribute +//~| HELP add a `!` mod crate_type { mod inner { #![crate_type="0800"] } //~^ WARN crate-level attribute should be in the root module #[crate_type = "0800"] fn f() { } //~^ WARN crate-level attribute should be an inner attribute + //~| HELP add a `!` #[crate_type = "0800"] struct S; //~^ WARN crate-level attribute should be an inner attribute + //~| HELP add a `!` #[crate_type = "0800"] type T = S; //~^ WARN crate-level attribute should be an inner attribute + //~| HELP add a `!` #[crate_type = "0800"] impl S { } //~^ WARN crate-level attribute should be an inner attribute + //~| HELP add a `!` } #[feature(x0600)] //~^ WARN crate-level attribute should be an inner attribute +//~| HELP add a `!` mod feature { mod inner { #![feature(x0600)] } //~^ WARN crate-level attribute should be in the root module #[feature(x0600)] fn f() { } //~^ WARN crate-level attribute should be an inner attribute + //~| HELP add a `!` #[feature(x0600)] struct S; //~^ WARN crate-level attribute should be an inner attribute + //~| HELP add a `!` #[feature(x0600)] type T = S; //~^ WARN crate-level attribute should be an inner attribute + //~| HELP add a `!` #[feature(x0600)] impl S { } //~^ WARN crate-level attribute should be an inner attribute + //~| HELP add a `!` } #[no_main] //~^ WARN crate-level attribute should be an inner attribute +//~| HELP add a `!` mod no_main_1 { mod inner { #![no_main] } //~^ WARN crate-level attribute should be in the root module #[no_main] fn f() { } //~^ WARN crate-level attribute should be an inner attribute + //~| HELP add a `!` #[no_main] struct S; //~^ WARN crate-level attribute should be an inner attribute + //~| HELP add a `!` #[no_main] type T = S; //~^ WARN crate-level attribute should be an inner attribute + //~| HELP add a `!` #[no_main] impl S { } //~^ WARN crate-level attribute should be an inner attribute + //~| HELP add a `!` } #[no_builtins] //~^ WARN crate-level attribute should be an inner attribute +//~| HELP add a `!` mod no_builtins { mod inner { #![no_builtins] } //~^ WARN crate-level attribute should be in the root module #[no_builtins] fn f() { } //~^ WARN crate-level attribute should be an inner attribute + //~| HELP add a `!` #[no_builtins] struct S; //~^ WARN crate-level attribute should be an inner attribute + //~| HELP add a `!` #[no_builtins] type T = S; //~^ WARN crate-level attribute should be an inner attribute + //~| HELP add a `!` #[no_builtins] impl S { } //~^ WARN crate-level attribute should be an inner attribute + //~| HELP add a `!` } #[recursion_limit="0200"] //~^ WARN crate-level attribute should be an inner attribute +//~| HELP add a `!` mod recursion_limit { mod inner { #![recursion_limit="0200"] } //~^ WARN crate-level attribute should be in the root module #[recursion_limit="0200"] fn f() { } //~^ WARN crate-level attribute should be an inner attribute + //~| HELP add a `!` #[recursion_limit="0200"] struct S; //~^ WARN crate-level attribute should be an inner attribute + //~| HELP add a `!` #[recursion_limit="0200"] type T = S; //~^ WARN crate-level attribute should be an inner attribute + //~| HELP add a `!` #[recursion_limit="0200"] impl S { } //~^ WARN crate-level attribute should be an inner attribute + //~| HELP add a `!` } #[type_length_limit="0100"] //~^ WARN crate-level attribute should be an inner attribute +//~| HELP add a `!` mod type_length_limit { mod inner { #![type_length_limit="0100"] } //~^ WARN crate-level attribute should be in the root module #[type_length_limit="0100"] fn f() { } //~^ WARN crate-level attribute should be an inner attribute + //~| HELP add a `!` #[type_length_limit="0100"] struct S; //~^ WARN crate-level attribute should be an inner attribute + //~| HELP add a `!` #[type_length_limit="0100"] type T = S; //~^ WARN crate-level attribute should be an inner attribute + //~| HELP add a `!` #[type_length_limit="0100"] impl S { } //~^ WARN crate-level attribute should be an inner attribute + //~| HELP add a `!` } fn main() {} diff --git a/tests/ui/feature-gates/issue-43106-gating-of-builtin-attrs.stderr b/tests/ui/feature-gates/issue-43106-gating-of-builtin-attrs.stderr index 8e2bffb91ca..ef74a00e5a1 100644 --- a/tests/ui/feature-gates/issue-43106-gating-of-builtin-attrs.stderr +++ b/tests/ui/feature-gates/issue-43106-gating-of-builtin-attrs.stderr @@ -1,5 +1,5 @@ warning: `#[macro_escape]` is a deprecated synonym for `#[macro_use]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:462:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:511:17 | LL | mod inner { #![macro_escape] } | ^^^^^^^^^^^^^^^^ @@ -7,7 +7,7 @@ LL | mod inner { #![macro_escape] } = help: try an outer attribute: `#[macro_use]` warning: `#[macro_escape]` is a deprecated synonym for `#[macro_use]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:459:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:508:1 | LL | #[macro_escape] | ^^^^^^^^^^^^^^^ @@ -43,151 +43,151 @@ LL | #![deny(x5100)] | ^^^^^ warning: unknown lint: `x5400` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:103:8 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:111:8 | LL | #[warn(x5400)] | ^^^^^ warning: unknown lint: `x5400` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:106:25 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:114:25 | LL | mod inner { #![warn(x5400)] } | ^^^^^ warning: unknown lint: `x5400` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:109:12 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:117:12 | LL | #[warn(x5400)] fn f() { } | ^^^^^ warning: unknown lint: `x5400` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:112:12 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:120:12 | LL | #[warn(x5400)] struct S; | ^^^^^ warning: unknown lint: `x5400` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:115:12 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:123:12 | LL | #[warn(x5400)] type T = S; | ^^^^^ warning: unknown lint: `x5400` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:118:12 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:126:12 | LL | #[warn(x5400)] impl S { } | ^^^^^ warning: unknown lint: `x5300` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:122:9 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:130:9 | LL | #[allow(x5300)] | ^^^^^ warning: unknown lint: `x5300` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:125:26 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:133:26 | LL | mod inner { #![allow(x5300)] } | ^^^^^ warning: unknown lint: `x5300` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:128:13 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:136:13 | LL | #[allow(x5300)] fn f() { } | ^^^^^ warning: unknown lint: `x5300` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:131:13 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:139:13 | LL | #[allow(x5300)] struct S; | ^^^^^ warning: unknown lint: `x5300` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:134:13 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:142:13 | LL | #[allow(x5300)] type T = S; | ^^^^^ warning: unknown lint: `x5300` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:137:13 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:145:13 | LL | #[allow(x5300)] impl S { } | ^^^^^ warning: unknown lint: `x5200` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:141:10 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:149:10 | LL | #[forbid(x5200)] | ^^^^^ warning: unknown lint: `x5200` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:144:27 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:152:27 | LL | mod inner { #![forbid(x5200)] } | ^^^^^ warning: unknown lint: `x5200` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:147:14 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:155:14 | LL | #[forbid(x5200)] fn f() { } | ^^^^^ warning: unknown lint: `x5200` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:150:14 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:158:14 | LL | #[forbid(x5200)] struct S; | ^^^^^ warning: unknown lint: `x5200` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:153:14 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:161:14 | LL | #[forbid(x5200)] type T = S; | ^^^^^ warning: unknown lint: `x5200` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:156:14 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:164:14 | LL | #[forbid(x5200)] impl S { } | ^^^^^ warning: unknown lint: `x5100` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:160:8 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:168:8 | LL | #[deny(x5100)] | ^^^^^ warning: unknown lint: `x5100` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:163:25 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:171:25 | LL | mod inner { #![deny(x5100)] } | ^^^^^ warning: unknown lint: `x5100` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:166:12 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:174:12 | LL | #[deny(x5100)] fn f() { } | ^^^^^ warning: unknown lint: `x5100` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:169:12 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:177:12 | LL | #[deny(x5100)] struct S; | ^^^^^ warning: unknown lint: `x5100` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:172:12 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:180:12 | LL | #[deny(x5100)] type T = S; | ^^^^^ warning: unknown lint: `x5100` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:175:12 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:183:12 | LL | #[deny(x5100)] impl S { } | ^^^^^ warning: `#[macro_export]` only has an effect on macro definitions - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:204:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:216:1 | LL | #[macro_export] | ^^^^^^^^^^^^^^^ @@ -198,104 +198,131 @@ note: the lint level is defined here LL | #![warn(unused_attributes, unknown_lints)] | ^^^^^^^^^^^^^^^^^ -warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:439:1 +warning: crate-level attribute should be an inner attribute + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:483:1 | LL | #[reexport_test_harness_main = "2900"] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: add a `!` + | +LL | #![reexport_test_harness_main = "2900"] + | + -warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:487:1 +warning: crate-level attribute should be an inner attribute + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:540:1 | LL | #[no_std] | ^^^^^^^^^ + | +help: add a `!` + | +LL | #![no_std] + | + warning: attribute should be applied to an `extern` block with non-Rust ABI - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:620:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:695:1 | -LL | #[link()] - | ^^^^^^^^^ +LL | #[link(name = "x")] + | ^^^^^^^^^^^^^^^^^^^ ... LL | / mod link { LL | | LL | | -LL | | mod inner { #![link()] } +LL | | mod inner { #![link(name = "x")] } ... | LL | | } | |_- not an `extern` block | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! -warning: `#[must_use]` has no effect when applied to modules - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:671:1 - | -LL | #[must_use] - | ^^^^^^^^^^^ - -warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:688:1 +warning: crate-level attribute should be an inner attribute + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:771:1 | LL | #[windows_subsystem = "windows"] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:709:1 | -LL | #[crate_name = "0900"] - | ^^^^^^^^^^^^^^^^^^^^^^ +help: add a `!` + | +LL | #![windows_subsystem = "windows"] + | + -warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:728:1 +warning: crate-level attribute should be an inner attribute + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:821:1 | LL | #[crate_type = "0800"] | ^^^^^^^^^^^^^^^^^^^^^^ + | +help: add a `!` + | +LL | #![crate_type = "0800"] + | + -warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:747:1 +warning: crate-level attribute should be an inner attribute + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:845:1 | LL | #[feature(x0600)] | ^^^^^^^^^^^^^^^^^ + | +help: add a `!` + | +LL | #![feature(x0600)] + | + -warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:767:1 +warning: crate-level attribute should be an inner attribute + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:870:1 | LL | #[no_main] | ^^^^^^^^^^ + | +help: add a `!` + | +LL | #![no_main] + | + -warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:786:1 +warning: crate-level attribute should be an inner attribute + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:894:1 | LL | #[no_builtins] | ^^^^^^^^^^^^^^ + | +help: add a `!` + | +LL | #![no_builtins] + | + -warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:805:1 +warning: crate-level attribute should be an inner attribute + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:918:1 | LL | #[recursion_limit="0200"] | ^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: add a `!` + | +LL | #![recursion_limit="0200"] + | + -warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:824:1 +warning: crate-level attribute should be an inner attribute + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:942:1 | LL | #[type_length_limit="0100"] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: add a `!` + | +LL | #![type_length_limit="0100"] + | + warning: attribute should be applied to an `extern` block with non-Rust ABI - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:68:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:72:1 | -LL | #![link()] - | ^^^^^^^^^^ not an `extern` block +LL | #![link(name = "x")] + | ^^^^^^^^^^^^^^^^^^^^ not an `extern` block | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! -warning: `#[must_use]` has no effect when applied to modules - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:78:1 - | -LL | #![must_use] - | ^^^^^^^^^^^^ - warning: the feature `rust1` has been stable since 1.0.0 and no longer requires an attribute to enable - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:92:12 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:100:12 | LL | #![feature(rust1)] | ^^^^^ @@ -303,439 +330,571 @@ LL | #![feature(rust1)] = note: `#[warn(stable_features)]` on by default warning: `#[macro_export]` only has an effect on macro definitions - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:207:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:219:17 | LL | mod inner { #![macro_export] } | ^^^^^^^^^^^^^^^^ warning: `#[macro_export]` only has an effect on macro definitions - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:210:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:222:5 | LL | #[macro_export] fn f() { } | ^^^^^^^^^^^^^^^ warning: `#[macro_export]` only has an effect on macro definitions - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:213:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:225:5 | LL | #[macro_export] struct S; | ^^^^^^^^^^^^^^^ warning: `#[macro_export]` only has an effect on macro definitions - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:216:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:228:5 | LL | #[macro_export] type T = S; | ^^^^^^^^^^^^^^^ warning: `#[macro_export]` only has an effect on macro definitions - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:219:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:231:5 | LL | #[macro_export] impl S { } | ^^^^^^^^^^^^^^^ warning: crate-level attribute should be in the root module - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:442:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:487:17 | LL | mod inner { #![reexport_test_harness_main="2900"] } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:445:5 +warning: crate-level attribute should be an inner attribute + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:490:5 | LL | #[reexport_test_harness_main = "2900"] fn f() { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: add a `!` + | +LL | #![reexport_test_harness_main = "2900"] fn f() { } + | + -warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:448:5 +warning: crate-level attribute should be an inner attribute + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:494:5 | LL | #[reexport_test_harness_main = "2900"] struct S; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: add a `!` + | +LL | #![reexport_test_harness_main = "2900"] struct S; + | + -warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:451:5 +warning: crate-level attribute should be an inner attribute + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:498:5 | LL | #[reexport_test_harness_main = "2900"] type T = S; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: add a `!` + | +LL | #![reexport_test_harness_main = "2900"] type T = S; + | + -warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:454:5 +warning: crate-level attribute should be an inner attribute + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:502:5 | LL | #[reexport_test_harness_main = "2900"] impl S { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: add a `!` + | +LL | #![reexport_test_harness_main = "2900"] impl S { } + | + warning: crate-level attribute should be in the root module - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:490:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:544:17 | LL | mod inner { #![no_std] } | ^^^^^^^^^^ -warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:493:5 +warning: crate-level attribute should be an inner attribute + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:547:5 | LL | #[no_std] fn f() { } | ^^^^^^^^^ + | +help: add a `!` + | +LL | #![no_std] fn f() { } + | + -warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:496:5 +warning: crate-level attribute should be an inner attribute + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:551:5 | LL | #[no_std] struct S; | ^^^^^^^^^ + | +help: add a `!` + | +LL | #![no_std] struct S; + | + -warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:499:5 +warning: crate-level attribute should be an inner attribute + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:555:5 | LL | #[no_std] type T = S; | ^^^^^^^^^ + | +help: add a `!` + | +LL | #![no_std] type T = S; + | + -warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:502:5 +warning: crate-level attribute should be an inner attribute + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:559:5 | LL | #[no_std] impl S { } | ^^^^^^^^^ - -warning: attribute should be applied to an `extern` block with non-Rust ABI - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:626:17 | -LL | mod inner { #![link()] } - | ------------^^^^^^^^^^-- not an `extern` block +help: add a `!` | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! +LL | #![no_std] impl S { } + | + warning: attribute should be applied to an `extern` block with non-Rust ABI - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:631:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:701:17 | -LL | #[link()] fn f() { } - | ^^^^^^^^^ ---------- not an `extern` block +LL | mod inner { #![link(name = "x")] } + | ------------^^^^^^^^^^^^^^^^^^^^-- not an `extern` block | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! warning: attribute should be applied to an `extern` block with non-Rust ABI - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:636:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:706:5 | -LL | #[link()] struct S; - | ^^^^^^^^^ --------- not an `extern` block +LL | #[link(name = "x")] fn f() { } + | ^^^^^^^^^^^^^^^^^^^ ---------- not an `extern` block | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! warning: attribute should be applied to an `extern` block with non-Rust ABI - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:641:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:711:5 | -LL | #[link()] type T = S; - | ^^^^^^^^^ ----------- not an `extern` block +LL | #[link(name = "x")] struct S; + | ^^^^^^^^^^^^^^^^^^^ --------- not an `extern` block | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! warning: attribute should be applied to an `extern` block with non-Rust ABI - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:646:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:716:5 | -LL | #[link()] impl S { } - | ^^^^^^^^^ ---------- not an `extern` block +LL | #[link(name = "x")] type T = S; + | ^^^^^^^^^^^^^^^^^^^ ----------- not an `extern` block | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! warning: attribute should be applied to an `extern` block with non-Rust ABI - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:651:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:721:5 | -LL | #[link()] extern "Rust" {} - | ^^^^^^^^^ +LL | #[link(name = "x")] impl S { } + | ^^^^^^^^^^^^^^^^^^^ ---------- not an `extern` block | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! -warning: `#[must_use]` has no effect when applied to modules - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:674:17 - | -LL | mod inner { #![must_use] } - | ^^^^^^^^^^^^ - -warning: `#[must_use]` has no effect when applied to type aliases - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:681:5 +warning: attribute should be applied to an `extern` block with non-Rust ABI + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:726:5 | -LL | #[must_use] type T = S; - | ^^^^^^^^^^^ - -warning: `#[must_use]` has no effect when applied to inherent impl blocks - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:684:5 +LL | #[link(name = "x")] extern "Rust" {} + | ^^^^^^^^^^^^^^^^^^^ | -LL | #[must_use] impl S { } - | ^^^^^^^^^^^ + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! warning: crate-level attribute should be in the root module - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:691:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:775:17 | LL | mod inner { #![windows_subsystem="windows"] } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:694:5 +warning: crate-level attribute should be an inner attribute + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:778:5 | LL | #[windows_subsystem = "windows"] fn f() { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: add a `!` + | +LL | #![windows_subsystem = "windows"] fn f() { } + | + -warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:697:5 +warning: crate-level attribute should be an inner attribute + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:782:5 | LL | #[windows_subsystem = "windows"] struct S; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:700:5 | -LL | #[windows_subsystem = "windows"] type T = S; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +help: add a `!` + | +LL | #![windows_subsystem = "windows"] struct S; + | + -warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:703:5 +warning: crate-level attribute should be an inner attribute + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:786:5 | -LL | #[windows_subsystem = "windows"] impl S { } +LL | #[windows_subsystem = "windows"] type T = S; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -warning: crate-level attribute should be in the root module - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:712:17 | -LL | mod inner { #![crate_name="0900"] } - | ^^^^^^^^^^^^^^^^^^^^^ - -warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:715:5 +help: add a `!` | -LL | #[crate_name = "0900"] fn f() { } - | ^^^^^^^^^^^^^^^^^^^^^^ +LL | #![windows_subsystem = "windows"] type T = S; + | + -warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:718:5 +warning: crate-level attribute should be an inner attribute + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:790:5 | -LL | #[crate_name = "0900"] struct S; - | ^^^^^^^^^^^^^^^^^^^^^^ - -warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:721:5 +LL | #[windows_subsystem = "windows"] impl S { } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | -LL | #[crate_name = "0900"] type T = S; - | ^^^^^^^^^^^^^^^^^^^^^^ - -warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:724:5 +help: add a `!` | -LL | #[crate_name = "0900"] impl S { } - | ^^^^^^^^^^^^^^^^^^^^^^ +LL | #![windows_subsystem = "windows"] impl S { } + | + warning: crate-level attribute should be in the root module - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:731:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:825:17 | LL | mod inner { #![crate_type="0800"] } | ^^^^^^^^^^^^^^^^^^^^^ -warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:734:5 +warning: crate-level attribute should be an inner attribute + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:828:5 | LL | #[crate_type = "0800"] fn f() { } | ^^^^^^^^^^^^^^^^^^^^^^ + | +help: add a `!` + | +LL | #![crate_type = "0800"] fn f() { } + | + -warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:737:5 +warning: crate-level attribute should be an inner attribute + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:832:5 | LL | #[crate_type = "0800"] struct S; | ^^^^^^^^^^^^^^^^^^^^^^ + | +help: add a `!` + | +LL | #![crate_type = "0800"] struct S; + | + -warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:740:5 +warning: crate-level attribute should be an inner attribute + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:836:5 | LL | #[crate_type = "0800"] type T = S; | ^^^^^^^^^^^^^^^^^^^^^^ + | +help: add a `!` + | +LL | #![crate_type = "0800"] type T = S; + | + -warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:743:5 +warning: crate-level attribute should be an inner attribute + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:840:5 | LL | #[crate_type = "0800"] impl S { } | ^^^^^^^^^^^^^^^^^^^^^^ + | +help: add a `!` + | +LL | #![crate_type = "0800"] impl S { } + | + warning: crate-level attribute should be in the root module - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:750:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:849:17 | LL | mod inner { #![feature(x0600)] } | ^^^^^^^^^^^^^^^^^^ -warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:753:5 +warning: crate-level attribute should be an inner attribute + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:852:5 | LL | #[feature(x0600)] fn f() { } | ^^^^^^^^^^^^^^^^^ + | +help: add a `!` + | +LL | #![feature(x0600)] fn f() { } + | + -warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:756:5 +warning: crate-level attribute should be an inner attribute + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:856:5 | LL | #[feature(x0600)] struct S; | ^^^^^^^^^^^^^^^^^ + | +help: add a `!` + | +LL | #![feature(x0600)] struct S; + | + -warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:759:5 +warning: crate-level attribute should be an inner attribute + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:860:5 | LL | #[feature(x0600)] type T = S; | ^^^^^^^^^^^^^^^^^ + | +help: add a `!` + | +LL | #![feature(x0600)] type T = S; + | + -warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:762:5 +warning: crate-level attribute should be an inner attribute + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:864:5 | LL | #[feature(x0600)] impl S { } | ^^^^^^^^^^^^^^^^^ + | +help: add a `!` + | +LL | #![feature(x0600)] impl S { } + | + warning: crate-level attribute should be in the root module - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:770:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:874:17 | LL | mod inner { #![no_main] } | ^^^^^^^^^^^ -warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:773:5 +warning: crate-level attribute should be an inner attribute + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:877:5 | LL | #[no_main] fn f() { } | ^^^^^^^^^^ + | +help: add a `!` + | +LL | #![no_main] fn f() { } + | + -warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:776:5 +warning: crate-level attribute should be an inner attribute + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:881:5 | LL | #[no_main] struct S; | ^^^^^^^^^^ + | +help: add a `!` + | +LL | #![no_main] struct S; + | + -warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:779:5 +warning: crate-level attribute should be an inner attribute + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:885:5 | LL | #[no_main] type T = S; | ^^^^^^^^^^ + | +help: add a `!` + | +LL | #![no_main] type T = S; + | + -warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:782:5 +warning: crate-level attribute should be an inner attribute + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:889:5 | LL | #[no_main] impl S { } | ^^^^^^^^^^ + | +help: add a `!` + | +LL | #![no_main] impl S { } + | + warning: crate-level attribute should be in the root module - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:789:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:898:17 | LL | mod inner { #![no_builtins] } | ^^^^^^^^^^^^^^^ -warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:792:5 +warning: crate-level attribute should be an inner attribute + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:901:5 | LL | #[no_builtins] fn f() { } | ^^^^^^^^^^^^^^ + | +help: add a `!` + | +LL | #![no_builtins] fn f() { } + | + -warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:795:5 +warning: crate-level attribute should be an inner attribute + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:905:5 | LL | #[no_builtins] struct S; | ^^^^^^^^^^^^^^ + | +help: add a `!` + | +LL | #![no_builtins] struct S; + | + -warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:798:5 +warning: crate-level attribute should be an inner attribute + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:909:5 | LL | #[no_builtins] type T = S; | ^^^^^^^^^^^^^^ + | +help: add a `!` + | +LL | #![no_builtins] type T = S; + | + -warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:801:5 +warning: crate-level attribute should be an inner attribute + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:913:5 | LL | #[no_builtins] impl S { } | ^^^^^^^^^^^^^^ + | +help: add a `!` + | +LL | #![no_builtins] impl S { } + | + warning: crate-level attribute should be in the root module - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:808:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:922:17 | LL | mod inner { #![recursion_limit="0200"] } | ^^^^^^^^^^^^^^^^^^^^^^^^^^ -warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:811:5 +warning: crate-level attribute should be an inner attribute + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:925:5 | LL | #[recursion_limit="0200"] fn f() { } | ^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: add a `!` + | +LL | #![recursion_limit="0200"] fn f() { } + | + -warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:814:5 +warning: crate-level attribute should be an inner attribute + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:929:5 | LL | #[recursion_limit="0200"] struct S; | ^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: add a `!` + | +LL | #![recursion_limit="0200"] struct S; + | + -warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:817:5 +warning: crate-level attribute should be an inner attribute + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:933:5 | LL | #[recursion_limit="0200"] type T = S; | ^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: add a `!` + | +LL | #![recursion_limit="0200"] type T = S; + | + -warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:820:5 +warning: crate-level attribute should be an inner attribute + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:937:5 | LL | #[recursion_limit="0200"] impl S { } | ^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: add a `!` + | +LL | #![recursion_limit="0200"] impl S { } + | + warning: crate-level attribute should be in the root module - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:827:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:946:17 | LL | mod inner { #![type_length_limit="0100"] } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:830:5 +warning: crate-level attribute should be an inner attribute + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:949:5 | LL | #[type_length_limit="0100"] fn f() { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: add a `!` + | +LL | #![type_length_limit="0100"] fn f() { } + | + -warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:833:5 +warning: crate-level attribute should be an inner attribute + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:953:5 | LL | #[type_length_limit="0100"] struct S; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: add a `!` + | +LL | #![type_length_limit="0100"] struct S; + | + -warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:836:5 +warning: crate-level attribute should be an inner attribute + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:957:5 | LL | #[type_length_limit="0100"] type T = S; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: add a `!` + | +LL | #![type_length_limit="0100"] type T = S; + | + -warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:839:5 +warning: crate-level attribute should be an inner attribute + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:961:5 | LL | #[type_length_limit="0100"] impl S { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: add a `!` + | +LL | #![type_length_limit="0100"] impl S { } + | + warning: `#[macro_use]` attribute cannot be used on functions - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:183:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:191:5 | LL | #[macro_use] fn f() { } | ^^^^^^^^^^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = help: `#[macro_use]` can be applied to modules, extern crates, crates + = help: `#[macro_use]` can be applied to modules, extern crates, and crates warning: `#[macro_use]` attribute cannot be used on structs - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:188:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:197:5 | LL | #[macro_use] struct S; | ^^^^^^^^^^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = help: `#[macro_use]` can be applied to modules, extern crates, crates + = help: `#[macro_use]` can be applied to modules, extern crates, and crates warning: `#[macro_use]` attribute cannot be used on type aliases - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:193:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:203:5 | LL | #[macro_use] type T = S; | ^^^^^^^^^^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = help: `#[macro_use]` can be applied to modules, extern crates, crates + = help: `#[macro_use]` can be applied to modules, extern crates, and crates warning: `#[macro_use]` attribute cannot be used on inherent impl blocks - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:198:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:209:5 | LL | #[macro_use] impl S { } | ^^^^^^^^^^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = help: `#[macro_use]` can be applied to modules, extern crates, crates + = help: `#[macro_use]` can be applied to modules, extern crates, and crates warning: `#[path]` attribute cannot be used on functions - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:259:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:271:5 | LL | #[path = "3800"] fn f() { } | ^^^^^^^^^^^^^^^^ @@ -744,7 +903,7 @@ LL | #[path = "3800"] fn f() { } = help: `#[path]` can only be applied to modules warning: `#[path]` attribute cannot be used on structs - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:264:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:277:5 | LL | #[path = "3800"] struct S; | ^^^^^^^^^^^^^^^^ @@ -753,7 +912,7 @@ LL | #[path = "3800"] struct S; = help: `#[path]` can only be applied to modules warning: `#[path]` attribute cannot be used on type aliases - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:269:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:283:5 | LL | #[path = "3800"] type T = S; | ^^^^^^^^^^^^^^^^ @@ -762,7 +921,7 @@ LL | #[path = "3800"] type T = S; = help: `#[path]` can only be applied to modules warning: `#[path]` attribute cannot be used on inherent impl blocks - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:274:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:289:5 | LL | #[path = "3800"] impl S { } | ^^^^^^^^^^^^^^^^ @@ -771,7 +930,7 @@ LL | #[path = "3800"] impl S { } = help: `#[path]` can only be applied to modules warning: `#[automatically_derived]` attribute cannot be used on modules - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:280:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:296:1 | LL | #[automatically_derived] | ^^^^^^^^^^^^^^^^^^^^^^^^ @@ -780,7 +939,7 @@ LL | #[automatically_derived] = help: `#[automatically_derived]` can only be applied to trait impl blocks warning: `#[automatically_derived]` attribute cannot be used on modules - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:285:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:302:17 | LL | mod inner { #![automatically_derived] } | ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -789,7 +948,7 @@ LL | mod inner { #![automatically_derived] } = help: `#[automatically_derived]` can only be applied to trait impl blocks warning: `#[automatically_derived]` attribute cannot be used on functions - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:290:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:308:5 | LL | #[automatically_derived] fn f() { } | ^^^^^^^^^^^^^^^^^^^^^^^^ @@ -798,7 +957,7 @@ LL | #[automatically_derived] fn f() { } = help: `#[automatically_derived]` can only be applied to trait impl blocks warning: `#[automatically_derived]` attribute cannot be used on structs - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:295:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:314:5 | LL | #[automatically_derived] struct S; | ^^^^^^^^^^^^^^^^^^^^^^^^ @@ -807,7 +966,7 @@ LL | #[automatically_derived] struct S; = help: `#[automatically_derived]` can only be applied to trait impl blocks warning: `#[automatically_derived]` attribute cannot be used on type aliases - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:300:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:320:5 | LL | #[automatically_derived] type T = S; | ^^^^^^^^^^^^^^^^^^^^^^^^ @@ -816,7 +975,7 @@ LL | #[automatically_derived] type T = S; = help: `#[automatically_derived]` can only be applied to trait impl blocks warning: `#[automatically_derived]` attribute cannot be used on traits - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:305:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:326:5 | LL | #[automatically_derived] trait W { } | ^^^^^^^^^^^^^^^^^^^^^^^^ @@ -825,7 +984,7 @@ LL | #[automatically_derived] trait W { } = help: `#[automatically_derived]` can only be applied to trait impl blocks warning: `#[automatically_derived]` attribute cannot be used on inherent impl blocks - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:310:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:332:5 | LL | #[automatically_derived] impl S { } | ^^^^^^^^^^^^^^^^^^^^^^^^ @@ -834,70 +993,70 @@ LL | #[automatically_derived] impl S { } = help: `#[automatically_derived]` can only be applied to trait impl blocks warning: `#[no_mangle]` attribute cannot be used on modules - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:318:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:341:1 | LL | #[no_mangle] | ^^^^^^^^^^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = help: `#[no_mangle]` can be applied to functions, statics + = help: `#[no_mangle]` can be applied to functions and statics warning: `#[no_mangle]` attribute cannot be used on modules - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:323:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:347:17 | LL | mod inner { #![no_mangle] } | ^^^^^^^^^^^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = help: `#[no_mangle]` can be applied to functions, statics + = help: `#[no_mangle]` can be applied to functions and statics warning: `#[no_mangle]` attribute cannot be used on structs - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:330:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:355:5 | LL | #[no_mangle] struct S; | ^^^^^^^^^^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = help: `#[no_mangle]` can be applied to functions, statics + = help: `#[no_mangle]` can be applied to functions and statics warning: `#[no_mangle]` attribute cannot be used on type aliases - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:335:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:361:5 | LL | #[no_mangle] type T = S; | ^^^^^^^^^^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = help: `#[no_mangle]` can be applied to functions, statics + = help: `#[no_mangle]` can be applied to functions and statics warning: `#[no_mangle]` attribute cannot be used on inherent impl blocks - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:340:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:367:5 | LL | #[no_mangle] impl S { } | ^^^^^^^^^^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = help: `#[no_mangle]` can be applied to functions, statics + = help: `#[no_mangle]` can be applied to functions and statics warning: `#[no_mangle]` attribute cannot be used on required trait methods - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:346:9 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:374:9 | LL | #[no_mangle] fn foo(); | ^^^^^^^^^^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = help: `#[no_mangle]` can be applied to functions, statics, inherent methods, trait methods in impl blocks + = help: `#[no_mangle]` can be applied to functions, statics, inherent methods, and trait methods in impl blocks warning: `#[no_mangle]` attribute cannot be used on provided trait methods - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:351:9 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:380:9 | LL | #[no_mangle] fn bar() {} | ^^^^^^^^^^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = help: `#[no_mangle]` can be applied to functions, statics, inherent methods, trait methods in impl blocks + = help: `#[no_mangle]` can be applied to functions, statics, inherent methods, and trait methods in impl blocks warning: `#[should_panic]` attribute cannot be used on modules - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:358:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:388:1 | LL | #[should_panic] | ^^^^^^^^^^^^^^^ @@ -906,7 +1065,7 @@ LL | #[should_panic] = help: `#[should_panic]` can only be applied to functions warning: `#[should_panic]` attribute cannot be used on modules - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:363:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:394:17 | LL | mod inner { #![should_panic] } | ^^^^^^^^^^^^^^^^ @@ -915,7 +1074,7 @@ LL | mod inner { #![should_panic] } = help: `#[should_panic]` can only be applied to functions warning: `#[should_panic]` attribute cannot be used on structs - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:370:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:402:5 | LL | #[should_panic] struct S; | ^^^^^^^^^^^^^^^ @@ -924,7 +1083,7 @@ LL | #[should_panic] struct S; = help: `#[should_panic]` can only be applied to functions warning: `#[should_panic]` attribute cannot be used on type aliases - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:375:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:408:5 | LL | #[should_panic] type T = S; | ^^^^^^^^^^^^^^^ @@ -933,7 +1092,7 @@ LL | #[should_panic] type T = S; = help: `#[should_panic]` can only be applied to functions warning: `#[should_panic]` attribute cannot be used on inherent impl blocks - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:380:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:414:5 | LL | #[should_panic] impl S { } | ^^^^^^^^^^^^^^^ @@ -942,7 +1101,7 @@ LL | #[should_panic] impl S { } = help: `#[should_panic]` can only be applied to functions warning: `#[ignore]` attribute cannot be used on modules - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:386:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:421:1 | LL | #[ignore] | ^^^^^^^^^ @@ -951,7 +1110,7 @@ LL | #[ignore] = help: `#[ignore]` can only be applied to functions warning: `#[ignore]` attribute cannot be used on modules - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:391:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:427:17 | LL | mod inner { #![ignore] } | ^^^^^^^^^^ @@ -960,7 +1119,7 @@ LL | mod inner { #![ignore] } = help: `#[ignore]` can only be applied to functions warning: `#[ignore]` attribute cannot be used on structs - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:398:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:435:5 | LL | #[ignore] struct S; | ^^^^^^^^^ @@ -969,7 +1128,7 @@ LL | #[ignore] struct S; = help: `#[ignore]` can only be applied to functions warning: `#[ignore]` attribute cannot be used on type aliases - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:403:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:441:5 | LL | #[ignore] type T = S; | ^^^^^^^^^ @@ -978,7 +1137,7 @@ LL | #[ignore] type T = S; = help: `#[ignore]` can only be applied to functions warning: `#[ignore]` attribute cannot be used on inherent impl blocks - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:408:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:447:5 | LL | #[ignore] impl S { } | ^^^^^^^^^ @@ -987,79 +1146,79 @@ LL | #[ignore] impl S { } = help: `#[ignore]` can only be applied to functions warning: `#[no_implicit_prelude]` attribute cannot be used on functions - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:418:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:458:5 | LL | #[no_implicit_prelude] fn f() { } | ^^^^^^^^^^^^^^^^^^^^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = help: `#[no_implicit_prelude]` can be applied to modules, crates + = help: `#[no_implicit_prelude]` can be applied to modules and crates warning: `#[no_implicit_prelude]` attribute cannot be used on structs - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:423:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:464:5 | LL | #[no_implicit_prelude] struct S; | ^^^^^^^^^^^^^^^^^^^^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = help: `#[no_implicit_prelude]` can be applied to modules, crates + = help: `#[no_implicit_prelude]` can be applied to modules and crates warning: `#[no_implicit_prelude]` attribute cannot be used on type aliases - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:428:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:470:5 | LL | #[no_implicit_prelude] type T = S; | ^^^^^^^^^^^^^^^^^^^^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = help: `#[no_implicit_prelude]` can be applied to modules, crates + = help: `#[no_implicit_prelude]` can be applied to modules and crates warning: `#[no_implicit_prelude]` attribute cannot be used on inherent impl blocks - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:433:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:476:5 | LL | #[no_implicit_prelude] impl S { } | ^^^^^^^^^^^^^^^^^^^^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = help: `#[no_implicit_prelude]` can be applied to modules, crates + = help: `#[no_implicit_prelude]` can be applied to modules and crates warning: `#[macro_escape]` attribute cannot be used on functions - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:466:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:515:5 | LL | #[macro_escape] fn f() { } | ^^^^^^^^^^^^^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = help: `#[macro_escape]` can be applied to modules, extern crates, crates + = help: `#[macro_escape]` can be applied to modules, extern crates, and crates warning: `#[macro_escape]` attribute cannot be used on structs - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:471:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:521:5 | LL | #[macro_escape] struct S; | ^^^^^^^^^^^^^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = help: `#[macro_escape]` can be applied to modules, extern crates, crates + = help: `#[macro_escape]` can be applied to modules, extern crates, and crates warning: `#[macro_escape]` attribute cannot be used on type aliases - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:476:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:527:5 | LL | #[macro_escape] type T = S; | ^^^^^^^^^^^^^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = help: `#[macro_escape]` can be applied to modules, extern crates, crates + = help: `#[macro_escape]` can be applied to modules, extern crates, and crates warning: `#[macro_escape]` attribute cannot be used on inherent impl blocks - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:481:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:533:5 | LL | #[macro_escape] impl S { } | ^^^^^^^^^^^^^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = help: `#[macro_escape]` can be applied to modules, extern crates, crates + = help: `#[macro_escape]` can be applied to modules, extern crates, and crates warning: `#[cold]` attribute cannot be used on modules - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:523:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:581:1 | LL | #[cold] | ^^^^^^^ @@ -1068,7 +1227,7 @@ LL | #[cold] = help: `#[cold]` can only be applied to functions warning: `#[cold]` attribute cannot be used on modules - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:529:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:588:17 | LL | mod inner { #![cold] } | ^^^^^^^^ @@ -1077,7 +1236,7 @@ LL | mod inner { #![cold] } = help: `#[cold]` can only be applied to functions warning: `#[cold]` attribute cannot be used on structs - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:536:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:596:5 | LL | #[cold] struct S; | ^^^^^^^ @@ -1086,7 +1245,7 @@ LL | #[cold] struct S; = help: `#[cold]` can only be applied to functions warning: `#[cold]` attribute cannot be used on type aliases - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:541:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:602:5 | LL | #[cold] type T = S; | ^^^^^^^ @@ -1095,7 +1254,7 @@ LL | #[cold] type T = S; = help: `#[cold]` can only be applied to functions warning: `#[cold]` attribute cannot be used on inherent impl blocks - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:546:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:608:5 | LL | #[cold] impl S { } | ^^^^^^^ @@ -1104,112 +1263,218 @@ LL | #[cold] impl S { } = help: `#[cold]` can only be applied to functions warning: `#[link_name]` attribute cannot be used on modules - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:552:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:615:1 | LL | #[link_name = "1900"] | ^^^^^^^^^^^^^^^^^^^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = help: `#[link_name]` can be applied to foreign functions, foreign statics + = help: `#[link_name]` can be applied to foreign functions and foreign statics warning: `#[link_name]` attribute cannot be used on foreign modules - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:557:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:621:5 | LL | #[link_name = "1900"] | ^^^^^^^^^^^^^^^^^^^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = help: `#[link_name]` can be applied to foreign functions, foreign statics + = help: `#[link_name]` can be applied to foreign functions and foreign statics warning: `#[link_name]` attribute cannot be used on modules - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:563:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:628:17 | LL | mod inner { #![link_name="1900"] } | ^^^^^^^^^^^^^^^^^^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = help: `#[link_name]` can be applied to foreign functions, foreign statics + = help: `#[link_name]` can be applied to foreign functions and foreign statics warning: `#[link_name]` attribute cannot be used on functions - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:568:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:634:5 | LL | #[link_name = "1900"] fn f() { } | ^^^^^^^^^^^^^^^^^^^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = help: `#[link_name]` can be applied to foreign functions, foreign statics + = help: `#[link_name]` can be applied to foreign functions and foreign statics warning: `#[link_name]` attribute cannot be used on structs - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:573:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:640:5 | LL | #[link_name = "1900"] struct S; | ^^^^^^^^^^^^^^^^^^^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = help: `#[link_name]` can be applied to foreign functions, foreign statics + = help: `#[link_name]` can be applied to foreign functions and foreign statics warning: `#[link_name]` attribute cannot be used on type aliases - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:578:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:646:5 | LL | #[link_name = "1900"] type T = S; | ^^^^^^^^^^^^^^^^^^^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = help: `#[link_name]` can be applied to foreign functions, foreign statics + = help: `#[link_name]` can be applied to foreign functions and foreign statics warning: `#[link_name]` attribute cannot be used on inherent impl blocks - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:583:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:652:5 | LL | #[link_name = "1900"] impl S { } | ^^^^^^^^^^^^^^^^^^^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = help: `#[link_name]` can be applied to foreign functions, foreign statics + = help: `#[link_name]` can be applied to foreign functions and foreign statics warning: `#[link_section]` attribute cannot be used on modules - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:589:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:659:1 | LL | #[link_section = "1800"] | ^^^^^^^^^^^^^^^^^^^^^^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = help: `#[link_section]` can be applied to statics, functions + = help: `#[link_section]` can be applied to statics and functions warning: `#[link_section]` attribute cannot be used on modules - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:594:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:665:17 | LL | mod inner { #![link_section="1800"] } | ^^^^^^^^^^^^^^^^^^^^^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = help: `#[link_section]` can be applied to statics, functions + = help: `#[link_section]` can be applied to statics and functions warning: `#[link_section]` attribute cannot be used on structs - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:601:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:673:5 | LL | #[link_section = "1800"] struct S; | ^^^^^^^^^^^^^^^^^^^^^^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = help: `#[link_section]` can be applied to statics, functions + = help: `#[link_section]` can be applied to statics and functions warning: `#[link_section]` attribute cannot be used on type aliases - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:606:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:679:5 | LL | #[link_section = "1800"] type T = S; | ^^^^^^^^^^^^^^^^^^^^^^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = help: `#[link_section]` can be applied to statics, functions + = help: `#[link_section]` can be applied to statics and functions warning: `#[link_section]` attribute cannot be used on inherent impl blocks - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:611:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:685:5 | LL | #[link_section = "1800"] impl S { } | ^^^^^^^^^^^^^^^^^^^^^^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = help: `#[link_section]` can be applied to statics, functions + = help: `#[link_section]` can be applied to statics and functions + +warning: `#[must_use]` attribute cannot be used on modules + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:746:1 + | +LL | #[must_use] + | ^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = help: `#[must_use]` can be applied to functions, data types, unions, and traits + +warning: `#[must_use]` attribute cannot be used on modules + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:751:17 + | +LL | mod inner { #![must_use] } + | ^^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = help: `#[must_use]` can be applied to functions, data types, unions, and traits + +warning: `#[must_use]` attribute cannot be used on type aliases + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:760:5 + | +LL | #[must_use] type T = S; + | ^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = help: `#[must_use]` can be applied to functions, data types, unions, and traits + +warning: `#[must_use]` attribute cannot be used on inherent impl blocks + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:765:5 + | +LL | #[must_use] impl S { } + | ^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = help: `#[must_use]` can be applied to functions, data types, unions, and traits + +warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![crate_name]` + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:797:1 + | +LL | #[crate_name = "0900"] + | ^^^^^^^^^^^^^^^^^^^^^^ + | +note: This attribute does not have an `!`, which means it is applied to this module + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:799:1 + | +LL | / mod crate_name { +LL | | +LL | | mod inner { #![crate_name="0900"] } +... | +LL | | } + | |_^ + +warning: the `#![crate_name]` attribute can only be used at the crate root + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:801:17 + | +LL | mod inner { #![crate_name="0900"] } + | ^^^^^^^^^^^^^^^^^^^^^ + +warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![crate_name]` + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:804:5 + | +LL | #[crate_name = "0900"] fn f() { } + | ^^^^^^^^^^^^^^^^^^^^^^ + | +note: This attribute does not have an `!`, which means it is applied to this function + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:804:28 + | +LL | #[crate_name = "0900"] fn f() { } + | ^^^^^^^^^^ + +warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![crate_name]` + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:808:5 + | +LL | #[crate_name = "0900"] struct S; + | ^^^^^^^^^^^^^^^^^^^^^^ + | +note: This attribute does not have an `!`, which means it is applied to this struct + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:808:28 + | +LL | #[crate_name = "0900"] struct S; + | ^^^^^^^^^ + +warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![crate_name]` + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:812:5 + | +LL | #[crate_name = "0900"] type T = S; + | ^^^^^^^^^^^^^^^^^^^^^^ + | +note: This attribute does not have an `!`, which means it is applied to this type alias + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:812:28 + | +LL | #[crate_name = "0900"] type T = S; + | ^^^^^^^^^^^ + +warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![crate_name]` + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:816:5 + | +LL | #[crate_name = "0900"] impl S { } + | ^^^^^^^^^^^^^^^^^^^^^^ + | +note: This attribute does not have an `!`, which means it is applied to this implementation block + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:816:28 + | +LL | #[crate_name = "0900"] impl S { } + | ^^^^^^^^^^ warning: `#[should_panic]` attribute cannot be used on crates --> $DIR/issue-43106-gating-of-builtin-attrs.rs:50:1 @@ -1221,7 +1486,7 @@ LL | #![should_panic] = help: `#[should_panic]` can only be applied to functions warning: `#[ignore]` attribute cannot be used on crates - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:53:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:54:1 | LL | #![ignore] | ^^^^^^^^^^ @@ -1230,7 +1495,7 @@ LL | #![ignore] = help: `#[ignore]` can only be applied to functions warning: `#[proc_macro_derive]` attribute cannot be used on crates - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:61:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:63:1 | LL | #![proc_macro_derive(Test)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -1239,7 +1504,7 @@ LL | #![proc_macro_derive(Test)] = help: `#[proc_macro_derive]` can only be applied to functions warning: `#[cold]` attribute cannot be used on crates - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:65:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:68:1 | LL | #![cold] | ^^^^^^^^ @@ -1248,22 +1513,31 @@ LL | #![cold] = help: `#[cold]` can only be applied to functions warning: `#[link_name]` attribute cannot be used on crates - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:70:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:74:1 | LL | #![link_name = "1900"] | ^^^^^^^^^^^^^^^^^^^^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = help: `#[link_name]` can be applied to foreign functions, foreign statics + = help: `#[link_name]` can be applied to foreign functions and foreign statics warning: `#[link_section]` attribute cannot be used on crates - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:74:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:79:1 | LL | #![link_section = "1800"] | ^^^^^^^^^^^^^^^^^^^^^^^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = help: `#[link_section]` can be applied to statics, functions + = help: `#[link_section]` can be applied to statics and functions + +warning: `#[must_use]` attribute cannot be used on crates + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:84:1 + | +LL | #![must_use] + | ^^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = help: `#[must_use]` can be applied to functions, data types, unions, and traits warning: 173 warnings emitted diff --git a/tests/ui/fmt/non-source-literals.stderr b/tests/ui/fmt/non-source-literals.stderr index 5f8a6200dab..5f042e1e631 100644 --- a/tests/ui/fmt/non-source-literals.stderr +++ b/tests/ui/fmt/non-source-literals.stderr @@ -4,7 +4,11 @@ error[E0277]: `NonDisplay` doesn't implement `std::fmt::Display` LL | let _ = format!(concat!("{", "}"), NonDisplay); | ^^^^^^^^^^ `NonDisplay` cannot be formatted with the default formatter | - = help: the trait `std::fmt::Display` is not implemented for `NonDisplay` +help: the trait `std::fmt::Display` is not implemented for `NonDisplay` + --> $DIR/non-source-literals.rs:5:1 + | +LL | pub struct NonDisplay; + | ^^^^^^^^^^^^^^^^^^^^^ = note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead = note: this error originates in the macro `$crate::__export::format_args` which comes from the expansion of the macro `format` (in Nightly builds, run with -Z macro-backtrace for more info) @@ -14,7 +18,11 @@ error[E0277]: `NonDisplay` doesn't implement `std::fmt::Display` LL | let _ = format!(concat!("{", "0", "}"), NonDisplay); | ^^^^^^^^^^ `NonDisplay` cannot be formatted with the default formatter | - = help: the trait `std::fmt::Display` is not implemented for `NonDisplay` +help: the trait `std::fmt::Display` is not implemented for `NonDisplay` + --> $DIR/non-source-literals.rs:5:1 + | +LL | pub struct NonDisplay; + | ^^^^^^^^^^^^^^^^^^^^^ = note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead = note: this error originates in the macro `$crate::__export::format_args` which comes from the expansion of the macro `format` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/tests/ui/fn/error-recovery-mismatch.stderr b/tests/ui/fn/error-recovery-mismatch.stderr index 10dab3052be..b4293500b3b 100644 --- a/tests/ui/fn/error-recovery-mismatch.stderr +++ b/tests/ui/fn/error-recovery-mismatch.stderr @@ -27,7 +27,7 @@ LL | fn fold<T>(&self, _: T, &self._) {} | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! = note: for more information, see issue #41686 <https://github.com/rust-lang/rust/issues/41686> - = note: `#[warn(anonymous_parameters)]` on by default + = note: `#[warn(anonymous_parameters)]` (part of `#[warn(rust_2018_compatibility)]`) on by default error[E0121]: the placeholder `_` is not allowed within types on item signatures for methods --> $DIR/error-recovery-mismatch.rs:11:35 diff --git a/tests/ui/fn/issue-39259.stderr b/tests/ui/fn/issue-39259.stderr index 90e305ca17a..fc5c8282503 100644 --- a/tests/ui/fn/issue-39259.stderr +++ b/tests/ui/fn/issue-39259.stderr @@ -24,7 +24,11 @@ error[E0277]: expected a `FnMut(u32)` closure, found `S` LL | impl Fn(u32) -> u32 for S { | ^ expected an `FnMut(u32)` closure, found `S` | - = help: the trait `FnMut(u32)` is not implemented for `S` +help: the trait `FnMut(u32)` is not implemented for `S` + --> $DIR/issue-39259.rs:4:1 + | +LL | struct S; + | ^^^^^^^^ note: required by a bound in `Fn` --> $SRC_DIR/core/src/ops/function.rs:LL:COL diff --git a/tests/ui/for/for-loop-bogosity.stderr b/tests/ui/for/for-loop-bogosity.stderr index 194a2fa08ce..f4d99671f8e 100644 --- a/tests/ui/for/for-loop-bogosity.stderr +++ b/tests/ui/for/for-loop-bogosity.stderr @@ -4,7 +4,11 @@ error[E0277]: `MyStruct` is not an iterator LL | for x in bogus { | ^^^^^ `MyStruct` is not an iterator | - = help: the trait `Iterator` is not implemented for `MyStruct` +help: the trait `Iterator` is not implemented for `MyStruct` + --> $DIR/for-loop-bogosity.rs:1:1 + | +LL | struct MyStruct { + | ^^^^^^^^^^^^^^^ = note: required for `MyStruct` to implement `IntoIterator` error: aborting due to 1 previous error diff --git a/tests/ui/frontmatter/auxiliary/makro.rs b/tests/ui/frontmatter/auxiliary/makro.rs index 78e7417afb5..70707b27bff 100644 --- a/tests/ui/frontmatter/auxiliary/makro.rs +++ b/tests/ui/frontmatter/auxiliary/makro.rs @@ -3,6 +3,6 @@ use proc_macro::TokenStream; #[proc_macro] pub fn check(_: TokenStream) -> TokenStream { - assert!("---\n---".parse::<TokenStream>().unwrap().is_empty()); + assert_eq!(6, "---\n---".parse::<TokenStream>().unwrap().into_iter().count()); Default::default() } diff --git a/tests/ui/frontmatter/hyphen-in-infostring-leading.rs b/tests/ui/frontmatter/hyphen-in-infostring-leading.rs new file mode 100644 index 00000000000..8652fd76ad5 --- /dev/null +++ b/tests/ui/frontmatter/hyphen-in-infostring-leading.rs @@ -0,0 +1,9 @@ +--- -toml +//~^ ERROR: invalid infostring for frontmatter +--- + +// infostrings cannot have leading hyphens + +#![feature(frontmatter)] + +fn main() {} diff --git a/tests/ui/frontmatter/hyphen-in-infostring-leading.stderr b/tests/ui/frontmatter/hyphen-in-infostring-leading.stderr new file mode 100644 index 00000000000..167b537d62b --- /dev/null +++ b/tests/ui/frontmatter/hyphen-in-infostring-leading.stderr @@ -0,0 +1,10 @@ +error: invalid infostring for frontmatter + --> $DIR/hyphen-in-infostring-leading.rs:1:4 + | +LL | --- -toml + | ^^^^^^ + | + = note: frontmatter infostrings must be a single identifier immediately following the opening + +error: aborting due to 1 previous error + diff --git a/tests/ui/frontmatter/hyphen-in-infostring-non-leading.rs b/tests/ui/frontmatter/hyphen-in-infostring-non-leading.rs new file mode 100644 index 00000000000..35e7b96ff87 --- /dev/null +++ b/tests/ui/frontmatter/hyphen-in-infostring-non-leading.rs @@ -0,0 +1,9 @@ +--- Cargo-toml +--- + +// infostrings can contain hyphens as long as a hyphen isn't the first character. +//@ check-pass + +#![feature(frontmatter)] + +fn main() {} diff --git a/tests/ui/frontmatter/proc-macro-observer.rs b/tests/ui/frontmatter/proc-macro-observer.rs index bafbe912032..b1cc1460933 100644 --- a/tests/ui/frontmatter/proc-macro-observer.rs +++ b/tests/ui/frontmatter/proc-macro-observer.rs @@ -2,11 +2,10 @@ //@ proc-macro: makro.rs //@ edition: 2021 -#![feature(frontmatter)] - makro::check!(); -// checks that a proc-macro cannot observe frontmatter tokens. +// checks that a proc-macro doesn't know or parse frontmatters at all and instead treats +// it as normal Rust code. // see auxiliary/makro.rs for how it is tested. fn main() {} diff --git a/tests/ui/issues/issue-54696.rs b/tests/ui/function-pointer/function-pointer-comparison-54696.rs index 63ffbe42bcc..2e28dfeaaf8 100644 --- a/tests/ui/issues/issue-54696.rs +++ b/tests/ui/function-pointer/function-pointer-comparison-54696.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/54696 //@ run-pass #![allow(unpredictable_function_pointer_comparisons)] diff --git a/tests/ui/generic-associated-types/ambig-hr-projection-issue-93340.next.stderr b/tests/ui/generic-associated-types/ambig-hr-projection-issue-93340.next.stderr index d624fb1e42b..d6294efbd28 100644 --- a/tests/ui/generic-associated-types/ambig-hr-projection-issue-93340.next.stderr +++ b/tests/ui/generic-associated-types/ambig-hr-projection-issue-93340.next.stderr @@ -1,30 +1,14 @@ -error[E0283]: type annotations needed - --> $DIR/ambig-hr-projection-issue-93340.rs:17:5 +error[E0282]: type annotations needed + --> $DIR/ambig-hr-projection-issue-93340.rs:16:5 | LL | cmp_eq | ^^^^^^ cannot infer type of the type parameter `A` declared on the function `cmp_eq` | - = note: cannot satisfy `_: Scalar` -note: required by a bound in `cmp_eq` - --> $DIR/ambig-hr-projection-issue-93340.rs:10:22 - | -LL | fn cmp_eq<'a, 'b, A: Scalar, B: Scalar, O: Scalar>(a: A::RefType<'a>, b: B::RefType<'b>) -> O { - | ^^^^^^ required by this bound in `cmp_eq` help: consider specifying the generic arguments | LL | cmp_eq::<A, B, O> | +++++++++++ -error[E0277]: expected a `Fn(<A as Scalar>::RefType<'_>, <B as Scalar>::RefType<'_>)` closure, found `for<'a, 'b> fn(<O as Scalar>::RefType<'a>, <_ as Scalar>::RefType<'b>) -> O {cmp_eq::<O, _, O>}` - --> $DIR/ambig-hr-projection-issue-93340.rs:14:1 - | -LL | / fn build_expression<A: Scalar, B: Scalar, O: Scalar>( -LL | | ) -> impl Fn(A::RefType<'_>, B::RefType<'_>) -> O { - | |_________________________________________________^ expected an `Fn(<A as Scalar>::RefType<'_>, <B as Scalar>::RefType<'_>)` closure, found `for<'a, 'b> fn(<O as Scalar>::RefType<'a>, <_ as Scalar>::RefType<'b>) -> O {cmp_eq::<O, _, O>}` - | - = help: the trait `for<'a, 'b> Fn(<A as Scalar>::RefType<'a>, <B as Scalar>::RefType<'b>)` is not implemented for fn item `for<'a, 'b> fn(<O as Scalar>::RefType<'a>, <_ as Scalar>::RefType<'b>) -> O {cmp_eq::<O, _, O>}` - -error: aborting due to 2 previous errors +error: aborting due to 1 previous error -Some errors have detailed explanations: E0277, E0283. -For more information about an error, try `rustc --explain E0277`. +For more information about this error, try `rustc --explain E0282`. diff --git a/tests/ui/generic-associated-types/ambig-hr-projection-issue-93340.old.stderr b/tests/ui/generic-associated-types/ambig-hr-projection-issue-93340.old.stderr index 4a293d44e0e..d913b2e91ca 100644 --- a/tests/ui/generic-associated-types/ambig-hr-projection-issue-93340.old.stderr +++ b/tests/ui/generic-associated-types/ambig-hr-projection-issue-93340.old.stderr @@ -1,5 +1,5 @@ error[E0283]: type annotations needed - --> $DIR/ambig-hr-projection-issue-93340.rs:17:5 + --> $DIR/ambig-hr-projection-issue-93340.rs:16:5 | LL | cmp_eq | ^^^^^^ cannot infer type of the type parameter `A` declared on the function `cmp_eq` diff --git a/tests/ui/generic-associated-types/ambig-hr-projection-issue-93340.rs b/tests/ui/generic-associated-types/ambig-hr-projection-issue-93340.rs index 6ba3c4c65d0..acfebad38db 100644 --- a/tests/ui/generic-associated-types/ambig-hr-projection-issue-93340.rs +++ b/tests/ui/generic-associated-types/ambig-hr-projection-issue-93340.rs @@ -13,7 +13,6 @@ fn cmp_eq<'a, 'b, A: Scalar, B: Scalar, O: Scalar>(a: A::RefType<'a>, b: B::RefT fn build_expression<A: Scalar, B: Scalar, O: Scalar>( ) -> impl Fn(A::RefType<'_>, B::RefType<'_>) -> O { - //[next]~^^ ERROR expected a `Fn(<A as Scalar>::RefType<'_>, <B as Scalar>::RefType<'_>)` closure cmp_eq //~^ ERROR type annotations needed } diff --git a/tests/ui/generic-associated-types/bugs/hrtb-implied-1.stderr b/tests/ui/generic-associated-types/bugs/hrtb-implied-1.stderr index 5dfc42bc873..8bb72833e30 100644 --- a/tests/ui/generic-associated-types/bugs/hrtb-implied-1.stderr +++ b/tests/ui/generic-associated-types/bugs/hrtb-implied-1.stderr @@ -9,11 +9,11 @@ LL | print_items::<WindowsMut<'_>>(windows); LL | } | - temporary value is freed at the end of this statement | -note: due to current limitations in the borrow checker, this implies a `'static` lifetime - --> $DIR/hrtb-implied-1.rs:26:26 +note: due to a current limitation of the type system, this implies a `'static` lifetime + --> $DIR/hrtb-implied-1.rs:26:5 | LL | for<'a> I::Item<'a>: Debug, - | ^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 1 previous error diff --git a/tests/ui/generic-associated-types/bugs/hrtb-implied-2.stderr b/tests/ui/generic-associated-types/bugs/hrtb-implied-2.stderr index 9a1a09b29df..1a397f6cdb2 100644 --- a/tests/ui/generic-associated-types/bugs/hrtb-implied-2.stderr +++ b/tests/ui/generic-associated-types/bugs/hrtb-implied-2.stderr @@ -15,7 +15,11 @@ LL | let _next = iter2.next(); = note: requirement occurs because of a mutable reference to `Eat<&mut I, F>` = note: mutable references are invariant over their type parameter = help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance - = note: due to current limitations in the borrow checker, this implies a `'static` lifetime +note: due to a current limitation of the type system, this implies a `'static` lifetime + --> $DIR/hrtb-implied-2.rs:31:8 + | +LL | F: FnMut(I::Item<'_>), + | ^^^^^^^^^^^^^^^^^^ error: aborting due to 1 previous error diff --git a/tests/ui/generic-associated-types/bugs/hrtb-implied-3.stderr b/tests/ui/generic-associated-types/bugs/hrtb-implied-3.stderr index 77f363ee87d..aaafcb3b7af 100644 --- a/tests/ui/generic-associated-types/bugs/hrtb-implied-3.stderr +++ b/tests/ui/generic-associated-types/bugs/hrtb-implied-3.stderr @@ -11,11 +11,11 @@ LL | trivial_bound(iter); | `iter` escapes the function body here | argument requires that `'1` must outlive `'static` | -note: due to current limitations in the borrow checker, this implies a `'static` lifetime - --> $DIR/hrtb-implied-3.rs:14:26 +note: due to a current limitation of the type system, this implies a `'static` lifetime + --> $DIR/hrtb-implied-3.rs:14:5 | LL | for<'a> I::Item<'a>: Sized, - | ^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 1 previous error diff --git a/tests/ui/generic-associated-types/collectivity-regression.stderr b/tests/ui/generic-associated-types/collectivity-regression.stderr index 1c081ac644a..31349c8eb27 100644 --- a/tests/ui/generic-associated-types/collectivity-regression.stderr +++ b/tests/ui/generic-associated-types/collectivity-regression.stderr @@ -7,7 +7,7 @@ LL | | let _x = x; LL | | }; | |_____^ | -note: due to current limitations in the borrow checker, this implies a `'static` lifetime +note: due to a current limitation of the type system, this implies a `'static` lifetime --> $DIR/collectivity-regression.rs:11:16 | LL | for<'a> T: Get<Value<'a> = ()>, diff --git a/tests/ui/generic-associated-types/extended/lending_iterator.stderr b/tests/ui/generic-associated-types/extended/lending_iterator.stderr index 84f5ed07bda..7af95dc96a1 100644 --- a/tests/ui/generic-associated-types/extended/lending_iterator.stderr +++ b/tests/ui/generic-associated-types/extended/lending_iterator.stderr @@ -12,6 +12,12 @@ error: `Self` does not live long enough | LL | <B as FromLendingIterator<A>>::from_iter(self) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +note: due to a current limitation of the type system, this implies a `'static` lifetime + --> $DIR/lending_iterator.rs:4:21 + | +LL | fn from_iter<T: for<'x> LendingIterator<Item<'x> = A>>(iter: T) -> Self; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 2 previous errors diff --git a/tests/ui/issues/issue-86756.rs b/tests/ui/generics/duplicate-generic-parameter-error-86756.rs index 55a6c144839..acc281cb8c4 100644 --- a/tests/ui/issues/issue-86756.rs +++ b/tests/ui/generics/duplicate-generic-parameter-error-86756.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/86756 //@ edition: 2015 trait Foo<T, T = T> {} //~^ ERROR the name `T` is already used for a generic parameter in this item's generic parameters diff --git a/tests/ui/issues/issue-86756.stderr b/tests/ui/generics/duplicate-generic-parameter-error-86756.stderr index b650b32c2a3..e761d15ff67 100644 --- a/tests/ui/issues/issue-86756.stderr +++ b/tests/ui/generics/duplicate-generic-parameter-error-86756.stderr @@ -1,5 +1,5 @@ error[E0403]: the name `T` is already used for a generic parameter in this item's generic parameters - --> $DIR/issue-86756.rs:2:14 + --> $DIR/duplicate-generic-parameter-error-86756.rs:3:14 | LL | trait Foo<T, T = T> {} | - ^ already used @@ -7,33 +7,33 @@ LL | trait Foo<T, T = T> {} | first use of `T` error[E0412]: cannot find type `dyn` in this scope - --> $DIR/issue-86756.rs:6:10 + --> $DIR/duplicate-generic-parameter-error-86756.rs:7:10 | LL | eq::<dyn, Foo> | ^^^ not found in this scope warning: trait objects without an explicit `dyn` are deprecated - --> $DIR/issue-86756.rs:6:15 + --> $DIR/duplicate-generic-parameter-error-86756.rs:7:15 | LL | eq::<dyn, Foo> | ^^^ | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! = note: for more information, see <https://doc.rust-lang.org/edition-guide/rust-2021/warnings-promoted-to-error.html> - = note: `#[warn(bare_trait_objects)]` on by default + = note: `#[warn(bare_trait_objects)]` (part of `#[warn(rust_2021_compatibility)]`) on by default help: if this is a dyn-compatible trait, use `dyn` | LL | eq::<dyn, dyn Foo> | +++ error[E0107]: missing generics for trait `Foo` - --> $DIR/issue-86756.rs:6:15 + --> $DIR/duplicate-generic-parameter-error-86756.rs:7:15 | LL | eq::<dyn, Foo> | ^^^ expected at least 1 generic argument | note: trait defined here, with at least 1 generic parameter: `T` - --> $DIR/issue-86756.rs:2:7 + --> $DIR/duplicate-generic-parameter-error-86756.rs:3:7 | LL | trait Foo<T, T = T> {} | ^^^ - diff --git a/tests/ui/generics/empty-generic-brackets-equiv.stderr b/tests/ui/generics/empty-generic-brackets-equiv.stderr index 151ee4697b4..aef4aa7cbf1 100644 --- a/tests/ui/generics/empty-generic-brackets-equiv.stderr +++ b/tests/ui/generics/empty-generic-brackets-equiv.stderr @@ -4,7 +4,7 @@ warning: trait `T` is never used LL | trait T<> {} | ^ | - = note: `#[warn(dead_code)]` on by default + = note: `#[warn(dead_code)]` (part of `#[warn(unused)]`) on by default warning: 1 warning emitted diff --git a/tests/ui/issues/issue-5997-outer-generic-parameter/issue-5997-enum.rs b/tests/ui/generics/enum-definition-with-outer-generic-parameter-5997.rs index 0b1857ae3df..00bf66dd4e0 100644 --- a/tests/ui/issues/issue-5997-outer-generic-parameter/issue-5997-enum.rs +++ b/tests/ui/generics/enum-definition-with-outer-generic-parameter-5997.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/5997 fn f<Z>() -> bool { enum E { V(Z) } //~^ ERROR can't use generic parameters from outer item diff --git a/tests/ui/issues/issue-5997-outer-generic-parameter/issue-5997-enum.stderr b/tests/ui/generics/enum-definition-with-outer-generic-parameter-5997.stderr index c0b3cd6de66..aea0f049b07 100644 --- a/tests/ui/issues/issue-5997-outer-generic-parameter/issue-5997-enum.stderr +++ b/tests/ui/generics/enum-definition-with-outer-generic-parameter-5997.stderr @@ -1,5 +1,5 @@ error[E0401]: can't use generic parameters from outer item - --> $DIR/issue-5997-enum.rs:2:16 + --> $DIR/enum-definition-with-outer-generic-parameter-5997.rs:3:16 | LL | fn f<Z>() -> bool { | - type parameter from outer item diff --git a/tests/ui/generics/invalid-type-param-default.stderr b/tests/ui/generics/invalid-type-param-default.stderr index 1c8fdd8ab5c..3bec7542ad0 100644 --- a/tests/ui/generics/invalid-type-param-default.stderr +++ b/tests/ui/generics/invalid-type-param-default.stderr @@ -12,7 +12,7 @@ LL | fn avg<T = i32>(_: T) {} | = 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 #36887 <https://github.com/rust-lang/rust/issues/36887> - = note: `#[deny(invalid_type_param_default)]` on by default + = note: `#[deny(invalid_type_param_default)]` (part of `#[deny(future_incompatible)]`) on by default error: defaults for generic parameters are not allowed here --> $DIR/invalid-type-param-default.rs:12:8 @@ -44,7 +44,7 @@ LL | fn avg<T = i32>(_: T) {} | = 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 #36887 <https://github.com/rust-lang/rust/issues/36887> - = note: `#[deny(invalid_type_param_default)]` on by default + = note: `#[deny(invalid_type_param_default)]` (part of `#[deny(future_incompatible)]`) on by default Future breakage diagnostic: error: defaults for generic parameters are not allowed here @@ -55,7 +55,7 @@ LL | fn mdn<T = T::Item>(_: T) {} | = 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 #36887 <https://github.com/rust-lang/rust/issues/36887> - = note: `#[deny(invalid_type_param_default)]` on by default + = note: `#[deny(invalid_type_param_default)]` (part of `#[deny(future_incompatible)]`) on by default Future breakage diagnostic: error: defaults for generic parameters are not allowed here @@ -66,5 +66,5 @@ LL | impl<T = i32> S<T> {} | = 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 #36887 <https://github.com/rust-lang/rust/issues/36887> - = note: `#[deny(invalid_type_param_default)]` on by default + = note: `#[deny(invalid_type_param_default)]` (part of `#[deny(future_incompatible)]`) on by default diff --git a/tests/ui/generics/overlapping-errors-span-issue-123861.stderr b/tests/ui/generics/overlapping-errors-span-issue-123861.stderr index 44e8b4a01e7..f9dfb00723e 100644 --- a/tests/ui/generics/overlapping-errors-span-issue-123861.stderr +++ b/tests/ui/generics/overlapping-errors-span-issue-123861.stderr @@ -23,7 +23,7 @@ LL | fn mainIterator<_ = _> {} | = 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 #36887 <https://github.com/rust-lang/rust/issues/36887> - = note: `#[deny(invalid_type_param_default)]` on by default + = note: `#[deny(invalid_type_param_default)]` (part of `#[deny(future_incompatible)]`) on by default error[E0121]: the placeholder `_` is not allowed within types on item signatures for functions --> $DIR/overlapping-errors-span-issue-123861.rs:1:21 @@ -43,5 +43,5 @@ LL | fn mainIterator<_ = _> {} | = 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 #36887 <https://github.com/rust-lang/rust/issues/36887> - = note: `#[deny(invalid_type_param_default)]` on by default + = note: `#[deny(invalid_type_param_default)]` (part of `#[deny(future_incompatible)]`) on by default diff --git a/tests/ui/higher-ranked/higher-ranked-lifetime-error.stderr b/tests/ui/higher-ranked/higher-ranked-lifetime-error.stderr index d7add865aa0..2e3fd612334 100644 --- a/tests/ui/higher-ranked/higher-ranked-lifetime-error.stderr +++ b/tests/ui/higher-ranked/higher-ranked-lifetime-error.stderr @@ -2,7 +2,7 @@ error: implementation of `FnMut` is not general enough --> $DIR/higher-ranked-lifetime-error.rs:12:5 | LL | assert_all::<_, &String>(id); - | ^^^^^^^^^^^^^^^^^^^^^^^^ implementation of `FnMut` is not general enough + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ implementation of `FnMut` is not general enough | = note: `for<'a> fn(&'a String) -> &'a String {id}` must implement `FnMut<(&String,)>` = note: ...but it actually implements `FnMut<(&'0 String,)>`, for some specific lifetime `'0` diff --git a/tests/ui/higher-ranked/trait-bounds/due-to-where-clause.stderr b/tests/ui/higher-ranked/trait-bounds/due-to-where-clause.stderr index 916854e07af..6c17b1f4874 100644 --- a/tests/ui/higher-ranked/trait-bounds/due-to-where-clause.stderr +++ b/tests/ui/higher-ranked/trait-bounds/due-to-where-clause.stderr @@ -2,7 +2,7 @@ error: implementation of `Foo` is not general enough --> $DIR/due-to-where-clause.rs:2:5 | LL | test::<FooS>(&mut 42); - | ^^^^^^^^^^^^ implementation of `Foo` is not general enough + | ^^^^^^^^^^^^^^^^^^^^^ implementation of `Foo` is not general enough | = note: `FooS<'_>` must implement `Foo<'0>`, for any lifetime `'0`... = note: ...but `FooS<'_>` actually implements `Foo<'1>`, for some specific lifetime `'1` 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 1c077a9b906..697e85dc8c3 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 @@ -15,7 +15,7 @@ LL | fn give_some<'a>() { LL | want_hrtb::<&'a u32>() | ^^^^^^^^^^^^^^^^^^^^ requires that `'a` must outlive `'static` | -note: due to current limitations in the borrow checker, this implies a `'static` lifetime +note: due to a current limitation of the type system, this implies a `'static` lifetime --> $DIR/hrtb-just-for-static.rs:9:15 | LL | where T : for<'a> Foo<&'a isize> diff --git a/tests/ui/higher-ranked/trait-bounds/hrtb-perfect-forwarding.stderr b/tests/ui/higher-ranked/trait-bounds/hrtb-perfect-forwarding.stderr index 727b9e6bec8..327c0faa482 100644 --- a/tests/ui/higher-ranked/trait-bounds/hrtb-perfect-forwarding.stderr +++ b/tests/ui/higher-ranked/trait-bounds/hrtb-perfect-forwarding.stderr @@ -47,7 +47,7 @@ LL | fn foo_hrtb_bar_not<'b, T>(mut t: T) LL | foo_hrtb_bar_not(&mut t); | ^^^^^^^^^^^^^^^^^^^^^^^^ requires that `'b` must outlive `'static` | -note: due to current limitations in the borrow checker, this implies a `'static` lifetime +note: due to a current limitation of the type system, this implies a `'static` lifetime --> $DIR/hrtb-perfect-forwarding.rs:37:8 | LL | T: for<'a> Foo<&'a isize> + Bar<&'b isize>, diff --git a/tests/ui/impl-trait/auto-trait-selection-freeze.next.stderr b/tests/ui/impl-trait/auto-trait-selection-freeze.next.stderr index 5caf0eb2fd4..7170efc8638 100644 --- a/tests/ui/impl-trait/auto-trait-selection-freeze.next.stderr +++ b/tests/ui/impl-trait/auto-trait-selection-freeze.next.stderr @@ -1,17 +1,9 @@ -error[E0283]: type annotations needed +error[E0282]: type annotations needed --> $DIR/auto-trait-selection-freeze.rs:19:16 | LL | if false { is_trait(foo()) } else { Default::default() } - | ^^^^^^^^ ----- type must be known at this point - | | - | cannot infer type of the type parameter `T` declared on the function `is_trait` + | ^^^^^^^^ cannot infer type of the type parameter `T` declared on the function `is_trait` | - = note: cannot satisfy `_: Trait<_>` -note: required by a bound in `is_trait` - --> $DIR/auto-trait-selection-freeze.rs:11:16 - | -LL | fn is_trait<T: Trait<U>, U: Default>(_: T) -> U { - | ^^^^^^^^ required by this bound in `is_trait` help: consider specifying the generic arguments | LL | if false { is_trait::<T, U>(foo()) } else { Default::default() } @@ -19,4 +11,4 @@ LL | if false { is_trait::<T, U>(foo()) } else { Default::default() } error: aborting due to 1 previous error -For more information about this error, try `rustc --explain E0283`. +For more information about this error, try `rustc --explain E0282`. diff --git a/tests/ui/impl-trait/auto-trait-selection.next.stderr b/tests/ui/impl-trait/auto-trait-selection.next.stderr index d34fdcc4496..0f33aca3019 100644 --- a/tests/ui/impl-trait/auto-trait-selection.next.stderr +++ b/tests/ui/impl-trait/auto-trait-selection.next.stderr @@ -1,17 +1,9 @@ -error[E0283]: type annotations needed +error[E0282]: type annotations needed --> $DIR/auto-trait-selection.rs:15:16 | LL | if false { is_trait(foo()) } else { Default::default() } - | ^^^^^^^^ ----- type must be known at this point - | | - | cannot infer type of the type parameter `T` declared on the function `is_trait` + | ^^^^^^^^ cannot infer type of the type parameter `T` declared on the function `is_trait` | - = note: cannot satisfy `_: Trait<_>` -note: required by a bound in `is_trait` - --> $DIR/auto-trait-selection.rs:7:16 - | -LL | fn is_trait<T: Trait<U>, U: Default>(_: T) -> U { - | ^^^^^^^^ required by this bound in `is_trait` help: consider specifying the generic arguments | LL | if false { is_trait::<T, U>(foo()) } else { Default::default() } @@ -19,4 +11,4 @@ LL | if false { is_trait::<T, U>(foo()) } else { Default::default() } error: aborting due to 1 previous error -For more information about this error, try `rustc --explain E0283`. +For more information about this error, try `rustc --explain E0282`. diff --git a/tests/ui/impl-trait/call_method_without_import.no_import.stderr b/tests/ui/impl-trait/call_method_without_import.no_import.stderr index dbac74b2247..2ca79aa7c10 100644 --- a/tests/ui/impl-trait/call_method_without_import.no_import.stderr +++ b/tests/ui/impl-trait/call_method_without_import.no_import.stderr @@ -3,6 +3,7 @@ error[E0599]: no method named `fmt` found for opaque type `impl Debug` in the cu | LL | x.fmt(f); | ^^^ method not found in `impl Debug` + | --> $SRC_DIR/core/src/fmt/mod.rs:LL:COL | = note: the method is available for `impl Debug` here diff --git a/tests/ui/impl-trait/diagnostics/highlight-difference-between-expected-trait-and-found-trait.svg b/tests/ui/impl-trait/diagnostics/highlight-difference-between-expected-trait-and-found-trait.svg index 9832e28e008..73acb072ac5 100644 --- a/tests/ui/impl-trait/diagnostics/highlight-difference-between-expected-trait-and-found-trait.svg +++ b/tests/ui/impl-trait/diagnostics/highlight-difference-between-expected-trait-and-found-trait.svg @@ -1,4 +1,4 @@ -<svg width="1028px" height="398px" xmlns="http://www.w3.org/2000/svg"> +<svg width="1188px" height="398px" xmlns="http://www.w3.org/2000/svg"> <style> .fg { fill: #AAAAAA } .bg { background: #000000 } @@ -29,7 +29,7 @@ </tspan> <tspan x="10px" y="82px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> fn foo() -> impl Foo<i32> {</tspan> </tspan> - <tspan x="10px" y="100px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-009 bold">^^^^^^^^^^^^^</tspan><tspan> </tspan><tspan class="fg-ansi256-009 bold">the trait `Bar<i32>` is not implemented for `Struct`</tspan> + <tspan x="10px" y="100px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-009 bold">^^^^^^^^^^^^^</tspan><tspan> </tspan><tspan class="fg-ansi256-009 bold">unsatisfied trait bound</tspan> </tspan> <tspan x="10px" y="118px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> Struct</tspan> </tspan> diff --git a/tests/ui/impl-trait/does-not-live-long-enough.stderr b/tests/ui/impl-trait/does-not-live-long-enough.stderr index cfc13298071..9f3918ce3e0 100644 --- a/tests/ui/impl-trait/does-not-live-long-enough.stderr +++ b/tests/ui/impl-trait/does-not-live-long-enough.stderr @@ -1,12 +1,14 @@ error[E0373]: closure may outlive the current function, but it borrows `prefix`, which is owned by the current function --> $DIR/does-not-live-long-enough.rs:6:33 | +LL | fn started_with<'a>(&'a self, prefix: &'a str) -> impl Iterator<Item=&'a str> { + | -- lifetime `'a` defined here LL | self.data.iter().filter(|s| s.starts_with(prefix)).map(|s| s.as_ref()) | ^^^ ------ `prefix` is borrowed here | | | may outlive borrowed value `prefix` | -note: closure is returned here +note: function requires argument type to outlive `'a` --> $DIR/does-not-live-long-enough.rs:6:9 | LL | self.data.iter().filter(|s| s.starts_with(prefix)).map(|s| s.as_ref()) diff --git a/tests/ui/impl-trait/example-st.stderr b/tests/ui/impl-trait/example-st.stderr index f722d7f6582..eb998bf3bb3 100644 --- a/tests/ui/impl-trait/example-st.stderr +++ b/tests/ui/impl-trait/example-st.stderr @@ -4,7 +4,7 @@ warning: trait `Bind` is never used LL | trait Bind<F> { | ^^^^ | - = note: `#[warn(dead_code)]` on by default + = note: `#[warn(dead_code)]` (part of `#[warn(unused)]`) on by default warning: 1 warning emitted diff --git a/tests/ui/impl-trait/fresh-lifetime-from-bare-trait-obj-114664.stderr b/tests/ui/impl-trait/fresh-lifetime-from-bare-trait-obj-114664.stderr index 46b677202ef..447f236def3 100644 --- a/tests/ui/impl-trait/fresh-lifetime-from-bare-trait-obj-114664.stderr +++ b/tests/ui/impl-trait/fresh-lifetime-from-bare-trait-obj-114664.stderr @@ -6,7 +6,7 @@ LL | fn ice() -> impl AsRef<Fn(&())> { | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! = note: for more information, see <https://doc.rust-lang.org/edition-guide/rust-2021/warnings-promoted-to-error.html> - = note: `#[warn(bare_trait_objects)]` on by default + = note: `#[warn(bare_trait_objects)]` (part of `#[warn(rust_2021_compatibility)]`) on by default help: if this is a dyn-compatible trait, use `dyn` | LL | fn ice() -> impl AsRef<dyn Fn(&())> { diff --git a/tests/ui/impl-trait/impl-generic-mismatch.stderr b/tests/ui/impl-trait/impl-generic-mismatch.stderr index 18347bd0f97..d7fff4c445d 100644 --- a/tests/ui/impl-trait/impl-generic-mismatch.stderr +++ b/tests/ui/impl-trait/impl-generic-mismatch.stderr @@ -48,6 +48,7 @@ error[E0643]: method `hash` has incompatible signature for trait | LL | fn hash(&self, hasher: &mut impl Hasher) {} | ^^^^^^^^^^^ expected generic parameter, found `impl Trait` + | --> $SRC_DIR/core/src/hash/mod.rs:LL:COL | = note: declaration in trait here diff --git a/tests/ui/impl-trait/in-trait/bad-item-bound-within-rpitit.stderr b/tests/ui/impl-trait/in-trait/bad-item-bound-within-rpitit.stderr index d3729b6c973..8bc3c8b647c 100644 --- a/tests/ui/impl-trait/in-trait/bad-item-bound-within-rpitit.stderr +++ b/tests/ui/impl-trait/in-trait/bad-item-bound-within-rpitit.stderr @@ -25,7 +25,7 @@ LL | fn iter(&self) -> impl 'a + Iterator<Item = I::Item<'a>> { | = note: add `#[allow(refining_impl_trait)]` if it is intended for this to be part of the public API of this crate = note: we are soliciting feedback, see issue #121718 <https://github.com/rust-lang/rust/issues/121718> for more information - = note: `#[warn(refining_impl_trait_reachable)]` on by default + = note: `#[warn(refining_impl_trait_reachable)]` (part of `#[warn(refining_impl_trait)]`) on by default help: replace the return type so that it matches the trait | LL - fn iter(&self) -> impl 'a + Iterator<Item = I::Item<'a>> { diff --git a/tests/ui/impl-trait/in-trait/expeced-refree-to-map-to-reearlybound-ice-108580.stderr b/tests/ui/impl-trait/in-trait/expeced-refree-to-map-to-reearlybound-ice-108580.stderr index 7c064cc7176..0a73a363786 100644 --- a/tests/ui/impl-trait/in-trait/expeced-refree-to-map-to-reearlybound-ice-108580.stderr +++ b/tests/ui/impl-trait/in-trait/expeced-refree-to-map-to-reearlybound-ice-108580.stderr @@ -9,7 +9,7 @@ LL | fn bar(&self) -> impl Iterator + '_ { | = note: add `#[allow(refining_impl_trait)]` if it is intended for this to be part of the public API of this crate = note: we are soliciting feedback, see issue #121718 <https://github.com/rust-lang/rust/issues/121718> for more information - = note: `#[warn(refining_impl_trait_internal)]` on by default + = note: `#[warn(refining_impl_trait_internal)]` (part of `#[warn(refining_impl_trait)]`) on by default help: replace the return type so that it matches the trait | LL | fn bar(&self) -> impl Iterator<Item = impl Sized> + '_ { diff --git a/tests/ui/impl-trait/in-trait/refine-captures.stderr b/tests/ui/impl-trait/in-trait/refine-captures.stderr index 6f213f16144..f7ba99c0763 100644 --- a/tests/ui/impl-trait/in-trait/refine-captures.stderr +++ b/tests/ui/impl-trait/in-trait/refine-captures.stderr @@ -6,7 +6,7 @@ LL | fn test() -> impl Sized + use<> {} | = note: add `#[allow(refining_impl_trait)]` if it is intended for this to be part of the public API of this crate = note: we are soliciting feedback, see issue #121718 <https://github.com/rust-lang/rust/issues/121718> for more information - = note: `#[warn(refining_impl_trait_internal)]` on by default + = note: `#[warn(refining_impl_trait_internal)]` (part of `#[warn(refining_impl_trait)]`) on by default help: modify the `use<..>` bound to capture the same lifetimes that the trait does | LL | fn test() -> impl Sized + use<'a> {} diff --git a/tests/ui/impl-trait/in-trait/return-dont-satisfy-bounds.stderr b/tests/ui/impl-trait/in-trait/return-dont-satisfy-bounds.stderr index a16e0160223..374176f041a 100644 --- a/tests/ui/impl-trait/in-trait/return-dont-satisfy-bounds.stderr +++ b/tests/ui/impl-trait/in-trait/return-dont-satisfy-bounds.stderr @@ -24,7 +24,7 @@ error[E0277]: the trait bound `Bar: Foo<u8>` is not satisfied --> $DIR/return-dont-satisfy-bounds.rs:8:34 | LL | fn foo<F2: Foo<u8>>(self) -> impl Foo<u8> { - | ^^^^^^^^^^^^ the trait `Foo<u8>` is not implemented for `Bar` + | ^^^^^^^^^^^^ unsatisfied trait bound ... LL | self | ---- return type was inferred to be `Bar` here diff --git a/tests/ui/impl-trait/in-trait/unconstrained-lt.stderr b/tests/ui/impl-trait/in-trait/unconstrained-lt.stderr index 27340c5b362..3a4d90dfd4e 100644 --- a/tests/ui/impl-trait/in-trait/unconstrained-lt.stderr +++ b/tests/ui/impl-trait/in-trait/unconstrained-lt.stderr @@ -9,7 +9,7 @@ LL | fn test() -> &'a () { | = note: add `#[allow(refining_impl_trait)]` if it is intended for this to be part of the public API of this crate = note: we are soliciting feedback, see issue #121718 <https://github.com/rust-lang/rust/issues/121718> for more information - = note: `#[warn(refining_impl_trait_internal)]` on by default + = note: `#[warn(refining_impl_trait_internal)]` (part of `#[warn(refining_impl_trait)]`) on by default help: replace the return type so that it matches the trait | LL - fn test() -> &'a () { diff --git a/tests/ui/impl-trait/issues/issue-62742.stderr b/tests/ui/impl-trait/issues/issue-62742.stderr index ee4eb98f4ea..7ded3519d85 100644 --- a/tests/ui/impl-trait/issues/issue-62742.stderr +++ b/tests/ui/impl-trait/issues/issue-62742.stderr @@ -2,7 +2,7 @@ error[E0277]: the trait bound `RawImpl<_>: Raw<_>` is not satisfied --> $DIR/issue-62742.rs:4:5 | LL | WrongImpl::foo(0i32); - | ^^^^^^^^^ the trait `Raw<_>` is not implemented for `RawImpl<_>` + | ^^^^^^^^^ unsatisfied trait bound | = help: the trait `Raw<_>` is not implemented for `RawImpl<_>` but trait `Raw<[_]>` is implemented for it @@ -41,7 +41,7 @@ error[E0277]: the trait bound `RawImpl<()>: Raw<()>` is not satisfied --> $DIR/issue-62742.rs:10:5 | LL | WrongImpl::<()>::foo(0i32); - | ^^^^^^^^^^^^^^^ the trait `Raw<()>` is not implemented for `RawImpl<()>` + | ^^^^^^^^^^^^^^^ unsatisfied trait bound | = help: the trait `Raw<()>` is not implemented for `RawImpl<()>` but trait `Raw<[()]>` is implemented for it diff --git a/tests/ui/impl-trait/member-constraints/apply_member_constraint-no-req-eq.rs b/tests/ui/impl-trait/member-constraints/apply_member_constraint-no-req-eq.rs index 3aa52fe2644..e9af42b30e9 100644 --- a/tests/ui/impl-trait/member-constraints/apply_member_constraint-no-req-eq.rs +++ b/tests/ui/impl-trait/member-constraints/apply_member_constraint-no-req-eq.rs @@ -1,5 +1,7 @@ //@ check-pass -// FIXME(-Znext-solver): enable this test +//@ revisions: current next +//@ ignore-compare-mode-next-solver (explicit revisions) +//@[next] compile-flags: -Znext-solver trait Id { type This; diff --git a/tests/ui/impl-trait/member-constraints/nested-impl-trait-pass.rs b/tests/ui/impl-trait/member-constraints/nested-impl-trait-pass.rs index 6860fc5e6a5..878b8746bfa 100644 --- a/tests/ui/impl-trait/member-constraints/nested-impl-trait-pass.rs +++ b/tests/ui/impl-trait/member-constraints/nested-impl-trait-pass.rs @@ -1,7 +1,9 @@ // Nested impl-traits can impose different member constraints on the same region variable. //@ check-pass -// FIXME(-Znext-solver): enable this test +//@ revisions: current next +//@ ignore-compare-mode-next-solver (explicit revisions) +//@[next] compile-flags: -Znext-solver trait Cap<'a> {} impl<T> Cap<'_> for T {} diff --git a/tests/ui/impl-trait/nested-rpit-hrtb.rs b/tests/ui/impl-trait/nested-rpit-hrtb.rs index 11d79bcff73..f4ff13d6c20 100644 --- a/tests/ui/impl-trait/nested-rpit-hrtb.rs +++ b/tests/ui/impl-trait/nested-rpit-hrtb.rs @@ -48,6 +48,7 @@ fn one_hrtb_mention_fn_trait_param_uses<'b>() -> impl for<'a> Bar<'a, Assoc = im // This should resolve. fn one_hrtb_mention_fn_outlives_uses<'b>() -> impl for<'a> Bar<'a, Assoc = impl Sized + 'b> {} //~^ ERROR implementation of `Bar` is not general enough +//~| ERROR lifetime may not live long enough // This should resolve. fn two_htrb_trait_param() -> impl for<'a> Foo<'a, Assoc = impl for<'b> Qux<'b>> {} diff --git a/tests/ui/impl-trait/nested-rpit-hrtb.stderr b/tests/ui/impl-trait/nested-rpit-hrtb.stderr index 2e95ef370c7..93cd7bd788f 100644 --- a/tests/ui/impl-trait/nested-rpit-hrtb.stderr +++ b/tests/ui/impl-trait/nested-rpit-hrtb.stderr @@ -1,5 +1,5 @@ error[E0261]: use of undeclared lifetime name `'b` - --> $DIR/nested-rpit-hrtb.rs:56:77 + --> $DIR/nested-rpit-hrtb.rs:57:77 | LL | fn two_htrb_outlives() -> impl for<'a> Foo<'a, Assoc = impl for<'b> Sized + 'b> {} | ^^ undeclared lifetime @@ -15,7 +15,7 @@ LL | fn two_htrb_outlives<'b>() -> impl for<'a> Foo<'a, Assoc = impl for<'b> Siz | ++++ error[E0261]: use of undeclared lifetime name `'b` - --> $DIR/nested-rpit-hrtb.rs:64:82 + --> $DIR/nested-rpit-hrtb.rs:65:82 | LL | fn two_htrb_outlives_uses() -> impl for<'a> Bar<'a, Assoc = impl for<'b> Sized + 'b> {} | ^^ undeclared lifetime @@ -87,6 +87,12 @@ LL | fn one_hrtb_mention_fn_trait_param_uses<'b>() -> impl for<'a> Bar<'a, Assoc but trait `Qux<'_>` is implemented for `()` = help: for that trait implementation, expected `()`, found `&'a ()` +error: lifetime may not live long enough + --> $DIR/nested-rpit-hrtb.rs:49:93 + | +LL | fn one_hrtb_mention_fn_outlives_uses<'b>() -> impl for<'a> Bar<'a, Assoc = impl Sized + 'b> {} + | -- lifetime `'b` defined here ^^ opaque type requires that `'b` must outlive `'static` + error: implementation of `Bar` is not general enough --> $DIR/nested-rpit-hrtb.rs:49:93 | @@ -97,7 +103,7 @@ LL | fn one_hrtb_mention_fn_outlives_uses<'b>() -> impl for<'a> Bar<'a, Assoc = = note: ...but it actually implements `Bar<'0>`, for some specific lifetime `'0` error[E0277]: the trait bound `for<'a, 'b> &'a (): Qux<'b>` is not satisfied - --> $DIR/nested-rpit-hrtb.rs:60:64 + --> $DIR/nested-rpit-hrtb.rs:61:64 | LL | fn two_htrb_trait_param_uses() -> impl for<'a> Bar<'a, Assoc = impl for<'b> Qux<'b>> {} | ^^^^^^^^^^^^^^^^^^^^ the trait `for<'a, 'b> Qux<'b>` is not implemented for `&'a ()` @@ -106,7 +112,7 @@ LL | fn two_htrb_trait_param_uses() -> impl for<'a> Bar<'a, Assoc = impl for<'b> but trait `Qux<'_>` is implemented for `()` = help: for that trait implementation, expected `()`, found `&'a ()` -error: aborting due to 9 previous errors +error: aborting due to 10 previous errors Some errors have detailed explanations: E0261, E0277, E0657. For more information about an error, try `rustc --explain E0261`. diff --git a/tests/ui/impl-trait/no-anonymize-regions.rs b/tests/ui/impl-trait/no-anonymize-regions.rs index 4f7f7c0641c..a89c9e05a34 100644 --- a/tests/ui/impl-trait/no-anonymize-regions.rs +++ b/tests/ui/impl-trait/no-anonymize-regions.rs @@ -1,5 +1,7 @@ //@ check-pass -// FIXME(-Znext-solver): enable this test +//@ revisions: current next +//@ ignore-compare-mode-next-solver (explicit revisions) +//@[next] compile-flags: -Znext-solver // A regression test for an error in `redis` while working on #139587. // diff --git a/tests/ui/impl-trait/non-defining-uses/as-projection-term.next.stderr b/tests/ui/impl-trait/non-defining-uses/as-projection-term.next.stderr index 08c8365b180..96e242d5d48 100644 --- a/tests/ui/impl-trait/non-defining-uses/as-projection-term.next.stderr +++ b/tests/ui/impl-trait/non-defining-uses/as-projection-term.next.stderr @@ -1,12 +1,8 @@ -error[E0792]: expected generic lifetime parameter, found `'_` +error: non-defining use of `impl Sized + '_` in the defining scope --> $DIR/as-projection-term.rs:14:19 | -LL | fn recur<'a>() -> impl Sized + 'a { - | -- this generic parameter must be used with a generic lifetime parameter -... LL | prove_proj(|| recur()); | ^^^^^^^ error: aborting due to 1 previous error -For more information about this error, try `rustc --explain E0792`. diff --git a/tests/ui/impl-trait/non-defining-uses/as-projection-term.rs b/tests/ui/impl-trait/non-defining-uses/as-projection-term.rs index 4c5adc7a00a..f0cf333b6a1 100644 --- a/tests/ui/impl-trait/non-defining-uses/as-projection-term.rs +++ b/tests/ui/impl-trait/non-defining-uses/as-projection-term.rs @@ -12,6 +12,6 @@ fn recur<'a>() -> impl Sized + 'a { // inference variable at this point, we unify it with `opaque<'1>` and // end up ignoring that defining use as the hidden type is equal to its key. prove_proj(|| recur()); - //[next]~^ ERROR expected generic lifetime parameter, found `'_` + //[next]~^ ERROR non-defining use of `impl Sized + '_` in the defining scope } fn main() {} diff --git a/tests/ui/impl-trait/precise-capturing/parenthesized.rs b/tests/ui/impl-trait/precise-capturing/parenthesized.rs new file mode 100644 index 00000000000..e3f80fc1d9f --- /dev/null +++ b/tests/ui/impl-trait/precise-capturing/parenthesized.rs @@ -0,0 +1,8 @@ +// Ensure that we forbid parenthesized use-bounds. In the future we might want +// to lift this restriction but for now they bear no use whatsoever. + +fn f() -> impl Sized + (use<>) {} +//~^ ERROR precise capturing lists may not be parenthesized +//~| HELP remove the parentheses + +fn main() {} diff --git a/tests/ui/impl-trait/precise-capturing/parenthesized.stderr b/tests/ui/impl-trait/precise-capturing/parenthesized.stderr new file mode 100644 index 00000000000..c97fa9972ef --- /dev/null +++ b/tests/ui/impl-trait/precise-capturing/parenthesized.stderr @@ -0,0 +1,14 @@ +error: precise capturing lists may not be parenthesized + --> $DIR/parenthesized.rs:4:24 + | +LL | fn f() -> impl Sized + (use<>) {} + | ^^^^^^^ + | +help: remove the parentheses + | +LL - fn f() -> impl Sized + (use<>) {} +LL + fn f() -> impl Sized + use<> {} + | + +error: aborting due to 1 previous error + diff --git a/tests/ui/impl-trait/recursive-in-exhaustiveness.current.stderr b/tests/ui/impl-trait/recursive-in-exhaustiveness.current.stderr index 080c3284641..11a88b0918c 100644 --- a/tests/ui/impl-trait/recursive-in-exhaustiveness.current.stderr +++ b/tests/ui/impl-trait/recursive-in-exhaustiveness.current.stderr @@ -11,7 +11,7 @@ LL | fn build2<T>(x: T) -> impl Sized { | ^^^^^^^^^^ error[E0720]: cannot resolve opaque type - --> $DIR/recursive-in-exhaustiveness.rs:39:23 + --> $DIR/recursive-in-exhaustiveness.rs:37:23 | LL | fn build3<T>(x: T) -> impl Sized { | ^^^^^^^^^^ diff --git a/tests/ui/impl-trait/recursive-in-exhaustiveness.next.stderr b/tests/ui/impl-trait/recursive-in-exhaustiveness.next.stderr index db57be73acc..45df8cc9c0c 100644 --- a/tests/ui/impl-trait/recursive-in-exhaustiveness.next.stderr +++ b/tests/ui/impl-trait/recursive-in-exhaustiveness.next.stderr @@ -1,80 +1,21 @@ -error[E0284]: type annotations needed: cannot normalize `build<_>::{opaque#0}` - --> $DIR/recursive-in-exhaustiveness.rs:20:5 +error[E0282]: type annotations needed + --> $DIR/recursive-in-exhaustiveness.rs:19:17 | -LL | build(x) - | ^^^^^^^^ cannot normalize `build<_>::{opaque#0}` +LL | let (x,) = (build(x),); + | ^^^^^^^^ cannot infer type -error[E0271]: type mismatch resolving `build2<(_,)>::{opaque#0} normalizes-to _` - --> $DIR/recursive-in-exhaustiveness.rs:30:6 +error[E0282]: type annotations needed + --> $DIR/recursive-in-exhaustiveness.rs:29:17 | -LL | (build2(x),) - | ^^^^^^^^^ types differ +LL | let (x,) = (build2(x),); + | ^^^^^^^^^ cannot infer type -error[E0271]: type mismatch resolving `build2<(_,)>::{opaque#0} normalizes-to _` - --> $DIR/recursive-in-exhaustiveness.rs:30:5 +error[E0282]: type annotations needed + --> $DIR/recursive-in-exhaustiveness.rs:40:5 | -LL | (build2(x),) - | ^^^^^^^^^^^^ types differ +LL | build3(x) + | ^^^^^^^^^ cannot infer type -error[E0277]: the size for values of type `(impl Sized,)` cannot be known at compilation time - --> $DIR/recursive-in-exhaustiveness.rs:30:5 - | -LL | (build2(x),) - | ^^^^^^^^^^^^ doesn't have a size known at compile-time - | - = help: the trait `Sized` is not implemented for `(impl Sized,)` - = note: tuples must have a statically known size to be initialized - -error[E0271]: type mismatch resolving `build3<(T,)>::{opaque#0} normalizes-to _` - --> $DIR/recursive-in-exhaustiveness.rs:41:17 - | -LL | let (x,) = (build3((x,)),); - | ^^^^^^^^^^^^ types differ - -error[E0277]: the size for values of type `(impl Sized,)` cannot be known at compilation time - --> $DIR/recursive-in-exhaustiveness.rs:41:16 - | -LL | let (x,) = (build3((x,)),); - | ^^^^^^^^^^^^^^^ doesn't have a size known at compile-time - | - = help: the trait `Sized` is not implemented for `(impl Sized,)` - = note: tuples must have a statically known size to be initialized - -error[E0308]: mismatched types - --> $DIR/recursive-in-exhaustiveness.rs:41:16 - | -LL | fn build3<T>(x: T) -> impl Sized { - | ---------- the found opaque type -LL | -LL | let (x,) = (build3((x,)),); - | ^^^^^^^^^^^^^^^ types differ - | - = note: expected type `_` - found tuple `(impl Sized,)` - -error[E0271]: type mismatch resolving `build3<(T,)>::{opaque#0} normalizes-to _` - --> $DIR/recursive-in-exhaustiveness.rs:41:17 - | -LL | let (x,) = (build3((x,)),); - | ^^^^^^^^^^^^ types differ - | - = note: the return type of a function must have a statically known size - -error[E0271]: type mismatch resolving `build3<(T,)>::{opaque#0} normalizes-to _` - --> $DIR/recursive-in-exhaustiveness.rs:41:16 - | -LL | let (x,) = (build3((x,)),); - | ^^^^^^^^^^^^^^^ types differ - -error[E0271]: type mismatch resolving `build3<(T,)>::{opaque#0} normalizes-to _` - --> $DIR/recursive-in-exhaustiveness.rs:41:17 - | -LL | let (x,) = (build3((x,)),); - | ^^^^^^^^^^^^ types differ - | - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` - -error: aborting due to 10 previous errors +error: aborting due to 3 previous errors -Some errors have detailed explanations: E0271, E0277, E0284, E0308. -For more information about an error, try `rustc --explain E0271`. +For more information about this error, try `rustc --explain E0282`. diff --git a/tests/ui/impl-trait/recursive-in-exhaustiveness.rs b/tests/ui/impl-trait/recursive-in-exhaustiveness.rs index dabef22af86..7aee8a630a5 100644 --- a/tests/ui/impl-trait/recursive-in-exhaustiveness.rs +++ b/tests/ui/impl-trait/recursive-in-exhaustiveness.rs @@ -17,8 +17,8 @@ fn build<T>(x: T) -> impl Sized { //[current]~^ ERROR cannot resolve opaque type let (x,) = (build(x),); + //[next]~^ ERROR type annotations needed build(x) - //[next]~^ ERROR type annotations needed: cannot normalize `build<_>::{opaque#0}` } // Opaque<T> = (Opaque<T>,) @@ -27,10 +27,8 @@ fn build<T>(x: T) -> impl Sized { fn build2<T>(x: T) -> impl Sized { //[current]~^ ERROR cannot resolve opaque type let (x,) = (build2(x),); + //[next]~^ ERROR type annotations needed (build2(x),) - //[next]~^ ERROR type mismatch resolving - //[next]~| ERROR type mismatch resolving - //[next]~| ERROR the size for values of type } // Opaque<T> = Opaque<(T,)> @@ -39,13 +37,8 @@ fn build2<T>(x: T) -> impl Sized { fn build3<T>(x: T) -> impl Sized { //[current]~^ ERROR cannot resolve opaque type let (x,) = (build3((x,)),); - //[next]~^ ERROR type mismatch resolving - //[next]~| ERROR type mismatch resolving - //[next]~| ERROR type mismatch resolving - //[next]~| ERROR type mismatch resolving - //[next]~| ERROR the size for values of type - //[next]~| ERROR mismatched types build3(x) + //[next]~^ ERROR type annotations needed } fn main() {} diff --git a/tests/ui/impl-trait/recursive-type-alias-impl-trait-declaration.stderr b/tests/ui/impl-trait/recursive-type-alias-impl-trait-declaration.stderr index a9a5483caa9..da196ae0433 100644 --- a/tests/ui/impl-trait/recursive-type-alias-impl-trait-declaration.stderr +++ b/tests/ui/impl-trait/recursive-type-alias-impl-trait-declaration.stderr @@ -7,7 +7,11 @@ LL | LL | Bar | --- return type was inferred to be `Bar` here | - = help: the trait `PartialEq<(Foo, i32)>` is not implemented for `Bar` +help: the trait `PartialEq<(Foo, i32)>` is not implemented for `Bar` + --> $DIR/recursive-type-alias-impl-trait-declaration.rs:5:1 + | +LL | struct Bar; + | ^^^^^^^^^^ = help: the trait `PartialEq<(Bar, i32)>` is implemented for `Bar` error: aborting due to 1 previous error diff --git a/tests/ui/impl-trait/rpit-assoc-pair-with-lifetime.stderr b/tests/ui/impl-trait/rpit-assoc-pair-with-lifetime.stderr index 3651226e0c3..7a9254bac60 100644 --- a/tests/ui/impl-trait/rpit-assoc-pair-with-lifetime.stderr +++ b/tests/ui/impl-trait/rpit-assoc-pair-with-lifetime.stderr @@ -1,8 +1,8 @@ warning: eliding a lifetime that's named elsewhere is confusing - --> $DIR/rpit-assoc-pair-with-lifetime.rs:3:31 + --> $DIR/rpit-assoc-pair-with-lifetime.rs:3:82 | LL | pub fn iter<'a>(v: Vec<(u32, &'a u32)>) -> impl DoubleEndedIterator<Item = (u32, &u32)> { - | ^^ the lifetime is named here ---- the same lifetime is elided here + | -- the lifetime is named here ^^^^ the same lifetime is elided here | = help: the same lifetime is referred to in inconsistent ways, making the signature confusing = note: `#[warn(mismatched_lifetime_syntaxes)]` on by default diff --git a/tests/ui/impl-trait/transmute/in-defining-scope.rs b/tests/ui/impl-trait/transmute/in-defining-scope.rs index 4c8e1852a91..d9eafcc553c 100644 --- a/tests/ui/impl-trait/transmute/in-defining-scope.rs +++ b/tests/ui/impl-trait/transmute/in-defining-scope.rs @@ -1,11 +1,12 @@ -// This causes a query cycle due to using `TypingEnv::PostAnalysis`, +// Used to cause a query cycle due to using `TypingEnv::PostAnalysis`, // in #119821 const eval was changed to always use this mode. // -// See that PR for more details. +//@ check-pass + use std::mem::transmute; + fn foo() -> impl Sized { - //~^ ERROR cycle detected when computing type of - //~| WARN function cannot return without recursing + //~^ WARN function cannot return without recursing unsafe { transmute::<_, u8>(foo()); } diff --git a/tests/ui/impl-trait/transmute/in-defining-scope.stderr b/tests/ui/impl-trait/transmute/in-defining-scope.stderr index 31535695178..015a39d6670 100644 --- a/tests/ui/impl-trait/transmute/in-defining-scope.stderr +++ b/tests/ui/impl-trait/transmute/in-defining-scope.stderr @@ -1,56 +1,5 @@ -error[E0391]: cycle detected when computing type of `foo::{opaque#0}` - --> $DIR/in-defining-scope.rs:6:13 - | -LL | fn foo() -> impl Sized { - | ^^^^^^^^^^ - | -note: ...which requires computing type of opaque `foo::{opaque#0}`... - --> $DIR/in-defining-scope.rs:6:13 - | -LL | fn foo() -> impl Sized { - | ^^^^^^^^^^ -note: ...which requires borrow-checking `foo`... - --> $DIR/in-defining-scope.rs:6:1 - | -LL | fn foo() -> impl Sized { - | ^^^^^^^^^^^^^^^^^^^^^^ -note: ...which requires promoting constants in MIR for `foo`... - --> $DIR/in-defining-scope.rs:6:1 - | -LL | fn foo() -> impl Sized { - | ^^^^^^^^^^^^^^^^^^^^^^ -note: ...which requires checking if `foo` contains FFI-unwind calls... - --> $DIR/in-defining-scope.rs:6:1 - | -LL | fn foo() -> impl Sized { - | ^^^^^^^^^^^^^^^^^^^^^^ -note: ...which requires building MIR for `foo`... - --> $DIR/in-defining-scope.rs:6:1 - | -LL | fn foo() -> impl Sized { - | ^^^^^^^^^^^^^^^^^^^^^^ -note: ...which requires match-checking `foo`... - --> $DIR/in-defining-scope.rs:6:1 - | -LL | fn foo() -> impl Sized { - | ^^^^^^^^^^^^^^^^^^^^^^ -note: ...which requires type-checking `foo`... - --> $DIR/in-defining-scope.rs:6:1 - | -LL | fn foo() -> impl Sized { - | ^^^^^^^^^^^^^^^^^^^^^^ - = note: ...which requires computing layout of `foo::{opaque#0}`... - = note: ...which requires normalizing `foo::{opaque#0}`... - = note: ...which again requires computing type of `foo::{opaque#0}`, completing the cycle -note: cycle used when checking that `foo::{opaque#0}` is well-formed - --> $DIR/in-defining-scope.rs:6:13 - | -LL | fn foo() -> impl Sized { - | ^^^^^^^^^^ - = 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 - warning: function cannot return without recursing - --> $DIR/in-defining-scope.rs:6:1 + --> $DIR/in-defining-scope.rs:8:1 | LL | fn foo() -> impl Sized { | ^^^^^^^^^^^^^^^^^^^^^^ cannot return without recursing @@ -61,6 +10,5 @@ LL | transmute::<_, u8>(foo()); = help: a `loop` may express intention better if this is on purpose = note: `#[warn(unconditional_recursion)]` on by default -error: aborting due to 1 previous error; 1 warning emitted +warning: 1 warning emitted -For more information about this error, try `rustc --explain E0391`. diff --git a/tests/ui/impl-trait/two_tait_defining_each_other2.next.stderr b/tests/ui/impl-trait/two_tait_defining_each_other2.next.stderr index fac4776905d..785e5fdeb64 100644 --- a/tests/ui/impl-trait/two_tait_defining_each_other2.next.stderr +++ b/tests/ui/impl-trait/two_tait_defining_each_other2.next.stderr @@ -1,9 +1,15 @@ error[E0282]: type annotations needed - --> $DIR/two_tait_defining_each_other2.rs:12:11 + --> $DIR/two_tait_defining_each_other2.rs:12:8 | LL | fn muh(x: A) -> B { - | ^ cannot infer type + | ^ cannot infer type -error: aborting due to 1 previous error +error[E0282]: type annotations needed + --> $DIR/two_tait_defining_each_other2.rs:14:5 + | +LL | x // B's hidden type is A (opaquely) + | ^ cannot infer type + +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0282`. diff --git a/tests/ui/impl-trait/two_tait_defining_each_other2.rs b/tests/ui/impl-trait/two_tait_defining_each_other2.rs index ec2963249f9..99262f4bc4b 100644 --- a/tests/ui/impl-trait/two_tait_defining_each_other2.rs +++ b/tests/ui/impl-trait/two_tait_defining_each_other2.rs @@ -12,7 +12,8 @@ trait Foo {} fn muh(x: A) -> B { //[next]~^ ERROR: type annotations needed x // B's hidden type is A (opaquely) - //[current]~^ ERROR opaque type's hidden type cannot be another opaque type + //[next]~^ ERROR: type annotations needed + //[current]~^^ ERROR opaque type's hidden type cannot be another opaque type } struct Bar; diff --git a/tests/ui/impl-trait/type-alias-generic-param.stderr b/tests/ui/impl-trait/type-alias-generic-param.stderr index e4115dc1319..0a063eed257 100644 --- a/tests/ui/impl-trait/type-alias-generic-param.stderr +++ b/tests/ui/impl-trait/type-alias-generic-param.stderr @@ -4,7 +4,7 @@ warning: trait `Meow` is never used LL | trait Meow { | ^^^^ | - = note: `#[warn(dead_code)]` on by default + = note: `#[warn(dead_code)]` (part of `#[warn(unused)]`) on by default warning: 1 warning emitted diff --git a/tests/ui/implied-bounds/normalization-placeholder-leak.fail.stderr b/tests/ui/implied-bounds/normalization-placeholder-leak.fail.stderr index 8919919d04e..be8b44b1bde 100644 --- a/tests/ui/implied-bounds/normalization-placeholder-leak.fail.stderr +++ b/tests/ui/implied-bounds/normalization-placeholder-leak.fail.stderr @@ -30,6 +30,12 @@ LL | fn test_lifetime<'lt, T: Trait>(_: Foo<&'lt u8>) {} | | | | | lifetime `'lt` defined here | requires that `'lt` must outlive `'static` + | +note: due to a current limitation of the type system, this implies a `'static` lifetime + --> $DIR/normalization-placeholder-leak.rs:19:5 + | +LL | for<'x> T::Ty<'x>: Sized; + | ^^^^^^^^^^^^^^^^^^^^^^^^ error: lifetime may not live long enough --> $DIR/normalization-placeholder-leak.rs:38:5 @@ -39,6 +45,12 @@ LL | fn test_alias<'lt, T: AnotherTrait>(_: Foo<T::Ty2::<'lt>>) {} | | | | | lifetime `'lt` defined here | requires that `'lt` must outlive `'static` + | +note: due to a current limitation of the type system, this implies a `'static` lifetime + --> $DIR/normalization-placeholder-leak.rs:19:5 + | +LL | for<'x> T::Ty<'x>: Sized; + | ^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 6 previous errors diff --git a/tests/ui/imports/ambiguous-10.stderr b/tests/ui/imports/ambiguous-10.stderr index cd36795b3c0..f175d27c99e 100644 --- a/tests/ui/imports/ambiguous-10.stderr +++ b/tests/ui/imports/ambiguous-10.stderr @@ -19,7 +19,7 @@ note: `Token` could also refer to the enum imported here LL | use crate::b::*; | ^^^^^^^^^^^ = help: consider adding an explicit import of `Token` to disambiguate - = note: `#[deny(ambiguous_glob_imports)]` on by default + = note: `#[deny(ambiguous_glob_imports)]` (part of `#[deny(future_incompatible)]`) on by default error: aborting due to 1 previous error @@ -45,5 +45,5 @@ note: `Token` could also refer to the enum imported here LL | use crate::b::*; | ^^^^^^^^^^^ = help: consider adding an explicit import of `Token` to disambiguate - = note: `#[deny(ambiguous_glob_imports)]` on by default + = note: `#[deny(ambiguous_glob_imports)]` (part of `#[deny(future_incompatible)]`) on by default diff --git a/tests/ui/imports/ambiguous-12.stderr b/tests/ui/imports/ambiguous-12.stderr index 273a4ed3c0f..5f92eae0dbc 100644 --- a/tests/ui/imports/ambiguous-12.stderr +++ b/tests/ui/imports/ambiguous-12.stderr @@ -19,7 +19,7 @@ note: `b` could also refer to the function imported here LL | use crate::public::*; | ^^^^^^^^^^^^^^^^ = help: consider adding an explicit import of `b` to disambiguate - = note: `#[deny(ambiguous_glob_imports)]` on by default + = note: `#[deny(ambiguous_glob_imports)]` (part of `#[deny(future_incompatible)]`) on by default error: aborting due to 1 previous error @@ -45,5 +45,5 @@ note: `b` could also refer to the function imported here LL | use crate::public::*; | ^^^^^^^^^^^^^^^^ = help: consider adding an explicit import of `b` to disambiguate - = note: `#[deny(ambiguous_glob_imports)]` on by default + = note: `#[deny(ambiguous_glob_imports)]` (part of `#[deny(future_incompatible)]`) on by default diff --git a/tests/ui/imports/ambiguous-13.stderr b/tests/ui/imports/ambiguous-13.stderr index c4a42c01c91..279b4e8f142 100644 --- a/tests/ui/imports/ambiguous-13.stderr +++ b/tests/ui/imports/ambiguous-13.stderr @@ -19,7 +19,7 @@ note: `Rect` could also refer to the struct imported here LL | use crate::content::*; | ^^^^^^^^^^^^^^^^^ = help: consider adding an explicit import of `Rect` to disambiguate - = note: `#[deny(ambiguous_glob_imports)]` on by default + = note: `#[deny(ambiguous_glob_imports)]` (part of `#[deny(future_incompatible)]`) on by default error: aborting due to 1 previous error @@ -45,5 +45,5 @@ note: `Rect` could also refer to the struct imported here LL | use crate::content::*; | ^^^^^^^^^^^^^^^^^ = help: consider adding an explicit import of `Rect` to disambiguate - = note: `#[deny(ambiguous_glob_imports)]` on by default + = note: `#[deny(ambiguous_glob_imports)]` (part of `#[deny(future_incompatible)]`) on by default diff --git a/tests/ui/imports/ambiguous-14.stderr b/tests/ui/imports/ambiguous-14.stderr index f3115f8c8b5..ef7e2669bae 100644 --- a/tests/ui/imports/ambiguous-14.stderr +++ b/tests/ui/imports/ambiguous-14.stderr @@ -19,7 +19,7 @@ note: `foo` could also refer to the function imported here LL | pub use b::*; | ^^^^ = help: consider adding an explicit import of `foo` to disambiguate - = note: `#[deny(ambiguous_glob_imports)]` on by default + = note: `#[deny(ambiguous_glob_imports)]` (part of `#[deny(future_incompatible)]`) on by default error: aborting due to 1 previous error @@ -45,5 +45,5 @@ note: `foo` could also refer to the function imported here LL | pub use b::*; | ^^^^ = help: consider adding an explicit import of `foo` to disambiguate - = note: `#[deny(ambiguous_glob_imports)]` on by default + = note: `#[deny(ambiguous_glob_imports)]` (part of `#[deny(future_incompatible)]`) on by default diff --git a/tests/ui/imports/ambiguous-15.stderr b/tests/ui/imports/ambiguous-15.stderr index 1312f2c63c4..15f83546532 100644 --- a/tests/ui/imports/ambiguous-15.stderr +++ b/tests/ui/imports/ambiguous-15.stderr @@ -19,7 +19,7 @@ note: `Error` could also refer to the enum imported here LL | pub use t2::*; | ^^^^^ = help: consider adding an explicit import of `Error` to disambiguate - = note: `#[deny(ambiguous_glob_imports)]` on by default + = note: `#[deny(ambiguous_glob_imports)]` (part of `#[deny(future_incompatible)]`) on by default error: aborting due to 1 previous error @@ -45,5 +45,5 @@ note: `Error` could also refer to the enum imported here LL | pub use t2::*; | ^^^^^ = help: consider adding an explicit import of `Error` to disambiguate - = note: `#[deny(ambiguous_glob_imports)]` on by default + = note: `#[deny(ambiguous_glob_imports)]` (part of `#[deny(future_incompatible)]`) on by default diff --git a/tests/ui/imports/ambiguous-16.stderr b/tests/ui/imports/ambiguous-16.stderr index ae65f9a84fc..7c80dee17f0 100644 --- a/tests/ui/imports/ambiguous-16.stderr +++ b/tests/ui/imports/ambiguous-16.stderr @@ -19,7 +19,7 @@ note: `ConfirmedTranscriptHashInput` could also refer to the struct imported her LL | pub use self::public_message_in::*; | ^^^^^^^^^^^^^^^^^^^^^^^^^^ = help: consider adding an explicit import of `ConfirmedTranscriptHashInput` to disambiguate - = note: `#[deny(ambiguous_glob_imports)]` on by default + = note: `#[deny(ambiguous_glob_imports)]` (part of `#[deny(future_incompatible)]`) on by default error: aborting due to 1 previous error @@ -45,5 +45,5 @@ note: `ConfirmedTranscriptHashInput` could also refer to the struct imported her LL | pub use self::public_message_in::*; | ^^^^^^^^^^^^^^^^^^^^^^^^^^ = help: consider adding an explicit import of `ConfirmedTranscriptHashInput` to disambiguate - = note: `#[deny(ambiguous_glob_imports)]` on by default + = note: `#[deny(ambiguous_glob_imports)]` (part of `#[deny(future_incompatible)]`) on by default diff --git a/tests/ui/imports/ambiguous-17.stderr b/tests/ui/imports/ambiguous-17.stderr index a87e2572d63..38491ce1062 100644 --- a/tests/ui/imports/ambiguous-17.stderr +++ b/tests/ui/imports/ambiguous-17.stderr @@ -29,7 +29,7 @@ note: `id` could also refer to the function imported here LL | pub use handwritten::*; | ^^^^^^^^^^^^^^ = help: consider adding an explicit import of `id` to disambiguate - = note: `#[deny(ambiguous_glob_imports)]` on by default + = note: `#[deny(ambiguous_glob_imports)]` (part of `#[deny(future_incompatible)]`) on by default error: aborting due to 1 previous error; 1 warning emitted @@ -55,5 +55,5 @@ note: `id` could also refer to the function imported here LL | pub use handwritten::*; | ^^^^^^^^^^^^^^ = help: consider adding an explicit import of `id` to disambiguate - = note: `#[deny(ambiguous_glob_imports)]` on by default + = note: `#[deny(ambiguous_glob_imports)]` (part of `#[deny(future_incompatible)]`) on by default diff --git a/tests/ui/imports/ambiguous-3.stderr b/tests/ui/imports/ambiguous-3.stderr index 8766db5654a..27fa05a195b 100644 --- a/tests/ui/imports/ambiguous-3.stderr +++ b/tests/ui/imports/ambiguous-3.stderr @@ -19,7 +19,7 @@ note: `x` could also refer to the function imported here LL | pub use self::c::*; | ^^^^^^^^^^ = help: consider adding an explicit import of `x` to disambiguate - = note: `#[deny(ambiguous_glob_imports)]` on by default + = note: `#[deny(ambiguous_glob_imports)]` (part of `#[deny(future_incompatible)]`) on by default error: aborting due to 1 previous error @@ -45,5 +45,5 @@ note: `x` could also refer to the function imported here LL | pub use self::c::*; | ^^^^^^^^^^ = help: consider adding an explicit import of `x` to disambiguate - = note: `#[deny(ambiguous_glob_imports)]` on by default + = note: `#[deny(ambiguous_glob_imports)]` (part of `#[deny(future_incompatible)]`) on by default diff --git a/tests/ui/imports/ambiguous-5.stderr b/tests/ui/imports/ambiguous-5.stderr index 41c15809351..1fc5f4543f3 100644 --- a/tests/ui/imports/ambiguous-5.stderr +++ b/tests/ui/imports/ambiguous-5.stderr @@ -19,7 +19,7 @@ note: `Class` could also refer to the struct imported here LL | use super::gsubgpos::*; | ^^^^^^^^^^^^^^^^^^ = help: consider adding an explicit import of `Class` to disambiguate - = note: `#[deny(ambiguous_glob_imports)]` on by default + = note: `#[deny(ambiguous_glob_imports)]` (part of `#[deny(future_incompatible)]`) on by default error: aborting due to 1 previous error @@ -45,5 +45,5 @@ note: `Class` could also refer to the struct imported here LL | use super::gsubgpos::*; | ^^^^^^^^^^^^^^^^^^ = help: consider adding an explicit import of `Class` to disambiguate - = note: `#[deny(ambiguous_glob_imports)]` on by default + = note: `#[deny(ambiguous_glob_imports)]` (part of `#[deny(future_incompatible)]`) on by default diff --git a/tests/ui/imports/ambiguous-6.stderr b/tests/ui/imports/ambiguous-6.stderr index d988126dbfb..681bc40931f 100644 --- a/tests/ui/imports/ambiguous-6.stderr +++ b/tests/ui/imports/ambiguous-6.stderr @@ -19,7 +19,7 @@ note: `C` could also refer to the constant imported here LL | pub use mod2::*; | ^^^^^^^ = help: consider adding an explicit import of `C` to disambiguate - = note: `#[deny(ambiguous_glob_imports)]` on by default + = note: `#[deny(ambiguous_glob_imports)]` (part of `#[deny(future_incompatible)]`) on by default error: aborting due to 1 previous error @@ -45,5 +45,5 @@ note: `C` could also refer to the constant imported here LL | pub use mod2::*; | ^^^^^^^ = help: consider adding an explicit import of `C` to disambiguate - = note: `#[deny(ambiguous_glob_imports)]` on by default + = note: `#[deny(ambiguous_glob_imports)]` (part of `#[deny(future_incompatible)]`) on by default diff --git a/tests/ui/imports/ambiguous-9.stderr b/tests/ui/imports/ambiguous-9.stderr index 1c4768da827..800a2e10c9d 100644 --- a/tests/ui/imports/ambiguous-9.stderr +++ b/tests/ui/imports/ambiguous-9.stderr @@ -29,7 +29,7 @@ note: `date_range` could also refer to the function imported here LL | use super::prelude::*; | ^^^^^^^^^^^^^^^^^ = help: consider adding an explicit import of `date_range` to disambiguate - = note: `#[deny(ambiguous_glob_imports)]` on by default + = note: `#[deny(ambiguous_glob_imports)]` (part of `#[deny(future_incompatible)]`) on by default warning: ambiguous glob re-exports --> $DIR/ambiguous-9.rs:15:13 @@ -85,7 +85,7 @@ note: `date_range` could also refer to the function imported here LL | use super::prelude::*; | ^^^^^^^^^^^^^^^^^ = help: consider adding an explicit import of `date_range` to disambiguate - = note: `#[deny(ambiguous_glob_imports)]` on by default + = note: `#[deny(ambiguous_glob_imports)]` (part of `#[deny(future_incompatible)]`) on by default Future breakage diagnostic: error: `date_range` is ambiguous @@ -109,5 +109,5 @@ note: `date_range` could also refer to the function imported here LL | use prelude::*; | ^^^^^^^^^^ = help: consider adding an explicit import of `date_range` to disambiguate - = note: `#[deny(ambiguous_glob_imports)]` on by default + = note: `#[deny(ambiguous_glob_imports)]` (part of `#[deny(future_incompatible)]`) on by default diff --git a/tests/ui/imports/duplicate.stderr b/tests/ui/imports/duplicate.stderr index ef987d07c04..5cd3b0c2c8a 100644 --- a/tests/ui/imports/duplicate.stderr +++ b/tests/ui/imports/duplicate.stderr @@ -89,7 +89,7 @@ note: `foo` could also refer to the function imported here LL | pub use crate::b::*; | ^^^^^^^^^^^ = help: consider adding an explicit import of `foo` to disambiguate - = note: `#[deny(ambiguous_glob_imports)]` on by default + = note: `#[deny(ambiguous_glob_imports)]` (part of `#[deny(future_incompatible)]`) on by default error: aborting due to 5 previous errors @@ -117,5 +117,5 @@ note: `foo` could also refer to the function imported here LL | pub use crate::b::*; | ^^^^^^^^^^^ = help: consider adding an explicit import of `foo` to disambiguate - = note: `#[deny(ambiguous_glob_imports)]` on by default + = note: `#[deny(ambiguous_glob_imports)]` (part of `#[deny(future_incompatible)]`) on by default diff --git a/tests/ui/imports/local-modularized-tricky-fail-2.stderr b/tests/ui/imports/local-modularized-tricky-fail-2.stderr index ea4056b3d75..e5b48d2efdd 100644 --- a/tests/ui/imports/local-modularized-tricky-fail-2.stderr +++ b/tests/ui/imports/local-modularized-tricky-fail-2.stderr @@ -16,7 +16,7 @@ LL | | } ... LL | define_exported!(); | ------------------ in this macro invocation - = note: `#[deny(macro_expanded_macro_exports_accessed_by_absolute_paths)]` on by default + = note: `#[deny(macro_expanded_macro_exports_accessed_by_absolute_paths)]` (part of `#[deny(future_incompatible)]`) on by default = note: this error originates in the macro `define_exported` (in Nightly builds, run with -Z macro-backtrace for more info) error: macro-expanded `macro_export` macros from the current crate cannot be referred to by absolute paths @@ -60,7 +60,7 @@ LL | | } ... LL | define_exported!(); | ------------------ in this macro invocation - = note: `#[deny(macro_expanded_macro_exports_accessed_by_absolute_paths)]` on by default + = note: `#[deny(macro_expanded_macro_exports_accessed_by_absolute_paths)]` (part of `#[deny(future_incompatible)]`) on by default = note: this error originates in the macro `define_exported` (in Nightly builds, run with -Z macro-backtrace for more info) Future breakage diagnostic: @@ -82,6 +82,6 @@ LL | | } ... LL | define_exported!(); | ------------------ in this macro invocation - = note: `#[deny(macro_expanded_macro_exports_accessed_by_absolute_paths)]` on by default + = note: `#[deny(macro_expanded_macro_exports_accessed_by_absolute_paths)]` (part of `#[deny(future_incompatible)]`) on by default = note: this error originates in the macro `define_exported` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/tests/ui/imports/suggest-remove-issue-121315.stderr b/tests/ui/imports/suggest-remove-issue-121315.stderr index 5d0bf9bea6a..c91ea8a8793 100644 --- a/tests/ui/imports/suggest-remove-issue-121315.stderr +++ b/tests/ui/imports/suggest-remove-issue-121315.stderr @@ -3,10 +3,10 @@ error: the item `TryFrom` is imported redundantly | LL | use std::convert::TryFrom; | ^^^^^^^^^^^^^^^^^^^^^ + | --> $SRC_DIR/std/src/prelude/mod.rs:LL:COL | = note: the item `TryFrom` is already defined here - | note: the lint level is defined here --> $DIR/suggest-remove-issue-121315.rs:2:25 | @@ -18,6 +18,7 @@ error: the item `TryFrom` is imported redundantly | LL | use std::convert::{TryFrom, TryInto}; | ^^^^^^^ + | --> $SRC_DIR/std/src/prelude/mod.rs:LL:COL | = note: the item `TryFrom` is already defined here @@ -27,6 +28,7 @@ error: the item `TryInto` is imported redundantly | LL | use std::convert::{TryFrom, TryInto}; | ^^^^^^^ + | --> $SRC_DIR/std/src/prelude/mod.rs:LL:COL | = note: the item `TryInto` is already defined here @@ -48,6 +50,7 @@ error: the item `Into` is imported redundantly | LL | use std::convert::{AsMut, Into}; | ^^^^ + | --> $SRC_DIR/std/src/prelude/mod.rs:LL:COL | = note: the item `Into` is already defined here diff --git a/tests/ui/imports/unresolved-seg-after-ambiguous.stderr b/tests/ui/imports/unresolved-seg-after-ambiguous.stderr index 3b50ae32683..67316462a27 100644 --- a/tests/ui/imports/unresolved-seg-after-ambiguous.stderr +++ b/tests/ui/imports/unresolved-seg-after-ambiguous.stderr @@ -25,7 +25,7 @@ note: `E` could also refer to the struct imported here LL | pub use self::d::*; | ^^^^^^^^^^ = help: consider adding an explicit import of `E` to disambiguate - = note: `#[deny(ambiguous_glob_imports)]` on by default + = note: `#[deny(ambiguous_glob_imports)]` (part of `#[deny(future_incompatible)]`) on by default error: aborting due to 2 previous errors @@ -52,5 +52,5 @@ note: `E` could also refer to the struct imported here LL | pub use self::d::*; | ^^^^^^^^^^ = help: consider adding an explicit import of `E` to disambiguate - = note: `#[deny(ambiguous_glob_imports)]` on by default + = note: `#[deny(ambiguous_glob_imports)]` (part of `#[deny(future_incompatible)]`) on by default diff --git a/tests/ui/inference/inference-variable-behind-raw-pointer.stderr b/tests/ui/inference/inference-variable-behind-raw-pointer.stderr index 3dea09e7f52..fe4e16c3328 100644 --- a/tests/ui/inference/inference-variable-behind-raw-pointer.stderr +++ b/tests/ui/inference/inference-variable-behind-raw-pointer.stderr @@ -6,7 +6,7 @@ LL | if data.is_null() {} | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! = note: for more information, see issue #46906 <https://github.com/rust-lang/rust/issues/46906> - = note: `#[warn(tyvar_behind_raw_pointer)]` on by default + = note: `#[warn(tyvar_behind_raw_pointer)]` (part of `#[warn(rust_2018_compatibility)]`) on by default warning: 1 warning emitted diff --git a/tests/ui/inference/inference_unstable.stderr b/tests/ui/inference/inference_unstable.stderr index 395dcb2661f..0072175d514 100644 --- a/tests/ui/inference/inference_unstable.stderr +++ b/tests/ui/inference/inference_unstable.stderr @@ -7,7 +7,7 @@ LL | assert_eq!('x'.ipu_flatten(), 1); = warning: once this associated item is added to the standard library, the ambiguity may cause an error or change in behavior! = note: for more information, see issue #48919 <https://github.com/rust-lang/rust/issues/48919> = help: call with fully qualified syntax `inference_unstable_itertools::IpuItertools::ipu_flatten(...)` to keep using the current method - = note: `#[warn(unstable_name_collisions)]` on by default + = note: `#[warn(unstable_name_collisions)]` (part of `#[warn(future_incompatible)]`) on by default help: add `#![feature(ipu_flatten)]` to the crate attributes to enable `inference_unstable_iterator::IpuIterator::ipu_flatten` | LL + #![feature(ipu_flatten)] diff --git a/tests/ui/inference/issue-72616.stderr b/tests/ui/inference/issue-72616.stderr index 31a0586301d..a271639996f 100644 --- a/tests/ui/inference/issue-72616.stderr +++ b/tests/ui/inference/issue-72616.stderr @@ -6,14 +6,10 @@ LL | if String::from("a") == "a".try_into().unwrap() {} | | | type must be known at this point | - = note: cannot satisfy `String: PartialEq<_>` - = help: the following 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: multiple `impl`s satisfying `String: PartialEq<_>` found in the following crates: `alloc`, `std`: + - impl PartialEq for String; + - impl PartialEq<Path> for String; + - impl PartialEq<PathBuf> for String; help: try using a fully qualified path to specify the expected types | LL - if String::from("a") == "a".try_into().unwrap() {} diff --git a/tests/ui/issues/issue-85461.rs b/tests/ui/instrument-coverage/link-regex-crate-with-instrument-coverage-85461.rs index 72538081ccb..ffb535e69ee 100644 --- a/tests/ui/issues/issue-85461.rs +++ b/tests/ui/instrument-coverage/link-regex-crate-with-instrument-coverage-85461.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/85461 //@ compile-flags: -Cinstrument-coverage -Ccodegen-units=4 --crate-type dylib -Copt-level=0 //@ build-pass //@ needs-profiler-runtime diff --git a/tests/ui/intrinsics/non-integer-atomic.stderr b/tests/ui/intrinsics/non-integer-atomic.stderr index 330d313639d..c27013c0de2 100644 --- a/tests/ui/intrinsics/non-integer-atomic.stderr +++ b/tests/ui/intrinsics/non-integer-atomic.stderr @@ -4,20 +4,20 @@ error[E0511]: invalid monomorphization of `atomic_load` intrinsic: expected basi LL | intrinsics::atomic_load::<_, { SeqCst }>(p); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +error[E0511]: invalid monomorphization of `atomic_xchg` intrinsic: expected basic integer or pointer type, found `&dyn Fn()` + --> $DIR/non-integer-atomic.rs:65:5 + | +LL | intrinsics::atomic_xchg::<_, { SeqCst }>(p, v); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + error[E0511]: invalid monomorphization of `atomic_load` intrinsic: expected basic integer or pointer type, found `Foo` --> $DIR/non-integer-atomic.rs:35:5 | LL | intrinsics::atomic_load::<_, { SeqCst }>(p); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error[E0511]: invalid monomorphization of `atomic_store` intrinsic: expected basic integer or pointer type, found `&dyn Fn()` - --> $DIR/non-integer-atomic.rs:60:5 - | -LL | intrinsics::atomic_store::<_, { SeqCst }>(p, v); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -error[E0511]: invalid monomorphization of `atomic_xchg` intrinsic: expected basic integer or pointer type, found `[u8; 100]` - --> $DIR/non-integer-atomic.rs:85:5 +error[E0511]: invalid monomorphization of `atomic_xchg` intrinsic: expected basic integer or pointer type, found `Foo` + --> $DIR/non-integer-atomic.rs:45:5 | LL | intrinsics::atomic_xchg::<_, { SeqCst }>(p, v); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -28,71 +28,71 @@ error[E0511]: invalid monomorphization of `atomic_cxchg` intrinsic: expected bas LL | intrinsics::atomic_cxchg::<_, { SeqCst }, { SeqCst }>(p, v, v); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error[E0511]: invalid monomorphization of `atomic_store` intrinsic: expected basic integer or pointer type, found `Foo` - --> $DIR/non-integer-atomic.rs:40:5 +error[E0511]: invalid monomorphization of `atomic_store` intrinsic: expected basic integer or pointer type, found `&dyn Fn()` + --> $DIR/non-integer-atomic.rs:60:5 | LL | intrinsics::atomic_store::<_, { SeqCst }>(p, v); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error[E0511]: invalid monomorphization of `atomic_cxchg` intrinsic: expected basic integer or pointer type, found `[u8; 100]` - --> $DIR/non-integer-atomic.rs:90:5 +error[E0511]: invalid monomorphization of `atomic_cxchg` intrinsic: expected basic integer or pointer type, found `Foo` + --> $DIR/non-integer-atomic.rs:50:5 | LL | intrinsics::atomic_cxchg::<_, { SeqCst }, { SeqCst }>(p, v, v); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error[E0511]: invalid monomorphization of `atomic_store` intrinsic: expected basic integer or pointer type, found `[u8; 100]` - --> $DIR/non-integer-atomic.rs:80:5 - | -LL | intrinsics::atomic_store::<_, { SeqCst }>(p, v); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -error[E0511]: invalid monomorphization of `atomic_store` intrinsic: expected basic integer or pointer type, found `bool` - --> $DIR/non-integer-atomic.rs:20:5 +error[E0511]: invalid monomorphization of `atomic_store` intrinsic: expected basic integer or pointer type, found `Foo` + --> $DIR/non-integer-atomic.rs:40:5 | LL | intrinsics::atomic_store::<_, { SeqCst }>(p, v); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error[E0511]: invalid monomorphization of `atomic_xchg` intrinsic: expected basic integer or pointer type, found `&dyn Fn()` - --> $DIR/non-integer-atomic.rs:65:5 - | -LL | intrinsics::atomic_xchg::<_, { SeqCst }>(p, v); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - error[E0511]: invalid monomorphization of `atomic_load` intrinsic: expected basic integer or pointer type, found `[u8; 100]` --> $DIR/non-integer-atomic.rs:75:5 | LL | intrinsics::atomic_load::<_, { SeqCst }>(p); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +error[E0511]: invalid monomorphization of `atomic_xchg` intrinsic: expected basic integer or pointer type, found `[u8; 100]` + --> $DIR/non-integer-atomic.rs:85:5 + | +LL | intrinsics::atomic_xchg::<_, { SeqCst }>(p, v); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + error[E0511]: invalid monomorphization of `atomic_load` intrinsic: expected basic integer or pointer type, found `bool` --> $DIR/non-integer-atomic.rs:15:5 | LL | intrinsics::atomic_load::<_, { SeqCst }>(p); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error[E0511]: invalid monomorphization of `atomic_cxchg` intrinsic: expected basic integer or pointer type, found `bool` - --> $DIR/non-integer-atomic.rs:30:5 +error[E0511]: invalid monomorphization of `atomic_xchg` intrinsic: expected basic integer or pointer type, found `bool` + --> $DIR/non-integer-atomic.rs:25:5 | -LL | intrinsics::atomic_cxchg::<_, { SeqCst }, { SeqCst }>(p, v, v); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | intrinsics::atomic_xchg::<_, { SeqCst }>(p, v); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error[E0511]: invalid monomorphization of `atomic_cxchg` intrinsic: expected basic integer or pointer type, found `Foo` - --> $DIR/non-integer-atomic.rs:50:5 +error[E0511]: invalid monomorphization of `atomic_cxchg` intrinsic: expected basic integer or pointer type, found `[u8; 100]` + --> $DIR/non-integer-atomic.rs:90:5 | LL | intrinsics::atomic_cxchg::<_, { SeqCst }, { SeqCst }>(p, v, v); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error[E0511]: invalid monomorphization of `atomic_xchg` intrinsic: expected basic integer or pointer type, found `Foo` - --> $DIR/non-integer-atomic.rs:45:5 +error[E0511]: invalid monomorphization of `atomic_store` intrinsic: expected basic integer or pointer type, found `[u8; 100]` + --> $DIR/non-integer-atomic.rs:80:5 | -LL | intrinsics::atomic_xchg::<_, { SeqCst }>(p, v); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | intrinsics::atomic_store::<_, { SeqCst }>(p, v); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error[E0511]: invalid monomorphization of `atomic_xchg` intrinsic: expected basic integer or pointer type, found `bool` - --> $DIR/non-integer-atomic.rs:25:5 +error[E0511]: invalid monomorphization of `atomic_cxchg` intrinsic: expected basic integer or pointer type, found `bool` + --> $DIR/non-integer-atomic.rs:30:5 | -LL | intrinsics::atomic_xchg::<_, { SeqCst }>(p, v); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | intrinsics::atomic_cxchg::<_, { SeqCst }, { SeqCst }>(p, v, v); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error[E0511]: invalid monomorphization of `atomic_store` intrinsic: expected basic integer or pointer type, found `bool` + --> $DIR/non-integer-atomic.rs:20:5 + | +LL | intrinsics::atomic_store::<_, { SeqCst }>(p, v); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 16 previous errors diff --git a/tests/ui/invalid-compile-flags/indirect-branch-cs-prefix/requires-x86-or-x86_64.aarch64.stderr b/tests/ui/invalid-compile-flags/indirect-branch-cs-prefix/requires-x86-or-x86_64.aarch64.stderr new file mode 100644 index 00000000000..e3f7871da35 --- /dev/null +++ b/tests/ui/invalid-compile-flags/indirect-branch-cs-prefix/requires-x86-or-x86_64.aarch64.stderr @@ -0,0 +1,4 @@ +error: `-Zindirect-branch-cs-prefix` is only supported on x86 and x86_64 + +error: aborting due to 1 previous error + diff --git a/tests/ui/invalid-compile-flags/indirect-branch-cs-prefix/requires-x86-or-x86_64.rs b/tests/ui/invalid-compile-flags/indirect-branch-cs-prefix/requires-x86-or-x86_64.rs new file mode 100644 index 00000000000..bc81c993d26 --- /dev/null +++ b/tests/ui/invalid-compile-flags/indirect-branch-cs-prefix/requires-x86-or-x86_64.rs @@ -0,0 +1,21 @@ +//@ revisions: x86 x86_64 aarch64 + +//@ compile-flags: -Zindirect-branch-cs-prefix + +//@[x86] check-pass +//@[x86] needs-llvm-components: x86 +//@[x86] compile-flags: --target i686-unknown-linux-gnu + +//@[x86_64] check-pass +//@[x86_64] needs-llvm-components: x86 +//@[x86_64] compile-flags: --target x86_64-unknown-linux-gnu + +//@[aarch64] check-fail +//@[aarch64] needs-llvm-components: aarch64 +//@[aarch64] compile-flags: --target aarch64-unknown-linux-gnu + +#![feature(no_core)] +#![no_core] +#![no_main] + +//[aarch64]~? ERROR `-Zindirect-branch-cs-prefix` is only supported on x86 and x86_64 diff --git a/tests/ui/invalid-compile-flags/print-crate-name-request-malformed-crate-name.rs b/tests/ui/invalid-compile-flags/print-crate-name-request-malformed-crate-name.rs index c7f3c2c5403..62f1f6cd09c 100644 --- a/tests/ui/invalid-compile-flags/print-crate-name-request-malformed-crate-name.rs +++ b/tests/ui/invalid-compile-flags/print-crate-name-request-malformed-crate-name.rs @@ -2,4 +2,4 @@ // See also <https://github.com/rust-lang/rust/issues/122001>. //@ compile-flags: --print=crate-name -#![crate_name = concat!("wrapped")] //~ ERROR malformed `crate_name` attribute input +#![crate_name = concat!("wrapped")] //~ ERROR attribute value must be a literal diff --git a/tests/ui/invalid-compile-flags/print-crate-name-request-malformed-crate-name.stderr b/tests/ui/invalid-compile-flags/print-crate-name-request-malformed-crate-name.stderr index b773f7c97aa..fab38dae78b 100644 --- a/tests/ui/invalid-compile-flags/print-crate-name-request-malformed-crate-name.stderr +++ b/tests/ui/invalid-compile-flags/print-crate-name-request-malformed-crate-name.stderr @@ -1,10 +1,8 @@ -error: malformed `crate_name` attribute input - --> $DIR/print-crate-name-request-malformed-crate-name.rs:5:1 +error: attribute value must be a literal + --> $DIR/print-crate-name-request-malformed-crate-name.rs:5:17 | LL | #![crate_name = concat!("wrapped")] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: must be of the form: `#![crate_name = "name"]` - | - = note: for more information, visit <https://doc.rust-lang.org/reference/crates-and-source-files.html#the-crate_name-attribute> + | ^^^^^^^^^^^^^^^^^^ error: aborting due to 1 previous error diff --git a/tests/ui/invalid-compile-flags/print-file-names-request-malformed-crate-name-1.stderr b/tests/ui/invalid-compile-flags/print-file-names-request-malformed-crate-name-1.stderr index 64e38ed8533..d3e60948e4c 100644 --- a/tests/ui/invalid-compile-flags/print-file-names-request-malformed-crate-name-1.stderr +++ b/tests/ui/invalid-compile-flags/print-file-names-request-malformed-crate-name-1.stderr @@ -1,10 +1,9 @@ -error: malformed `crate_name` attribute input +error[E0539]: malformed `crate_name` attribute input --> $DIR/print-file-names-request-malformed-crate-name-1.rs:4:1 | LL | #![crate_name] | ^^^^^^^^^^^^^^ help: must be of the form: `#![crate_name = "name"]` - | - = note: for more information, visit <https://doc.rust-lang.org/reference/crates-and-source-files.html#the-crate_name-attribute> error: aborting due to 1 previous error +For more information about this error, try `rustc --explain E0539`. diff --git a/tests/ui/invalid-compile-flags/print-file-names-request-malformed-crate-name-2.rs b/tests/ui/invalid-compile-flags/print-file-names-request-malformed-crate-name-2.rs index 13c9d1e0027..1ac1208ee44 100644 --- a/tests/ui/invalid-compile-flags/print-file-names-request-malformed-crate-name-2.rs +++ b/tests/ui/invalid-compile-flags/print-file-names-request-malformed-crate-name-2.rs @@ -4,4 +4,4 @@ //@ compile-flags: --print=file-names #![crate_name = "this_one_is_okay"] -#![crate_name = concat!("this_one_is_not")] //~ ERROR malformed `crate_name` attribute input +#![crate_name = concat!("this_one_is_not")] //~ ERROR attribute value must be a literal diff --git a/tests/ui/invalid-compile-flags/print-file-names-request-malformed-crate-name-2.stderr b/tests/ui/invalid-compile-flags/print-file-names-request-malformed-crate-name-2.stderr index e9a5b58e4f9..1571521ff17 100644 --- a/tests/ui/invalid-compile-flags/print-file-names-request-malformed-crate-name-2.stderr +++ b/tests/ui/invalid-compile-flags/print-file-names-request-malformed-crate-name-2.stderr @@ -1,10 +1,8 @@ -error: malformed `crate_name` attribute input - --> $DIR/print-file-names-request-malformed-crate-name-2.rs:7:1 +error: attribute value must be a literal + --> $DIR/print-file-names-request-malformed-crate-name-2.rs:7:17 | LL | #![crate_name = concat!("this_one_is_not")] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: must be of the form: `#![crate_name = "name"]` - | - = note: for more information, visit <https://doc.rust-lang.org/reference/crates-and-source-files.html#the-crate_name-attribute> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 1 previous error diff --git a/tests/ui/invalid-compile-flags/print-file-names-request-malformed-crate-name.rs b/tests/ui/invalid-compile-flags/print-file-names-request-malformed-crate-name.rs index 5fe8bd7945f..6441017c665 100644 --- a/tests/ui/invalid-compile-flags/print-file-names-request-malformed-crate-name.rs +++ b/tests/ui/invalid-compile-flags/print-file-names-request-malformed-crate-name.rs @@ -2,4 +2,4 @@ // See also <https://github.com/rust-lang/rust/issues/122001>. //@ compile-flags: --print=file-names -#![crate_name = concat!("wrapped")] //~ ERROR malformed `crate_name` attribute input +#![crate_name = concat!("wrapped")] //~ ERROR attribute value must be a literal diff --git a/tests/ui/invalid-compile-flags/print-file-names-request-malformed-crate-name.stderr b/tests/ui/invalid-compile-flags/print-file-names-request-malformed-crate-name.stderr index e63525c6a5d..155e2e5a3fa 100644 --- a/tests/ui/invalid-compile-flags/print-file-names-request-malformed-crate-name.stderr +++ b/tests/ui/invalid-compile-flags/print-file-names-request-malformed-crate-name.stderr @@ -1,10 +1,8 @@ -error: malformed `crate_name` attribute input - --> $DIR/print-file-names-request-malformed-crate-name.rs:5:1 +error: attribute value must be a literal + --> $DIR/print-file-names-request-malformed-crate-name.rs:5:17 | LL | #![crate_name = concat!("wrapped")] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: must be of the form: `#![crate_name = "name"]` - | - = note: for more information, visit <https://doc.rust-lang.org/reference/crates-and-source-files.html#the-crate_name-attribute> + | ^^^^^^^^^^^^^^^^^^ error: aborting due to 1 previous error diff --git a/tests/ui/invalid/invalid-no-sanitize.rs b/tests/ui/invalid/invalid-no-sanitize.rs deleted file mode 100644 index b52e3cc83fa..00000000000 --- a/tests/ui/invalid/invalid-no-sanitize.rs +++ /dev/null @@ -1,5 +0,0 @@ -#![feature(no_sanitize)] - -#[no_sanitize(brontosaurus)] //~ ERROR invalid argument -fn main() { -} diff --git a/tests/ui/invalid/invalid-no-sanitize.stderr b/tests/ui/invalid/invalid-no-sanitize.stderr deleted file mode 100644 index b1c80438b31..00000000000 --- a/tests/ui/invalid/invalid-no-sanitize.stderr +++ /dev/null @@ -1,10 +0,0 @@ -error: invalid argument for `no_sanitize` - --> $DIR/invalid-no-sanitize.rs:3:15 - | -LL | #[no_sanitize(brontosaurus)] - | ^^^^^^^^^^^^ - | - = note: expected one of: `address`, `cfi`, `hwaddress`, `kcfi`, `memory`, `memtag`, `shadow-call-stack`, or `thread` - -error: aborting due to 1 previous error - diff --git a/tests/ui/issues/issue-17351.stderr b/tests/ui/issues/issue-17351.stderr index e4c84ab9315..043d4ffc780 100644 --- a/tests/ui/issues/issue-17351.stderr +++ b/tests/ui/issues/issue-17351.stderr @@ -6,7 +6,7 @@ LL | trait Str { fn foo(&self) {} } | | | method in this trait | - = note: `#[warn(dead_code)]` on by default + = note: `#[warn(dead_code)]` (part of `#[warn(unused)]`) on by default warning: 1 warning emitted diff --git a/tests/ui/issues/issue-17546.stderr b/tests/ui/issues/issue-17546.stderr index 25a94dd9723..5bae738d3ec 100644 --- a/tests/ui/issues/issue-17546.stderr +++ b/tests/ui/issues/issue-17546.stderr @@ -3,10 +3,10 @@ error[E0573]: expected type, found variant `NoResult` | LL | fn new() -> NoResult<MyEnum, String> { | ^^^^^^^^^^^^^^^^^^^^^^^^ + | --> $SRC_DIR/core/src/result.rs:LL:COL | = note: similarly named enum `Result` defined here - | help: try using the variant's enum | LL - fn new() -> NoResult<MyEnum, String> { @@ -57,10 +57,10 @@ error[E0573]: expected type, found variant `NoResult` | LL | fn newer() -> NoResult<foo::MyEnum, String> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | --> $SRC_DIR/core/src/result.rs:LL:COL | = note: similarly named enum `Result` defined here - | help: try using the variant's enum | LL - fn newer() -> NoResult<foo::MyEnum, String> { diff --git a/tests/ui/issues/issue-20055-box-trait.stderr b/tests/ui/issues/issue-20055-box-trait.stderr index db9d359e225..b1cbb2a5717 100644 --- a/tests/ui/issues/issue-20055-box-trait.stderr +++ b/tests/ui/issues/issue-20055-box-trait.stderr @@ -6,7 +6,7 @@ LL | trait Boo { LL | fn dummy(&self) { } | ^^^^^ | - = note: `#[warn(dead_code)]` on by default + = note: `#[warn(dead_code)]` (part of `#[warn(unused)]`) on by default warning: 1 warning emitted diff --git a/tests/ui/issues/issue-23485.stderr b/tests/ui/issues/issue-23485.stderr index ed2d2400d0d..7ad518e449b 100644 --- a/tests/ui/issues/issue-23485.stderr +++ b/tests/ui/issues/issue-23485.stderr @@ -7,7 +7,7 @@ LL | trait Iterator { LL | fn clone_first(mut self) -> Option<<Self::Item as Deref>::Target> where | ^^^^^^^^^^^ | - = note: `#[warn(dead_code)]` on by default + = note: `#[warn(dead_code)]` (part of `#[warn(unused)]`) on by default warning: 1 warning emitted diff --git a/tests/ui/issues/issue-26217.stderr b/tests/ui/issues/issue-26217.stderr index 0b153ad7490..a8750567819 100644 --- a/tests/ui/issues/issue-26217.stderr +++ b/tests/ui/issues/issue-26217.stderr @@ -6,11 +6,11 @@ LL | fn bar<'a>() { LL | foo::<&'a i32>(); | ^^^^^^^^^^^^^^ requires that `'a` must outlive `'static` | -note: due to current limitations in the borrow checker, this implies a `'static` lifetime - --> $DIR/issue-26217.rs:1:30 +note: due to a current limitation of the type system, this implies a `'static` lifetime + --> $DIR/issue-26217.rs:1:19 | LL | fn foo<T>() where for<'a> T: 'a {} - | ^^ + | ^^^^^^^^^^^^^ error: aborting due to 1 previous error diff --git a/tests/ui/issues/issue-27033.stderr b/tests/ui/issues/issue-27033.stderr index 7a0ca888d74..129870f8c40 100644 --- a/tests/ui/issues/issue-27033.stderr +++ b/tests/ui/issues/issue-27033.stderr @@ -3,6 +3,7 @@ error[E0530]: match bindings cannot shadow unit variants | LL | None @ _ => {} | ^^^^ cannot be named the same as a unit variant + | --> $SRC_DIR/std/src/prelude/mod.rs:LL:COL | = note: the unit variant `None` is defined here diff --git a/tests/ui/issues/issue-28344.stderr b/tests/ui/issues/issue-28344.stderr index dfd4951f172..c23b5767302 100644 --- a/tests/ui/issues/issue-28344.stderr +++ b/tests/ui/issues/issue-28344.stderr @@ -6,7 +6,7 @@ LL | let x: u8 = BitXor::bitor(0 as u8, 0 as u8); | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! = note: for more information, see <https://doc.rust-lang.org/edition-guide/rust-2021/warnings-promoted-to-error.html> - = note: `#[warn(bare_trait_objects)]` on by default + = note: `#[warn(bare_trait_objects)]` (part of `#[warn(rust_2021_compatibility)]`) on by default help: if this is a dyn-compatible trait, use `dyn` | LL | let x: u8 = <dyn BitXor>::bitor(0 as u8, 0 as u8); diff --git a/tests/ui/issues/issue-29466.rs b/tests/ui/issues/issue-29466.rs index dbc37506a17..3962940e848 100644 --- a/tests/ui/issues/issue-29466.rs +++ b/tests/ui/issues/issue-29466.rs @@ -2,6 +2,9 @@ // //@ run-pass +// FIXME(#61117): Respect debuginfo-level-tests, do not force debuginfo-level=0 +//@ compile-flags: -Cdebuginfo=0 + #![allow(unused_variables)] macro_rules! m( diff --git a/tests/ui/issues/issue-2989.stderr b/tests/ui/issues/issue-2989.stderr index 57181607cec..500ace8f275 100644 --- a/tests/ui/issues/issue-2989.stderr +++ b/tests/ui/issues/issue-2989.stderr @@ -4,7 +4,7 @@ warning: trait `methods` is never used LL | trait methods { | ^^^^^^^ | - = note: `#[warn(dead_code)]` on by default + = note: `#[warn(dead_code)]` (part of `#[warn(unused)]`) on by default warning: 1 warning emitted diff --git a/tests/ui/issues/issue-32782.rs b/tests/ui/issues/issue-32782.rs index e3aa9f3bf2f..1e99a25cec3 100644 --- a/tests/ui/issues/issue-32782.rs +++ b/tests/ui/issues/issue-32782.rs @@ -4,7 +4,9 @@ macro_rules! bar ( macro_rules! foo ( () => ( - #[allow_internal_unstable] //~ ERROR allow_internal_unstable side-steps + #[allow_internal_unstable()] + //~^ ERROR allow_internal_unstable side-steps + //~| ERROR `#[allow_internal_unstable]` attribute cannot be used on macro calls bar!(); ); ); diff --git a/tests/ui/issues/issue-32782.stderr b/tests/ui/issues/issue-32782.stderr index 830d83f6e57..96cd0489b2a 100644 --- a/tests/ui/issues/issue-32782.stderr +++ b/tests/ui/issues/issue-32782.stderr @@ -1,8 +1,8 @@ error[E0658]: allow_internal_unstable side-steps feature gating and stability checks --> $DIR/issue-32782.rs:7:9 | -LL | #[allow_internal_unstable] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | #[allow_internal_unstable()] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ... LL | foo!(); | ------ in this macro invocation @@ -11,6 +11,18 @@ LL | foo!(); = 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` (in Nightly builds, run with -Z macro-backtrace for more info) -error: aborting due to 1 previous error +error: `#[allow_internal_unstable]` attribute cannot be used on macro calls + --> $DIR/issue-32782.rs:7:9 + | +LL | #[allow_internal_unstable()] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +... +LL | foo!(); + | ------ in this macro invocation + | + = help: `#[allow_internal_unstable]` can be applied to macro defs and functions + = note: this error originates in the macro `foo` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0658`. diff --git a/tests/ui/issues/issue-34503.stderr b/tests/ui/issues/issue-34503.stderr index 60d8d76a619..1877e20bbc1 100644 --- a/tests/ui/issues/issue-34503.stderr +++ b/tests/ui/issues/issue-34503.stderr @@ -8,7 +8,7 @@ LL | fn foo(&self) where (T, Option<T>): Ord {} LL | fn bar(&self, x: &Option<T>) -> bool | ^^^ | - = note: `#[warn(dead_code)]` on by default + = note: `#[warn(dead_code)]` (part of `#[warn(unused)]`) on by default warning: 1 warning emitted diff --git a/tests/ui/issues/issue-39367.stderr b/tests/ui/issues/issue-39367.stderr index 65076375e96..1592b8b6672 100644 --- a/tests/ui/issues/issue-39367.stderr +++ b/tests/ui/issues/issue-39367.stderr @@ -11,7 +11,7 @@ LL | | }); | = note: for more information, see <https://doc.rust-lang.org/edition-guide/rust-2024/static-mut-references.html> = note: shared references to mutable statics are dangerous; it's undefined behavior if the static is mutated or if a mutable reference is created for it while the shared reference lives - = note: `#[warn(static_mut_refs)]` on by default + = note: `#[warn(static_mut_refs)]` (part of `#[warn(rust_2024_compatibility)]`) on by default warning: 1 warning emitted diff --git a/tests/ui/issues/issue-45801.stderr b/tests/ui/issues/issue-45801.stderr index 940c1865fa3..9f7c822f165 100644 --- a/tests/ui/issues/issue-45801.stderr +++ b/tests/ui/issues/issue-45801.stderr @@ -2,7 +2,7 @@ error[E0277]: the trait bound `Params: Plugin<i32>` is not satisfied --> $DIR/issue-45801.rs:21:9 | LL | req.get_ref::<Params>(); - | ^^^^^^^ the trait `Plugin<i32>` is not implemented for `Params` + | ^^^^^^^ unsatisfied trait bound | = help: the trait `Plugin<i32>` is not implemented for `Params` but trait `Plugin<Foo>` is implemented for it diff --git a/tests/ui/issues/issue-46311.rs b/tests/ui/issues/issue-46311.rs index 1233a49c582..24435665501 100644 --- a/tests/ui/issues/issue-46311.rs +++ b/tests/ui/issues/issue-46311.rs @@ -1,4 +1,4 @@ fn main() { - 'break: loop { //~ ERROR invalid label name `'break` + 'break: loop { //~ ERROR labels cannot use keyword names } } diff --git a/tests/ui/issues/issue-46311.stderr b/tests/ui/issues/issue-46311.stderr index 86a3602899a..f040ba2c026 100644 --- a/tests/ui/issues/issue-46311.stderr +++ b/tests/ui/issues/issue-46311.stderr @@ -1,4 +1,4 @@ -error: invalid label name `'break` +error: labels cannot use keyword names --> $DIR/issue-46311.rs:2:5 | LL | 'break: loop { diff --git a/tests/ui/issues/issue-47094.stderr b/tests/ui/issues/issue-47094.stderr index 1c6693403b8..da414d68214 100644 --- a/tests/ui/issues/issue-47094.stderr +++ b/tests/ui/issues/issue-47094.stderr @@ -6,7 +6,7 @@ LL | #[repr(C, u8)] | = 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 #68585 <https://github.com/rust-lang/rust/issues/68585> - = note: `#[deny(conflicting_repr_hints)]` on by default + = note: `#[deny(conflicting_repr_hints)]` (part of `#[deny(future_incompatible)]`) on by default error[E0566]: conflicting representation hints --> $DIR/issue-47094.rs:8:8 @@ -32,7 +32,7 @@ LL | #[repr(C, u8)] | = 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 #68585 <https://github.com/rust-lang/rust/issues/68585> - = note: `#[deny(conflicting_repr_hints)]` on by default + = note: `#[deny(conflicting_repr_hints)]` (part of `#[deny(future_incompatible)]`) on by default Future breakage diagnostic: error[E0566]: conflicting representation hints @@ -46,5 +46,5 @@ LL | #[repr(u8)] | = 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 #68585 <https://github.com/rust-lang/rust/issues/68585> - = note: `#[deny(conflicting_repr_hints)]` on by default + = note: `#[deny(conflicting_repr_hints)]` (part of `#[deny(future_incompatible)]`) on by default diff --git a/tests/ui/issues/issue-54410.rs b/tests/ui/issues/issue-54410.rs deleted file mode 100644 index e3e8ca985b9..00000000000 --- a/tests/ui/issues/issue-54410.rs +++ /dev/null @@ -1,8 +0,0 @@ -extern "C" { - pub static mut symbol: [i8]; - //~^ ERROR the size for values of type `[i8]` cannot be known at compilation time -} - -fn main() { - println!("{:p}", unsafe { &symbol }); -} diff --git a/tests/ui/issues/issue-54410.stderr b/tests/ui/issues/issue-54410.stderr deleted file mode 100644 index cb68ada7e13..00000000000 --- a/tests/ui/issues/issue-54410.stderr +++ /dev/null @@ -1,12 +0,0 @@ -error[E0277]: the size for values of type `[i8]` cannot be known at compilation time - --> $DIR/issue-54410.rs:2:5 - | -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 - -For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/issues/issue-5518.rs b/tests/ui/issues/issue-5518.rs deleted file mode 100644 index 333185c482f..00000000000 --- a/tests/ui/issues/issue-5518.rs +++ /dev/null @@ -1,7 +0,0 @@ -//@ run-pass -//@ aux-build:issue-5518.rs - - -extern crate issue_5518 as other; - -fn main() {} diff --git a/tests/ui/issues/issue-5844.rs b/tests/ui/issues/issue-5844.rs deleted file mode 100644 index 23021207ae1..00000000000 --- a/tests/ui/issues/issue-5844.rs +++ /dev/null @@ -1,7 +0,0 @@ -//@aux-build:issue-5844-aux.rs - -extern crate issue_5844_aux; - -fn main() { - issue_5844_aux::rand(); //~ ERROR: requires unsafe -} diff --git a/tests/ui/issues/issue-58734.stderr b/tests/ui/issues/issue-58734.stderr index c246d1fc111..2336a94f150 100644 --- a/tests/ui/issues/issue-58734.stderr +++ b/tests/ui/issues/issue-58734.stderr @@ -6,7 +6,7 @@ LL | Trait::nonexistent(()); | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! = note: for more information, see <https://doc.rust-lang.org/edition-guide/rust-2021/warnings-promoted-to-error.html> - = note: `#[warn(bare_trait_objects)]` on by default + = note: `#[warn(bare_trait_objects)]` (part of `#[warn(rust_2021_compatibility)]`) on by default help: if this is a dyn-compatible trait, use `dyn` | LL | <dyn Trait>::nonexistent(()); diff --git a/tests/ui/issues/issue-5997-outer-generic-parameter/issue-5997-struct.rs b/tests/ui/issues/issue-5997-outer-generic-parameter/issue-5997-struct.rs deleted file mode 100644 index 19d994b0dfb..00000000000 --- a/tests/ui/issues/issue-5997-outer-generic-parameter/issue-5997-struct.rs +++ /dev/null @@ -1,10 +0,0 @@ -fn f<T>() -> bool { - struct S(T); //~ ERROR can't use generic parameters from outer item - - true -} - -fn main() { - let b = f::<isize>(); - assert!(b); -} diff --git a/tests/ui/issues/issue-5997-outer-generic-parameter/issue-5997-struct.stderr b/tests/ui/issues/issue-5997-outer-generic-parameter/issue-5997-struct.stderr deleted file mode 100644 index 670a54894b5..00000000000 --- a/tests/ui/issues/issue-5997-outer-generic-parameter/issue-5997-struct.stderr +++ /dev/null @@ -1,13 +0,0 @@ -error[E0401]: can't use generic parameters from outer item - --> $DIR/issue-5997-struct.rs:2:14 - | -LL | fn f<T>() -> bool { - | - type parameter from outer item -LL | struct S(T); - | -^ use of generic parameter from outer item - | | - | help: try introducing a local generic parameter here: `<T>` - -error: aborting due to 1 previous error - -For more information about this error, try `rustc --explain E0401`. diff --git a/tests/ui/issues/issue-6344-match.rs b/tests/ui/issues/issue-6344-match.rs deleted file mode 100644 index 9251e274383..00000000000 --- a/tests/ui/issues/issue-6344-match.rs +++ /dev/null @@ -1,18 +0,0 @@ -//@ run-pass -#![allow(non_shorthand_field_patterns)] - -struct A { x: usize } - -impl Drop for A { - fn drop(&mut self) {} -} - -pub fn main() { - let a = A { x: 0 }; - - match a { - A { x : ref x } => { - println!("{}", x) - } - } -} diff --git a/tests/ui/issues/issue-7178.rs b/tests/ui/issues/issue-7178.rs deleted file mode 100644 index 408ce0b03eb..00000000000 --- a/tests/ui/issues/issue-7178.rs +++ /dev/null @@ -1,9 +0,0 @@ -//@ run-pass -//@ aux-build:issue-7178.rs - - -extern crate issue_7178 as cross_crate_self; - -pub fn main() { - let _ = cross_crate_self::Foo::new(&1); -} diff --git a/tests/ui/issues/issue-72278.stderr b/tests/ui/issues/issue-72278.stderr index 5468837a305..91efada3d8d 100644 --- a/tests/ui/issues/issue-72278.stderr +++ b/tests/ui/issues/issue-72278.stderr @@ -9,7 +9,7 @@ LL | S.func::<'a, U>() | = 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 #42868 <https://github.com/rust-lang/rust/issues/42868> - = note: `#[warn(late_bound_lifetime_arguments)]` on by default + = note: `#[warn(late_bound_lifetime_arguments)]` (part of `#[warn(future_incompatible)]`) on by default warning: 1 warning emitted diff --git a/tests/ui/issues/issue-7575.stderr b/tests/ui/issues/issue-7575.stderr deleted file mode 100644 index 2f987d19c80..00000000000 --- a/tests/ui/issues/issue-7575.stderr +++ /dev/null @@ -1,10 +0,0 @@ -warning: trait `Foo` is never used - --> $DIR/issue-7575.rs:3:7 - | -LL | trait Foo { - | ^^^ - | - = note: `#[warn(dead_code)]` on by default - -warning: 1 warning emitted - diff --git a/tests/ui/issues/issue-77218/issue-77218-2.fixed b/tests/ui/issues/issue-77218/issue-77218-2.fixed deleted file mode 100644 index 98d79b5da65..00000000000 --- a/tests/ui/issues/issue-77218/issue-77218-2.fixed +++ /dev/null @@ -1,6 +0,0 @@ -//@ run-rustfix -fn main() { - let value = [7u8]; - while let Some(0) = value.get(0) { //~ ERROR invalid left-hand side of assignment - } -} diff --git a/tests/ui/issues/issue-77218/issue-77218-2.rs b/tests/ui/issues/issue-77218/issue-77218-2.rs deleted file mode 100644 index 3be38f8f721..00000000000 --- a/tests/ui/issues/issue-77218/issue-77218-2.rs +++ /dev/null @@ -1,6 +0,0 @@ -//@ run-rustfix -fn main() { - let value = [7u8]; - while Some(0) = value.get(0) { //~ ERROR invalid left-hand side of assignment - } -} diff --git a/tests/ui/issues/issue-77218/issue-77218-2.stderr b/tests/ui/issues/issue-77218/issue-77218-2.stderr deleted file mode 100644 index dfed0b6e67e..00000000000 --- a/tests/ui/issues/issue-77218/issue-77218-2.stderr +++ /dev/null @@ -1,16 +0,0 @@ -error[E0070]: invalid left-hand side of assignment - --> $DIR/issue-77218-2.rs:4:19 - | -LL | while Some(0) = value.get(0) { - | - ^ - | | - | cannot assign to this expression - | -help: you might have meant to use pattern destructuring - | -LL | while let Some(0) = value.get(0) { - | +++ - -error: aborting due to 1 previous error - -For more information about this error, try `rustc --explain E0070`. diff --git a/tests/ui/issues/issue-7899.rs b/tests/ui/issues/issue-7899.rs deleted file mode 100644 index 4b69f3e3d89..00000000000 --- a/tests/ui/issues/issue-7899.rs +++ /dev/null @@ -1,10 +0,0 @@ -//@ run-pass -#![allow(unused_variables)] -//@ aux-build:issue-7899.rs - - -extern crate issue_7899 as testcrate; - -fn main() { - let f = testcrate::V2(1.0f32, 2.0f32); -} diff --git a/tests/ui/issues/issue-8044.rs b/tests/ui/issues/issue-8044.rs deleted file mode 100644 index 3c10bbca634..00000000000 --- a/tests/ui/issues/issue-8044.rs +++ /dev/null @@ -1,10 +0,0 @@ -//@ run-pass -//@ aux-build:issue-8044.rs - - -extern crate issue_8044 as minimal; -use minimal::{BTree, leaf}; - -pub fn main() { - BTree::<isize> { node: leaf(1) }; -} diff --git a/tests/ui/issues/issue-8401.rs b/tests/ui/issues/issue-8401.rs deleted file mode 100644 index 1df63516fb0..00000000000 --- a/tests/ui/issues/issue-8401.rs +++ /dev/null @@ -1,7 +0,0 @@ -//@ run-pass -//@ aux-build:issue-8401.rs - - -extern crate issue_8401; - -pub fn main() {} diff --git a/tests/ui/issues/issue-9123.rs b/tests/ui/issues/issue-9123.rs deleted file mode 100644 index bbf6c13341c..00000000000 --- a/tests/ui/issues/issue-9123.rs +++ /dev/null @@ -1,7 +0,0 @@ -//@ run-pass -//@ aux-build:issue-9123.rs - - -extern crate issue_9123; - -pub fn main() {} diff --git a/tests/ui/iterators/into-iter-on-arrays-2018.stderr b/tests/ui/iterators/into-iter-on-arrays-2018.stderr index 8818ef80f76..6419d779b4f 100644 --- a/tests/ui/iterators/into-iter-on-arrays-2018.stderr +++ b/tests/ui/iterators/into-iter-on-arrays-2018.stderr @@ -6,7 +6,7 @@ LL | let _: Iter<'_, i32> = array.into_iter(); | = warning: this changes meaning in Rust 2021 = note: for more information, see <https://doc.rust-lang.org/edition-guide/rust-2021/IntoIterator-for-arrays.html> - = note: `#[warn(array_into_iter)]` on by default + = note: `#[warn(array_into_iter)]` (part of `#[warn(rust_2021_compatibility)]`) on by default help: use `.iter()` instead of `.into_iter()` to avoid ambiguity | LL - let _: Iter<'_, i32> = array.into_iter(); diff --git a/tests/ui/iterators/into-iter-on-arrays-lint.stderr b/tests/ui/iterators/into-iter-on-arrays-lint.stderr index a9dfa5819c1..a3eb3133a00 100644 --- a/tests/ui/iterators/into-iter-on-arrays-lint.stderr +++ b/tests/ui/iterators/into-iter-on-arrays-lint.stderr @@ -6,7 +6,7 @@ LL | small.into_iter(); | = warning: this changes meaning in Rust 2021 = note: for more information, see <https://doc.rust-lang.org/edition-guide/rust-2021/IntoIterator-for-arrays.html> - = note: `#[warn(array_into_iter)]` on by default + = note: `#[warn(array_into_iter)]` (part of `#[warn(rust_2021_compatibility)]`) on by default help: use `.iter()` instead of `.into_iter()` to avoid ambiguity | LL - small.into_iter(); diff --git a/tests/ui/iterators/into-iter-on-boxed-slices-2021.stderr b/tests/ui/iterators/into-iter-on-boxed-slices-2021.stderr index a0c1432756d..d2df6a2f40c 100644 --- a/tests/ui/iterators/into-iter-on-boxed-slices-2021.stderr +++ b/tests/ui/iterators/into-iter-on-boxed-slices-2021.stderr @@ -6,7 +6,7 @@ LL | let _: Iter<'_, i32> = boxed_slice.into_iter(); | = warning: this changes meaning in Rust 2024 = note: for more information, see <https://doc.rust-lang.org/edition-guide/rust-2024/intoiterator-box-slice.html> - = note: `#[warn(boxed_slice_into_iter)]` on by default + = note: `#[warn(boxed_slice_into_iter)]` (part of `#[warn(rust_2024_compatibility)]`) on by default help: use `.iter()` instead of `.into_iter()` to avoid ambiguity | LL - let _: Iter<'_, i32> = boxed_slice.into_iter(); diff --git a/tests/ui/iterators/into-iter-on-boxed-slices-lint.stderr b/tests/ui/iterators/into-iter-on-boxed-slices-lint.stderr index 377455d6a26..670a741ab8b 100644 --- a/tests/ui/iterators/into-iter-on-boxed-slices-lint.stderr +++ b/tests/ui/iterators/into-iter-on-boxed-slices-lint.stderr @@ -6,7 +6,7 @@ LL | boxed.into_iter(); | = warning: this changes meaning in Rust 2024 = note: for more information, see <https://doc.rust-lang.org/edition-guide/rust-2024/intoiterator-box-slice.html> - = note: `#[warn(boxed_slice_into_iter)]` on by default + = note: `#[warn(boxed_slice_into_iter)]` (part of `#[warn(rust_2024_compatibility)]`) on by default help: use `.iter()` instead of `.into_iter()` to avoid ambiguity | LL - boxed.into_iter(); diff --git a/tests/ui/issues/issue-81584.fixed b/tests/ui/iterators/iterator-scope-collect-suggestion-81584.fixed index c3d33a1b4f8..0e3d48fe27d 100644 --- a/tests/ui/issues/issue-81584.fixed +++ b/tests/ui/iterators/iterator-scope-collect-suggestion-81584.fixed @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/81584 //@ run-rustfix fn main() { let _ = vec![vec![0, 1], vec![2]] diff --git a/tests/ui/issues/issue-81584.rs b/tests/ui/iterators/iterator-scope-collect-suggestion-81584.rs index 27db73aaa2c..3fba39517fc 100644 --- a/tests/ui/issues/issue-81584.rs +++ b/tests/ui/iterators/iterator-scope-collect-suggestion-81584.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/81584 //@ run-rustfix fn main() { let _ = vec![vec![0, 1], vec![2]] diff --git a/tests/ui/issues/issue-81584.stderr b/tests/ui/iterators/iterator-scope-collect-suggestion-81584.stderr index eb97916ad75..e180183e7e3 100644 --- a/tests/ui/issues/issue-81584.stderr +++ b/tests/ui/iterators/iterator-scope-collect-suggestion-81584.stderr @@ -1,5 +1,5 @@ error[E0515]: cannot return value referencing function parameter `y` - --> $DIR/issue-81584.rs:5:22 + --> $DIR/iterator-scope-collect-suggestion-81584.rs:6:22 | LL | .map(|y| y.iter().map(|x| x + 1)) | -^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/kindck/kindck-copy.stderr b/tests/ui/kindck/kindck-copy.stderr index aee2aa98a60..f5623ddd4f7 100644 --- a/tests/ui/kindck/kindck-copy.stderr +++ b/tests/ui/kindck/kindck-copy.stderr @@ -120,8 +120,13 @@ error[E0277]: the trait bound `MyNoncopyStruct: Copy` is not satisfied --> $DIR/kindck-copy.rs:64:19 | LL | assert_copy::<MyNoncopyStruct>(); - | ^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `MyNoncopyStruct` + | ^^^^^^^^^^^^^^^ unsatisfied trait bound | +help: the trait `Copy` is not implemented for `MyNoncopyStruct` + --> $DIR/kindck-copy.rs:15:1 + | +LL | struct MyNoncopyStruct { + | ^^^^^^^^^^^^^^^^^^^^^^ note: required by a bound in `assert_copy` --> $DIR/kindck-copy.rs:5:18 | diff --git a/tests/ui/label/label-static.rs b/tests/ui/label/label-static.rs index 95e764d0187..ef06658506a 100644 --- a/tests/ui/label/label-static.rs +++ b/tests/ui/label/label-static.rs @@ -1,5 +1,5 @@ fn main() { - 'static: loop { //~ ERROR invalid label name `'static` - break 'static //~ ERROR invalid label name `'static` + 'static: loop { //~ ERROR labels cannot use keyword names + break 'static //~ ERROR labels cannot use keyword names } } diff --git a/tests/ui/label/label-static.stderr b/tests/ui/label/label-static.stderr index 1d3251d1b5f..f6ae8b44c08 100644 --- a/tests/ui/label/label-static.stderr +++ b/tests/ui/label/label-static.stderr @@ -1,10 +1,10 @@ -error: invalid label name `'static` +error: labels cannot use keyword names --> $DIR/label-static.rs:2:5 | LL | 'static: loop { | ^^^^^^^ -error: invalid label name `'static` +error: labels cannot use keyword names --> $DIR/label-static.rs:3:15 | LL | break 'static diff --git a/tests/ui/label/label-underscore.rs b/tests/ui/label/label-underscore.rs index de67f3d2c3e..8f1f90fe7c0 100644 --- a/tests/ui/label/label-underscore.rs +++ b/tests/ui/label/label-underscore.rs @@ -1,5 +1,5 @@ fn main() { - '_: loop { //~ ERROR invalid label name `'_` - break '_ //~ ERROR invalid label name `'_` + '_: loop { //~ ERROR labels cannot use keyword names + break '_ //~ ERROR labels cannot use keyword names } } diff --git a/tests/ui/label/label-underscore.stderr b/tests/ui/label/label-underscore.stderr index 4558ec4cb41..c0eb178d0f0 100644 --- a/tests/ui/label/label-underscore.stderr +++ b/tests/ui/label/label-underscore.stderr @@ -1,10 +1,10 @@ -error: invalid label name `'_` +error: labels cannot use keyword names --> $DIR/label-underscore.rs:2:5 | LL | '_: loop { | ^^ -error: invalid label name `'_` +error: labels cannot use keyword names --> $DIR/label-underscore.rs:3:15 | LL | break '_ diff --git a/tests/ui/lang-items/issue-83471.stderr b/tests/ui/lang-items/issue-83471.stderr index e913c0bf10f..28fa552fbeb 100644 --- a/tests/ui/lang-items/issue-83471.stderr +++ b/tests/ui/lang-items/issue-83471.stderr @@ -48,7 +48,7 @@ LL | fn call(export_name); | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! = note: for more information, see issue #41686 <https://github.com/rust-lang/rust/issues/41686> - = note: `#[warn(anonymous_parameters)]` on by default + = note: `#[warn(anonymous_parameters)]` (part of `#[warn(rust_2018_compatibility)]`) on by default error[E0718]: `fn` lang item must be applied to a trait with 1 generic argument --> $DIR/issue-83471.rs:19:1 diff --git a/tests/ui/layout/base-layout-is-sized-ice-123078.rs b/tests/ui/layout/base-layout-is-sized-ice-123078.rs index b1c33e15075..bbe32b2022a 100644 --- a/tests/ui/layout/base-layout-is-sized-ice-123078.rs +++ b/tests/ui/layout/base-layout-is-sized-ice-123078.rs @@ -8,7 +8,9 @@ struct S { } const C: S = unsafe { std::mem::transmute(()) }; -//~^ ERROR cannot transmute between types of different sizes, or dependently-sized types +//~^ ERROR the type `S` has an unknown layout +//~| ERROR cannot transmute between types of different sizes, or dependently-sized types + const _: [(); { C; 0 diff --git a/tests/ui/layout/base-layout-is-sized-ice-123078.stderr b/tests/ui/layout/base-layout-is-sized-ice-123078.stderr index d8743d4e6d6..d6cebd3e7ae 100644 --- a/tests/ui/layout/base-layout-is-sized-ice-123078.stderr +++ b/tests/ui/layout/base-layout-is-sized-ice-123078.stderr @@ -16,6 +16,12 @@ help: the `Box` type always has a statically known size and allocates its conten LL | a: Box<[u8]>, | ++++ + +error[E0080]: the type `S` has an unknown layout + --> $DIR/base-layout-is-sized-ice-123078.rs:10:1 + | +LL | const C: S = unsafe { std::mem::transmute(()) }; + | ^^^^^^^^^^ evaluation of `C` failed here + error[E0512]: cannot transmute between types of different sizes, or dependently-sized types --> $DIR/base-layout-is-sized-ice-123078.rs:10:23 | @@ -25,7 +31,7 @@ LL | const C: S = unsafe { std::mem::transmute(()) }; = note: source type: `()` (0 bits) = note: target type: `S` (the type `S` has an unknown layout) -error: aborting due to 2 previous errors +error: aborting due to 3 previous errors -Some errors have detailed explanations: E0277, E0512. -For more information about an error, try `rustc --explain E0277`. +Some errors have detailed explanations: E0080, E0277, E0512. +For more information about an error, try `rustc --explain E0080`. diff --git a/tests/ui/layout/normalization-failure.rs b/tests/ui/layout/normalization-failure.rs index c0f8710c03c..a0195224d8c 100644 --- a/tests/ui/layout/normalization-failure.rs +++ b/tests/ui/layout/normalization-failure.rs @@ -49,8 +49,8 @@ fn check<T: Project1>() { unsafe { std::mem::transmute::<_, ()>(opaque::<T>().get()); //~^ ERROR: cannot transmute - //~| NOTE: (unable to determine layout for `<impl Project2 as Project2>::Assoc2` because `<impl Project2 as Project2>::Assoc2` cannot be normalized) - //~| NOTE: (0 bits) + //~| NOTE: source type: `{type error}` (the type has an unknown layout) + //~| NOTE: target type: `()` (0 bits) } } diff --git a/tests/ui/layout/normalization-failure.stderr b/tests/ui/layout/normalization-failure.stderr index 5fe38d4403a..1c78fc6ac41 100644 --- a/tests/ui/layout/normalization-failure.stderr +++ b/tests/ui/layout/normalization-failure.stderr @@ -4,7 +4,7 @@ error[E0512]: cannot transmute between types of different sizes, or dependently- LL | std::mem::transmute::<_, ()>(opaque::<T>().get()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: source type: `<impl Project2 as Project2>::Assoc2` (unable to determine layout for `<impl Project2 as Project2>::Assoc2` because `<impl Project2 as Project2>::Assoc2` cannot be normalized) + = note: source type: `{type error}` (the type has an unknown layout) = note: target type: `()` (0 bits) error: aborting due to 1 previous error diff --git a/tests/ui/layout/transmute-to-tail-with-err.rs b/tests/ui/layout/transmute-to-tail-with-err.rs index 6753ce15ed1..614c1ac756e 100644 --- a/tests/ui/layout/transmute-to-tail-with-err.rs +++ b/tests/ui/layout/transmute-to-tail-with-err.rs @@ -5,4 +5,5 @@ struct Bar(Box<dyn Trait<T>>); fn main() { let x: Bar = unsafe { std::mem::transmute(()) }; + //~^ ERROR cannot transmute between types of different size } diff --git a/tests/ui/layout/transmute-to-tail-with-err.stderr b/tests/ui/layout/transmute-to-tail-with-err.stderr index 433c6b38d0b..cff40812717 100644 --- a/tests/ui/layout/transmute-to-tail-with-err.stderr +++ b/tests/ui/layout/transmute-to-tail-with-err.stderr @@ -9,6 +9,16 @@ help: you might be missing a type parameter LL | struct Bar<T>(Box<dyn Trait<T>>); | +++ -error: aborting due to 1 previous error +error[E0512]: cannot transmute between types of different sizes, or dependently-sized types + --> $DIR/transmute-to-tail-with-err.rs:7:27 + | +LL | let x: Bar = unsafe { std::mem::transmute(()) }; + | ^^^^^^^^^^^^^^^^^^^ + | + = note: source type: `()` (0 bits) + = note: target type: `Bar` (the type has an unknown layout) + +error: aborting due to 2 previous errors -For more information about this error, try `rustc --explain E0412`. +Some errors have detailed explanations: E0412, E0512. +For more information about an error, try `rustc --explain E0412`. diff --git a/tests/ui/issues/issue-53419.rs b/tests/ui/lifetimes/dyn-trait-function-pointer-53419.rs index 55d41f2005d..b1017b104ac 100644 --- a/tests/ui/issues/issue-53419.rs +++ b/tests/ui/lifetimes/dyn-trait-function-pointer-53419.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/53419 //@ check-pass struct Foo { diff --git a/tests/ui/lifetimes/issue-105507.fixed b/tests/ui/lifetimes/issue-105507.fixed index 177da01b154..46d4f14a245 100644 --- a/tests/ui/lifetimes/issue-105507.fixed +++ b/tests/ui/lifetimes/issue-105507.fixed @@ -25,8 +25,8 @@ impl<T> ProjectedMyTrait for T where T: Project, for<'a> T::Projected<'a>: MyTrait, - //~^ NOTE due to current limitations in the borrow checker, this implies a `'static` lifetime - //~| NOTE due to current limitations in the borrow checker, this implies a `'static` lifetime + //~^ NOTE due to a current limitation of the type system, this implies a `'static` lifetime + //~| NOTE due to a current limitation of the type system, this implies a `'static` lifetime {} fn require_trait<T: MyTrait>(_: T) {} diff --git a/tests/ui/lifetimes/issue-105507.rs b/tests/ui/lifetimes/issue-105507.rs index 858fa19a029..f1721fee5b4 100644 --- a/tests/ui/lifetimes/issue-105507.rs +++ b/tests/ui/lifetimes/issue-105507.rs @@ -25,8 +25,8 @@ impl<T> ProjectedMyTrait for T where T: Project, for<'a> T::Projected<'a>: MyTrait, - //~^ NOTE due to current limitations in the borrow checker, this implies a `'static` lifetime - //~| NOTE due to current limitations in the borrow checker, this implies a `'static` lifetime + //~^ NOTE due to a current limitation of the type system, this implies a `'static` lifetime + //~| NOTE due to a current limitation of the type system, this implies a `'static` lifetime {} fn require_trait<T: MyTrait>(_: T) {} diff --git a/tests/ui/lifetimes/issue-105507.stderr b/tests/ui/lifetimes/issue-105507.stderr index 44d3a7eb9a4..7fccba7cc44 100644 --- a/tests/ui/lifetimes/issue-105507.stderr +++ b/tests/ui/lifetimes/issue-105507.stderr @@ -4,7 +4,7 @@ error: `T` does not live long enough LL | require_trait(wrap); | ^^^^^^^^^^^^^^^^^^^ | -note: due to current limitations in the borrow checker, this implies a `'static` lifetime +note: due to a current limitation of the type system, this implies a `'static` lifetime --> $DIR/issue-105507.rs:27:35 | LL | for<'a> T::Projected<'a>: MyTrait, @@ -20,7 +20,7 @@ error: `U` does not live long enough LL | require_trait(wrap1); | ^^^^^^^^^^^^^^^^^^^^ | -note: due to current limitations in the borrow checker, this implies a `'static` lifetime +note: due to a current limitation of the type system, this implies a `'static` lifetime --> $DIR/issue-105507.rs:27:35 | LL | for<'a> T::Projected<'a>: MyTrait, diff --git a/tests/ui/lifetimes/issue-95023.stderr b/tests/ui/lifetimes/issue-95023.stderr index dffa033fb17..013bc51ff78 100644 --- a/tests/ui/lifetimes/issue-95023.stderr +++ b/tests/ui/lifetimes/issue-95023.stderr @@ -46,7 +46,11 @@ error[E0277]: expected a `FnMut(&isize)` closure, found `Error` LL | impl Fn(&isize) for Error { | ^^^^^ expected an `FnMut(&isize)` closure, found `Error` | - = help: the trait `FnMut(&isize)` is not implemented for `Error` +help: the trait `FnMut(&isize)` is not implemented for `Error` + --> $DIR/issue-95023.rs:2:1 + | +LL | struct Error(ErrorKind); + | ^^^^^^^^^^^^ note: required by a bound in `Fn` --> $SRC_DIR/core/src/ops/function.rs:LL:COL diff --git a/tests/ui/lifetimes/mismatched-lifetime-syntaxes-details/example-from-issue48686.stderr b/tests/ui/lifetimes/mismatched-lifetime-syntaxes-details/example-from-issue48686.stderr index 5a7a5a6ebf9..2b7d6a6da27 100644 --- a/tests/ui/lifetimes/mismatched-lifetime-syntaxes-details/example-from-issue48686.stderr +++ b/tests/ui/lifetimes/mismatched-lifetime-syntaxes-details/example-from-issue48686.stderr @@ -1,8 +1,8 @@ error: eliding a lifetime that's named elsewhere is confusing - --> $DIR/example-from-issue48686.rs:6:21 + --> $DIR/example-from-issue48686.rs:6:50 | LL | pub fn get_mut(&'static self, x: &mut u8) -> &mut u8 { - | ^^^^^^^ ------- the same lifetime is elided here + | ------- ^^^^^^^ the same lifetime is elided here | | | the lifetime is named here | diff --git a/tests/ui/lifetimes/mismatched-lifetime-syntaxes-details/missing-lifetime-kind.stderr b/tests/ui/lifetimes/mismatched-lifetime-syntaxes-details/missing-lifetime-kind.stderr index af56a0a0ea5..c4d6e78d787 100644 --- a/tests/ui/lifetimes/mismatched-lifetime-syntaxes-details/missing-lifetime-kind.stderr +++ b/tests/ui/lifetimes/mismatched-lifetime-syntaxes-details/missing-lifetime-kind.stderr @@ -1,8 +1,8 @@ error: eliding a lifetime that's named elsewhere is confusing - --> $DIR/missing-lifetime-kind.rs:3:22 + --> $DIR/missing-lifetime-kind.rs:3:32 | LL | fn ampersand<'a>(x: &'a u8) -> &u8 { - | ^^ --- the same lifetime is elided here + | -- ^^^ the same lifetime is elided here | | | the lifetime is named here | @@ -18,10 +18,10 @@ LL | fn ampersand<'a>(x: &'a u8) -> &'a u8 { | ++ error: hiding a lifetime that's named elsewhere is confusing - --> $DIR/missing-lifetime-kind.rs:10:21 + --> $DIR/missing-lifetime-kind.rs:10:31 | LL | fn brackets<'a>(x: &'a u8) -> Brackets { - | ^^ -------- the same lifetime is hidden here + | -- ^^^^^^^^ the same lifetime is hidden here | | | the lifetime is named here | @@ -32,10 +32,10 @@ LL | fn brackets<'a>(x: &'a u8) -> Brackets<'a> { | ++++ error: hiding a lifetime that's named elsewhere is confusing - --> $DIR/missing-lifetime-kind.rs:17:18 + --> $DIR/missing-lifetime-kind.rs:17:28 | LL | fn comma<'a>(x: &'a u8) -> Comma<u8> { - | ^^ --------- the same lifetime is hidden here + | -- ^^^^^^^^^ the same lifetime is hidden here | | | the lifetime is named here | @@ -46,10 +46,10 @@ LL | fn comma<'a>(x: &'a u8) -> Comma<'a, u8> { | +++ error: eliding a lifetime that's named elsewhere is confusing - --> $DIR/missing-lifetime-kind.rs:22:23 + --> $DIR/missing-lifetime-kind.rs:22:34 | LL | fn underscore<'a>(x: &'a u8) -> &'_ u8 { - | ^^ -- the same lifetime is elided here + | -- ^^ the same lifetime is elided here | | | the lifetime is named here | diff --git a/tests/ui/lifetimes/mismatched-lifetime-syntaxes-details/not-tied-to-crate.stderr b/tests/ui/lifetimes/mismatched-lifetime-syntaxes-details/not-tied-to-crate.stderr index cf0a29678fa..28de809faab 100644 --- a/tests/ui/lifetimes/mismatched-lifetime-syntaxes-details/not-tied-to-crate.stderr +++ b/tests/ui/lifetimes/mismatched-lifetime-syntaxes-details/not-tied-to-crate.stderr @@ -1,8 +1,8 @@ warning: eliding a lifetime that's named elsewhere is confusing - --> $DIR/not-tied-to-crate.rs:8:16 + --> $DIR/not-tied-to-crate.rs:8:31 | LL | fn bar(x: &'static u8) -> &u8 { - | ^^^^^^^ --- the same lifetime is elided here + | ------- ^^^ the same lifetime is elided here | | | the lifetime is named here | @@ -18,10 +18,10 @@ LL | fn bar(x: &'static u8) -> &'static u8 { | +++++++ error: eliding a lifetime that's named elsewhere is confusing - --> $DIR/not-tied-to-crate.rs:14:16 + --> $DIR/not-tied-to-crate.rs:14:31 | LL | fn baz(x: &'static u8) -> &u8 { - | ^^^^^^^ --- the same lifetime is elided here + | ------- ^^^ the same lifetime is elided here | | | the lifetime is named here | diff --git a/tests/ui/lifetimes/mismatched-lifetime-syntaxes-details/static.stderr b/tests/ui/lifetimes/mismatched-lifetime-syntaxes-details/static.stderr index d60bec6f7e4..5f21a2877a7 100644 --- a/tests/ui/lifetimes/mismatched-lifetime-syntaxes-details/static.stderr +++ b/tests/ui/lifetimes/mismatched-lifetime-syntaxes-details/static.stderr @@ -1,8 +1,8 @@ error: eliding a lifetime that's named elsewhere is confusing - --> $DIR/static.rs:16:18 + --> $DIR/static.rs:16:33 | LL | fn ampersand(x: &'static u8) -> &u8 { - | ^^^^^^^ --- the same lifetime is elided here + | ------- ^^^ the same lifetime is elided here | | | the lifetime is named here | @@ -18,10 +18,10 @@ LL | fn ampersand(x: &'static u8) -> &'static u8 { | +++++++ error: hiding a lifetime that's named elsewhere is confusing - --> $DIR/static.rs:23:17 + --> $DIR/static.rs:23:32 | LL | fn brackets(x: &'static u8) -> Brackets { - | ^^^^^^^ -------- the same lifetime is hidden here + | ------- ^^^^^^^^ the same lifetime is hidden here | | | the lifetime is named here | @@ -32,10 +32,10 @@ LL | fn brackets(x: &'static u8) -> Brackets<'static> { | +++++++++ error: hiding a lifetime that's named elsewhere is confusing - --> $DIR/static.rs:30:14 + --> $DIR/static.rs:30:29 | LL | fn comma(x: &'static u8) -> Comma<u8> { - | ^^^^^^^ --------- the same lifetime is hidden here + | ------- ^^^^^^^^^ the same lifetime is hidden here | | | the lifetime is named here | @@ -46,10 +46,10 @@ LL | fn comma(x: &'static u8) -> Comma<'static, u8> { | ++++++++ error: eliding a lifetime that's named elsewhere is confusing - --> $DIR/static.rs:35:19 + --> $DIR/static.rs:35:35 | LL | fn underscore(x: &'static u8) -> &'_ u8 { - | ^^^^^^^ -- the same lifetime is elided here + | ------- ^^ the same lifetime is elided here | | | the lifetime is named here | diff --git a/tests/ui/lifetimes/mismatched-lifetime-syntaxes.rs b/tests/ui/lifetimes/mismatched-lifetime-syntaxes.rs index f6260c47202..f404c4163a9 100644 --- a/tests/ui/lifetimes/mismatched-lifetime-syntaxes.rs +++ b/tests/ui/lifetimes/mismatched-lifetime-syntaxes.rs @@ -36,8 +36,8 @@ fn explicit_bound_path_to_implicit_path<'a>(v: ContainsLifetime<'a>) -> Contains fn explicit_bound_path_to_explicit_anonymous_path<'a>( v: ContainsLifetime<'a>, - //~^ ERROR eliding a lifetime that's named elsewhere is confusing ) -> ContainsLifetime<'_> { + //~^ ERROR eliding a lifetime that's named elsewhere is confusing v } @@ -188,8 +188,8 @@ mod impl_trait { fn explicit_bound_path_to_impl_trait_precise_capture<'a>( v: ContainsLifetime<'a>, - //~^ ERROR eliding a lifetime that's named elsewhere is confusing ) -> impl FnOnce() + use<'_> { + //~^ ERROR eliding a lifetime that's named elsewhere is confusing move || _ = v } } @@ -208,8 +208,8 @@ mod dyn_trait { fn explicit_bound_path_to_dyn_trait_bound<'a>( v: ContainsLifetime<'a>, - //~^ ERROR hiding a lifetime that's named elsewhere is confusing ) -> Box<dyn Iterator<Item = ContainsLifetime> + '_> { + //~^ ERROR hiding a lifetime that's named elsewhere is confusing Box::new(iter::once(v)) } } diff --git a/tests/ui/lifetimes/mismatched-lifetime-syntaxes.stderr b/tests/ui/lifetimes/mismatched-lifetime-syntaxes.stderr index 20b7561c594..89768fc764a 100644 --- a/tests/ui/lifetimes/mismatched-lifetime-syntaxes.stderr +++ b/tests/ui/lifetimes/mismatched-lifetime-syntaxes.stderr @@ -1,8 +1,8 @@ error: eliding a lifetime that's named elsewhere is confusing - --> $DIR/mismatched-lifetime-syntaxes.rs:10:47 + --> $DIR/mismatched-lifetime-syntaxes.rs:10:57 | LL | fn explicit_bound_ref_to_implicit_ref<'a>(v: &'a u8) -> &u8 { - | ^^ --- the same lifetime is elided here + | -- ^^^ the same lifetime is elided here | | | the lifetime is named here | @@ -18,10 +18,10 @@ LL | fn explicit_bound_ref_to_implicit_ref<'a>(v: &'a u8) -> &'a u8 { | ++ error: eliding a lifetime that's named elsewhere is confusing - --> $DIR/mismatched-lifetime-syntaxes.rs:15:57 + --> $DIR/mismatched-lifetime-syntaxes.rs:15:68 | LL | fn explicit_bound_ref_to_explicit_anonymous_ref<'a>(v: &'a u8) -> &'_ u8 { - | ^^ -- the same lifetime is elided here + | -- ^^ the same lifetime is elided here | | | the lifetime is named here | @@ -36,7 +36,7 @@ error: hiding a lifetime that's elided elsewhere is confusing --> $DIR/mismatched-lifetime-syntaxes.rs:22:48 | LL | fn implicit_path_to_explicit_anonymous_path(v: ContainsLifetime) -> ContainsLifetime<'_> { - | ^^^^^^^^^^^^^^^^ -- the same lifetime is elided here + | ^^^^^^^^^^^^^^^^ ^^ the same lifetime is elided here | | | the lifetime is hidden here | @@ -50,7 +50,7 @@ error: hiding a lifetime that's elided elsewhere is confusing --> $DIR/mismatched-lifetime-syntaxes.rs:27:65 | LL | fn explicit_anonymous_path_to_implicit_path(v: ContainsLifetime<'_>) -> ContainsLifetime { - | ^^ ---------------- the same lifetime is hidden here + | ^^ ^^^^^^^^^^^^^^^^ the same lifetime is hidden here | | | the lifetime is elided here | @@ -61,10 +61,10 @@ LL | fn explicit_anonymous_path_to_implicit_path(v: ContainsLifetime<'_>) -> Con | ++++ error: hiding a lifetime that's named elsewhere is confusing - --> $DIR/mismatched-lifetime-syntaxes.rs:32:65 + --> $DIR/mismatched-lifetime-syntaxes.rs:32:73 | LL | fn explicit_bound_path_to_implicit_path<'a>(v: ContainsLifetime<'a>) -> ContainsLifetime { - | ^^ ---------------- the same lifetime is hidden here + | -- ^^^^^^^^^^^^^^^^ the same lifetime is hidden here | | | the lifetime is named here | @@ -75,13 +75,12 @@ LL | fn explicit_bound_path_to_implicit_path<'a>(v: ContainsLifetime<'a>) -> Con | ++++ error: eliding a lifetime that's named elsewhere is confusing - --> $DIR/mismatched-lifetime-syntaxes.rs:38:25 + --> $DIR/mismatched-lifetime-syntaxes.rs:39:23 | LL | v: ContainsLifetime<'a>, - | ^^ the lifetime is named here -LL | + | -- the lifetime is named here LL | ) -> ContainsLifetime<'_> { - | -- the same lifetime is elided here + | ^^ the same lifetime is elided here | = help: the same lifetime is referred to in inconsistent ways, making the signature confusing help: consistently use `'a` @@ -94,7 +93,7 @@ error: hiding a lifetime that's elided elsewhere is confusing --> $DIR/mismatched-lifetime-syntaxes.rs:46:37 | LL | fn implicit_ref_to_implicit_path(v: &u8) -> ContainsLifetime { - | ^^^ ---------------- the same lifetime is hidden here + | ^^^ ^^^^^^^^^^^^^^^^ the same lifetime is hidden here | | | the lifetime is elided here | @@ -108,7 +107,7 @@ error: hiding a lifetime that's elided elsewhere is confusing --> $DIR/mismatched-lifetime-syntaxes.rs:51:48 | LL | fn explicit_anonymous_ref_to_implicit_path(v: &'_ u8) -> ContainsLifetime { - | ^^ ---------------- the same lifetime is hidden here + | ^^ ^^^^^^^^^^^^^^^^ the same lifetime is hidden here | | | the lifetime is elided here | @@ -119,10 +118,10 @@ LL | fn explicit_anonymous_ref_to_implicit_path(v: &'_ u8) -> ContainsLifetime<' | ++++ error: hiding a lifetime that's named elsewhere is confusing - --> $DIR/mismatched-lifetime-syntaxes.rs:56:48 + --> $DIR/mismatched-lifetime-syntaxes.rs:56:58 | LL | fn explicit_bound_ref_to_implicit_path<'a>(v: &'a u8) -> ContainsLifetime { - | ^^ ---------------- the same lifetime is hidden here + | -- ^^^^^^^^^^^^^^^^ the same lifetime is hidden here | | | the lifetime is named here | @@ -133,10 +132,10 @@ LL | fn explicit_bound_ref_to_implicit_path<'a>(v: &'a u8) -> ContainsLifetime<' | ++++ error: eliding a lifetime that's named elsewhere is confusing - --> $DIR/mismatched-lifetime-syntaxes.rs:61:58 + --> $DIR/mismatched-lifetime-syntaxes.rs:61:85 | LL | fn explicit_bound_ref_to_explicit_anonymous_path<'a>(v: &'a u8) -> ContainsLifetime<'_> { - | ^^ -- the same lifetime is elided here + | -- ^^ the same lifetime is elided here | | | the lifetime is named here | @@ -151,7 +150,7 @@ error: hiding a lifetime that's elided elsewhere is confusing --> $DIR/mismatched-lifetime-syntaxes.rs:68:37 | LL | fn implicit_path_to_implicit_ref(v: ContainsLifetime) -> &u8 { - | ^^^^^^^^^^^^^^^^ --- the same lifetime is elided here + | ^^^^^^^^^^^^^^^^ ^^^ the same lifetime is elided here | | | the lifetime is hidden here | @@ -165,7 +164,7 @@ error: hiding a lifetime that's elided elsewhere is confusing --> $DIR/mismatched-lifetime-syntaxes.rs:73:47 | LL | fn implicit_path_to_explicit_anonymous_ref(v: ContainsLifetime) -> &'_ u8 { - | ^^^^^^^^^^^^^^^^ -- the same lifetime is elided here + | ^^^^^^^^^^^^^^^^ ^^ the same lifetime is elided here | | | the lifetime is hidden here | @@ -176,10 +175,10 @@ LL | fn implicit_path_to_explicit_anonymous_ref(v: ContainsLifetime<'_>) -> &'_ | ++++ error: eliding a lifetime that's named elsewhere is confusing - --> $DIR/mismatched-lifetime-syntaxes.rs:78:64 + --> $DIR/mismatched-lifetime-syntaxes.rs:78:72 | LL | fn explicit_bound_path_to_implicit_ref<'a>(v: ContainsLifetime<'a>) -> &u8 { - | ^^ --- the same lifetime is elided here + | -- ^^^ the same lifetime is elided here | | | the lifetime is named here | @@ -190,10 +189,10 @@ LL | fn explicit_bound_path_to_implicit_ref<'a>(v: ContainsLifetime<'a>) -> &'a | ++ error: eliding a lifetime that's named elsewhere is confusing - --> $DIR/mismatched-lifetime-syntaxes.rs:83:74 + --> $DIR/mismatched-lifetime-syntaxes.rs:83:83 | LL | fn explicit_bound_path_to_explicit_anonymous_ref<'a>(v: ContainsLifetime<'a>) -> &'_ u8 { - | ^^ -- the same lifetime is elided here + | -- ^^ the same lifetime is elided here | | | the lifetime is named here | @@ -205,10 +204,10 @@ LL + fn explicit_bound_path_to_explicit_anonymous_ref<'a>(v: ContainsLifetime<'a | error: eliding a lifetime that's named elsewhere is confusing - --> $DIR/mismatched-lifetime-syntaxes.rs:89:55 + --> $DIR/mismatched-lifetime-syntaxes.rs:89:67 | LL | fn method_explicit_bound_ref_to_implicit_ref<'a>(&'a self) -> &u8 { - | ^^ --- the same lifetime is elided here + | -- ^^^ the same lifetime is elided here | | | the lifetime is named here | @@ -219,10 +218,10 @@ LL | fn method_explicit_bound_ref_to_implicit_ref<'a>(&'a self) -> &'a u8 { | ++ error: eliding a lifetime that's named elsewhere is confusing - --> $DIR/mismatched-lifetime-syntaxes.rs:94:65 + --> $DIR/mismatched-lifetime-syntaxes.rs:94:78 | LL | fn method_explicit_bound_ref_to_explicit_anonymous_ref<'a>(&'a self) -> &'_ u8 { - | ^^ -- the same lifetime is elided here + | -- ^^ the same lifetime is elided here | | | the lifetime is named here | @@ -237,7 +236,7 @@ error: hiding a lifetime that's elided elsewhere is confusing --> $DIR/mismatched-lifetime-syntaxes.rs:101:56 | LL | fn method_explicit_anonymous_ref_to_implicit_path(&'_ self) -> ContainsLifetime { - | ^^ ---------------- the same lifetime is hidden here + | ^^ ^^^^^^^^^^^^^^^^ the same lifetime is hidden here | | | the lifetime is elided here | @@ -248,10 +247,10 @@ LL | fn method_explicit_anonymous_ref_to_implicit_path(&'_ self) -> Contains | ++++ error: hiding a lifetime that's named elsewhere is confusing - --> $DIR/mismatched-lifetime-syntaxes.rs:106:56 + --> $DIR/mismatched-lifetime-syntaxes.rs:106:68 | LL | fn method_explicit_bound_ref_to_implicit_path<'a>(&'a self) -> ContainsLifetime { - | ^^ ---------------- the same lifetime is hidden here + | -- ^^^^^^^^^^^^^^^^ the same lifetime is hidden here | | | the lifetime is named here | @@ -262,10 +261,10 @@ LL | fn method_explicit_bound_ref_to_implicit_path<'a>(&'a self) -> Contains | ++++ error: eliding a lifetime that's named elsewhere is confusing - --> $DIR/mismatched-lifetime-syntaxes.rs:111:66 + --> $DIR/mismatched-lifetime-syntaxes.rs:111:95 | LL | fn method_explicit_bound_ref_to_explicit_anonymous_path<'a>(&'a self) -> ContainsLifetime<'_> { - | ^^ -- the same lifetime is elided here + | -- ^^ the same lifetime is elided here | | | the lifetime is named here | @@ -277,10 +276,10 @@ LL + fn method_explicit_bound_ref_to_explicit_anonymous_path<'a>(&'a self) - | error: eliding a lifetime that's named elsewhere is confusing - --> $DIR/mismatched-lifetime-syntaxes.rs:126:39 + --> $DIR/mismatched-lifetime-syntaxes.rs:126:54 | LL | fn static_ref_to_implicit_ref(v: &'static u8) -> &u8 { - | ^^^^^^^ --- the same lifetime is elided here + | ------- ^^^ the same lifetime is elided here | | | the lifetime is named here | @@ -291,10 +290,10 @@ LL | fn static_ref_to_implicit_ref(v: &'static u8) -> &'static u8 { | +++++++ error: eliding a lifetime that's named elsewhere is confusing - --> $DIR/mismatched-lifetime-syntaxes.rs:131:49 + --> $DIR/mismatched-lifetime-syntaxes.rs:131:65 | LL | fn static_ref_to_explicit_anonymous_ref(v: &'static u8) -> &'_ u8 { - | ^^^^^^^ -- the same lifetime is elided here + | ------- ^^ the same lifetime is elided here | | | the lifetime is named here | @@ -306,10 +305,10 @@ LL + fn static_ref_to_explicit_anonymous_ref(v: &'static u8) -> &'static u8 | error: hiding a lifetime that's named elsewhere is confusing - --> $DIR/mismatched-lifetime-syntaxes.rs:136:40 + --> $DIR/mismatched-lifetime-syntaxes.rs:136:55 | LL | fn static_ref_to_implicit_path(v: &'static u8) -> ContainsLifetime { - | ^^^^^^^ ---------------- the same lifetime is hidden here + | ------- ^^^^^^^^^^^^^^^^ the same lifetime is hidden here | | | the lifetime is named here | @@ -320,10 +319,10 @@ LL | fn static_ref_to_implicit_path(v: &'static u8) -> ContainsLifetime<'sta | +++++++++ error: eliding a lifetime that's named elsewhere is confusing - --> $DIR/mismatched-lifetime-syntaxes.rs:141:50 + --> $DIR/mismatched-lifetime-syntaxes.rs:141:82 | LL | fn static_ref_to_explicit_anonymous_path(v: &'static u8) -> ContainsLifetime<'_> { - | ^^^^^^^ -- the same lifetime is elided here + | ------- ^^ the same lifetime is elided here | | | the lifetime is named here | @@ -335,10 +334,10 @@ LL + fn static_ref_to_explicit_anonymous_path(v: &'static u8) -> ContainsLif | error: eliding a lifetime that's named elsewhere is confusing - --> $DIR/mismatched-lifetime-syntaxes.rs:147:40 + --> $DIR/mismatched-lifetime-syntaxes.rs:147:57 | LL | fn static_ref_to_implicit_ref(&'static self) -> &u8 { - | ^^^^^^^ --- the same lifetime is elided here + | ------- ^^^ the same lifetime is elided here | | | the lifetime is named here | @@ -349,10 +348,10 @@ LL | fn static_ref_to_implicit_ref(&'static self) -> &'static u8 { | +++++++ error: eliding a lifetime that's named elsewhere is confusing - --> $DIR/mismatched-lifetime-syntaxes.rs:152:50 + --> $DIR/mismatched-lifetime-syntaxes.rs:152:68 | LL | fn static_ref_to_explicit_anonymous_ref(&'static self) -> &'_ u8 { - | ^^^^^^^ -- the same lifetime is elided here + | ------- ^^ the same lifetime is elided here | | | the lifetime is named here | @@ -364,10 +363,10 @@ LL + fn static_ref_to_explicit_anonymous_ref(&'static self) -> &'static | error: hiding a lifetime that's named elsewhere is confusing - --> $DIR/mismatched-lifetime-syntaxes.rs:157:41 + --> $DIR/mismatched-lifetime-syntaxes.rs:157:58 | LL | fn static_ref_to_implicit_path(&'static self) -> ContainsLifetime { - | ^^^^^^^ ---------------- the same lifetime is hidden here + | ------- ^^^^^^^^^^^^^^^^ the same lifetime is hidden here | | | the lifetime is named here | @@ -378,10 +377,10 @@ LL | fn static_ref_to_implicit_path(&'static self) -> ContainsLifetime<' | +++++++++ error: eliding a lifetime that's named elsewhere is confusing - --> $DIR/mismatched-lifetime-syntaxes.rs:162:51 + --> $DIR/mismatched-lifetime-syntaxes.rs:162:85 | LL | fn static_ref_to_explicit_anonymous_path(&'static self) -> ContainsLifetime<'_> { - | ^^^^^^^ -- the same lifetime is elided here + | ------- ^^ the same lifetime is elided here | | | the lifetime is named here | @@ -393,10 +392,10 @@ LL + fn static_ref_to_explicit_anonymous_path(&'static self) -> Contains | error: eliding a lifetime that's named elsewhere is confusing - --> $DIR/mismatched-lifetime-syntaxes.rs:174:55 + --> $DIR/mismatched-lifetime-syntaxes.rs:174:81 | LL | fn explicit_bound_ref_to_impl_trait_bound<'a>(v: &'a u8) -> impl FnOnce() + '_ { - | ^^ -- the same lifetime is elided here + | -- ^^ the same lifetime is elided here | | | the lifetime is named here | @@ -408,10 +407,10 @@ LL + fn explicit_bound_ref_to_impl_trait_bound<'a>(v: &'a u8) -> impl FnOnce | error: eliding a lifetime that's named elsewhere is confusing - --> $DIR/mismatched-lifetime-syntaxes.rs:179:65 + --> $DIR/mismatched-lifetime-syntaxes.rs:179:95 | LL | fn explicit_bound_ref_to_impl_trait_precise_capture<'a>(v: &'a u8) -> impl FnOnce() + use<'_> { - | ^^ the lifetime is named here -- the same lifetime is elided here + | -- the lifetime is named here ^^ the same lifetime is elided here | = help: the same lifetime is referred to in inconsistent ways, making the signature confusing help: consistently use `'a` @@ -421,10 +420,10 @@ LL + fn explicit_bound_ref_to_impl_trait_precise_capture<'a>(v: &'a u8) -> i | error: eliding a lifetime that's named elsewhere is confusing - --> $DIR/mismatched-lifetime-syntaxes.rs:184:72 + --> $DIR/mismatched-lifetime-syntaxes.rs:184:96 | LL | fn explicit_bound_path_to_impl_trait_bound<'a>(v: ContainsLifetime<'a>) -> impl FnOnce() + '_ { - | ^^ -- the same lifetime is elided here + | -- ^^ the same lifetime is elided here | | | the lifetime is named here | @@ -436,13 +435,12 @@ LL + fn explicit_bound_path_to_impl_trait_bound<'a>(v: ContainsLifetime<'a>) | error: eliding a lifetime that's named elsewhere is confusing - --> $DIR/mismatched-lifetime-syntaxes.rs:190:29 + --> $DIR/mismatched-lifetime-syntaxes.rs:191:30 | LL | v: ContainsLifetime<'a>, - | ^^ the lifetime is named here -LL | + | -- the lifetime is named here LL | ) -> impl FnOnce() + use<'_> { - | -- the same lifetime is elided here + | ^^ the same lifetime is elided here | = help: the same lifetime is referred to in inconsistent ways, making the signature confusing help: consistently use `'a` @@ -452,10 +450,10 @@ LL + ) -> impl FnOnce() + use<'a> { | error: eliding a lifetime that's named elsewhere is confusing - --> $DIR/mismatched-lifetime-syntaxes.rs:204:54 + --> $DIR/mismatched-lifetime-syntaxes.rs:204:88 | LL | fn explicit_bound_ref_to_dyn_trait_bound<'a>(v: &'a u8) -> Box<dyn Iterator<Item = &u8> + '_> { - | ^^ the lifetime is named here --- the same lifetime is elided here + | -- the lifetime is named here ^^^ the same lifetime is elided here | = help: the same lifetime is referred to in inconsistent ways, making the signature confusing help: consistently use `'a` @@ -464,13 +462,12 @@ LL | fn explicit_bound_ref_to_dyn_trait_bound<'a>(v: &'a u8) -> Box<dyn Iter | ++ error: hiding a lifetime that's named elsewhere is confusing - --> $DIR/mismatched-lifetime-syntaxes.rs:210:29 + --> $DIR/mismatched-lifetime-syntaxes.rs:211:34 | LL | v: ContainsLifetime<'a>, - | ^^ the lifetime is named here -LL | + | -- the lifetime is named here LL | ) -> Box<dyn Iterator<Item = ContainsLifetime> + '_> { - | ---------------- the same lifetime is hidden here + | ^^^^^^^^^^^^^^^^ the same lifetime is hidden here | = help: the same lifetime is referred to in inconsistent ways, making the signature confusing help: consistently use `'a` @@ -479,10 +476,10 @@ LL | ) -> Box<dyn Iterator<Item = ContainsLifetime<'a>> + '_> { | ++++ error: eliding a lifetime that's named elsewhere is confusing - --> $DIR/mismatched-lifetime-syntaxes.rs:222:33 + --> $DIR/mismatched-lifetime-syntaxes.rs:222:52 | LL | fn multiple_inputs<'a>(v: (&'a u8, &'a u8)) -> &u8 { - | ^^ ^^ --- the same lifetime is elided here + | -- -- ^^^ the same lifetime is elided here | | | | | the lifetime is named here | the lifetime is named here @@ -494,10 +491,10 @@ LL | fn multiple_inputs<'a>(v: (&'a u8, &'a u8)) -> &'a u8 { | ++ error: eliding a lifetime that's named elsewhere is confusing - --> $DIR/mismatched-lifetime-syntaxes.rs:227:33 + --> $DIR/mismatched-lifetime-syntaxes.rs:227:44 | LL | fn multiple_outputs<'a>(v: &'a u8) -> (&u8, &u8) { - | ^^ --- --- the same lifetime is elided here + | -- ^^^ ^^^ the same lifetime is elided here | | | | | the same lifetime is elided here | the lifetime is named here @@ -509,10 +506,10 @@ LL | fn multiple_outputs<'a>(v: &'a u8) -> (&'a u8, &'a u8) { | ++ ++ error: hiding or eliding a lifetime that's named elsewhere is confusing - --> $DIR/mismatched-lifetime-syntaxes.rs:232:53 + --> $DIR/mismatched-lifetime-syntaxes.rs:232:62 | LL | fn all_three_categories<'a>(v: ContainsLifetime<'a>) -> (&u8, ContainsLifetime) { - | ^^ --- ---------------- the same lifetime is hidden here + | -- ^^^ ^^^^^^^^^^^^^^^^ the same lifetime is hidden here | | | | | the same lifetime is elided here | the lifetime is named here @@ -524,10 +521,10 @@ LL | fn all_three_categories<'a>(v: ContainsLifetime<'a>) -> (&'a u8, Contai | ++ ++++ error: eliding a lifetime that's named elsewhere is confusing - --> $DIR/mismatched-lifetime-syntaxes.rs:237:38 + --> $DIR/mismatched-lifetime-syntaxes.rs:237:49 | LL | fn explicit_bound_output<'a>(v: &'a u8) -> (&u8, &'a u8, ContainsLifetime<'a>) { - | ^^ --- -- -- the same lifetime is named here + | -- ^^^ -- -- the same lifetime is named here | | | | | | | the same lifetime is named here | | the same lifetime is elided here @@ -543,7 +540,7 @@ error: hiding a lifetime that's elided elsewhere is confusing --> $DIR/mismatched-lifetime-syntaxes.rs:250:45 | LL | fn implicit_ref_to_implicit_path(v: &u8) -> ContainsLifetime; - | ^^^ ---------------- the same lifetime is hidden here + | ^^^ ^^^^^^^^^^^^^^^^ the same lifetime is hidden here | | | the lifetime is elided here | @@ -557,7 +554,7 @@ error: hiding a lifetime that's elided elsewhere is confusing --> $DIR/mismatched-lifetime-syntaxes.rs:253:49 | LL | fn method_implicit_ref_to_implicit_path(&self) -> ContainsLifetime; - | ^^^^^ ---------------- the same lifetime is hidden here + | ^^^^^ ^^^^^^^^^^^^^^^^ the same lifetime is hidden here | | | the lifetime is elided here | @@ -571,7 +568,7 @@ error: hiding a lifetime that's elided elsewhere is confusing --> $DIR/mismatched-lifetime-syntaxes.rs:258:45 | LL | fn implicit_ref_to_implicit_path(v: &u8) -> ContainsLifetime { - | ^^^ ---------------- the same lifetime is hidden here + | ^^^ ^^^^^^^^^^^^^^^^ the same lifetime is hidden here | | | the lifetime is elided here | @@ -585,7 +582,7 @@ error: hiding a lifetime that's elided elsewhere is confusing --> $DIR/mismatched-lifetime-syntaxes.rs:263:49 | LL | fn method_implicit_ref_to_implicit_path(&self) -> ContainsLifetime { - | ^^^^^ ---------------- the same lifetime is hidden here + | ^^^^^ ^^^^^^^^^^^^^^^^ the same lifetime is hidden here | | | the lifetime is elided here | @@ -599,7 +596,7 @@ error: hiding a lifetime that's elided elsewhere is confusing --> $DIR/mismatched-lifetime-syntaxes.rs:277:45 | LL | fn implicit_ref_to_implicit_path(v: &u8) -> ContainsLifetime; - | ^^^ ---------------- the same lifetime is hidden here + | ^^^ ^^^^^^^^^^^^^^^^ the same lifetime is hidden here | | | the lifetime is elided here | diff --git a/tests/ui/lifetimes/raw/use-of-undeclared-raw-lifetimes.rs b/tests/ui/lifetimes/raw/use-of-undeclared-raw-lifetimes.rs new file mode 100644 index 00000000000..69461cfb200 --- /dev/null +++ b/tests/ui/lifetimes/raw/use-of-undeclared-raw-lifetimes.rs @@ -0,0 +1,21 @@ +// Check that we properly suggest `r#fn` if we use it undeclared. +// https://github.com/rust-lang/rust/issues/143150 +// +//@ edition: 2021 + +fn a(_: dyn Trait + 'r#fn) { + //~^ ERROR use of undeclared lifetime name `'r#fn` [E0261] +} + +trait Trait {} + +struct Test { + a: &'r#fn str, + //~^ ERROR use of undeclared lifetime name `'r#fn` [E0261] +} + +trait Trait1<T> + where T: for<'a> Trait1<T> + 'r#fn { } +//~^ ERROR use of undeclared lifetime name `'r#fn` [E0261] + +fn main() {} diff --git a/tests/ui/lifetimes/raw/use-of-undeclared-raw-lifetimes.stderr b/tests/ui/lifetimes/raw/use-of-undeclared-raw-lifetimes.stderr new file mode 100644 index 00000000000..8a17ce53dcf --- /dev/null +++ b/tests/ui/lifetimes/raw/use-of-undeclared-raw-lifetimes.stderr @@ -0,0 +1,42 @@ +error[E0261]: use of undeclared lifetime name `'r#fn` + --> $DIR/use-of-undeclared-raw-lifetimes.rs:6:21 + | +LL | fn a(_: dyn Trait + 'r#fn) { + | ^^^^^ undeclared lifetime + | +help: consider introducing lifetime `'r#fn` here + | +LL | fn a<'r#fn>(_: dyn Trait + 'r#fn) { + | +++++++ + +error[E0261]: use of undeclared lifetime name `'r#fn` + --> $DIR/use-of-undeclared-raw-lifetimes.rs:13:9 + | +LL | a: &'r#fn str, + | ^^^^^ undeclared lifetime + | +help: consider introducing lifetime `'r#fn` here + | +LL | struct Test<'r#fn> { + | +++++++ + +error[E0261]: use of undeclared lifetime name `'r#fn` + --> $DIR/use-of-undeclared-raw-lifetimes.rs:18:32 + | +LL | where T: for<'a> Trait1<T> + 'r#fn { } + | ^^^^^ undeclared lifetime + | + = note: for more information on higher-ranked polymorphism, visit https://doc.rust-lang.org/nomicon/hrtb.html +help: consider making the bound lifetime-generic with a new `'r#fn` lifetime + | +LL - where T: for<'a> Trait1<T> + 'r#fn { } +LL + where for<'r#fn, 'a> T: Trait1<T> + 'r#fn { } + | +help: consider introducing lifetime `'r#fn` here + | +LL | trait Trait1<'r#fn, T> + | ++++++ + +error: aborting due to 3 previous errors + +For more information about this error, try `rustc --explain E0261`. diff --git a/tests/ui/issues/issue-7268.rs b/tests/ui/lifetimes/static-bound-fulfillment-with-pointer-7268.rs index a3bc1bc3446..8ec58e6cd80 100644 --- a/tests/ui/issues/issue-7268.rs +++ b/tests/ui/lifetimes/static-bound-fulfillment-with-pointer-7268.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/7268 //@ check-pass #![allow(dead_code)] diff --git a/tests/ui/lifetimes/unusual-rib-combinations.stderr b/tests/ui/lifetimes/unusual-rib-combinations.stderr index bd68479c58c..7f44ab2ed6b 100644 --- a/tests/ui/lifetimes/unusual-rib-combinations.stderr +++ b/tests/ui/lifetimes/unusual-rib-combinations.stderr @@ -30,7 +30,7 @@ LL | fn c<T = u8()>() {} | = 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 #36887 <https://github.com/rust-lang/rust/issues/36887> - = note: `#[deny(invalid_type_param_default)]` on by default + = note: `#[deny(invalid_type_param_default)]` (part of `#[deny(future_incompatible)]`) on by default error[E0308]: mismatched types --> $DIR/unusual-rib-combinations.rs:5:16 @@ -51,5 +51,5 @@ LL | fn c<T = u8()>() {} | = 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 #36887 <https://github.com/rust-lang/rust/issues/36887> - = note: `#[deny(invalid_type_param_default)]` on by default + = note: `#[deny(invalid_type_param_default)]` (part of `#[deny(future_incompatible)]`) on by default diff --git a/tests/ui/limits/huge-enum.stderr b/tests/ui/limits/huge-enum.full-debuginfo.stderr index 18168b3fa5c..4b179d59e5f 100644 --- a/tests/ui/limits/huge-enum.stderr +++ b/tests/ui/limits/huge-enum.full-debuginfo.stderr @@ -1,5 +1,5 @@ error: values of the type `Option<TYPE>` are too big for the target architecture - --> $DIR/huge-enum.rs:12:9 + --> $DIR/huge-enum.rs:17:9 | LL | let big: BIG = None; | ^^^ diff --git a/tests/ui/limits/huge-enum.no-debuginfo.stderr b/tests/ui/limits/huge-enum.no-debuginfo.stderr new file mode 100644 index 00000000000..4b179d59e5f --- /dev/null +++ b/tests/ui/limits/huge-enum.no-debuginfo.stderr @@ -0,0 +1,8 @@ +error: values of the type `Option<TYPE>` are too big for the target architecture + --> $DIR/huge-enum.rs:17:9 + | +LL | let big: BIG = None; + | ^^^ + +error: aborting due to 1 previous error + diff --git a/tests/ui/limits/huge-enum.rs b/tests/ui/limits/huge-enum.rs index 66c5be20693..9395bee9765 100644 --- a/tests/ui/limits/huge-enum.rs +++ b/tests/ui/limits/huge-enum.rs @@ -1,6 +1,11 @@ +// FIXME(#61117): Remove revisions once x86_64-gnu-debug CI job sets rust.debuginfo-level-tests=2 +// NOTE: The .stderr for both revisions shall be identical. +//@ revisions: no-debuginfo full-debuginfo //@ build-fail //@ normalize-stderr: "std::option::Option<\[u32; \d+\]>" -> "TYPE" //@ normalize-stderr: "\[u32; \d+\]" -> "TYPE" +//@[no-debuginfo] compile-flags: -Cdebuginfo=0 +//@[full-debuginfo] compile-flags: -Cdebuginfo=2 #[cfg(target_pointer_width = "32")] type BIG = Option<[u32; (1<<29)-1]>; diff --git a/tests/ui/link-native-libs/issue-43925.rs b/tests/ui/link-native-libs/issue-43925.rs index 1a210887154..e3ce71352c0 100644 --- a/tests/ui/link-native-libs/issue-43925.rs +++ b/tests/ui/link-native-libs/issue-43925.rs @@ -1,4 +1,6 @@ -#[link(name = "foo", cfg("rlib"))] //~ ERROR link cfg must have a single predicate argument +#[link(name = "foo", cfg("rlib"))] +//~^ ERROR link cfg is unstable +//~| ERROR `cfg` predicate key must be an identifier extern "C" {} fn main() {} diff --git a/tests/ui/link-native-libs/issue-43925.stderr b/tests/ui/link-native-libs/issue-43925.stderr index 7cc347c6163..82d204222df 100644 --- a/tests/ui/link-native-libs/issue-43925.stderr +++ b/tests/ui/link-native-libs/issue-43925.stderr @@ -1,8 +1,18 @@ -error: link cfg must have a single predicate argument +error[E0658]: link cfg is unstable --> $DIR/issue-43925.rs:1:22 | LL | #[link(name = "foo", cfg("rlib"))] | ^^^^^^^^^^^ + | + = help: add `#![feature(link_cfg)]` 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: `cfg` predicate key must be an identifier + --> $DIR/issue-43925.rs:1:26 + | +LL | #[link(name = "foo", cfg("rlib"))] + | ^^^^^^ -error: aborting due to 1 previous error +error: aborting due to 2 previous errors +For more information about this error, try `rustc --explain E0658`. diff --git a/tests/ui/link-native-libs/issue-43926.rs b/tests/ui/link-native-libs/issue-43926.rs index 6d3003552dc..293ad3f4ec1 100644 --- a/tests/ui/link-native-libs/issue-43926.rs +++ b/tests/ui/link-native-libs/issue-43926.rs @@ -1,4 +1,4 @@ -#[link(name = "foo", cfg())] //~ ERROR link cfg must have a single predicate argument +#[link(name = "foo", cfg())] //~ ERROR malformed `link` attribute input extern "C" {} fn main() {} diff --git a/tests/ui/link-native-libs/issue-43926.stderr b/tests/ui/link-native-libs/issue-43926.stderr index 7c5c50a38a9..9e3ec21cc94 100644 --- a/tests/ui/link-native-libs/issue-43926.stderr +++ b/tests/ui/link-native-libs/issue-43926.stderr @@ -1,8 +1,28 @@ -error: link cfg must have a single predicate argument - --> $DIR/issue-43926.rs:1:22 +error[E0805]: malformed `link` attribute input + --> $DIR/issue-43926.rs:1:1 | LL | #[link(name = "foo", cfg())] - | ^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^-----^^ + | | + | expected a single argument here + | + = note: for more information, visit <https://doc.rust-lang.org/reference/items/external-blocks.html#the-link-attribute> +help: try changing it to one of the following valid forms of the attribute + | +LL - #[link(name = "foo", cfg())] +LL + #[link(name = "...")] + | +LL - #[link(name = "foo", cfg())] +LL + #[link(name = "...", import_name_type = "decorated|noprefix|undecorated")] + | +LL - #[link(name = "foo", cfg())] +LL + #[link(name = "...", kind = "dylib|static|...")] + | +LL - #[link(name = "foo", cfg())] +LL + #[link(name = "...", kind = "dylib|static|...", wasm_import_module = "...", import_name_type = "decorated|noprefix|undecorated")] + | + = and 1 other candidate error: aborting due to 1 previous error +For more information about this error, try `rustc --explain E0805`. diff --git a/tests/ui/link-native-libs/link-attr-validation-early.rs b/tests/ui/link-native-libs/link-attr-validation-early.rs index a7dd80f8920..89a34ac6ca1 100644 --- a/tests/ui/link-native-libs/link-attr-validation-early.rs +++ b/tests/ui/link-native-libs/link-attr-validation-early.rs @@ -1,8 +1,6 @@ // Top-level ill-formed -#[link] //~ ERROR valid forms for the attribute are - //~| WARN this was previously accepted -#[link = "foo"] //~ ERROR valid forms for the attribute are - //~| WARN this was previously accepted +#[link] //~ ERROR malformed +#[link = "foo"] //~ ERROR malformed extern "C" {} fn main() {} diff --git a/tests/ui/link-native-libs/link-attr-validation-early.stderr b/tests/ui/link-native-libs/link-attr-validation-early.stderr index 36cca6f27ef..e4799b1a161 100644 --- a/tests/ui/link-native-libs/link-attr-validation-early.stderr +++ b/tests/ui/link-native-libs/link-attr-validation-early.stderr @@ -1,47 +1,45 @@ -error: valid forms for the attribute are `#[link(name = "...")]`, `#[link(name = "...", kind = "dylib|static|...")]`, `#[link(name = "...", wasm_import_module = "...")]`, `#[link(name = "...", import_name_type = "decorated|noprefix|undecorated")]`, and `#[link(name = "...", kind = "dylib|static|...", wasm_import_module = "...", import_name_type = "decorated|noprefix|undecorated")]` +error[E0539]: malformed `link` attribute input --> $DIR/link-attr-validation-early.rs:2:1 | LL | #[link] - | ^^^^^^^ + | ^^^^^^^ expected this to be a list | - = 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 #57571 <https://github.com/rust-lang/rust/issues/57571> = note: for more information, visit <https://doc.rust-lang.org/reference/items/external-blocks.html#the-link-attribute> - = note: `#[deny(ill_formed_attribute_input)]` on by default +help: try changing it to one of the following valid forms of the attribute + | +LL | #[link(name = "...")] + | ++++++++++++++ +LL | #[link(name = "...", import_name_type = "decorated|noprefix|undecorated")] + | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +LL | #[link(name = "...", kind = "dylib|static|...")] + | +++++++++++++++++++++++++++++++++++++++++ +LL | #[link(name = "...", kind = "dylib|static|...", wasm_import_module = "...", import_name_type = "decorated|noprefix|undecorated")] + | ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + = and 1 other candidate -error: valid forms for the attribute are `#[link(name = "...")]`, `#[link(name = "...", kind = "dylib|static|...")]`, `#[link(name = "...", wasm_import_module = "...")]`, `#[link(name = "...", import_name_type = "decorated|noprefix|undecorated")]`, and `#[link(name = "...", kind = "dylib|static|...", wasm_import_module = "...", import_name_type = "decorated|noprefix|undecorated")]` - --> $DIR/link-attr-validation-early.rs:4:1 +error[E0539]: malformed `link` attribute input + --> $DIR/link-attr-validation-early.rs:3:1 | LL | #[link = "foo"] - | ^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^ expected this to be a list | - = 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 #57571 <https://github.com/rust-lang/rust/issues/57571> = note: for more information, visit <https://doc.rust-lang.org/reference/items/external-blocks.html#the-link-attribute> - -error: aborting due to 2 previous errors - -Future incompatibility report: Future breakage diagnostic: -error: valid forms for the attribute are `#[link(name = "...")]`, `#[link(name = "...", kind = "dylib|static|...")]`, `#[link(name = "...", wasm_import_module = "...")]`, `#[link(name = "...", import_name_type = "decorated|noprefix|undecorated")]`, and `#[link(name = "...", kind = "dylib|static|...", wasm_import_module = "...", import_name_type = "decorated|noprefix|undecorated")]` - --> $DIR/link-attr-validation-early.rs:2:1 +help: try changing it to one of the following valid forms of the attribute | -LL | #[link] - | ^^^^^^^ +LL - #[link = "foo"] +LL + #[link(name = "...")] | - = 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 #57571 <https://github.com/rust-lang/rust/issues/57571> - = note: for more information, visit <https://doc.rust-lang.org/reference/items/external-blocks.html#the-link-attribute> - = note: `#[deny(ill_formed_attribute_input)]` on by default - -Future breakage diagnostic: -error: valid forms for the attribute are `#[link(name = "...")]`, `#[link(name = "...", kind = "dylib|static|...")]`, `#[link(name = "...", wasm_import_module = "...")]`, `#[link(name = "...", import_name_type = "decorated|noprefix|undecorated")]`, and `#[link(name = "...", kind = "dylib|static|...", wasm_import_module = "...", import_name_type = "decorated|noprefix|undecorated")]` - --> $DIR/link-attr-validation-early.rs:4:1 +LL - #[link = "foo"] +LL + #[link(name = "...", import_name_type = "decorated|noprefix|undecorated")] | -LL | #[link = "foo"] - | ^^^^^^^^^^^^^^^ +LL - #[link = "foo"] +LL + #[link(name = "...", kind = "dylib|static|...")] | - = 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 #57571 <https://github.com/rust-lang/rust/issues/57571> - = note: for more information, visit <https://doc.rust-lang.org/reference/items/external-blocks.html#the-link-attribute> - = note: `#[deny(ill_formed_attribute_input)]` on by default +LL - #[link = "foo"] +LL + #[link(name = "...", kind = "dylib|static|...", wasm_import_module = "...", import_name_type = "decorated|noprefix|undecorated")] + | + = and 1 other candidate + +error: aborting due to 2 previous errors +For more information about this error, try `rustc --explain E0539`. diff --git a/tests/ui/link-native-libs/link-attr-validation-late.rs b/tests/ui/link-native-libs/link-attr-validation-late.rs index 4eeb8ba4884..d2947b5f61a 100644 --- a/tests/ui/link-native-libs/link-attr-validation-late.rs +++ b/tests/ui/link-native-libs/link-attr-validation-late.rs @@ -1,38 +1,36 @@ #![feature(link_cfg)] // Top-level ill-formed -#[link(name = "...", "literal")] //~ ERROR unexpected `#[link]` argument -#[link(name = "...", unknown)] //~ ERROR unexpected `#[link]` argument +#[link(name = "...", "literal")] //~ ERROR malformed `link` attribute input +#[link(name = "...", unknown)] //~ ERROR malformed `link` attribute input extern "C" {} // Duplicate arguments -#[link(name = "foo", name = "bar")] //~ ERROR multiple `name` arguments -#[link(name = "...", kind = "dylib", kind = "bar")] //~ ERROR multiple `kind` arguments -#[link(name = "...", modifiers = "+verbatim", modifiers = "bar")] //~ ERROR multiple `modifiers` arguments -#[link(name = "...", cfg(false), cfg(false))] //~ ERROR multiple `cfg` arguments -#[link(wasm_import_module = "foo", wasm_import_module = "bar")] //~ ERROR multiple `wasm_import_module` arguments +#[link(name = "foo", name = "bar")] //~ ERROR malformed `link` attribute input +#[link(name = "...", kind = "dylib", kind = "bar")] //~ ERROR malformed `link` attribute input +#[link(name = "...", modifiers = "+verbatim", modifiers = "bar")] //~ ERROR malformed `link` attribute input +#[link(name = "...", cfg(false), cfg(false))] //~ ERROR malformed `link` attribute input +#[link(wasm_import_module = "foo", wasm_import_module = "bar")] //~ ERROR malformed `link` attribute input extern "C" {} // Ill-formed arguments -#[link(name)] //~ ERROR link name must be of the form `name = "string"` - //~| ERROR `#[link]` attribute requires a `name = "string"` argument -#[link(name())] //~ ERROR link name must be of the form `name = "string"` - //~| ERROR `#[link]` attribute requires a `name = "string"` argument -#[link(name = "...", kind)] //~ ERROR link kind must be of the form `kind = "string"` -#[link(name = "...", kind())] //~ ERROR link kind must be of the form `kind = "string"` -#[link(name = "...", modifiers)] //~ ERROR link modifiers must be of the form `modifiers = "string"` -#[link(name = "...", modifiers())] //~ ERROR link modifiers must be of the form `modifiers = "string"` -#[link(name = "...", cfg)] //~ ERROR link cfg must be of the form `cfg(/* predicate */)` -#[link(name = "...", cfg = "literal")] //~ ERROR link cfg must be of the form `cfg(/* predicate */)` -#[link(name = "...", cfg("literal"))] //~ ERROR link cfg must have a single predicate argument -#[link(name = "...", wasm_import_module)] //~ ERROR wasm import module must be of the form `wasm_import_module = "string"` -#[link(name = "...", wasm_import_module())] //~ ERROR wasm import module must be of the form `wasm_import_module = "string"` +#[link(name)] //~ ERROR malformed `link` attribute input +#[link(name())] //~ ERROR malformed `link` attribute input +#[link(name = "...", kind)] //~ ERROR malformed `link` attribute input +#[link(name = "...", kind())] //~ ERROR malformed `link` attribute input +#[link(name = "...", modifiers)] //~ ERROR malformed `link` attribute input +#[link(name = "...", modifiers())] //~ ERROR malformed `link` attribute input +#[link(name = "...", cfg)] //~ ERROR malformed `link` attribute input +#[link(name = "...", cfg = "literal")] //~ ERROR malformed `link` attribute input +#[link(name = "...", cfg("literal"))] //~ ERROR `cfg` predicate key must be an identifier +#[link(name = "...", wasm_import_module)] //~ ERROR malformed `link` attribute input +#[link(name = "...", wasm_import_module())] //~ ERROR malformed `link` attribute input extern "C" {} // Basic modifier validation #[link(name = "...", modifiers = "")] //~ ERROR invalid linking modifier syntax, expected '+' or '-' prefix #[link(name = "...", modifiers = "no-plus-minus")] //~ ERROR invalid linking modifier syntax, expected '+' or '-' prefix -#[link(name = "...", modifiers = "+unknown")] //~ ERROR unknown linking modifier `unknown` +#[link(name = "...", modifiers = "+unknown")] //~ ERROR malformed `link` attribute input #[link(name = "...", modifiers = "+verbatim,+verbatim")] //~ ERROR multiple `verbatim` modifiers extern "C" {} diff --git a/tests/ui/link-native-libs/link-attr-validation-late.stderr b/tests/ui/link-native-libs/link-attr-validation-late.stderr index f3989c09360..834dca0bc0b 100644 --- a/tests/ui/link-native-libs/link-attr-validation-late.stderr +++ b/tests/ui/link-native-libs/link-attr-validation-late.stderr @@ -1,147 +1,472 @@ -error: unexpected `#[link]` argument, expected one of: name, kind, modifiers, cfg, wasm_import_module, import_name_type - --> $DIR/link-attr-validation-late.rs:4:22 +error[E0565]: malformed `link` attribute input + --> $DIR/link-attr-validation-late.rs:4:1 | LL | #[link(name = "...", "literal")] - | ^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^---------^^ + | | + | didn't expect a literal here + | + = note: for more information, visit <https://doc.rust-lang.org/reference/items/external-blocks.html#the-link-attribute> +help: try changing it to one of the following valid forms of the attribute + | +LL - #[link(name = "...", "literal")] +LL + #[link(name = "...")] + | +LL - #[link(name = "...", "literal")] +LL + #[link(name = "...", import_name_type = "decorated|noprefix|undecorated")] + | +LL - #[link(name = "...", "literal")] +LL + #[link(name = "...", kind = "dylib|static|...")] + | +LL - #[link(name = "...", "literal")] +LL + #[link(name = "...", kind = "dylib|static|...", wasm_import_module = "...", import_name_type = "decorated|noprefix|undecorated")] + | + = and 1 other candidate -error: unexpected `#[link]` argument, expected one of: name, kind, modifiers, cfg, wasm_import_module, import_name_type - --> $DIR/link-attr-validation-late.rs:5:22 +error[E0539]: malformed `link` attribute input + --> $DIR/link-attr-validation-late.rs:5:1 | LL | #[link(name = "...", unknown)] - | ^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^-------^^ + | | + | valid arguments are "name", "kind", "modifiers", "cfg", "wasm_import_module" or "import_name_type" + | + = note: for more information, visit <https://doc.rust-lang.org/reference/items/external-blocks.html#the-link-attribute> +help: try changing it to one of the following valid forms of the attribute + | +LL - #[link(name = "...", unknown)] +LL + #[link(name = "...")] + | +LL - #[link(name = "...", unknown)] +LL + #[link(name = "...", import_name_type = "decorated|noprefix|undecorated")] + | +LL - #[link(name = "...", unknown)] +LL + #[link(name = "...", kind = "dylib|static|...")] + | +LL - #[link(name = "...", unknown)] +LL + #[link(name = "...", kind = "dylib|static|...", wasm_import_module = "...", import_name_type = "decorated|noprefix|undecorated")] + | + = and 1 other candidate -error: multiple `name` arguments in a single `#[link]` attribute - --> $DIR/link-attr-validation-late.rs:9:22 +error[E0538]: malformed `link` attribute input + --> $DIR/link-attr-validation-late.rs:9:1 | LL | #[link(name = "foo", name = "bar")] - | ^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^------------^^ + | | + | found `name` used as a key more than once + | + = note: for more information, visit <https://doc.rust-lang.org/reference/items/external-blocks.html#the-link-attribute> +help: try changing it to one of the following valid forms of the attribute + | +LL - #[link(name = "foo", name = "bar")] +LL + #[link(name = "...")] + | +LL - #[link(name = "foo", name = "bar")] +LL + #[link(name = "...", import_name_type = "decorated|noprefix|undecorated")] + | +LL - #[link(name = "foo", name = "bar")] +LL + #[link(name = "...", kind = "dylib|static|...")] + | +LL - #[link(name = "foo", name = "bar")] +LL + #[link(name = "...", kind = "dylib|static|...", wasm_import_module = "...", import_name_type = "decorated|noprefix|undecorated")] + | + = and 1 other candidate -error: multiple `kind` arguments in a single `#[link]` attribute - --> $DIR/link-attr-validation-late.rs:10:38 +error[E0538]: malformed `link` attribute input + --> $DIR/link-attr-validation-late.rs:10:1 | LL | #[link(name = "...", kind = "dylib", kind = "bar")] - | ^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^------------^^ + | | + | found `kind` used as a key more than once + | + = note: for more information, visit <https://doc.rust-lang.org/reference/items/external-blocks.html#the-link-attribute> +help: try changing it to one of the following valid forms of the attribute + | +LL - #[link(name = "...", kind = "dylib", kind = "bar")] +LL + #[link(name = "...")] + | +LL - #[link(name = "...", kind = "dylib", kind = "bar")] +LL + #[link(name = "...", import_name_type = "decorated|noprefix|undecorated")] + | +LL - #[link(name = "...", kind = "dylib", kind = "bar")] +LL + #[link(name = "...", kind = "dylib|static|...")] + | +LL - #[link(name = "...", kind = "dylib", kind = "bar")] +LL + #[link(name = "...", kind = "dylib|static|...", wasm_import_module = "...", import_name_type = "decorated|noprefix|undecorated")] + | + = and 1 other candidate -error: multiple `modifiers` arguments in a single `#[link]` attribute - --> $DIR/link-attr-validation-late.rs:11:47 +error[E0538]: malformed `link` attribute input + --> $DIR/link-attr-validation-late.rs:11:1 | LL | #[link(name = "...", modifiers = "+verbatim", modifiers = "bar")] - | ^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-----------------^^ + | | + | found `modifiers` used as a key more than once + | + = note: for more information, visit <https://doc.rust-lang.org/reference/items/external-blocks.html#the-link-attribute> +help: try changing it to one of the following valid forms of the attribute + | +LL - #[link(name = "...", modifiers = "+verbatim", modifiers = "bar")] +LL + #[link(name = "...")] + | +LL - #[link(name = "...", modifiers = "+verbatim", modifiers = "bar")] +LL + #[link(name = "...", import_name_type = "decorated|noprefix|undecorated")] + | +LL - #[link(name = "...", modifiers = "+verbatim", modifiers = "bar")] +LL + #[link(name = "...", kind = "dylib|static|...")] + | +LL - #[link(name = "...", modifiers = "+verbatim", modifiers = "bar")] +LL + #[link(name = "...", kind = "dylib|static|...", wasm_import_module = "...", import_name_type = "decorated|noprefix|undecorated")] + | + = and 1 other candidate -error: multiple `cfg` arguments in a single `#[link]` attribute - --> $DIR/link-attr-validation-late.rs:12:34 +error[E0538]: malformed `link` attribute input + --> $DIR/link-attr-validation-late.rs:12:1 | LL | #[link(name = "...", cfg(false), cfg(false))] - | ^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^----------^^ + | | + | found `cfg` used as a key more than once + | + = note: for more information, visit <https://doc.rust-lang.org/reference/items/external-blocks.html#the-link-attribute> +help: try changing it to one of the following valid forms of the attribute + | +LL - #[link(name = "...", cfg(false), cfg(false))] +LL + #[link(name = "...")] + | +LL - #[link(name = "...", cfg(false), cfg(false))] +LL + #[link(name = "...", import_name_type = "decorated|noprefix|undecorated")] + | +LL - #[link(name = "...", cfg(false), cfg(false))] +LL + #[link(name = "...", kind = "dylib|static|...")] + | +LL - #[link(name = "...", cfg(false), cfg(false))] +LL + #[link(name = "...", kind = "dylib|static|...", wasm_import_module = "...", import_name_type = "decorated|noprefix|undecorated")] + | + = and 1 other candidate -error: multiple `wasm_import_module` arguments in a single `#[link]` attribute - --> $DIR/link-attr-validation-late.rs:13:36 +error[E0538]: malformed `link` attribute input + --> $DIR/link-attr-validation-late.rs:13:1 | LL | #[link(wasm_import_module = "foo", wasm_import_module = "bar")] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ - -error: link name must be of the form `name = "string"` - --> $DIR/link-attr-validation-late.rs:17:8 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^--------------------------^^ + | | + | found `wasm_import_module` used as a key more than once | -LL | #[link(name)] - | ^^^^ + = note: for more information, visit <https://doc.rust-lang.org/reference/items/external-blocks.html#the-link-attribute> +help: try changing it to one of the following valid forms of the attribute + | +LL - #[link(wasm_import_module = "foo", wasm_import_module = "bar")] +LL + #[link(name = "...")] + | +LL - #[link(wasm_import_module = "foo", wasm_import_module = "bar")] +LL + #[link(name = "...", import_name_type = "decorated|noprefix|undecorated")] + | +LL - #[link(wasm_import_module = "foo", wasm_import_module = "bar")] +LL + #[link(name = "...", kind = "dylib|static|...")] + | +LL - #[link(wasm_import_module = "foo", wasm_import_module = "bar")] +LL + #[link(name = "...", kind = "dylib|static|...", wasm_import_module = "...", import_name_type = "decorated|noprefix|undecorated")] + | + = and 1 other candidate -error[E0459]: `#[link]` attribute requires a `name = "string"` argument +error[E0539]: malformed `link` attribute input --> $DIR/link-attr-validation-late.rs:17:1 | LL | #[link(name)] - | ^^^^^^^^^^^^^ missing `name` argument - -error: link name must be of the form `name = "string"` - --> $DIR/link-attr-validation-late.rs:19:8 + | ^^^^^^^----^^ + | | + | expected this to be of the form `name = "..."` | -LL | #[link(name())] - | ^^^^^^ + = note: for more information, visit <https://doc.rust-lang.org/reference/items/external-blocks.html#the-link-attribute> +help: try changing it to one of the following valid forms of the attribute + | +LL | #[link(name = "...")] + | +++++++ +LL | #[link(name = "...", import_name_type = "decorated|noprefix|undecorated")] + | ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +LL | #[link(name = "...", kind = "dylib|static|...")] + | ++++++++++++++++++++++++++++++++++ +LL | #[link(name = "...", kind = "dylib|static|...", wasm_import_module = "...", import_name_type = "decorated|noprefix|undecorated")] + | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + = and 1 other candidate -error[E0459]: `#[link]` attribute requires a `name = "string"` argument - --> $DIR/link-attr-validation-late.rs:19:1 +error[E0539]: malformed `link` attribute input + --> $DIR/link-attr-validation-late.rs:18:1 | LL | #[link(name())] - | ^^^^^^^^^^^^^^^ missing `name` argument + | ^^^^^^^------^^ + | | + | expected this to be of the form `name = "..."` + | + = note: for more information, visit <https://doc.rust-lang.org/reference/items/external-blocks.html#the-link-attribute> +help: try changing it to one of the following valid forms of the attribute + | +LL - #[link(name())] +LL + #[link(name = "...")] + | +LL - #[link(name())] +LL + #[link(name = "...", import_name_type = "decorated|noprefix|undecorated")] + | +LL - #[link(name())] +LL + #[link(name = "...", kind = "dylib|static|...")] + | +LL - #[link(name())] +LL + #[link(name = "...", kind = "dylib|static|...", wasm_import_module = "...", import_name_type = "decorated|noprefix|undecorated")] + | + = and 1 other candidate -error: link kind must be of the form `kind = "string"` - --> $DIR/link-attr-validation-late.rs:21:22 +error[E0539]: malformed `link` attribute input + --> $DIR/link-attr-validation-late.rs:19:1 | LL | #[link(name = "...", kind)] - | ^^^^ + | ^^^^^^^^^^^^^^^^^^^^^----^^ + | | + | expected this to be of the form `kind = "..."` + | + = note: for more information, visit <https://doc.rust-lang.org/reference/items/external-blocks.html#the-link-attribute> +help: try changing it to one of the following valid forms of the attribute + | +LL - #[link(name = "...", kind)] +LL + #[link(name = "...")] + | +LL - #[link(name = "...", kind)] +LL + #[link(name = "...", import_name_type = "decorated|noprefix|undecorated")] + | +LL | #[link(name = "...", kind = "dylib|static|...")] + | ++++++++++++++++++++ +LL | #[link(name = "...", kind = "dylib|static|...", wasm_import_module = "...", import_name_type = "decorated|noprefix|undecorated")] + | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + = and 1 other candidate -error: link kind must be of the form `kind = "string"` - --> $DIR/link-attr-validation-late.rs:22:22 +error[E0539]: malformed `link` attribute input + --> $DIR/link-attr-validation-late.rs:20:1 | LL | #[link(name = "...", kind())] - | ^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^------^^ + | | + | expected this to be of the form `kind = "..."` + | + = note: for more information, visit <https://doc.rust-lang.org/reference/items/external-blocks.html#the-link-attribute> +help: try changing it to one of the following valid forms of the attribute + | +LL - #[link(name = "...", kind())] +LL + #[link(name = "...")] + | +LL - #[link(name = "...", kind())] +LL + #[link(name = "...", import_name_type = "decorated|noprefix|undecorated")] + | +LL - #[link(name = "...", kind())] +LL + #[link(name = "...", kind = "dylib|static|...")] + | +LL - #[link(name = "...", kind())] +LL + #[link(name = "...", kind = "dylib|static|...", wasm_import_module = "...", import_name_type = "decorated|noprefix|undecorated")] + | + = and 1 other candidate -error: link modifiers must be of the form `modifiers = "string"` - --> $DIR/link-attr-validation-late.rs:23:22 +error[E0539]: malformed `link` attribute input + --> $DIR/link-attr-validation-late.rs:21:1 | LL | #[link(name = "...", modifiers)] - | ^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^---------^^ + | | + | expected this to be of the form `modifiers = "..."` + | + = note: for more information, visit <https://doc.rust-lang.org/reference/items/external-blocks.html#the-link-attribute> +help: try changing it to one of the following valid forms of the attribute + | +LL - #[link(name = "...", modifiers)] +LL + #[link(name = "...")] + | +LL - #[link(name = "...", modifiers)] +LL + #[link(name = "...", import_name_type = "decorated|noprefix|undecorated")] + | +LL - #[link(name = "...", modifiers)] +LL + #[link(name = "...", kind = "dylib|static|...")] + | +LL - #[link(name = "...", modifiers)] +LL + #[link(name = "...", kind = "dylib|static|...", wasm_import_module = "...", import_name_type = "decorated|noprefix|undecorated")] + | + = and 1 other candidate -error: link modifiers must be of the form `modifiers = "string"` - --> $DIR/link-attr-validation-late.rs:24:22 +error[E0539]: malformed `link` attribute input + --> $DIR/link-attr-validation-late.rs:22:1 | LL | #[link(name = "...", modifiers())] - | ^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^-----------^^ + | | + | expected this to be of the form `modifiers = "..."` + | + = note: for more information, visit <https://doc.rust-lang.org/reference/items/external-blocks.html#the-link-attribute> +help: try changing it to one of the following valid forms of the attribute + | +LL - #[link(name = "...", modifiers())] +LL + #[link(name = "...")] + | +LL - #[link(name = "...", modifiers())] +LL + #[link(name = "...", import_name_type = "decorated|noprefix|undecorated")] + | +LL - #[link(name = "...", modifiers())] +LL + #[link(name = "...", kind = "dylib|static|...")] + | +LL - #[link(name = "...", modifiers())] +LL + #[link(name = "...", kind = "dylib|static|...", wasm_import_module = "...", import_name_type = "decorated|noprefix|undecorated")] + | + = and 1 other candidate -error: link cfg must be of the form `cfg(/* predicate */)` - --> $DIR/link-attr-validation-late.rs:25:22 +error[E0539]: malformed `link` attribute input + --> $DIR/link-attr-validation-late.rs:23:1 | LL | #[link(name = "...", cfg)] - | ^^^ + | ^^^^^^^^^^^^^^^^^^^^^---^^ + | | + | expected this to be a list + | + = note: for more information, visit <https://doc.rust-lang.org/reference/items/external-blocks.html#the-link-attribute> +help: try changing it to one of the following valid forms of the attribute + | +LL - #[link(name = "...", cfg)] +LL + #[link(name = "...")] + | +LL - #[link(name = "...", cfg)] +LL + #[link(name = "...", import_name_type = "decorated|noprefix|undecorated")] + | +LL - #[link(name = "...", cfg)] +LL + #[link(name = "...", kind = "dylib|static|...")] + | +LL - #[link(name = "...", cfg)] +LL + #[link(name = "...", kind = "dylib|static|...", wasm_import_module = "...", import_name_type = "decorated|noprefix|undecorated")] + | + = and 1 other candidate -error: link cfg must be of the form `cfg(/* predicate */)` - --> $DIR/link-attr-validation-late.rs:26:22 +error[E0539]: malformed `link` attribute input + --> $DIR/link-attr-validation-late.rs:24:1 | LL | #[link(name = "...", cfg = "literal")] - | ^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^---------------^^ + | | + | expected this to be a list + | + = note: for more information, visit <https://doc.rust-lang.org/reference/items/external-blocks.html#the-link-attribute> +help: try changing it to one of the following valid forms of the attribute + | +LL - #[link(name = "...", cfg = "literal")] +LL + #[link(name = "...")] + | +LL - #[link(name = "...", cfg = "literal")] +LL + #[link(name = "...", import_name_type = "decorated|noprefix|undecorated")] + | +LL - #[link(name = "...", cfg = "literal")] +LL + #[link(name = "...", kind = "dylib|static|...")] + | +LL - #[link(name = "...", cfg = "literal")] +LL + #[link(name = "...", kind = "dylib|static|...", wasm_import_module = "...", import_name_type = "decorated|noprefix|undecorated")] + | + = and 1 other candidate -error: link cfg must have a single predicate argument - --> $DIR/link-attr-validation-late.rs:27:22 +error: `cfg` predicate key must be an identifier + --> $DIR/link-attr-validation-late.rs:25:26 | LL | #[link(name = "...", cfg("literal"))] - | ^^^^^^^^^^^^^^ + | ^^^^^^^^^ -error: wasm import module must be of the form `wasm_import_module = "string"` - --> $DIR/link-attr-validation-late.rs:28:22 +error[E0539]: malformed `link` attribute input + --> $DIR/link-attr-validation-late.rs:26:1 | LL | #[link(name = "...", wasm_import_module)] - | ^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^------------------^^ + | | + | expected this to be of the form `wasm_import_module = "..."` + | + = note: for more information, visit <https://doc.rust-lang.org/reference/items/external-blocks.html#the-link-attribute> +help: try changing it to one of the following valid forms of the attribute + | +LL - #[link(name = "...", wasm_import_module)] +LL + #[link(name = "...")] + | +LL - #[link(name = "...", wasm_import_module)] +LL + #[link(name = "...", import_name_type = "decorated|noprefix|undecorated")] + | +LL - #[link(name = "...", wasm_import_module)] +LL + #[link(name = "...", kind = "dylib|static|...")] + | +LL - #[link(name = "...", wasm_import_module)] +LL + #[link(name = "...", kind = "dylib|static|...", wasm_import_module = "...", import_name_type = "decorated|noprefix|undecorated")] + | + = and 1 other candidate -error: wasm import module must be of the form `wasm_import_module = "string"` - --> $DIR/link-attr-validation-late.rs:29:22 +error[E0539]: malformed `link` attribute input + --> $DIR/link-attr-validation-late.rs:27:1 | LL | #[link(name = "...", wasm_import_module())] - | ^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^--------------------^^ + | | + | expected this to be of the form `wasm_import_module = "..."` + | + = note: for more information, visit <https://doc.rust-lang.org/reference/items/external-blocks.html#the-link-attribute> +help: try changing it to one of the following valid forms of the attribute + | +LL - #[link(name = "...", wasm_import_module())] +LL + #[link(name = "...")] + | +LL - #[link(name = "...", wasm_import_module())] +LL + #[link(name = "...", import_name_type = "decorated|noprefix|undecorated")] + | +LL - #[link(name = "...", wasm_import_module())] +LL + #[link(name = "...", kind = "dylib|static|...")] + | +LL - #[link(name = "...", wasm_import_module())] +LL + #[link(name = "...", kind = "dylib|static|...", wasm_import_module = "...", import_name_type = "decorated|noprefix|undecorated")] + | + = and 1 other candidate error: invalid linking modifier syntax, expected '+' or '-' prefix before one of: bundle, verbatim, whole-archive, as-needed - --> $DIR/link-attr-validation-late.rs:33:34 + --> $DIR/link-attr-validation-late.rs:31:34 | LL | #[link(name = "...", modifiers = "")] | ^^ error: invalid linking modifier syntax, expected '+' or '-' prefix before one of: bundle, verbatim, whole-archive, as-needed - --> $DIR/link-attr-validation-late.rs:34:34 + --> $DIR/link-attr-validation-late.rs:32:34 | LL | #[link(name = "...", modifiers = "no-plus-minus")] | ^^^^^^^^^^^^^^^ -error: unknown linking modifier `unknown`, expected one of: bundle, verbatim, whole-archive, as-needed - --> $DIR/link-attr-validation-late.rs:35:34 +error[E0539]: malformed `link` attribute input + --> $DIR/link-attr-validation-late.rs:33:1 | LL | #[link(name = "...", modifiers = "+unknown")] - | ^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^----------^^ + | | + | valid arguments are "bundle", "verbatim", "whole-archive" or "as-needed" + | + = note: for more information, visit <https://doc.rust-lang.org/reference/items/external-blocks.html#the-link-attribute> +help: try changing it to one of the following valid forms of the attribute + | +LL - #[link(name = "...", modifiers = "+unknown")] +LL + #[link(name = "...")] + | +LL - #[link(name = "...", modifiers = "+unknown")] +LL + #[link(name = "...", import_name_type = "decorated|noprefix|undecorated")] + | +LL - #[link(name = "...", modifiers = "+unknown")] +LL + #[link(name = "...", kind = "dylib|static|...")] + | +LL - #[link(name = "...", modifiers = "+unknown")] +LL + #[link(name = "...", kind = "dylib|static|...", wasm_import_module = "...", import_name_type = "decorated|noprefix|undecorated")] + | + = and 1 other candidate error: multiple `verbatim` modifiers in a single `modifiers` argument - --> $DIR/link-attr-validation-late.rs:36:34 + --> $DIR/link-attr-validation-late.rs:34:34 | LL | #[link(name = "...", modifiers = "+verbatim,+verbatim")] | ^^^^^^^^^^^^^^^^^^^^^ -error: aborting due to 24 previous errors +error: aborting due to 22 previous errors -For more information about this error, try `rustc --explain E0459`. +Some errors have detailed explanations: E0538, E0539, E0565. +For more information about an error, try `rustc --explain E0538`. diff --git a/tests/ui/link-native-libs/modifiers-override-4.rs b/tests/ui/link-native-libs/modifiers-override-4.rs new file mode 100644 index 00000000000..cc5b07e20cc --- /dev/null +++ b/tests/ui/link-native-libs/modifiers-override-4.rs @@ -0,0 +1,12 @@ +#[link(name = "foo")] +#[link( +//~^ ERROR malformed `link` attribute input + name = "bar", + kind = "static", + modifiers = "+whole-archive,-whole-archive", + //~^ ERROR multiple `whole-archive` modifiers in a single `modifiers` argument + modifiers = "+bundle" +)] +extern "C" {} + +fn main() {} diff --git a/tests/ui/link-native-libs/modifiers-override-4.stderr b/tests/ui/link-native-libs/modifiers-override-4.stderr new file mode 100644 index 00000000000..317e89cb39c --- /dev/null +++ b/tests/ui/link-native-libs/modifiers-override-4.stderr @@ -0,0 +1,67 @@ +error[E0538]: malformed `link` attribute input + --> $DIR/modifiers-override-4.rs:2:1 + | +LL | / #[link( +LL | | +LL | | name = "bar", +LL | | kind = "static", +... | +LL | | modifiers = "+bundle" + | | --------------------- found `modifiers` used as a key more than once +LL | | )] + | |__^ + | + = note: for more information, visit <https://doc.rust-lang.org/reference/items/external-blocks.html#the-link-attribute> +help: try changing it to one of the following valid forms of the attribute + | +LL - #[link( +LL - +LL - name = "bar", +LL - kind = "static", +LL - modifiers = "+whole-archive,-whole-archive", +LL - +LL - modifiers = "+bundle" +LL - )] +LL + #[link(name = "...")] + | +LL - #[link( +LL - +LL - name = "bar", +LL - kind = "static", +LL - modifiers = "+whole-archive,-whole-archive", +LL - +LL - modifiers = "+bundle" +LL - )] +LL + #[link(name = "...", import_name_type = "decorated|noprefix|undecorated")] + | +LL - #[link( +LL - +LL - name = "bar", +LL - kind = "static", +LL - modifiers = "+whole-archive,-whole-archive", +LL - +LL - modifiers = "+bundle" +LL - )] +LL + #[link(name = "...", kind = "dylib|static|...")] + | +LL - #[link( +LL - +LL - name = "bar", +LL - kind = "static", +LL - modifiers = "+whole-archive,-whole-archive", +LL - +LL - modifiers = "+bundle" +LL - )] +LL + #[link(name = "...", kind = "dylib|static|...", wasm_import_module = "...", import_name_type = "decorated|noprefix|undecorated")] + | + = and 1 other candidate + +error: multiple `whole-archive` modifiers in a single `modifiers` argument + --> $DIR/modifiers-override-4.rs:6:17 + | +LL | modifiers = "+whole-archive,-whole-archive", + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0538`. diff --git a/tests/ui/link-native-libs/modifiers-override.rs b/tests/ui/link-native-libs/modifiers-override.rs index cd2d003664a..a44b7d37ed8 100644 --- a/tests/ui/link-native-libs/modifiers-override.rs +++ b/tests/ui/link-native-libs/modifiers-override.rs @@ -4,13 +4,8 @@ #[link( name = "bar", kind = "static", - modifiers = "+whole-archive,-whole-archive", - //~^ ERROR multiple `whole-archive` modifiers in a single `modifiers` argument - modifiers = "+bundle" - //~^ ERROR multiple `modifiers` arguments in a single `#[link]` attribute )] extern "C" {} //~^ ERROR overriding linking modifiers from command line is not supported -//~| ERROR overriding linking modifiers from command line is not supported fn main() {} diff --git a/tests/ui/link-native-libs/modifiers-override.stderr b/tests/ui/link-native-libs/modifiers-override.stderr index 64427651e9f..3cc99c96c7c 100644 --- a/tests/ui/link-native-libs/modifiers-override.stderr +++ b/tests/ui/link-native-libs/modifiers-override.stderr @@ -1,28 +1,8 @@ -error: multiple `modifiers` arguments in a single `#[link]` attribute - --> $DIR/modifiers-override.rs:9:5 - | -LL | modifiers = "+bundle" - | ^^^^^^^^^^^^^^^^^^^^^ - -error: multiple `whole-archive` modifiers in a single `modifiers` argument - --> $DIR/modifiers-override.rs:7:17 - | -LL | modifiers = "+whole-archive,-whole-archive", - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -error: overriding linking modifiers from command line is not supported - --> $DIR/modifiers-override.rs:12:1 - | -LL | extern "C" {} - | ^^^^^^^^^^^^^ - error: overriding linking modifiers from command line is not supported - --> $DIR/modifiers-override.rs:12:1 + --> $DIR/modifiers-override.rs:8:1 | LL | extern "C" {} | ^^^^^^^^^^^^^ - | - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` -error: aborting due to 4 previous errors +error: aborting due to 1 previous error diff --git a/tests/ui/linkage-attr/raw-dylib/windows/import-name-type-invalid-format.rs b/tests/ui/linkage-attr/raw-dylib/windows/import-name-type-invalid-format.rs index 50ad8a173ad..542f34b3eb1 100644 --- a/tests/ui/linkage-attr/raw-dylib/windows/import-name-type-invalid-format.rs +++ b/tests/ui/linkage-attr/raw-dylib/windows/import-name-type-invalid-format.rs @@ -1,7 +1,10 @@ -//@ only-windows -//@ only-x86 +//@ add-core-stubs +//@ compile-flags: --target i686-pc-windows-msvc +//@ needs-llvm-components: x86 +#![feature(no_core, rustc_attrs, lang_items)] +#![no_core] +#![crate_type = "lib"] + #[link(name = "foo", kind = "raw-dylib", import_name_type = 6)] -//~^ ERROR import name type must be of the form `import_name_type = "string"` +//~^ ERROR malformed extern "C" { } - -fn main() {} diff --git a/tests/ui/linkage-attr/raw-dylib/windows/import-name-type-invalid-format.stderr b/tests/ui/linkage-attr/raw-dylib/windows/import-name-type-invalid-format.stderr index d2cf7a0ba1f..6121762fb03 100644 --- a/tests/ui/linkage-attr/raw-dylib/windows/import-name-type-invalid-format.stderr +++ b/tests/ui/linkage-attr/raw-dylib/windows/import-name-type-invalid-format.stderr @@ -1,8 +1,28 @@ -error: import name type must be of the form `import_name_type = "string"` - --> $DIR/import-name-type-invalid-format.rs:3:42 +error[E0539]: malformed `link` attribute input + --> $DIR/import-name-type-invalid-format.rs:8:1 | LL | #[link(name = "foo", kind = "raw-dylib", import_name_type = 6)] - | ^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^--------------------^^ + | | + | expected this to be of the form `import_name_type = "..."` + | + = note: for more information, visit <https://doc.rust-lang.org/reference/items/external-blocks.html#the-link-attribute> +help: try changing it to one of the following valid forms of the attribute + | +LL - #[link(name = "foo", kind = "raw-dylib", import_name_type = 6)] +LL + #[link(name = "...")] + | +LL - #[link(name = "foo", kind = "raw-dylib", import_name_type = 6)] +LL + #[link(name = "...", import_name_type = "decorated|noprefix|undecorated")] + | +LL - #[link(name = "foo", kind = "raw-dylib", import_name_type = 6)] +LL + #[link(name = "...", kind = "dylib|static|...")] + | +LL - #[link(name = "foo", kind = "raw-dylib", import_name_type = 6)] +LL + #[link(name = "...", kind = "dylib|static|...", wasm_import_module = "...", import_name_type = "decorated|noprefix|undecorated")] + | + = and 1 other candidate error: aborting due to 1 previous error +For more information about this error, try `rustc --explain E0539`. diff --git a/tests/ui/linkage-attr/raw-dylib/windows/import-name-type-multiple.rs b/tests/ui/linkage-attr/raw-dylib/windows/import-name-type-multiple.rs index cf456b9b261..e2418642aea 100644 --- a/tests/ui/linkage-attr/raw-dylib/windows/import-name-type-multiple.rs +++ b/tests/ui/linkage-attr/raw-dylib/windows/import-name-type-multiple.rs @@ -1,8 +1,11 @@ // ignore-tidy-linelength -//@ only-windows -//@ only-x86 +//@ add-core-stubs +//@ compile-flags: --target i686-pc-windows-msvc +//@ needs-llvm-components: x86 +#![feature(no_core, rustc_attrs, lang_items)] +#![no_core] +#![crate_type = "lib"] + #[link(name = "foo", kind = "raw-dylib", import_name_type = "decorated", import_name_type = "decorated")] -//~^ ERROR multiple `import_name_type` arguments in a single `#[link]` attribute +//~^ ERROR malformed extern "C" { } - -fn main() {} diff --git a/tests/ui/linkage-attr/raw-dylib/windows/import-name-type-multiple.stderr b/tests/ui/linkage-attr/raw-dylib/windows/import-name-type-multiple.stderr index 8e65baf65df..adfe915b464 100644 --- a/tests/ui/linkage-attr/raw-dylib/windows/import-name-type-multiple.stderr +++ b/tests/ui/linkage-attr/raw-dylib/windows/import-name-type-multiple.stderr @@ -1,8 +1,28 @@ -error: multiple `import_name_type` arguments in a single `#[link]` attribute - --> $DIR/import-name-type-multiple.rs:4:74 +error[E0538]: malformed `link` attribute input + --> $DIR/import-name-type-multiple.rs:9:1 | LL | #[link(name = "foo", kind = "raw-dylib", import_name_type = "decorated", import_name_type = "decorated")] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^------------------------------^^ + | | + | found `import_name_type` used as a key more than once + | + = note: for more information, visit <https://doc.rust-lang.org/reference/items/external-blocks.html#the-link-attribute> +help: try changing it to one of the following valid forms of the attribute + | +LL - #[link(name = "foo", kind = "raw-dylib", import_name_type = "decorated", import_name_type = "decorated")] +LL + #[link(name = "...")] + | +LL - #[link(name = "foo", kind = "raw-dylib", import_name_type = "decorated", import_name_type = "decorated")] +LL + #[link(name = "...", import_name_type = "decorated|noprefix|undecorated")] + | +LL - #[link(name = "foo", kind = "raw-dylib", import_name_type = "decorated", import_name_type = "decorated")] +LL + #[link(name = "...", kind = "dylib|static|...")] + | +LL - #[link(name = "foo", kind = "raw-dylib", import_name_type = "decorated", import_name_type = "decorated")] +LL + #[link(name = "...", kind = "dylib|static|...", wasm_import_module = "...", import_name_type = "decorated|noprefix|undecorated")] + | + = and 1 other candidate error: aborting due to 1 previous error +For more information about this error, try `rustc --explain E0538`. diff --git a/tests/ui/linkage-attr/raw-dylib/windows/import-name-type-unknown-value.rs b/tests/ui/linkage-attr/raw-dylib/windows/import-name-type-unknown-value.rs index b3859ba1ce6..174e8682f29 100644 --- a/tests/ui/linkage-attr/raw-dylib/windows/import-name-type-unknown-value.rs +++ b/tests/ui/linkage-attr/raw-dylib/windows/import-name-type-unknown-value.rs @@ -1,7 +1,10 @@ -//@ only-windows -//@ only-x86 +//@ add-core-stubs +//@ compile-flags: --target i686-pc-windows-msvc +//@ needs-llvm-components: x86 +#![feature(no_core, rustc_attrs, lang_items)] +#![no_core] +#![crate_type = "lib"] + #[link(name = "foo", kind = "raw-dylib", import_name_type = "unknown")] -//~^ ERROR unknown import name type `unknown`, expected one of: decorated, noprefix, undecorated +//~^ ERROR malformed extern "C" { } - -fn main() {} diff --git a/tests/ui/linkage-attr/raw-dylib/windows/import-name-type-unknown-value.stderr b/tests/ui/linkage-attr/raw-dylib/windows/import-name-type-unknown-value.stderr index 4b8b90eb6e2..fc24a6bed17 100644 --- a/tests/ui/linkage-attr/raw-dylib/windows/import-name-type-unknown-value.stderr +++ b/tests/ui/linkage-attr/raw-dylib/windows/import-name-type-unknown-value.stderr @@ -1,8 +1,28 @@ -error: unknown import name type `unknown`, expected one of: decorated, noprefix, undecorated - --> $DIR/import-name-type-unknown-value.rs:3:42 +error[E0539]: malformed `link` attribute input + --> $DIR/import-name-type-unknown-value.rs:8:1 | LL | #[link(name = "foo", kind = "raw-dylib", import_name_type = "unknown")] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^----------------------------^^ + | | + | valid arguments are "decorated", "noprefix" or "undecorated" + | + = note: for more information, visit <https://doc.rust-lang.org/reference/items/external-blocks.html#the-link-attribute> +help: try changing it to one of the following valid forms of the attribute + | +LL - #[link(name = "foo", kind = "raw-dylib", import_name_type = "unknown")] +LL + #[link(name = "...")] + | +LL - #[link(name = "foo", kind = "raw-dylib", import_name_type = "unknown")] +LL + #[link(name = "...", import_name_type = "decorated|noprefix|undecorated")] + | +LL - #[link(name = "foo", kind = "raw-dylib", import_name_type = "unknown")] +LL + #[link(name = "...", kind = "dylib|static|...")] + | +LL - #[link(name = "foo", kind = "raw-dylib", import_name_type = "unknown")] +LL + #[link(name = "...", kind = "dylib|static|...", wasm_import_module = "...", import_name_type = "decorated|noprefix|undecorated")] + | + = and 1 other candidate error: aborting due to 1 previous error +For more information about this error, try `rustc --explain E0539`. diff --git a/tests/ui/linkage-attr/raw-dylib/windows/import-name-type-unsupported-link-kind.rs b/tests/ui/linkage-attr/raw-dylib/windows/import-name-type-unsupported-link-kind.rs index 3ead5cb1fd7..ca6aef79c95 100644 --- a/tests/ui/linkage-attr/raw-dylib/windows/import-name-type-unsupported-link-kind.rs +++ b/tests/ui/linkage-attr/raw-dylib/windows/import-name-type-unsupported-link-kind.rs @@ -1,5 +1,10 @@ -//@ only-windows -//@ only-x86 +//@ add-core-stubs +//@ compile-flags: --target i686-pc-windows-msvc +//@ needs-llvm-components: x86 +#![feature(no_core, rustc_attrs, lang_items)] +#![no_core] +#![crate_type = "lib"] + #[link(name = "foo", import_name_type = "decorated")] //~^ ERROR import name type can only be used with link kind `raw-dylib` extern "C" { } @@ -11,5 +16,3 @@ extern "C" { } // Specifying `import_name_type` before `kind` shouldn't raise an error. #[link(name = "bar", import_name_type = "decorated", kind = "raw-dylib")] extern "C" { } - -fn main() {} diff --git a/tests/ui/linkage-attr/raw-dylib/windows/import-name-type-unsupported-link-kind.stderr b/tests/ui/linkage-attr/raw-dylib/windows/import-name-type-unsupported-link-kind.stderr index 75cadc471c4..075e4ffffb8 100644 --- a/tests/ui/linkage-attr/raw-dylib/windows/import-name-type-unsupported-link-kind.stderr +++ b/tests/ui/linkage-attr/raw-dylib/windows/import-name-type-unsupported-link-kind.stderr @@ -1,11 +1,11 @@ error: import name type can only be used with link kind `raw-dylib` - --> $DIR/import-name-type-unsupported-link-kind.rs:3:22 + --> $DIR/import-name-type-unsupported-link-kind.rs:8:22 | LL | #[link(name = "foo", import_name_type = "decorated")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: import name type can only be used with link kind `raw-dylib` - --> $DIR/import-name-type-unsupported-link-kind.rs:7:39 + --> $DIR/import-name-type-unsupported-link-kind.rs:12:39 | LL | #[link(name = "bar", kind = "static", import_name_type = "decorated")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/linkage-attr/raw-dylib/windows/import-name-type-x86-only.rs b/tests/ui/linkage-attr/raw-dylib/windows/import-name-type-x86-only.rs index ab0dcda64e6..5f1410f7d2a 100644 --- a/tests/ui/linkage-attr/raw-dylib/windows/import-name-type-x86-only.rs +++ b/tests/ui/linkage-attr/raw-dylib/windows/import-name-type-x86-only.rs @@ -1,7 +1,10 @@ -//@ only-windows -//@ ignore-x86 +//@ add-core-stubs +//@ compile-flags: --target aarch64-pc-windows-msvc +//@ needs-llvm-components: aarch64 +#![feature(no_core, rustc_attrs, lang_items)] +#![no_core] +#![crate_type = "lib"] + #[link(name = "foo", kind = "raw-dylib", import_name_type = "decorated")] //~^ ERROR import name type is only supported on x86 extern "C" { } - -fn main() {} diff --git a/tests/ui/linkage-attr/raw-dylib/windows/import-name-type-x86-only.stderr b/tests/ui/linkage-attr/raw-dylib/windows/import-name-type-x86-only.stderr index 757f1f7994e..ad3b9f79c84 100644 --- a/tests/ui/linkage-attr/raw-dylib/windows/import-name-type-x86-only.stderr +++ b/tests/ui/linkage-attr/raw-dylib/windows/import-name-type-x86-only.stderr @@ -1,5 +1,5 @@ error: import name type is only supported on x86 - --> $DIR/import-name-type-x86-only.rs:3:42 + --> $DIR/import-name-type-x86-only.rs:8:42 | LL | #[link(name = "foo", kind = "raw-dylib", import_name_type = "decorated")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/linkage-attr/raw-dylib/windows/link-ordinal-not-foreign-fn.rs b/tests/ui/linkage-attr/raw-dylib/windows/link-ordinal-not-foreign-fn.rs index 301e690be38..8651a4e7175 100644 --- a/tests/ui/linkage-attr/raw-dylib/windows/link-ordinal-not-foreign-fn.rs +++ b/tests/ui/linkage-attr/raw-dylib/windows/link-ordinal-not-foreign-fn.rs @@ -10,7 +10,7 @@ fn test() {} //~^ ERROR attribute cannot be used on static mut imported_val: i32 = 123; -#[link(name = "exporter", kind = "raw-dylib")] +#[link(name = "exporter")] extern "C" { #[link_ordinal(13)] fn imported_function(); diff --git a/tests/ui/linkage-attr/raw-dylib/windows/link-ordinal-not-foreign-fn.stderr b/tests/ui/linkage-attr/raw-dylib/windows/link-ordinal-not-foreign-fn.stderr index c561373db77..0f7fb8e6d3b 100644 --- a/tests/ui/linkage-attr/raw-dylib/windows/link-ordinal-not-foreign-fn.stderr +++ b/tests/ui/linkage-attr/raw-dylib/windows/link-ordinal-not-foreign-fn.stderr @@ -4,7 +4,7 @@ error: `#[link_ordinal]` attribute cannot be used on structs LL | #[link_ordinal(123)] | ^^^^^^^^^^^^^^^^^^^^ | - = help: `#[link_ordinal]` can be applied to foreign functions, foreign statics + = help: `#[link_ordinal]` can be applied to foreign functions and foreign statics error: `#[link_ordinal]` attribute cannot be used on functions --> $DIR/link-ordinal-not-foreign-fn.rs:5:1 @@ -12,7 +12,7 @@ error: `#[link_ordinal]` attribute cannot be used on functions LL | #[link_ordinal(123)] | ^^^^^^^^^^^^^^^^^^^^ | - = help: `#[link_ordinal]` can be applied to foreign functions, foreign statics + = help: `#[link_ordinal]` can be applied to foreign functions and foreign statics error: `#[link_ordinal]` attribute cannot be used on statics --> $DIR/link-ordinal-not-foreign-fn.rs:9:1 @@ -20,7 +20,7 @@ error: `#[link_ordinal]` attribute cannot be used on statics LL | #[link_ordinal(42)] | ^^^^^^^^^^^^^^^^^^^ | - = help: `#[link_ordinal]` can be applied to foreign functions, foreign statics + = help: `#[link_ordinal]` can be applied to foreign functions and foreign statics error: aborting due to 3 previous errors diff --git a/tests/ui/linkage-attr/raw-dylib/windows/unsupported-abi.stderr b/tests/ui/linkage-attr/raw-dylib/windows/unsupported-abi.stderr index 91e42f2909e..8727e55f4ce 100644 --- a/tests/ui/linkage-attr/raw-dylib/windows/unsupported-abi.stderr +++ b/tests/ui/linkage-attr/raw-dylib/windows/unsupported-abi.stderr @@ -12,7 +12,7 @@ LL | | } = 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 #137018 <https://github.com/rust-lang/rust/issues/137018> = help: if you need `extern "stdcall"` on win32 and `extern "C"` everywhere else, use `extern "system"` - = note: `#[warn(unsupported_calling_conventions)]` on by default + = note: `#[warn(unsupported_calling_conventions)]` (part of `#[warn(future_incompatible)]`) on by default error: ABI not supported by `#[link(kind = "raw-dylib")]` on this architecture --> $DIR/unsupported-abi.rs:16:5 diff --git a/tests/ui/lint/bare-trait-objects-path.stderr b/tests/ui/lint/bare-trait-objects-path.stderr index 8da63a9c546..5d756db2319 100644 --- a/tests/ui/lint/bare-trait-objects-path.stderr +++ b/tests/ui/lint/bare-trait-objects-path.stderr @@ -6,7 +6,7 @@ LL | Dyn::func(); | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! = note: for more information, see <https://doc.rust-lang.org/edition-guide/rust-2021/warnings-promoted-to-error.html> - = note: `#[warn(bare_trait_objects)]` on by default + = note: `#[warn(bare_trait_objects)]` (part of `#[warn(rust_2021_compatibility)]`) on by default help: if this is a dyn-compatible trait, use `dyn` | LL | <dyn Dyn>::func(); diff --git a/tests/ui/lint/dropping_copy_types-macros.fixed b/tests/ui/lint/dropping_copy_types-macros.fixed index a8ceedadc80..2a0c3988157 100644 --- a/tests/ui/lint/dropping_copy_types-macros.fixed +++ b/tests/ui/lint/dropping_copy_types-macros.fixed @@ -9,4 +9,7 @@ fn main() { let mut msg = String::new(); let _ = writeln!(&mut msg, "test"); //~^ ERROR calls to `std::mem::drop` + + let _ = format_args!("a"); + //~^ ERROR calls to `std::mem::drop` } diff --git a/tests/ui/lint/dropping_copy_types-macros.rs b/tests/ui/lint/dropping_copy_types-macros.rs index b249b0c868f..2272e0e8560 100644 --- a/tests/ui/lint/dropping_copy_types-macros.rs +++ b/tests/ui/lint/dropping_copy_types-macros.rs @@ -9,4 +9,7 @@ fn main() { let mut msg = String::new(); drop(writeln!(&mut msg, "test")); //~^ ERROR calls to `std::mem::drop` + + drop(format_args!("a")); + //~^ ERROR calls to `std::mem::drop` } diff --git a/tests/ui/lint/dropping_copy_types-macros.stderr b/tests/ui/lint/dropping_copy_types-macros.stderr index 117e9f4fe09..5048f6e3f18 100644 --- a/tests/ui/lint/dropping_copy_types-macros.stderr +++ b/tests/ui/lint/dropping_copy_types-macros.stderr @@ -17,5 +17,19 @@ LL - drop(writeln!(&mut msg, "test")); LL + let _ = writeln!(&mut msg, "test"); | -error: aborting due to 1 previous error +error: calls to `std::mem::drop` with a value that implements `Copy` does nothing + --> $DIR/dropping_copy_types-macros.rs:13:5 + | +LL | drop(format_args!("a")); + | ^^^^^-----------------^ + | | + | argument has type `Arguments<'_>` + | +help: use `let _ = ...` to ignore the expression or result + | +LL - drop(format_args!("a")); +LL + let _ = format_args!("a"); + | + +error: aborting due to 2 previous errors diff --git a/tests/ui/lint/forbid-group-member.stderr b/tests/ui/lint/forbid-group-member.stderr index 2e0147693f3..54f56ecbe64 100644 --- a/tests/ui/lint/forbid-group-member.stderr +++ b/tests/ui/lint/forbid-group-member.stderr @@ -9,7 +9,7 @@ LL | #[allow(unused_variables)] | = 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 #81670 <https://github.com/rust-lang/rust/issues/81670> - = note: `#[warn(forbidden_lint_groups)]` on by default + = note: `#[warn(forbidden_lint_groups)]` (part of `#[warn(future_incompatible)]`) on by default warning: 1 warning emitted @@ -25,5 +25,5 @@ LL | #[allow(unused_variables)] | = 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 #81670 <https://github.com/rust-lang/rust/issues/81670> - = note: `#[warn(forbidden_lint_groups)]` on by default + = note: `#[warn(forbidden_lint_groups)]` (part of `#[warn(future_incompatible)]`) on by default diff --git a/tests/ui/lint/future-incompatible-lint-group.stderr b/tests/ui/lint/future-incompatible-lint-group.stderr index 87b9ebec08b..4157cd0c77d 100644 --- a/tests/ui/lint/future-incompatible-lint-group.stderr +++ b/tests/ui/lint/future-incompatible-lint-group.stderr @@ -6,7 +6,7 @@ LL | fn f(u8) {} | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! = note: for more information, see issue #41686 <https://github.com/rust-lang/rust/issues/41686> - = note: `#[warn(anonymous_parameters)]` on by default + = note: `#[warn(anonymous_parameters)]` (part of `#[warn(rust_2018_compatibility)]`) on by default error: ambiguous associated item --> $DIR/future-incompatible-lint-group.rs:18:17 diff --git a/tests/ui/lint/inert-attr-macro.rs b/tests/ui/lint/inert-attr-macro.rs index f2d50e30aec..c2ccba7f9ba 100644 --- a/tests/ui/lint/inert-attr-macro.rs +++ b/tests/ui/lint/inert-attr-macro.rs @@ -7,12 +7,14 @@ macro_rules! foo { } fn main() { - #[inline] foo!(); //~ WARN unused attribute `inline` + #[inline] foo!(); //~ WARN `#[inline]` attribute cannot be used on macro calls + //~^ WARN previously accepted // This does nothing, since `#[allow(warnings)]` is itself // an inert attribute on a macro call #[allow(warnings)] #[inline] foo!(); //~ WARN unused attribute `allow` - //~^ WARN unused attribute `inline` + //~^ WARN `#[inline]` attribute cannot be used on macro calls + //~| WARN previously accepted // This does work, since the attribute is on a parent // of the macro invocation. diff --git a/tests/ui/lint/inert-attr-macro.stderr b/tests/ui/lint/inert-attr-macro.stderr index 5ccb4ffe792..9ab6e3ddc74 100644 --- a/tests/ui/lint/inert-attr-macro.stderr +++ b/tests/ui/lint/inert-attr-macro.stderr @@ -1,14 +1,11 @@ -warning: unused attribute `inline` +warning: `#[inline]` attribute cannot be used on macro calls --> $DIR/inert-attr-macro.rs:10:5 | LL | #[inline] foo!(); | ^^^^^^^^^ | -note: the built-in attribute `inline` will be ignored, since it's applied to the macro invocation `foo` - --> $DIR/inert-attr-macro.rs:10:15 - | -LL | #[inline] foo!(); - | ^^^ + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = help: `#[inline]` can only be applied to functions note: the lint level is defined here --> $DIR/inert-attr-macro.rs:3:9 | @@ -17,28 +14,25 @@ LL | #![warn(unused)] = note: `#[warn(unused_attributes)]` implied by `#[warn(unused)]` warning: unused attribute `allow` - --> $DIR/inert-attr-macro.rs:14:5 + --> $DIR/inert-attr-macro.rs:15:5 | LL | #[allow(warnings)] #[inline] foo!(); | ^^^^^^^^^^^^^^^^^^ | note: the built-in attribute `allow` will be ignored, since it's applied to the macro invocation `foo` - --> $DIR/inert-attr-macro.rs:14:34 + --> $DIR/inert-attr-macro.rs:15:34 | LL | #[allow(warnings)] #[inline] foo!(); | ^^^ -warning: unused attribute `inline` - --> $DIR/inert-attr-macro.rs:14:24 +warning: `#[inline]` attribute cannot be used on macro calls + --> $DIR/inert-attr-macro.rs:15:24 | LL | #[allow(warnings)] #[inline] foo!(); | ^^^^^^^^^ | -note: the built-in attribute `inline` will be ignored, since it's applied to the macro invocation `foo` - --> $DIR/inert-attr-macro.rs:14:34 - | -LL | #[allow(warnings)] #[inline] foo!(); - | ^^^ + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = help: `#[inline]` can only be applied to functions warning: 3 warnings emitted diff --git a/tests/ui/lint/int_to_ptr-unsized.rs b/tests/ui/lint/int_to_ptr-unsized.rs new file mode 100644 index 00000000000..bbdc2474561 --- /dev/null +++ b/tests/ui/lint/int_to_ptr-unsized.rs @@ -0,0 +1,23 @@ +// Checks for the `integer_to_pointer_transmutes` lint with unsized types +// +// Related to https://github.com/rust-lang/rust/issues/145935 + +//@ check-pass + +#![allow(non_camel_case_types)] +#![allow(unused_unsafe)] + +#[cfg(target_pointer_width = "64")] +type usizemetadata = i128; + +#[cfg(target_pointer_width = "32")] +type usizemetadata = i64; + +unsafe fn unsized_type(a: usize) { + let _ref = unsafe { std::mem::transmute::<usizemetadata, &'static str>(0xff) }; + //~^ WARN transmuting an integer to a pointer + let _ptr = unsafe { std::mem::transmute::<usizemetadata, *const [u8]>(0xff) }; + //~^ WARN transmuting an integer to a pointer +} + +fn main() {} diff --git a/tests/ui/lint/int_to_ptr-unsized.stderr b/tests/ui/lint/int_to_ptr-unsized.stderr new file mode 100644 index 00000000000..9799af8b12c --- /dev/null +++ b/tests/ui/lint/int_to_ptr-unsized.stderr @@ -0,0 +1,27 @@ +warning: transmuting an integer to a pointer creates a pointer without provenance + --> $DIR/int_to_ptr-unsized.rs:17:25 + | +LL | let _ref = unsafe { std::mem::transmute::<usizemetadata, &'static str>(0xff) }; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: this is dangerous because dereferencing the resulting pointer is undefined behavior + = note: exposed provenance semantics can be used to create a pointer based on some previously exposed provenance + = help: if you truly mean to create a pointer without provenance, use `std::ptr::without_provenance_mut` + = help: for more information about transmute, see <https://doc.rust-lang.org/std/mem/fn.transmute.html#transmutation-between-pointers-and-integers> + = help: for more information about exposed provenance, see <https://doc.rust-lang.org/std/ptr/index.html#exposed-provenance> + = note: `#[warn(integer_to_ptr_transmutes)]` on by default + +warning: transmuting an integer to a pointer creates a pointer without provenance + --> $DIR/int_to_ptr-unsized.rs:19:25 + | +LL | let _ptr = unsafe { std::mem::transmute::<usizemetadata, *const [u8]>(0xff) }; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: this is dangerous because dereferencing the resulting pointer is undefined behavior + = note: exposed provenance semantics can be used to create a pointer based on some previously exposed provenance + = help: if you truly mean to create a pointer without provenance, use `std::ptr::without_provenance_mut` + = help: for more information about transmute, see <https://doc.rust-lang.org/std/mem/fn.transmute.html#transmutation-between-pointers-and-integers> + = help: for more information about exposed provenance, see <https://doc.rust-lang.org/std/ptr/index.html#exposed-provenance> + +warning: 2 warnings emitted + diff --git a/tests/ui/lint/int_to_ptr.fixed b/tests/ui/lint/int_to_ptr.fixed new file mode 100644 index 00000000000..8f373492e6f --- /dev/null +++ b/tests/ui/lint/int_to_ptr.fixed @@ -0,0 +1,47 @@ +// Checks for the `integer_to_pointer_transmutes` lint + +//@ check-pass +//@ run-rustfix + +#![allow(unused_unsafe)] +#![allow(dead_code)] + +unsafe fn should_lint(a: usize) { + let _ptr: *const u8 = unsafe { std::ptr::with_exposed_provenance::<u8>(a) }; + //~^ WARN transmuting an integer to a pointer + let _ptr: *mut u8 = unsafe { std::ptr::with_exposed_provenance_mut::<u8>(a) }; + //~^ WARN transmuting an integer to a pointer + let _ref: &'static u8 = unsafe { &*std::ptr::with_exposed_provenance::<u8>(a) }; + //~^ WARN transmuting an integer to a pointer + let _ref: &'static mut u8 = unsafe { &mut *std::ptr::with_exposed_provenance_mut::<u8>(a) }; + //~^ WARN transmuting an integer to a pointer + + let _ptr = unsafe { std::ptr::with_exposed_provenance::<u8>(42usize) }; + //~^ WARN transmuting an integer to a pointer + let _ptr = unsafe { std::ptr::with_exposed_provenance::<u8>(a + a) }; + //~^ WARN transmuting an integer to a pointer +} + +const unsafe fn should_lintin_const(a: usize) { + let _ptr: *const u8 = unsafe { std::ptr::with_exposed_provenance::<u8>(a) }; + //~^ WARN transmuting an integer to a pointer + let _ptr: *mut u8 = unsafe { std::ptr::with_exposed_provenance_mut::<u8>(a) }; + //~^ WARN transmuting an integer to a pointer + let _ref: &'static u8 = unsafe { &*std::ptr::with_exposed_provenance::<u8>(a) }; + //~^ WARN transmuting an integer to a pointer + let _ref: &'static mut u8 = unsafe { &mut *std::ptr::with_exposed_provenance_mut::<u8>(a) }; + //~^ WARN transmuting an integer to a pointer + + let _ptr = unsafe { std::ptr::with_exposed_provenance::<u8>(42usize) }; + //~^ WARN transmuting an integer to a pointer + let _ptr = unsafe { std::ptr::with_exposed_provenance::<u8>(a + a) }; + //~^ WARN transmuting an integer to a pointer +} + +unsafe fn should_not_lint(a: usize) { + let _ptr = unsafe { std::mem::transmute::<usize, *const u8>(0usize) }; // linted by other lints + let _ptr = unsafe { std::mem::transmute::<usize, *const ()>(a) }; // inner type is a ZST + let _ptr = unsafe { std::mem::transmute::<usize, fn()>(a) }; // omit fn-ptr for now +} + +fn main() {} diff --git a/tests/ui/lint/int_to_ptr.rs b/tests/ui/lint/int_to_ptr.rs new file mode 100644 index 00000000000..7f60da47b85 --- /dev/null +++ b/tests/ui/lint/int_to_ptr.rs @@ -0,0 +1,47 @@ +// Checks for the `integer_to_pointer_transmutes` lint + +//@ check-pass +//@ run-rustfix + +#![allow(unused_unsafe)] +#![allow(dead_code)] + +unsafe fn should_lint(a: usize) { + let _ptr: *const u8 = unsafe { std::mem::transmute::<usize, *const u8>(a) }; + //~^ WARN transmuting an integer to a pointer + let _ptr: *mut u8 = unsafe { std::mem::transmute::<usize, *mut u8>(a) }; + //~^ WARN transmuting an integer to a pointer + let _ref: &'static u8 = unsafe { std::mem::transmute::<usize, &'static u8>(a) }; + //~^ WARN transmuting an integer to a pointer + let _ref: &'static mut u8 = unsafe { std::mem::transmute::<usize, &'static mut u8>(a) }; + //~^ WARN transmuting an integer to a pointer + + let _ptr = unsafe { std::mem::transmute::<usize, *const u8>(42usize) }; + //~^ WARN transmuting an integer to a pointer + let _ptr = unsafe { std::mem::transmute::<usize, *const u8>(a + a) }; + //~^ WARN transmuting an integer to a pointer +} + +const unsafe fn should_lintin_const(a: usize) { + let _ptr: *const u8 = unsafe { std::mem::transmute::<usize, *const u8>(a) }; + //~^ WARN transmuting an integer to a pointer + let _ptr: *mut u8 = unsafe { std::mem::transmute::<usize, *mut u8>(a) }; + //~^ WARN transmuting an integer to a pointer + let _ref: &'static u8 = unsafe { std::mem::transmute::<usize, &'static u8>(a) }; + //~^ WARN transmuting an integer to a pointer + let _ref: &'static mut u8 = unsafe { std::mem::transmute::<usize, &'static mut u8>(a) }; + //~^ WARN transmuting an integer to a pointer + + let _ptr = unsafe { std::mem::transmute::<usize, *const u8>(42usize) }; + //~^ WARN transmuting an integer to a pointer + let _ptr = unsafe { std::mem::transmute::<usize, *const u8>(a + a) }; + //~^ WARN transmuting an integer to a pointer +} + +unsafe fn should_not_lint(a: usize) { + let _ptr = unsafe { std::mem::transmute::<usize, *const u8>(0usize) }; // linted by other lints + let _ptr = unsafe { std::mem::transmute::<usize, *const ()>(a) }; // inner type is a ZST + let _ptr = unsafe { std::mem::transmute::<usize, fn()>(a) }; // omit fn-ptr for now +} + +fn main() {} diff --git a/tests/ui/lint/int_to_ptr.stderr b/tests/ui/lint/int_to_ptr.stderr new file mode 100644 index 00000000000..4035bda8fb2 --- /dev/null +++ b/tests/ui/lint/int_to_ptr.stderr @@ -0,0 +1,207 @@ +warning: transmuting an integer to a pointer creates a pointer without provenance + --> $DIR/int_to_ptr.rs:10:36 + | +LL | let _ptr: *const u8 = unsafe { std::mem::transmute::<usize, *const u8>(a) }; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: this is dangerous because dereferencing the resulting pointer is undefined behavior + = note: exposed provenance semantics can be used to create a pointer based on some previously exposed provenance + = help: if you truly mean to create a pointer without provenance, use `std::ptr::without_provenance_mut` + = help: for more information about transmute, see <https://doc.rust-lang.org/std/mem/fn.transmute.html#transmutation-between-pointers-and-integers> + = help: for more information about exposed provenance, see <https://doc.rust-lang.org/std/ptr/index.html#exposed-provenance> + = note: `#[warn(integer_to_ptr_transmutes)]` on by default +help: use `std::ptr::with_exposed_provenance` instead to use a previously exposed provenance + | +LL - let _ptr: *const u8 = unsafe { std::mem::transmute::<usize, *const u8>(a) }; +LL + let _ptr: *const u8 = unsafe { std::ptr::with_exposed_provenance::<u8>(a) }; + | + +warning: transmuting an integer to a pointer creates a pointer without provenance + --> $DIR/int_to_ptr.rs:12:34 + | +LL | let _ptr: *mut u8 = unsafe { std::mem::transmute::<usize, *mut u8>(a) }; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: this is dangerous because dereferencing the resulting pointer is undefined behavior + = note: exposed provenance semantics can be used to create a pointer based on some previously exposed provenance + = help: if you truly mean to create a pointer without provenance, use `std::ptr::without_provenance_mut` + = help: for more information about transmute, see <https://doc.rust-lang.org/std/mem/fn.transmute.html#transmutation-between-pointers-and-integers> + = help: for more information about exposed provenance, see <https://doc.rust-lang.org/std/ptr/index.html#exposed-provenance> +help: use `std::ptr::with_exposed_provenance_mut` instead to use a previously exposed provenance + | +LL - let _ptr: *mut u8 = unsafe { std::mem::transmute::<usize, *mut u8>(a) }; +LL + let _ptr: *mut u8 = unsafe { std::ptr::with_exposed_provenance_mut::<u8>(a) }; + | + +warning: transmuting an integer to a pointer creates a pointer without provenance + --> $DIR/int_to_ptr.rs:14:38 + | +LL | let _ref: &'static u8 = unsafe { std::mem::transmute::<usize, &'static u8>(a) }; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: this is dangerous because dereferencing the resulting pointer is undefined behavior + = note: exposed provenance semantics can be used to create a pointer based on some previously exposed provenance + = help: if you truly mean to create a pointer without provenance, use `std::ptr::without_provenance_mut` + = help: for more information about transmute, see <https://doc.rust-lang.org/std/mem/fn.transmute.html#transmutation-between-pointers-and-integers> + = help: for more information about exposed provenance, see <https://doc.rust-lang.org/std/ptr/index.html#exposed-provenance> +help: use `std::ptr::with_exposed_provenance` instead to use a previously exposed provenance + | +LL - let _ref: &'static u8 = unsafe { std::mem::transmute::<usize, &'static u8>(a) }; +LL + let _ref: &'static u8 = unsafe { &*std::ptr::with_exposed_provenance::<u8>(a) }; + | + +warning: transmuting an integer to a pointer creates a pointer without provenance + --> $DIR/int_to_ptr.rs:16:42 + | +LL | let _ref: &'static mut u8 = unsafe { std::mem::transmute::<usize, &'static mut u8>(a) }; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: this is dangerous because dereferencing the resulting pointer is undefined behavior + = note: exposed provenance semantics can be used to create a pointer based on some previously exposed provenance + = help: if you truly mean to create a pointer without provenance, use `std::ptr::without_provenance_mut` + = help: for more information about transmute, see <https://doc.rust-lang.org/std/mem/fn.transmute.html#transmutation-between-pointers-and-integers> + = help: for more information about exposed provenance, see <https://doc.rust-lang.org/std/ptr/index.html#exposed-provenance> +help: use `std::ptr::with_exposed_provenance_mut` instead to use a previously exposed provenance + | +LL - let _ref: &'static mut u8 = unsafe { std::mem::transmute::<usize, &'static mut u8>(a) }; +LL + let _ref: &'static mut u8 = unsafe { &mut *std::ptr::with_exposed_provenance_mut::<u8>(a) }; + | + +warning: transmuting an integer to a pointer creates a pointer without provenance + --> $DIR/int_to_ptr.rs:19:25 + | +LL | let _ptr = unsafe { std::mem::transmute::<usize, *const u8>(42usize) }; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: this is dangerous because dereferencing the resulting pointer is undefined behavior + = note: exposed provenance semantics can be used to create a pointer based on some previously exposed provenance + = help: if you truly mean to create a pointer without provenance, use `std::ptr::without_provenance_mut` + = help: for more information about transmute, see <https://doc.rust-lang.org/std/mem/fn.transmute.html#transmutation-between-pointers-and-integers> + = help: for more information about exposed provenance, see <https://doc.rust-lang.org/std/ptr/index.html#exposed-provenance> +help: use `std::ptr::with_exposed_provenance` instead to use a previously exposed provenance + | +LL - let _ptr = unsafe { std::mem::transmute::<usize, *const u8>(42usize) }; +LL + let _ptr = unsafe { std::ptr::with_exposed_provenance::<u8>(42usize) }; + | + +warning: transmuting an integer to a pointer creates a pointer without provenance + --> $DIR/int_to_ptr.rs:21:25 + | +LL | let _ptr = unsafe { std::mem::transmute::<usize, *const u8>(a + a) }; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: this is dangerous because dereferencing the resulting pointer is undefined behavior + = note: exposed provenance semantics can be used to create a pointer based on some previously exposed provenance + = help: if you truly mean to create a pointer without provenance, use `std::ptr::without_provenance_mut` + = help: for more information about transmute, see <https://doc.rust-lang.org/std/mem/fn.transmute.html#transmutation-between-pointers-and-integers> + = help: for more information about exposed provenance, see <https://doc.rust-lang.org/std/ptr/index.html#exposed-provenance> +help: use `std::ptr::with_exposed_provenance` instead to use a previously exposed provenance + | +LL - let _ptr = unsafe { std::mem::transmute::<usize, *const u8>(a + a) }; +LL + let _ptr = unsafe { std::ptr::with_exposed_provenance::<u8>(a + a) }; + | + +warning: transmuting an integer to a pointer creates a pointer without provenance + --> $DIR/int_to_ptr.rs:26:36 + | +LL | let _ptr: *const u8 = unsafe { std::mem::transmute::<usize, *const u8>(a) }; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: this is dangerous because dereferencing the resulting pointer is undefined behavior + = note: exposed provenance semantics can be used to create a pointer based on some previously exposed provenance + = help: if you truly mean to create a pointer without provenance, use `std::ptr::without_provenance_mut` + = help: for more information about transmute, see <https://doc.rust-lang.org/std/mem/fn.transmute.html#transmutation-between-pointers-and-integers> + = help: for more information about exposed provenance, see <https://doc.rust-lang.org/std/ptr/index.html#exposed-provenance> +help: use `std::ptr::with_exposed_provenance` instead to use a previously exposed provenance + | +LL - let _ptr: *const u8 = unsafe { std::mem::transmute::<usize, *const u8>(a) }; +LL + let _ptr: *const u8 = unsafe { std::ptr::with_exposed_provenance::<u8>(a) }; + | + +warning: transmuting an integer to a pointer creates a pointer without provenance + --> $DIR/int_to_ptr.rs:28:34 + | +LL | let _ptr: *mut u8 = unsafe { std::mem::transmute::<usize, *mut u8>(a) }; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: this is dangerous because dereferencing the resulting pointer is undefined behavior + = note: exposed provenance semantics can be used to create a pointer based on some previously exposed provenance + = help: if you truly mean to create a pointer without provenance, use `std::ptr::without_provenance_mut` + = help: for more information about transmute, see <https://doc.rust-lang.org/std/mem/fn.transmute.html#transmutation-between-pointers-and-integers> + = help: for more information about exposed provenance, see <https://doc.rust-lang.org/std/ptr/index.html#exposed-provenance> +help: use `std::ptr::with_exposed_provenance_mut` instead to use a previously exposed provenance + | +LL - let _ptr: *mut u8 = unsafe { std::mem::transmute::<usize, *mut u8>(a) }; +LL + let _ptr: *mut u8 = unsafe { std::ptr::with_exposed_provenance_mut::<u8>(a) }; + | + +warning: transmuting an integer to a pointer creates a pointer without provenance + --> $DIR/int_to_ptr.rs:30:38 + | +LL | let _ref: &'static u8 = unsafe { std::mem::transmute::<usize, &'static u8>(a) }; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: this is dangerous because dereferencing the resulting pointer is undefined behavior + = note: exposed provenance semantics can be used to create a pointer based on some previously exposed provenance + = help: if you truly mean to create a pointer without provenance, use `std::ptr::without_provenance_mut` + = help: for more information about transmute, see <https://doc.rust-lang.org/std/mem/fn.transmute.html#transmutation-between-pointers-and-integers> + = help: for more information about exposed provenance, see <https://doc.rust-lang.org/std/ptr/index.html#exposed-provenance> +help: use `std::ptr::with_exposed_provenance` instead to use a previously exposed provenance + | +LL - let _ref: &'static u8 = unsafe { std::mem::transmute::<usize, &'static u8>(a) }; +LL + let _ref: &'static u8 = unsafe { &*std::ptr::with_exposed_provenance::<u8>(a) }; + | + +warning: transmuting an integer to a pointer creates a pointer without provenance + --> $DIR/int_to_ptr.rs:32:42 + | +LL | let _ref: &'static mut u8 = unsafe { std::mem::transmute::<usize, &'static mut u8>(a) }; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: this is dangerous because dereferencing the resulting pointer is undefined behavior + = note: exposed provenance semantics can be used to create a pointer based on some previously exposed provenance + = help: if you truly mean to create a pointer without provenance, use `std::ptr::without_provenance_mut` + = help: for more information about transmute, see <https://doc.rust-lang.org/std/mem/fn.transmute.html#transmutation-between-pointers-and-integers> + = help: for more information about exposed provenance, see <https://doc.rust-lang.org/std/ptr/index.html#exposed-provenance> +help: use `std::ptr::with_exposed_provenance_mut` instead to use a previously exposed provenance + | +LL - let _ref: &'static mut u8 = unsafe { std::mem::transmute::<usize, &'static mut u8>(a) }; +LL + let _ref: &'static mut u8 = unsafe { &mut *std::ptr::with_exposed_provenance_mut::<u8>(a) }; + | + +warning: transmuting an integer to a pointer creates a pointer without provenance + --> $DIR/int_to_ptr.rs:35:25 + | +LL | let _ptr = unsafe { std::mem::transmute::<usize, *const u8>(42usize) }; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: this is dangerous because dereferencing the resulting pointer is undefined behavior + = note: exposed provenance semantics can be used to create a pointer based on some previously exposed provenance + = help: if you truly mean to create a pointer without provenance, use `std::ptr::without_provenance_mut` + = help: for more information about transmute, see <https://doc.rust-lang.org/std/mem/fn.transmute.html#transmutation-between-pointers-and-integers> + = help: for more information about exposed provenance, see <https://doc.rust-lang.org/std/ptr/index.html#exposed-provenance> +help: use `std::ptr::with_exposed_provenance` instead to use a previously exposed provenance + | +LL - let _ptr = unsafe { std::mem::transmute::<usize, *const u8>(42usize) }; +LL + let _ptr = unsafe { std::ptr::with_exposed_provenance::<u8>(42usize) }; + | + +warning: transmuting an integer to a pointer creates a pointer without provenance + --> $DIR/int_to_ptr.rs:37:25 + | +LL | let _ptr = unsafe { std::mem::transmute::<usize, *const u8>(a + a) }; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: this is dangerous because dereferencing the resulting pointer is undefined behavior + = note: exposed provenance semantics can be used to create a pointer based on some previously exposed provenance + = help: if you truly mean to create a pointer without provenance, use `std::ptr::without_provenance_mut` + = help: for more information about transmute, see <https://doc.rust-lang.org/std/mem/fn.transmute.html#transmutation-between-pointers-and-integers> + = help: for more information about exposed provenance, see <https://doc.rust-lang.org/std/ptr/index.html#exposed-provenance> +help: use `std::ptr::with_exposed_provenance` instead to use a previously exposed provenance + | +LL - let _ptr = unsafe { std::mem::transmute::<usize, *const u8>(a + a) }; +LL + let _ptr = unsafe { std::ptr::with_exposed_provenance::<u8>(a + a) }; + | + +warning: 12 warnings emitted + diff --git a/tests/ui/lint/internal/higher-ranked-query-instability.rs b/tests/ui/lint/internal/higher-ranked-query-instability.rs new file mode 100644 index 00000000000..4407baac0c6 --- /dev/null +++ b/tests/ui/lint/internal/higher-ranked-query-instability.rs @@ -0,0 +1,11 @@ +//@ check-pass +//@ compile-flags: -Zunstable-options + +// Make sure we don't try to resolve instances for trait refs that have escaping +// bound vars when computing the query instability lint. + +fn foo<T>() where for<'a> &'a [T]: IntoIterator<Item = &'a T> {} + +fn main() { + foo::<()>(); +} diff --git a/tests/ui/lint/let_underscore/let_underscore_lock.stderr b/tests/ui/lint/let_underscore/let_underscore_lock.stderr index a54a23e364b..d70dab32e3e 100644 --- a/tests/ui/lint/let_underscore/let_underscore_lock.stderr +++ b/tests/ui/lint/let_underscore/let_underscore_lock.stderr @@ -4,7 +4,7 @@ error: non-binding let on a synchronization lock LL | let _ = data.lock().unwrap(); | ^ this lock is not assigned to a binding and is immediately dropped | - = note: `#[deny(let_underscore_lock)]` on by default + = note: `#[deny(let_underscore_lock)]` (part of `#[deny(let_underscore)]`) on by default help: consider binding to an unused variable to avoid immediately dropping the value | LL | let _unused = data.lock().unwrap(); diff --git a/tests/ui/lint/linker-warning.stderr b/tests/ui/lint/linker-warning.stderr index c678562ab54..ae5f6b3adec 100644 --- a/tests/ui/lint/linker-warning.stderr +++ b/tests/ui/lint/linker-warning.stderr @@ -1,4 +1,4 @@ -warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` +warning: crate-level attribute should be an inner attribute --> $DIR/linker-warning.rs:7:1 | LL | #[allow(linker_messages)] @@ -9,6 +9,10 @@ note: the lint level is defined here | LL | #![warn(unused_attributes)] | ^^^^^^^^^^^^^^^^^ +help: add a `!` + | +LL | #![allow(linker_messages)] + | + warning: unused attribute --> $DIR/linker-warning.rs:4:1 diff --git a/tests/ui/lint/lint-misplaced-attr.stderr b/tests/ui/lint/lint-misplaced-attr.stderr index abaf4620e6f..bcfda170080 100644 --- a/tests/ui/lint/lint-misplaced-attr.stderr +++ b/tests/ui/lint/lint-misplaced-attr.stderr @@ -10,11 +10,16 @@ note: the lint level is defined here LL | #![deny(unused_attributes)] | ^^^^^^^^^^^^^^^^^ -error: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` +error: crate-level attribute should be an inner attribute --> $DIR/lint-misplaced-attr.rs:10:1 | LL | #[crate_type = "bin"] fn main() {} | ^^^^^^^^^^^^^^^^^^^^^ + | +help: add a `!` + | +LL | #![crate_type = "bin"] fn main() {} + | + error: aborting due to 2 previous errors diff --git a/tests/ui/lint/lint-non-uppercase-usages.stderr b/tests/ui/lint/lint-non-uppercase-usages.stderr index b34be31216d..5dde4d4c89d 100644 --- a/tests/ui/lint/lint-non-uppercase-usages.stderr +++ b/tests/ui/lint/lint-non-uppercase-usages.stderr @@ -4,7 +4,7 @@ warning: constant `my_static` should have an upper case name LL | const my_static: u32 = 0; | ^^^^^^^^^ | - = note: `#[warn(non_upper_case_globals)]` on by default + = note: `#[warn(non_upper_case_globals)]` (part of `#[warn(nonstandard_style)]`) on by default help: convert the identifier to upper case | LL - const my_static: u32 = 0; diff --git a/tests/ui/lint/mention-lint-group-in-default-level-lint-note-issue-65464.rs b/tests/ui/lint/mention-lint-group-in-default-level-lint-note-issue-65464.rs new file mode 100644 index 00000000000..5db7cc02baa --- /dev/null +++ b/tests/ui/lint/mention-lint-group-in-default-level-lint-note-issue-65464.rs @@ -0,0 +1,22 @@ +//@ check-pass + +// Verify information about membership to builtin lint group is included in the lint message when +// explaining lint level and source for builtin lints with default settings. +// +// Ideally, we'd like to use lints that are part of `unused` group as shown in the issue. +// This is not possible in a ui test, because `unused` lints are enabled with `-A unused` +// in such tests, and the we're testing a scenario with no modification to the default settings. + +fn main() { + // additional context is provided only if the level is not explicitly set + let WrongCase = 1; + //~^ WARN [non_snake_case] + //~| NOTE `#[warn(non_snake_case)]` (part of `#[warn(nonstandard_style)]`) on by default + + // unchanged message if the level is explicitly set + // even if the level is the same as the default + #[warn(nonstandard_style)] //~ NOTE the lint level is defined here + let WrongCase = 2; + //~^ WARN [non_snake_case] + //~| NOTE `#[warn(non_snake_case)]` implied by `#[warn(nonstandard_style)]` +} diff --git a/tests/ui/lint/mention-lint-group-in-default-level-lint-note-issue-65464.stderr b/tests/ui/lint/mention-lint-group-in-default-level-lint-note-issue-65464.stderr new file mode 100644 index 00000000000..86ec59220f0 --- /dev/null +++ b/tests/ui/lint/mention-lint-group-in-default-level-lint-note-issue-65464.stderr @@ -0,0 +1,23 @@ +warning: variable `WrongCase` should have a snake case name + --> $DIR/mention-lint-group-in-default-level-lint-note-issue-65464.rs:12:9 + | +LL | let WrongCase = 1; + | ^^^^^^^^^ help: convert the identifier to snake case: `wrong_case` + | + = note: `#[warn(non_snake_case)]` (part of `#[warn(nonstandard_style)]`) on by default + +warning: variable `WrongCase` should have a snake case name + --> $DIR/mention-lint-group-in-default-level-lint-note-issue-65464.rs:19:9 + | +LL | let WrongCase = 2; + | ^^^^^^^^^ help: convert the identifier to snake case: `wrong_case` + | +note: the lint level is defined here + --> $DIR/mention-lint-group-in-default-level-lint-note-issue-65464.rs:18:12 + | +LL | #[warn(nonstandard_style)] + | ^^^^^^^^^^^^^^^^^ + = note: `#[warn(non_snake_case)]` implied by `#[warn(nonstandard_style)]` + +warning: 2 warnings emitted + diff --git a/tests/ui/lint/rfc-2457-non-ascii-idents/lint-uncommon-codepoints.stderr b/tests/ui/lint/rfc-2457-non-ascii-idents/lint-uncommon-codepoints.stderr index 000545a0600..1ba4deded46 100644 --- a/tests/ui/lint/rfc-2457-non-ascii-idents/lint-uncommon-codepoints.stderr +++ b/tests/ui/lint/rfc-2457-non-ascii-idents/lint-uncommon-codepoints.stderr @@ -33,7 +33,7 @@ warning: constant `µ` should have an upper case name LL | const µ: f64 = 0.000001; | ^ help: convert the identifier to upper case: `Μ` | - = note: `#[warn(non_upper_case_globals)]` on by default + = note: `#[warn(non_upper_case_globals)]` (part of `#[warn(nonstandard_style)]`) on by default error: aborting due to 3 previous errors; 1 warning emitted diff --git a/tests/ui/lint/semicolon-in-expressions-from-macros/warn-semicolon-in-expressions-from-macros.stderr b/tests/ui/lint/semicolon-in-expressions-from-macros/warn-semicolon-in-expressions-from-macros.stderr index 99cdcafab39..9506d702f51 100644 --- a/tests/ui/lint/semicolon-in-expressions-from-macros/warn-semicolon-in-expressions-from-macros.stderr +++ b/tests/ui/lint/semicolon-in-expressions-from-macros/warn-semicolon-in-expressions-from-macros.stderr @@ -9,7 +9,7 @@ LL | _ => foo!() | = 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 #79813 <https://github.com/rust-lang/rust/issues/79813> - = note: `#[deny(semicolon_in_expressions_from_macros)]` on by default + = note: `#[deny(semicolon_in_expressions_from_macros)]` (part of `#[deny(future_incompatible)]`) on by default = note: this error originates in the macro `foo` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 1 previous error @@ -26,6 +26,6 @@ LL | _ => foo!() | = 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 #79813 <https://github.com/rust-lang/rust/issues/79813> - = note: `#[deny(semicolon_in_expressions_from_macros)]` on by default + = note: `#[deny(semicolon_in_expressions_from_macros)]` (part of `#[deny(future_incompatible)]`) on by default = note: this error originates in the macro `foo` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/tests/ui/lint/special-upper-lower-cases.stderr b/tests/ui/lint/special-upper-lower-cases.stderr index 2aa13c33be3..0f5cf336aec 100644 --- a/tests/ui/lint/special-upper-lower-cases.stderr +++ b/tests/ui/lint/special-upper-lower-cases.stderr @@ -4,7 +4,7 @@ warning: type `𝕟𝕠𝕥𝕒𝕔𝕒𝕞𝕖𝕝` should have an upper camel LL | struct 𝕟𝕠𝕥𝕒𝕔𝕒𝕞𝕖𝕝; | ^^^^^^^^^ should have an UpperCamelCase name | - = note: `#[warn(non_camel_case_types)]` on by default + = note: `#[warn(non_camel_case_types)]` (part of `#[warn(nonstandard_style)]`) on by default warning: type `𝕟𝕠𝕥_𝕒_𝕔𝕒𝕞𝕖𝕝` should have an upper camel case name --> $DIR/special-upper-lower-cases.rs:14:8 @@ -18,7 +18,7 @@ warning: static variable `𝗻𝗼𝗻𝘂𝗽𝗽𝗲𝗿𝗰𝗮𝘀𝗲` shou LL | static 𝗻𝗼𝗻𝘂𝗽𝗽𝗲𝗿𝗰𝗮𝘀𝗲: i32 = 1; | ^^^^^^^^^^^^ should have an UPPER_CASE name | - = note: `#[warn(non_upper_case_globals)]` on by default + = note: `#[warn(non_upper_case_globals)]` (part of `#[warn(nonstandard_style)]`) on by default warning: variable `𝓢𝓝𝓐𝓐𝓐𝓐𝓚𝓔𝓢` should have a snake case name --> $DIR/special-upper-lower-cases.rs:21:9 @@ -26,7 +26,7 @@ warning: variable `𝓢𝓝𝓐𝓐𝓐𝓐𝓚𝓔𝓢` should have a snake cas LL | let 𝓢𝓝𝓐𝓐𝓐𝓐𝓚𝓔𝓢 = 1; | ^^^^^^^^^ should have a snake_case name | - = note: `#[warn(non_snake_case)]` on by default + = note: `#[warn(non_snake_case)]` (part of `#[warn(nonstandard_style)]`) on by default warning: 4 warnings emitted diff --git a/tests/ui/lint/static-mut-refs.e2021.stderr b/tests/ui/lint/static-mut-refs.e2021.stderr index 75a7e60690c..86854ab2dda 100644 --- a/tests/ui/lint/static-mut-refs.e2021.stderr +++ b/tests/ui/lint/static-mut-refs.e2021.stderr @@ -6,7 +6,7 @@ LL | let _y = &X; | = note: for more information, see <https://doc.rust-lang.org/edition-guide/rust-2024/static-mut-references.html> = note: shared references to mutable statics are dangerous; it's undefined behavior if the static is mutated or if a mutable reference is created for it while the shared reference lives - = note: `#[warn(static_mut_refs)]` on by default + = note: `#[warn(static_mut_refs)]` (part of `#[warn(rust_2024_compatibility)]`) on by default help: use `&raw const` instead to create a raw pointer | LL | let _y = &raw const X; diff --git a/tests/ui/lint/static-mut-refs.e2024.stderr b/tests/ui/lint/static-mut-refs.e2024.stderr index 42a96bafc88..5c21c5b0dd9 100644 --- a/tests/ui/lint/static-mut-refs.e2024.stderr +++ b/tests/ui/lint/static-mut-refs.e2024.stderr @@ -6,7 +6,7 @@ LL | let _y = &X; | = note: for more information, see <https://doc.rust-lang.org/edition-guide/rust-2024/static-mut-references.html> = note: shared references to mutable statics are dangerous; it's undefined behavior if the static is mutated or if a mutable reference is created for it while the shared reference lives - = note: `#[deny(static_mut_refs)]` on by default + = note: `#[deny(static_mut_refs)]` (part of `#[deny(rust_2024_compatibility)]`) on by default help: use `&raw const` instead to create a raw pointer | LL | let _y = &raw const X; diff --git a/tests/ui/lint/unused/concat-in-crate-deprecated-issue-137687.rs b/tests/ui/lint/unused/concat-in-crate-deprecated-issue-137687.rs new file mode 100644 index 00000000000..22dd55f4421 --- /dev/null +++ b/tests/ui/lint/unused/concat-in-crate-deprecated-issue-137687.rs @@ -0,0 +1,6 @@ +//@ check-pass +#[deprecated = concat !()] +macro_rules! a { + () => {}; +} +fn main() {} diff --git a/tests/ui/lint/unused/concat-in-crate-name-issue-137687.rs b/tests/ui/lint/unused/concat-in-crate-name-issue-137687.rs new file mode 100644 index 00000000000..c507b6590c2 --- /dev/null +++ b/tests/ui/lint/unused/concat-in-crate-name-issue-137687.rs @@ -0,0 +1,9 @@ +#![deny(unused)] + +#[crate_name = concat !()] +//~^ ERROR crate-level attribute should be an inner attribute +macro_rules! a { + //~^ ERROR unused macro definition + () => {}; +} +fn main() {} diff --git a/tests/ui/lint/unused/concat-in-crate-name-issue-137687.stderr b/tests/ui/lint/unused/concat-in-crate-name-issue-137687.stderr new file mode 100644 index 00000000000..b06e65af7bc --- /dev/null +++ b/tests/ui/lint/unused/concat-in-crate-name-issue-137687.stderr @@ -0,0 +1,31 @@ +error: unused macro definition: `a` + --> $DIR/concat-in-crate-name-issue-137687.rs:5:14 + | +LL | macro_rules! a { + | ^ + | +note: the lint level is defined here + --> $DIR/concat-in-crate-name-issue-137687.rs:1:9 + | +LL | #![deny(unused)] + | ^^^^^^ + = note: `#[deny(unused_macros)]` implied by `#[deny(unused)]` + +error: crate-level attribute should be an inner attribute: add an exclamation mark: `#![crate_name]` + --> $DIR/concat-in-crate-name-issue-137687.rs:3:1 + | +LL | #[crate_name = concat !()] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +note: This attribute does not have an `!`, which means it is applied to this macro def + --> $DIR/concat-in-crate-name-issue-137687.rs:5:1 + | +LL | / macro_rules! a { +LL | | +LL | | () => {}; +LL | | } + | |_^ + = note: `#[deny(unused_attributes)]` implied by `#[deny(unused)]` + +error: aborting due to 2 previous errors + diff --git a/tests/ui/lint/unused/issue-70041.stderr b/tests/ui/lint/unused/issue-70041.stderr index b2e6d1aeb3f..4a2c4b8b907 100644 --- a/tests/ui/lint/unused/issue-70041.stderr +++ b/tests/ui/lint/unused/issue-70041.stderr @@ -4,7 +4,7 @@ warning: unused macro definition: `regex` LL | macro_rules! regex { | ^^^^^ | - = note: `#[warn(unused_macros)]` on by default + = note: `#[warn(unused_macros)]` (part of `#[warn(unused)]`) on by default warning: unused import: `regex` --> $DIR/issue-70041.rs:10:5 @@ -12,7 +12,7 @@ warning: unused import: `regex` LL | use regex; | ^^^^^ | - = note: `#[warn(unused_imports)]` on by default + = note: `#[warn(unused_imports)]` (part of `#[warn(unused)]`) on by default warning: 2 warnings emitted diff --git a/tests/ui/lint/unused/unused-attr-duplicate.rs b/tests/ui/lint/unused/unused-attr-duplicate.rs index cfa6c2b4228..a334c49788c 100644 --- a/tests/ui/lint/unused/unused-attr-duplicate.rs +++ b/tests/ui/lint/unused/unused-attr-duplicate.rs @@ -11,8 +11,12 @@ // - no_main: extra setup #![deny(unused_attributes)] #![crate_name = "unused_attr_duplicate"] -#![crate_name = "unused_attr_duplicate2"] //~ ERROR unused attribute -//~^ WARN this was previously accepted +#![crate_name = "unused_attr_duplicate2"] +//~^ ERROR unused attribute +//~| WARN this was previously accepted +//~| ERROR unused attribute +//~| WARN this was previously accepted +// FIXME(jdonszelmann) this error is given twice now. I'll look at this in the future #![recursion_limit = "128"] #![recursion_limit = "256"] //~ ERROR unused attribute //~^ WARN this was previously accepted diff --git a/tests/ui/lint/unused/unused-attr-duplicate.stderr b/tests/ui/lint/unused/unused-attr-duplicate.stderr index 6c44e884ba5..203211d0d56 100644 --- a/tests/ui/lint/unused/unused-attr-duplicate.stderr +++ b/tests/ui/lint/unused/unused-attr-duplicate.stderr @@ -1,14 +1,15 @@ error: unused attribute - --> $DIR/unused-attr-duplicate.rs:33:1 + --> $DIR/unused-attr-duplicate.rs:14:1 | -LL | #[no_link] - | ^^^^^^^^^^ help: remove this attribute +LL | #![crate_name = "unused_attr_duplicate2"] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute | note: attribute also specified here - --> $DIR/unused-attr-duplicate.rs:32:1 + --> $DIR/unused-attr-duplicate.rs:13:1 | -LL | #[no_link] - | ^^^^^^^^^^ +LL | #![crate_name = "unused_attr_duplicate"] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! note: the lint level is defined here --> $DIR/unused-attr-duplicate.rs:12:9 | @@ -16,291 +17,304 @@ LL | #![deny(unused_attributes)] | ^^^^^^^^^^^^^^^^^ error: unused attribute - --> $DIR/unused-attr-duplicate.rs:14:1 + --> $DIR/unused-attr-duplicate.rs:37:1 | -LL | #![crate_name = "unused_attr_duplicate2"] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute +LL | #[no_link] + | ^^^^^^^^^^ help: remove this attribute | note: attribute also specified here - --> $DIR/unused-attr-duplicate.rs:13:1 + --> $DIR/unused-attr-duplicate.rs:36:1 | -LL | #![crate_name = "unused_attr_duplicate"] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! +LL | #[no_link] + | ^^^^^^^^^^ error: unused attribute - --> $DIR/unused-attr-duplicate.rs:17:1 + --> $DIR/unused-attr-duplicate.rs:21:1 | LL | #![recursion_limit = "256"] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute | note: attribute also specified here - --> $DIR/unused-attr-duplicate.rs:16:1 + --> $DIR/unused-attr-duplicate.rs:20:1 | LL | #![recursion_limit = "128"] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! error: unused attribute - --> $DIR/unused-attr-duplicate.rs:20:1 + --> $DIR/unused-attr-duplicate.rs:24:1 | LL | #![type_length_limit = "1"] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute | note: attribute also specified here - --> $DIR/unused-attr-duplicate.rs:19:1 + --> $DIR/unused-attr-duplicate.rs:23:1 | LL | #![type_length_limit = "1048576"] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! error: unused attribute - --> $DIR/unused-attr-duplicate.rs:23:1 + --> $DIR/unused-attr-duplicate.rs:27:1 | LL | #![no_std] | ^^^^^^^^^^ help: remove this attribute | note: attribute also specified here - --> $DIR/unused-attr-duplicate.rs:22:1 + --> $DIR/unused-attr-duplicate.rs:26:1 | LL | #![no_std] | ^^^^^^^^^^ error: unused attribute - --> $DIR/unused-attr-duplicate.rs:27:1 + --> $DIR/unused-attr-duplicate.rs:31:1 | LL | #![windows_subsystem = "windows"] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute | note: attribute also specified here - --> $DIR/unused-attr-duplicate.rs:26:1 + --> $DIR/unused-attr-duplicate.rs:30:1 | LL | #![windows_subsystem = "console"] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! error: unused attribute - --> $DIR/unused-attr-duplicate.rs:30:1 + --> $DIR/unused-attr-duplicate.rs:34:1 | LL | #![no_builtins] | ^^^^^^^^^^^^^^^ help: remove this attribute | note: attribute also specified here - --> $DIR/unused-attr-duplicate.rs:29:1 + --> $DIR/unused-attr-duplicate.rs:33:1 | LL | #![no_builtins] | ^^^^^^^^^^^^^^^ error: unused attribute - --> $DIR/unused-attr-duplicate.rs:40:5 + --> $DIR/unused-attr-duplicate.rs:44:5 | LL | #[macro_export] | ^^^^^^^^^^^^^^^ help: remove this attribute | note: attribute also specified here - --> $DIR/unused-attr-duplicate.rs:39:5 + --> $DIR/unused-attr-duplicate.rs:43:5 | LL | #[macro_export] | ^^^^^^^^^^^^^^^ error: unused attribute - --> $DIR/unused-attr-duplicate.rs:37:1 + --> $DIR/unused-attr-duplicate.rs:41:1 | LL | #[macro_use] | ^^^^^^^^^^^^ help: remove this attribute | note: attribute also specified here - --> $DIR/unused-attr-duplicate.rs:36:1 + --> $DIR/unused-attr-duplicate.rs:40:1 | LL | #[macro_use] | ^^^^^^^^^^^^ error: unused attribute - --> $DIR/unused-attr-duplicate.rs:47:1 + --> $DIR/unused-attr-duplicate.rs:51:1 | LL | #[path = "bar.rs"] | ^^^^^^^^^^^^^^^^^^ help: remove this attribute | note: attribute also specified here - --> $DIR/unused-attr-duplicate.rs:46:1 + --> $DIR/unused-attr-duplicate.rs:50:1 | LL | #[path = "auxiliary/lint_unused_extern_crate.rs"] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! error: unused attribute - --> $DIR/unused-attr-duplicate.rs:53:1 + --> $DIR/unused-attr-duplicate.rs:57:1 | LL | #[ignore = "some text"] | ^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute | note: attribute also specified here - --> $DIR/unused-attr-duplicate.rs:52:1 + --> $DIR/unused-attr-duplicate.rs:56:1 | LL | #[ignore] | ^^^^^^^^^ error: unused attribute - --> $DIR/unused-attr-duplicate.rs:55:1 + --> $DIR/unused-attr-duplicate.rs:59:1 | LL | #[should_panic(expected = "values don't match")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute | note: attribute also specified here - --> $DIR/unused-attr-duplicate.rs:54:1 + --> $DIR/unused-attr-duplicate.rs:58:1 | LL | #[should_panic] | ^^^^^^^^^^^^^^^ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! error: unused attribute - --> $DIR/unused-attr-duplicate.rs:60:1 + --> $DIR/unused-attr-duplicate.rs:64:1 | LL | #[must_use = "some message"] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute | note: attribute also specified here - --> $DIR/unused-attr-duplicate.rs:59:1 + --> $DIR/unused-attr-duplicate.rs:63:1 | LL | #[must_use] | ^^^^^^^^^^^ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! error: unused attribute - --> $DIR/unused-attr-duplicate.rs:66:1 + --> $DIR/unused-attr-duplicate.rs:70:1 | LL | #[non_exhaustive] | ^^^^^^^^^^^^^^^^^ help: remove this attribute | note: attribute also specified here - --> $DIR/unused-attr-duplicate.rs:65:1 + --> $DIR/unused-attr-duplicate.rs:69:1 | LL | #[non_exhaustive] | ^^^^^^^^^^^^^^^^^ error: unused attribute - --> $DIR/unused-attr-duplicate.rs:72:1 + --> $DIR/unused-attr-duplicate.rs:76:1 | LL | #[automatically_derived] | ^^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute | note: attribute also specified here - --> $DIR/unused-attr-duplicate.rs:71:1 + --> $DIR/unused-attr-duplicate.rs:75:1 | LL | #[automatically_derived] | ^^^^^^^^^^^^^^^^^^^^^^^^ error: unused attribute - --> $DIR/unused-attr-duplicate.rs:76:1 + --> $DIR/unused-attr-duplicate.rs:80:1 | LL | #[inline(never)] | ^^^^^^^^^^^^^^^^ help: remove this attribute | note: attribute also specified here - --> $DIR/unused-attr-duplicate.rs:75:1 + --> $DIR/unused-attr-duplicate.rs:79:1 | LL | #[inline(always)] | ^^^^^^^^^^^^^^^^^ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! error: unused attribute - --> $DIR/unused-attr-duplicate.rs:79:1 + --> $DIR/unused-attr-duplicate.rs:83:1 | LL | #[cold] | ^^^^^^^ help: remove this attribute | note: attribute also specified here - --> $DIR/unused-attr-duplicate.rs:78:1 + --> $DIR/unused-attr-duplicate.rs:82:1 | LL | #[cold] | ^^^^^^^ error: unused attribute - --> $DIR/unused-attr-duplicate.rs:81:1 + --> $DIR/unused-attr-duplicate.rs:85:1 | LL | #[track_caller] | ^^^^^^^^^^^^^^^ help: remove this attribute | note: attribute also specified here - --> $DIR/unused-attr-duplicate.rs:80:1 + --> $DIR/unused-attr-duplicate.rs:84:1 | LL | #[track_caller] | ^^^^^^^^^^^^^^^ error: unused attribute - --> $DIR/unused-attr-duplicate.rs:88:5 + --> $DIR/unused-attr-duplicate.rs:92:5 | LL | #[link_name = "this_does_not_exist"] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute | note: attribute also specified here - --> $DIR/unused-attr-duplicate.rs:90:5 + --> $DIR/unused-attr-duplicate.rs:94:5 | LL | #[link_name = "rust_dbg_extern_identity_u32"] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! error: unused attribute - --> $DIR/unused-attr-duplicate.rs:94:1 + --> $DIR/unused-attr-duplicate.rs:98:1 | LL | #[export_name = "exported_symbol_name"] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute | note: attribute also specified here - --> $DIR/unused-attr-duplicate.rs:96:1 + --> $DIR/unused-attr-duplicate.rs:100:1 | LL | #[export_name = "exported_symbol_name2"] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! error: unused attribute - --> $DIR/unused-attr-duplicate.rs:100:1 + --> $DIR/unused-attr-duplicate.rs:104:1 | LL | #[no_mangle] | ^^^^^^^^^^^^ help: remove this attribute | note: attribute also specified here - --> $DIR/unused-attr-duplicate.rs:99:1 + --> $DIR/unused-attr-duplicate.rs:103:1 | LL | #[no_mangle] | ^^^^^^^^^^^^ error: unused attribute - --> $DIR/unused-attr-duplicate.rs:104:1 + --> $DIR/unused-attr-duplicate.rs:108:1 | LL | #[used] | ^^^^^^^ help: remove this attribute | note: attribute also specified here - --> $DIR/unused-attr-duplicate.rs:103:1 + --> $DIR/unused-attr-duplicate.rs:107:1 | LL | #[used] | ^^^^^^^ error: unused attribute - --> $DIR/unused-attr-duplicate.rs:107:1 + --> $DIR/unused-attr-duplicate.rs:111:1 | LL | #[link_section = ".text"] | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute | note: attribute also specified here - --> $DIR/unused-attr-duplicate.rs:110:1 + --> $DIR/unused-attr-duplicate.rs:114:1 | LL | #[link_section = ".bss"] | ^^^^^^^^^^^^^^^^^^^^^^^^ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! error: unused attribute - --> $DIR/unused-attr-duplicate.rs:25:1 + --> $DIR/unused-attr-duplicate.rs:14:1 + | +LL | #![crate_name = "unused_attr_duplicate2"] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute + | +note: attribute also specified here + --> $DIR/unused-attr-duplicate.rs:13:1 + | +LL | #![crate_name = "unused_attr_duplicate"] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + +error: unused attribute + --> $DIR/unused-attr-duplicate.rs:29:1 | LL | #![no_implicit_prelude] | ^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute | note: attribute also specified here - --> $DIR/unused-attr-duplicate.rs:24:1 + --> $DIR/unused-attr-duplicate.rs:28:1 | LL | #![no_implicit_prelude] | ^^^^^^^^^^^^^^^^^^^^^^^ -error: aborting due to 24 previous errors +error: aborting due to 25 previous errors diff --git a/tests/ui/lint/unused/unused-attr-macro-rules.stderr b/tests/ui/lint/unused/unused-attr-macro-rules.stderr index 0c55ae678e9..af64be8f6e9 100644 --- a/tests/ui/lint/unused/unused-attr-macro-rules.stderr +++ b/tests/ui/lint/unused/unused-attr-macro-rules.stderr @@ -1,4 +1,4 @@ -error: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` +error: crate-level attribute should be an inner attribute --> $DIR/unused-attr-macro-rules.rs:11:1 | LL | #[recursion_limit="1"] @@ -9,6 +9,10 @@ note: the lint level is defined here | LL | #![deny(unused_attributes)] | ^^^^^^^^^^^^^^^^^ +help: add a `!` + | +LL | #![recursion_limit="1"] + | + error: `#[macro_use]` attribute cannot be used on macro defs --> $DIR/unused-attr-macro-rules.rs:7:1 @@ -17,7 +21,7 @@ LL | #[macro_use] | ^^^^^^^^^^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = help: `#[macro_use]` can be applied to modules, extern crates, crates + = help: `#[macro_use]` can be applied to modules, extern crates, and crates error: `#[path]` attribute cannot be used on macro defs --> $DIR/unused-attr-macro-rules.rs:9:1 diff --git a/tests/ui/lint/unused/unused_attributes-must_use.fixed b/tests/ui/lint/unused/unused_attributes-must_use.fixed index 80d488296ea..fa596da95cc 100644 --- a/tests/ui/lint/unused/unused_attributes-must_use.fixed +++ b/tests/ui/lint/unused/unused_attributes-must_use.fixed @@ -4,18 +4,23 @@ #![deny(unused_attributes, unused_must_use)] #![feature(asm_experimental_arch, stmt_expr_attributes, trait_alias)] - //~ ERROR `#[must_use]` has no effect + //~ ERROR attribute cannot be used on +//~| WARN previously accepted extern crate std as std2; - //~ ERROR `#[must_use]` has no effect + //~ ERROR attribute cannot be used on +//~| WARN previously accepted mod test_mod {} - //~ ERROR `#[must_use]` has no effect + //~ ERROR attribute cannot be used on +//~| WARN previously accepted use std::arch::global_asm; - //~ ERROR `#[must_use]` has no effect + //~ ERROR attribute cannot be used on +//~| WARN previously accepted const CONST: usize = 4; - //~ ERROR `#[must_use]` has no effect + //~ ERROR attribute cannot be used on +//~| WARN previously accepted #[no_mangle] static STATIC: usize = 4; @@ -32,7 +37,8 @@ union U { unit: (), } - //~ ERROR `#[must_use]` has no effect + //~ ERROR attribute cannot be used on +//~| WARN previously accepted impl U { #[must_use] fn method() -> i32 { @@ -46,10 +52,12 @@ fn foo() -> i64 { 4 } - //~ ERROR `#[must_use]` has no effect + //~ ERROR attribute cannot be used on +//~| WARN previously accepted extern "Rust" { #[link_name = "STATIC"] - //~ ERROR `#[must_use]` has no effect + //~ ERROR attribute cannot be used on + //~| WARN previously accepted static FOREIGN_STATIC: usize; #[link_name = "foo"] @@ -57,19 +65,24 @@ extern "Rust" { fn foreign_foo() -> i64; } - //~ ERROR unused attribute +//~^ ERROR `#[must_use]` attribute cannot be used on macro calls +//~| WARN this was previously accepted by the compiler but is being phased out global_asm!(""); - //~ ERROR `#[must_use]` has no effect + //~ ERROR attribute cannot be used on +//~| WARN previously accepted type UseMe = (); -fn qux< T>(_: T) {} //~ ERROR `#[must_use]` has no effect +fn qux< T>(_: T) {} //~ ERROR attribute cannot be used on +//~| WARN previously accepted #[must_use] trait Use { - //~ ERROR `#[must_use]` has no effect + //~ ERROR attribute cannot be used on + //~| WARN previously accepted const ASSOC_CONST: usize = 4; - //~ ERROR `#[must_use]` has no effect + //~ ERROR attribute cannot be used on + //~| WARN previously accepted type AssocTy; #[must_use] @@ -78,20 +91,24 @@ trait Use { } } - //~ ERROR `#[must_use]` has no effect + //~ ERROR attribute cannot be used on +//~| WARN previously accepted impl Use for () { type AssocTy = (); - //~ ERROR `#[must_use]` has no effect + //~ ERROR attribute cannot be used on + //~| WARN previously accepted fn get_four(&self) -> usize { 4 } } - //~ ERROR `#[must_use]` has no effect + //~ ERROR attribute cannot be used on +//~| WARN previously accepted trait Alias = Use; - //~ ERROR `#[must_use]` has no effect + //~ ERROR attribute cannot be used on +//~| WARN previously accepted macro_rules! cool_macro { () => { 4 @@ -99,11 +116,13 @@ macro_rules! cool_macro { } fn main() { - //~ ERROR `#[must_use]` has no effect + //~ ERROR attribute cannot be used on + //~| WARN previously accepted let x = || {}; x(); - let x = //~ ERROR `#[must_use]` has no effect + let x = //~ ERROR attribute cannot be used on + //~| WARN previously accepted || {}; x(); @@ -125,7 +144,8 @@ fn main() { let _ = ().get_four(); //~ ERROR that must be used match Some(4) { - //~ ERROR `#[must_use]` has no effect + //~ ERROR attribute cannot be used on + //~| WARN previously accepted Some(res) => res, None => 0, }; @@ -133,7 +153,9 @@ fn main() { struct PatternField { foo: i32, } - let s = PatternField { foo: 123 }; //~ ERROR `#[must_use]` has no effect - let PatternField { foo } = s; //~ ERROR `#[must_use]` has no effect + let s = PatternField { foo: 123 }; //~ ERROR attribute cannot be used on + //~| WARN previously accepted + let PatternField { foo } = s; //~ ERROR attribute cannot be used on + //~| WARN previously accepted let _ = foo; } diff --git a/tests/ui/lint/unused/unused_attributes-must_use.rs b/tests/ui/lint/unused/unused_attributes-must_use.rs index edefe8ed65e..3e72dd1e438 100644 --- a/tests/ui/lint/unused/unused_attributes-must_use.rs +++ b/tests/ui/lint/unused/unused_attributes-must_use.rs @@ -4,18 +4,23 @@ #![deny(unused_attributes, unused_must_use)] #![feature(asm_experimental_arch, stmt_expr_attributes, trait_alias)] -#[must_use] //~ ERROR `#[must_use]` has no effect +#[must_use] //~ ERROR attribute cannot be used on +//~| WARN previously accepted extern crate std as std2; -#[must_use] //~ ERROR `#[must_use]` has no effect +#[must_use] //~ ERROR attribute cannot be used on +//~| WARN previously accepted mod test_mod {} -#[must_use] //~ ERROR `#[must_use]` has no effect +#[must_use] //~ ERROR attribute cannot be used on +//~| WARN previously accepted use std::arch::global_asm; -#[must_use] //~ ERROR `#[must_use]` has no effect +#[must_use] //~ ERROR attribute cannot be used on +//~| WARN previously accepted const CONST: usize = 4; -#[must_use] //~ ERROR `#[must_use]` has no effect +#[must_use] //~ ERROR attribute cannot be used on +//~| WARN previously accepted #[no_mangle] static STATIC: usize = 4; @@ -32,7 +37,8 @@ union U { unit: (), } -#[must_use] //~ ERROR `#[must_use]` has no effect +#[must_use] //~ ERROR attribute cannot be used on +//~| WARN previously accepted impl U { #[must_use] fn method() -> i32 { @@ -46,10 +52,12 @@ fn foo() -> i64 { 4 } -#[must_use] //~ ERROR `#[must_use]` has no effect +#[must_use] //~ ERROR attribute cannot be used on +//~| WARN previously accepted extern "Rust" { #[link_name = "STATIC"] - #[must_use] //~ ERROR `#[must_use]` has no effect + #[must_use] //~ ERROR attribute cannot be used on + //~| WARN previously accepted static FOREIGN_STATIC: usize; #[link_name = "foo"] @@ -57,19 +65,25 @@ extern "Rust" { fn foreign_foo() -> i64; } -#[must_use] //~ ERROR unused attribute +#[must_use] +//~^ ERROR `#[must_use]` attribute cannot be used on macro calls +//~| WARN this was previously accepted by the compiler but is being phased out global_asm!(""); -#[must_use] //~ ERROR `#[must_use]` has no effect +#[must_use] //~ ERROR attribute cannot be used on +//~| WARN previously accepted type UseMe = (); -fn qux<#[must_use] T>(_: T) {} //~ ERROR `#[must_use]` has no effect +fn qux<#[must_use] T>(_: T) {} //~ ERROR attribute cannot be used on +//~| WARN previously accepted #[must_use] trait Use { - #[must_use] //~ ERROR `#[must_use]` has no effect + #[must_use] //~ ERROR attribute cannot be used on + //~| WARN previously accepted const ASSOC_CONST: usize = 4; - #[must_use] //~ ERROR `#[must_use]` has no effect + #[must_use] //~ ERROR attribute cannot be used on + //~| WARN previously accepted type AssocTy; #[must_use] @@ -78,20 +92,24 @@ trait Use { } } -#[must_use] //~ ERROR `#[must_use]` has no effect +#[must_use] //~ ERROR attribute cannot be used on +//~| WARN previously accepted impl Use for () { type AssocTy = (); - #[must_use] //~ ERROR `#[must_use]` has no effect + #[must_use] //~ ERROR attribute cannot be used on + //~| WARN previously accepted fn get_four(&self) -> usize { 4 } } -#[must_use] //~ ERROR `#[must_use]` has no effect +#[must_use] //~ ERROR attribute cannot be used on +//~| WARN previously accepted trait Alias = Use; -#[must_use] //~ ERROR `#[must_use]` has no effect +#[must_use] //~ ERROR attribute cannot be used on +//~| WARN previously accepted macro_rules! cool_macro { () => { 4 @@ -99,11 +117,13 @@ macro_rules! cool_macro { } fn main() { - #[must_use] //~ ERROR `#[must_use]` has no effect + #[must_use] //~ ERROR attribute cannot be used on + //~| WARN previously accepted let x = || {}; x(); - let x = #[must_use] //~ ERROR `#[must_use]` has no effect + let x = #[must_use] //~ ERROR attribute cannot be used on + //~| WARN previously accepted || {}; x(); @@ -125,7 +145,8 @@ fn main() { ().get_four(); //~ ERROR that must be used match Some(4) { - #[must_use] //~ ERROR `#[must_use]` has no effect + #[must_use] //~ ERROR attribute cannot be used on + //~| WARN previously accepted Some(res) => res, None => 0, }; @@ -133,7 +154,9 @@ fn main() { struct PatternField { foo: i32, } - let s = PatternField { #[must_use] foo: 123 }; //~ ERROR `#[must_use]` has no effect - let PatternField { #[must_use] foo } = s; //~ ERROR `#[must_use]` has no effect + let s = PatternField { #[must_use] foo: 123 }; //~ ERROR attribute cannot be used on + //~| WARN previously accepted + let PatternField { #[must_use] foo } = s; //~ ERROR attribute cannot be used on + //~| WARN previously accepted let _ = foo; } diff --git a/tests/ui/lint/unused/unused_attributes-must_use.stderr b/tests/ui/lint/unused/unused_attributes-must_use.stderr index 9e37f6504cc..001ec52ddd9 100644 --- a/tests/ui/lint/unused/unused_attributes-must_use.stderr +++ b/tests/ui/lint/unused/unused_attributes-must_use.stderr @@ -1,148 +1,208 @@ -error: unused attribute `must_use` - --> $DIR/unused_attributes-must_use.rs:60:1 +error: `#[must_use]` attribute cannot be used on macro calls + --> $DIR/unused_attributes-must_use.rs:68:1 | LL | #[must_use] | ^^^^^^^^^^^ | -note: the built-in attribute `must_use` will be ignored, since it's applied to the macro invocation `global_asm` - --> $DIR/unused_attributes-must_use.rs:61:1 - | -LL | global_asm!(""); - | ^^^^^^^^^^ + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = help: `#[must_use]` can be applied to functions, data types, unions, and traits note: the lint level is defined here --> $DIR/unused_attributes-must_use.rs:4:9 | LL | #![deny(unused_attributes, unused_must_use)] | ^^^^^^^^^^^^^^^^^ -error: `#[must_use]` has no effect when applied to extern crates +error: `#[must_use]` attribute cannot be used on extern crates --> $DIR/unused_attributes-must_use.rs:7:1 | LL | #[must_use] | ^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = help: `#[must_use]` can be applied to functions, data types, unions, and traits -error: `#[must_use]` has no effect when applied to modules - --> $DIR/unused_attributes-must_use.rs:10:1 +error: `#[must_use]` attribute cannot be used on modules + --> $DIR/unused_attributes-must_use.rs:11:1 | LL | #[must_use] | ^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = help: `#[must_use]` can be applied to functions, data types, unions, and traits -error: `#[must_use]` has no effect when applied to use statements - --> $DIR/unused_attributes-must_use.rs:13:1 +error: `#[must_use]` attribute cannot be used on use statements + --> $DIR/unused_attributes-must_use.rs:15:1 | LL | #[must_use] | ^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = help: `#[must_use]` can be applied to functions, data types, unions, and traits -error: `#[must_use]` has no effect when applied to constants - --> $DIR/unused_attributes-must_use.rs:16:1 +error: `#[must_use]` attribute cannot be used on constants + --> $DIR/unused_attributes-must_use.rs:19:1 | LL | #[must_use] | ^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = help: `#[must_use]` can be applied to functions, data types, unions, and traits -error: `#[must_use]` has no effect when applied to statics - --> $DIR/unused_attributes-must_use.rs:18:1 +error: `#[must_use]` attribute cannot be used on statics + --> $DIR/unused_attributes-must_use.rs:22:1 | LL | #[must_use] | ^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = help: `#[must_use]` can be applied to functions, data types, unions, and traits -error: `#[must_use]` has no effect when applied to inherent impl blocks - --> $DIR/unused_attributes-must_use.rs:35:1 +error: `#[must_use]` attribute cannot be used on inherent impl blocks + --> $DIR/unused_attributes-must_use.rs:40:1 | LL | #[must_use] | ^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = help: `#[must_use]` can be applied to functions, data types, unions, and traits -error: `#[must_use]` has no effect when applied to foreign modules - --> $DIR/unused_attributes-must_use.rs:49:1 +error: `#[must_use]` attribute cannot be used on foreign modules + --> $DIR/unused_attributes-must_use.rs:55:1 | LL | #[must_use] | ^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = help: `#[must_use]` can be applied to functions, data types, unions, and traits -error: `#[must_use]` has no effect when applied to type aliases - --> $DIR/unused_attributes-must_use.rs:63:1 +error: `#[must_use]` attribute cannot be used on foreign statics + --> $DIR/unused_attributes-must_use.rs:59:5 + | +LL | #[must_use] + | ^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = help: `#[must_use]` can be applied to functions, data types, unions, and traits + +error: `#[must_use]` attribute cannot be used on type aliases + --> $DIR/unused_attributes-must_use.rs:73:1 | LL | #[must_use] | ^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = help: `#[must_use]` can be applied to functions, data types, unions, and traits -error: `#[must_use]` has no effect when applied to type parameters - --> $DIR/unused_attributes-must_use.rs:66:8 +error: `#[must_use]` attribute cannot be used on function params + --> $DIR/unused_attributes-must_use.rs:77:8 | LL | fn qux<#[must_use] T>(_: T) {} | ^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = help: `#[must_use]` can be applied to functions, data types, unions, and traits -error: `#[must_use]` has no effect when applied to trait impl blocks - --> $DIR/unused_attributes-must_use.rs:81:1 +error: `#[must_use]` attribute cannot be used on associated consts + --> $DIR/unused_attributes-must_use.rs:82:5 + | +LL | #[must_use] + | ^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = help: `#[must_use]` can be applied to functions, data types, unions, and traits + +error: `#[must_use]` attribute cannot be used on associated types + --> $DIR/unused_attributes-must_use.rs:85:5 + | +LL | #[must_use] + | ^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = help: `#[must_use]` can be applied to functions, data types, unions, and traits + +error: `#[must_use]` attribute cannot be used on trait impl blocks + --> $DIR/unused_attributes-must_use.rs:95:1 | LL | #[must_use] | ^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = help: `#[must_use]` can be applied to functions, data types, unions, and traits -error: `#[must_use]` has no effect when applied to trait aliases - --> $DIR/unused_attributes-must_use.rs:91:1 +error: `#[must_use]` attribute cannot be used on trait methods in impl blocks + --> $DIR/unused_attributes-must_use.rs:100:5 + | +LL | #[must_use] + | ^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = help: `#[must_use]` can be applied to data types, functions, unions, required trait methods, provided trait methods, inherent methods, foreign functions, and traits + +error: `#[must_use]` attribute cannot be used on trait aliases + --> $DIR/unused_attributes-must_use.rs:107:1 | LL | #[must_use] | ^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = help: `#[must_use]` can be applied to functions, data types, unions, and traits -error: `#[must_use]` has no effect when applied to macro defs - --> $DIR/unused_attributes-must_use.rs:94:1 +error: `#[must_use]` attribute cannot be used on macro defs + --> $DIR/unused_attributes-must_use.rs:111:1 | LL | #[must_use] | ^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = help: `#[must_use]` can be applied to functions, data types, unions, and traits -error: `#[must_use]` has no effect when applied to statements - --> $DIR/unused_attributes-must_use.rs:102:5 +error: `#[must_use]` attribute cannot be used on statements + --> $DIR/unused_attributes-must_use.rs:120:5 | LL | #[must_use] | ^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = help: `#[must_use]` can be applied to functions, data types, unions, and traits -error: `#[must_use]` has no effect when applied to closures - --> $DIR/unused_attributes-must_use.rs:106:13 +error: `#[must_use]` attribute cannot be used on closures + --> $DIR/unused_attributes-must_use.rs:125:13 | LL | let x = #[must_use] | ^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = help: `#[must_use]` can be applied to methods, data types, functions, unions, foreign functions, and traits -error: `#[must_use]` has no effect when applied to match arms - --> $DIR/unused_attributes-must_use.rs:128:9 +error: `#[must_use]` attribute cannot be used on match arms + --> $DIR/unused_attributes-must_use.rs:148:9 | LL | #[must_use] | ^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = help: `#[must_use]` can be applied to functions, data types, unions, and traits -error: `#[must_use]` has no effect when applied to struct fields - --> $DIR/unused_attributes-must_use.rs:136:28 +error: `#[must_use]` attribute cannot be used on struct fields + --> $DIR/unused_attributes-must_use.rs:157:28 | LL | let s = PatternField { #[must_use] foo: 123 }; | ^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = help: `#[must_use]` can be applied to functions, data types, unions, and traits -error: `#[must_use]` has no effect when applied to pattern fields - --> $DIR/unused_attributes-must_use.rs:137:24 +error: `#[must_use]` attribute cannot be used on pattern fields + --> $DIR/unused_attributes-must_use.rs:159:24 | LL | let PatternField { #[must_use] foo } = s; | ^^^^^^^^^^^ - -error: `#[must_use]` has no effect when applied to associated consts - --> $DIR/unused_attributes-must_use.rs:70:5 | -LL | #[must_use] - | ^^^^^^^^^^^ - -error: `#[must_use]` has no effect when applied to associated types - --> $DIR/unused_attributes-must_use.rs:72:5 - | -LL | #[must_use] - | ^^^^^^^^^^^ - -error: `#[must_use]` has no effect when applied to provided trait methods - --> $DIR/unused_attributes-must_use.rs:85:5 - | -LL | #[must_use] - | ^^^^^^^^^^^ - -error: `#[must_use]` has no effect when applied to foreign statics - --> $DIR/unused_attributes-must_use.rs:52:5 - | -LL | #[must_use] - | ^^^^^^^^^^^ + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = help: `#[must_use]` can be applied to functions, data types, unions, and traits error: unused `X` that must be used - --> $DIR/unused_attributes-must_use.rs:110:5 + --> $DIR/unused_attributes-must_use.rs:130:5 | LL | X; | ^ @@ -158,7 +218,7 @@ LL | let _ = X; | +++++++ error: unused `Y` that must be used - --> $DIR/unused_attributes-must_use.rs:111:5 + --> $DIR/unused_attributes-must_use.rs:131:5 | LL | Y::Z; | ^^^^ @@ -169,7 +229,7 @@ LL | let _ = Y::Z; | +++++++ error: unused `U` that must be used - --> $DIR/unused_attributes-must_use.rs:112:5 + --> $DIR/unused_attributes-must_use.rs:132:5 | LL | U { unit: () }; | ^^^^^^^^^^^^^^ @@ -180,7 +240,7 @@ LL | let _ = U { unit: () }; | +++++++ error: unused return value of `U::method` that must be used - --> $DIR/unused_attributes-must_use.rs:113:5 + --> $DIR/unused_attributes-must_use.rs:133:5 | LL | U::method(); | ^^^^^^^^^^^ @@ -191,7 +251,7 @@ LL | let _ = U::method(); | +++++++ error: unused return value of `foo` that must be used - --> $DIR/unused_attributes-must_use.rs:114:5 + --> $DIR/unused_attributes-must_use.rs:134:5 | LL | foo(); | ^^^^^ @@ -202,7 +262,7 @@ LL | let _ = foo(); | +++++++ error: unused return value of `foreign_foo` that must be used - --> $DIR/unused_attributes-must_use.rs:117:9 + --> $DIR/unused_attributes-must_use.rs:137:9 | LL | foreign_foo(); | ^^^^^^^^^^^^^ @@ -213,7 +273,7 @@ LL | let _ = foreign_foo(); | +++++++ error: unused return value of `Use::get_four` that must be used - --> $DIR/unused_attributes-must_use.rs:125:5 + --> $DIR/unused_attributes-must_use.rs:145:5 | LL | ().get_four(); | ^^^^^^^^^^^^^ diff --git a/tests/ui/lint/use-redundant/use-redundant-issue-71450.stderr b/tests/ui/lint/use-redundant/use-redundant-issue-71450.stderr index c14ab9e11e0..8a5c243ddf8 100644 --- a/tests/ui/lint/use-redundant/use-redundant-issue-71450.stderr +++ b/tests/ui/lint/use-redundant/use-redundant-issue-71450.stderr @@ -3,10 +3,10 @@ warning: the item `String` is imported redundantly | LL | use std::string::String; | ^^^^^^^^^^^^^^^^^^^ + | --> $SRC_DIR/std/src/prelude/mod.rs:LL:COL | = note: the item `String` is already defined here - | note: the lint level is defined here --> $DIR/use-redundant-issue-71450.rs:3:9 | diff --git a/tests/ui/lint/use-redundant/use-redundant-prelude-rust-2015.stderr b/tests/ui/lint/use-redundant/use-redundant-prelude-rust-2015.stderr index 48d5c275055..71bc7d3b371 100644 --- a/tests/ui/lint/use-redundant/use-redundant-prelude-rust-2015.stderr +++ b/tests/ui/lint/use-redundant/use-redundant-prelude-rust-2015.stderr @@ -3,10 +3,10 @@ warning: the item `Some` is imported redundantly | LL | use std::option::Option::Some; | ^^^^^^^^^^^^^^^^^^^^^^^^^ + | --> $SRC_DIR/std/src/prelude/mod.rs:LL:COL | = note: the item `Some` is already defined here - | note: the lint level is defined here --> $DIR/use-redundant-prelude-rust-2015.rs:3:9 | @@ -18,6 +18,7 @@ warning: the item `None` is imported redundantly | LL | use std::option::Option::None; | ^^^^^^^^^^^^^^^^^^^^^^^^^ + | --> $SRC_DIR/std/src/prelude/mod.rs:LL:COL | = note: the item `None` is already defined here @@ -27,6 +28,7 @@ warning: the item `Ok` is imported redundantly | LL | use std::result::Result::Ok; | ^^^^^^^^^^^^^^^^^^^^^^^ + | --> $SRC_DIR/std/src/prelude/mod.rs:LL:COL | = note: the item `Ok` is already defined here @@ -36,6 +38,7 @@ warning: the item `Err` is imported redundantly | LL | use std::result::Result::Err; | ^^^^^^^^^^^^^^^^^^^^^^^^ + | --> $SRC_DIR/std/src/prelude/mod.rs:LL:COL | = note: the item `Err` is already defined here diff --git a/tests/ui/lint/use-redundant/use-redundant-prelude-rust-2021.stderr b/tests/ui/lint/use-redundant/use-redundant-prelude-rust-2021.stderr index 526771c597a..f9b7af2105c 100644 --- a/tests/ui/lint/use-redundant/use-redundant-prelude-rust-2021.stderr +++ b/tests/ui/lint/use-redundant/use-redundant-prelude-rust-2021.stderr @@ -3,10 +3,10 @@ warning: the item `TryFrom` is imported redundantly | LL | use std::convert::TryFrom; | ^^^^^^^^^^^^^^^^^^^^^ + | --> $SRC_DIR/std/src/prelude/mod.rs:LL:COL | = note: the item `TryFrom` is already defined here - | note: the lint level is defined here --> $DIR/use-redundant-prelude-rust-2021.rs:3:9 | @@ -18,6 +18,7 @@ warning: the item `TryInto` is imported redundantly | LL | use std::convert::TryInto; | ^^^^^^^^^^^^^^^^^^^^^ + | --> $SRC_DIR/std/src/prelude/mod.rs:LL:COL | = note: the item `TryInto` is already defined here diff --git a/tests/ui/lint/warn-unused-inline-on-fn-prototypes.stderr b/tests/ui/lint/warn-unused-inline-on-fn-prototypes.stderr index 336366042f9..fcce1db7a9a 100644 --- a/tests/ui/lint/warn-unused-inline-on-fn-prototypes.stderr +++ b/tests/ui/lint/warn-unused-inline-on-fn-prototypes.stderr @@ -5,7 +5,7 @@ LL | #[inline] | ^^^^^^^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = help: `#[inline]` can be applied to functions, inherent methods, provided trait methods, trait methods in impl blocks, closures + = help: `#[inline]` can be applied to functions, inherent methods, provided trait methods, trait methods in impl blocks, and closures note: the lint level is defined here --> $DIR/warn-unused-inline-on-fn-prototypes.rs:1:9 | @@ -19,7 +19,7 @@ LL | #[inline] | ^^^^^^^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = help: `#[inline]` can be applied to methods, functions, closures + = help: `#[inline]` can be applied to methods, functions, and closures error: aborting due to 2 previous errors diff --git a/tests/ui/issues/issue-5741.rs b/tests/ui/loops/unreachable-while-loop-5741.rs index af4702ec22c..bc69df0f675 100644 --- a/tests/ui/issues/issue-5741.rs +++ b/tests/ui/loops/unreachable-while-loop-5741.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/5741 //@ run-pass #![allow(while_true)] #![allow(unreachable_code)] diff --git a/tests/ui/macros/format-foreign-dollar-without-spec.rs b/tests/ui/macros/format-foreign-dollar-without-spec.rs new file mode 100644 index 00000000000..c57c1382c8d --- /dev/null +++ b/tests/ui/macros/format-foreign-dollar-without-spec.rs @@ -0,0 +1,5 @@ +// https://github.com/rust-lang/rust/issues/137580 +fn main() { + println!("%65536$", 1); + //~^ ERROR never used +} diff --git a/tests/ui/macros/format-foreign-dollar-without-spec.stderr b/tests/ui/macros/format-foreign-dollar-without-spec.stderr new file mode 100644 index 00000000000..d5a07c50f00 --- /dev/null +++ b/tests/ui/macros/format-foreign-dollar-without-spec.stderr @@ -0,0 +1,16 @@ +error: argument never used + --> $DIR/format-foreign-dollar-without-spec.rs:3:25 + | +LL | println!("%65536$", 1); + | ^ argument never used + | +note: format specifiers use curly braces, and the conversion specifier ` + ` is unknown or unsupported + --> $DIR/format-foreign-dollar-without-spec.rs:3:15 + | +LL | println!("%65536$", 1); + | ^^^^^^^^ + = note: printf formatting is not supported; see the documentation for `std::fmt` + +error: aborting due to 1 previous error + diff --git a/tests/ui/macros/issue-111749.stderr b/tests/ui/macros/issue-111749.stderr index 884537ef531..ae953e042e0 100644 --- a/tests/ui/macros/issue-111749.stderr +++ b/tests/ui/macros/issue-111749.stderr @@ -12,7 +12,7 @@ LL | cbor_map! { #[test(test)] 4}; | = 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 #57571 <https://github.com/rust-lang/rust/issues/57571> - = note: `#[deny(ill_formed_attribute_input)]` on by default + = note: `#[deny(ill_formed_attribute_input)]` (part of `#[deny(future_incompatible)]`) on by default error: aborting due to 2 previous errors @@ -25,5 +25,5 @@ LL | cbor_map! { #[test(test)] 4}; | = 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 #57571 <https://github.com/rust-lang/rust/issues/57571> - = note: `#[deny(ill_formed_attribute_input)]` on by default + = note: `#[deny(ill_formed_attribute_input)]` (part of `#[deny(future_incompatible)]`) on by default diff --git a/tests/ui/macros/issue-68060.stderr b/tests/ui/macros/issue-68060.stderr index c701e50f054..4699594a2b0 100644 --- a/tests/ui/macros/issue-68060.stderr +++ b/tests/ui/macros/issue-68060.stderr @@ -4,7 +4,7 @@ error: `#[target_feature]` attribute cannot be used on closures LL | #[target_feature(enable = "")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = help: `#[target_feature]` can be applied to methods, functions + = help: `#[target_feature]` can be applied to methods and functions error[E0658]: `#[track_caller]` on closures is currently unstable --> $DIR/issue-68060.rs:6:13 diff --git a/tests/ui/macros/lint-trailing-macro-call.stderr b/tests/ui/macros/lint-trailing-macro-call.stderr index 3fd1ea81345..cf836abb80f 100644 --- a/tests/ui/macros/lint-trailing-macro-call.stderr +++ b/tests/ui/macros/lint-trailing-macro-call.stderr @@ -11,7 +11,7 @@ LL | expand_it!() = note: for more information, see issue #79813 <https://github.com/rust-lang/rust/issues/79813> = note: macro invocations at the end of a block are treated as expressions = note: to ignore the value produced by the macro, add a semicolon after the invocation of `expand_it` - = note: `#[deny(semicolon_in_expressions_from_macros)]` on by default + = note: `#[deny(semicolon_in_expressions_from_macros)]` (part of `#[deny(future_incompatible)]`) on by default = note: this error originates in the macro `expand_it` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 1 previous error @@ -30,6 +30,6 @@ LL | expand_it!() = note: for more information, see issue #79813 <https://github.com/rust-lang/rust/issues/79813> = note: macro invocations at the end of a block are treated as expressions = note: to ignore the value produced by the macro, add a semicolon after the invocation of `expand_it` - = note: `#[deny(semicolon_in_expressions_from_macros)]` on by default + = note: `#[deny(semicolon_in_expressions_from_macros)]` (part of `#[deny(future_incompatible)]`) on by default = note: this error originates in the macro `expand_it` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/tests/ui/macros/macro-context.stderr b/tests/ui/macros/macro-context.stderr index 6b49c05f360..2efc0b136bc 100644 --- a/tests/ui/macros/macro-context.stderr +++ b/tests/ui/macros/macro-context.stderr @@ -75,7 +75,7 @@ LL | let i = m!(); | = 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 #79813 <https://github.com/rust-lang/rust/issues/79813> - = note: `#[deny(semicolon_in_expressions_from_macros)]` on by default + = note: `#[deny(semicolon_in_expressions_from_macros)]` (part of `#[deny(future_incompatible)]`) on by default = note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 7 previous errors @@ -94,6 +94,6 @@ LL | let i = m!(); | = 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 #79813 <https://github.com/rust-lang/rust/issues/79813> - = note: `#[deny(semicolon_in_expressions_from_macros)]` on by default + = note: `#[deny(semicolon_in_expressions_from_macros)]` (part of `#[deny(future_incompatible)]`) on by default = note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/tests/ui/macros/macro-in-expression-context.fixed b/tests/ui/macros/macro-in-expression-context.fixed index 52e1b429e48..1d767266025 100644 --- a/tests/ui/macros/macro-in-expression-context.fixed +++ b/tests/ui/macros/macro-in-expression-context.fixed @@ -8,7 +8,7 @@ macro_rules! foo { //~| NOTE macro invocations at the end of a block //~| NOTE to ignore the value produced by the macro //~| NOTE for more information - //~| NOTE `#[deny(semicolon_in_expressions_from_macros)]` on by default + //~| NOTE `#[deny(semicolon_in_expressions_from_macros)]` (part of `#[deny(future_incompatible)]`) on by default assert_eq!("B", "B"); } //~^^ ERROR macro expansion ignores `assert_eq` and any tokens following diff --git a/tests/ui/macros/macro-in-expression-context.rs b/tests/ui/macros/macro-in-expression-context.rs index 5c560e78dad..0bdead1b480 100644 --- a/tests/ui/macros/macro-in-expression-context.rs +++ b/tests/ui/macros/macro-in-expression-context.rs @@ -8,7 +8,7 @@ macro_rules! foo { //~| NOTE macro invocations at the end of a block //~| NOTE to ignore the value produced by the macro //~| NOTE for more information - //~| NOTE `#[deny(semicolon_in_expressions_from_macros)]` on by default + //~| NOTE `#[deny(semicolon_in_expressions_from_macros)]` (part of `#[deny(future_incompatible)]`) on by default assert_eq!("B", "B"); } //~^^ ERROR macro expansion ignores `assert_eq` and any tokens following diff --git a/tests/ui/macros/macro-in-expression-context.stderr b/tests/ui/macros/macro-in-expression-context.stderr index b04348d7010..ce5abdb94b2 100644 --- a/tests/ui/macros/macro-in-expression-context.stderr +++ b/tests/ui/macros/macro-in-expression-context.stderr @@ -26,7 +26,7 @@ LL | foo!() = note: for more information, see issue #79813 <https://github.com/rust-lang/rust/issues/79813> = note: macro invocations at the end of a block are treated as expressions = note: to ignore the value produced by the macro, add a semicolon after the invocation of `foo` - = note: `#[deny(semicolon_in_expressions_from_macros)]` on by default + = note: `#[deny(semicolon_in_expressions_from_macros)]` (part of `#[deny(future_incompatible)]`) on by default = note: this error originates in the macro `foo` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 2 previous errors @@ -45,6 +45,6 @@ LL | foo!() = note: for more information, see issue #79813 <https://github.com/rust-lang/rust/issues/79813> = note: macro invocations at the end of a block are treated as expressions = note: to ignore the value produced by the macro, add a semicolon after the invocation of `foo` - = note: `#[deny(semicolon_in_expressions_from_macros)]` on by default + = note: `#[deny(semicolon_in_expressions_from_macros)]` (part of `#[deny(future_incompatible)]`) on by default = note: this error originates in the macro `foo` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/tests/ui/issues/issue-7970a.rs b/tests/ui/macros/macro-invocation-span-error-7970.rs index dae906410ed..df7e1cfea88 100644 --- a/tests/ui/issues/issue-7970a.rs +++ b/tests/ui/macros/macro-invocation-span-error-7970.rs @@ -1,5 +1,8 @@ +// https://github.com/rust-lang/rust/issues/7970 macro_rules! one_arg_macro { - ($fmt:expr) => (print!(concat!($fmt, "\n"))); + ($fmt:expr) => { + print!(concat!($fmt, "\n")) + }; } fn main() { diff --git a/tests/ui/issues/issue-7970a.stderr b/tests/ui/macros/macro-invocation-span-error-7970.stderr index 1e6bb92ea57..beb54e05992 100644 --- a/tests/ui/issues/issue-7970a.stderr +++ b/tests/ui/macros/macro-invocation-span-error-7970.stderr @@ -1,5 +1,5 @@ error: unexpected end of macro invocation - --> $DIR/issue-7970a.rs:6:5 + --> $DIR/macro-invocation-span-error-7970.rs:9:5 | LL | macro_rules! one_arg_macro { | -------------------------- when calling this macro @@ -8,9 +8,9 @@ LL | one_arg_macro!(); | ^^^^^^^^^^^^^^^^ missing tokens in macro arguments | note: while trying to match meta-variable `$fmt:expr` - --> $DIR/issue-7970a.rs:2:6 + --> $DIR/macro-invocation-span-error-7970.rs:3:6 | -LL | ($fmt:expr) => (print!(concat!($fmt, "\n"))); +LL | ($fmt:expr) => { | ^^^^^^^^^ error: aborting due to 1 previous error diff --git a/tests/ui/macros/macro-name-typo.stderr b/tests/ui/macros/macro-name-typo.stderr index 9059b10faaa..1cc7ea6ec1b 100644 --- a/tests/ui/macros/macro-name-typo.stderr +++ b/tests/ui/macros/macro-name-typo.stderr @@ -3,6 +3,7 @@ error: cannot find macro `printlx` in this scope | LL | printlx!("oh noes!"); | ^^^^^^^ help: a macro with a similar name exists: `println` + | --> $SRC_DIR/std/src/macros.rs:LL:COL | = note: similarly named macro `println` defined here diff --git a/tests/ui/macros/macro-path-prelude-fail-3.stderr b/tests/ui/macros/macro-path-prelude-fail-3.stderr index 485d7b7869a..3d0a074deeb 100644 --- a/tests/ui/macros/macro-path-prelude-fail-3.stderr +++ b/tests/ui/macros/macro-path-prelude-fail-3.stderr @@ -3,6 +3,7 @@ error: cannot find macro `inline` in this scope | LL | inline!(); | ^^^^^^ help: a macro with a similar name exists: `line` + | --> $SRC_DIR/core/src/macros/mod.rs:LL:COL | = note: similarly named macro `line` defined here diff --git a/tests/ui/issues/issue-8521.rs b/tests/ui/macros/macro-path-type-bounds-8521.rs index 78ce85787d5..975d3dc402e 100644 --- a/tests/ui/issues/issue-8521.rs +++ b/tests/ui/macros/macro-path-type-bounds-8521.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/8521 //@ check-pass trait Foo1 {} diff --git a/tests/ui/macros/macro-rules-as-derive-or-attr-issue-132928.stderr b/tests/ui/macros/macro-rules-as-derive-or-attr-issue-132928.stderr index 77f8bef83a4..aad4a844ec1 100644 --- a/tests/ui/macros/macro-rules-as-derive-or-attr-issue-132928.stderr +++ b/tests/ui/macros/macro-rules-as-derive-or-attr-issue-132928.stderr @@ -2,7 +2,7 @@ error: cannot find derive macro `sample` in this scope --> $DIR/macro-rules-as-derive-or-attr-issue-132928.rs:6:10 | LL | macro_rules! sample { () => {} } - | ------ `sample` exists, but a declarative macro cannot be used as a derive macro + | ------ `sample` exists, but has no `derive` rules ... LL | #[derive(sample)] | ^^^^^^ @@ -20,7 +20,7 @@ error: cannot find derive macro `sample` in this scope --> $DIR/macro-rules-as-derive-or-attr-issue-132928.rs:6:10 | LL | macro_rules! sample { () => {} } - | ------ `sample` exists, but a declarative macro cannot be used as a derive macro + | ------ `sample` exists, but has no `derive` rules ... LL | #[derive(sample)] | ^^^^^^ @@ -31,7 +31,7 @@ error: cannot find derive macro `sample` in this scope --> $DIR/macro-rules-as-derive-or-attr-issue-132928.rs:6:10 | LL | macro_rules! sample { () => {} } - | ------ `sample` exists, but a declarative macro cannot be used as a derive macro + | ------ `sample` exists, but has no `derive` rules ... LL | #[derive(sample)] | ^^^^^^ diff --git a/tests/ui/macros/macro-rules-derive-error.rs b/tests/ui/macros/macro-rules-derive-error.rs new file mode 100644 index 00000000000..3ef0236c528 --- /dev/null +++ b/tests/ui/macros/macro-rules-derive-error.rs @@ -0,0 +1,51 @@ +#![feature(macro_derive)] + +macro_rules! MyDerive { + derive() { $($body:tt)* } => { + compile_error!(concat!("MyDerive: ", stringify!($($body)*))); + }; + //~^^ ERROR: MyDerive +} + +macro_rules! fn_only { +//~^ NOTE: `fn_only` exists, but has no `derive` rules +//~| NOTE: `fn_only` exists, but has no `derive` rules + {} => {} +} + +//~v NOTE: `DeriveOnly` exists, but has no rules for function-like invocation +macro_rules! DeriveOnly { + derive() {} => {} +} + +fn main() { + //~v NOTE: in this expansion of #[derive(MyDerive)] + #[derive(MyDerive)] + struct S1; + + //~vv ERROR: cannot find macro `MyDerive` in this scope + //~| NOTE: `MyDerive` is in scope, but it is a derive + MyDerive!(arg); + + #[derive(fn_only)] + struct S2; + //~^^ ERROR: cannot find derive macro `fn_only` in this scope + //~| ERROR: cannot find derive macro `fn_only` in this scope + //~| NOTE: duplicate diagnostic emitted + + DeriveOnly!(); //~ ERROR: cannot find macro `DeriveOnly` in this scope +} + +#[derive(ForwardReferencedDerive)] +struct S; +//~^^ ERROR: cannot find derive macro `ForwardReferencedDerive` in this scope +//~| NOTE: consider moving the definition of `ForwardReferencedDerive` before this call +//~| ERROR: cannot find derive macro `ForwardReferencedDerive` in this scope +//~| NOTE: consider moving the definition of `ForwardReferencedDerive` before this call +//~| NOTE: duplicate diagnostic emitted + +macro_rules! ForwardReferencedDerive { +//~^ NOTE: a macro with the same name exists, but it appears later +//~| NOTE: a macro with the same name exists, but it appears later + derive() {} => {} +} diff --git a/tests/ui/macros/macro-rules-derive-error.stderr b/tests/ui/macros/macro-rules-derive-error.stderr new file mode 100644 index 00000000000..bf6f58a3686 --- /dev/null +++ b/tests/ui/macros/macro-rules-derive-error.stderr @@ -0,0 +1,75 @@ +error: MyDerive: struct S1; + --> $DIR/macro-rules-derive-error.rs:5:9 + | +LL | compile_error!(concat!("MyDerive: ", stringify!($($body)*))); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +... +LL | #[derive(MyDerive)] + | -------- in this derive macro expansion + | + = note: this error originates in the derive macro `MyDerive` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: cannot find macro `MyDerive` in this scope + --> $DIR/macro-rules-derive-error.rs:28:5 + | +LL | MyDerive!(arg); + | ^^^^^^^^ + | + = note: `MyDerive` is in scope, but it is a derive macro: `#[derive(MyDerive)]` + +error: cannot find derive macro `fn_only` in this scope + --> $DIR/macro-rules-derive-error.rs:30:14 + | +LL | macro_rules! fn_only { + | ------- `fn_only` exists, but has no `derive` rules +... +LL | #[derive(fn_only)] + | ^^^^^^^ + +error: cannot find derive macro `fn_only` in this scope + --> $DIR/macro-rules-derive-error.rs:30:14 + | +LL | macro_rules! fn_only { + | ------- `fn_only` exists, but has no `derive` rules +... +LL | #[derive(fn_only)] + | ^^^^^^^ + | + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + +error: cannot find macro `DeriveOnly` in this scope + --> $DIR/macro-rules-derive-error.rs:36:5 + | +LL | macro_rules! DeriveOnly { + | ---------- `DeriveOnly` exists, but has no rules for function-like invocation +... +LL | DeriveOnly!(); + | ^^^^^^^^^^ + +error: cannot find derive macro `ForwardReferencedDerive` in this scope + --> $DIR/macro-rules-derive-error.rs:39:10 + | +LL | #[derive(ForwardReferencedDerive)] + | ^^^^^^^^^^^^^^^^^^^^^^^ consider moving the definition of `ForwardReferencedDerive` before this call + | +note: a macro with the same name exists, but it appears later + --> $DIR/macro-rules-derive-error.rs:47:14 + | +LL | macro_rules! ForwardReferencedDerive { + | ^^^^^^^^^^^^^^^^^^^^^^^ + +error: cannot find derive macro `ForwardReferencedDerive` in this scope + --> $DIR/macro-rules-derive-error.rs:39:10 + | +LL | #[derive(ForwardReferencedDerive)] + | ^^^^^^^^^^^^^^^^^^^^^^^ consider moving the definition of `ForwardReferencedDerive` before this call + | +note: a macro with the same name exists, but it appears later + --> $DIR/macro-rules-derive-error.rs:47:14 + | +LL | macro_rules! ForwardReferencedDerive { + | ^^^^^^^^^^^^^^^^^^^^^^^ + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + +error: aborting due to 7 previous errors + diff --git a/tests/ui/macros/macro-rules-derive.rs b/tests/ui/macros/macro-rules-derive.rs new file mode 100644 index 00000000000..d5294330fbf --- /dev/null +++ b/tests/ui/macros/macro-rules-derive.rs @@ -0,0 +1,71 @@ +//@ run-pass +//@ check-run-results +#![feature(macro_derive)] + +#[macro_export] +macro_rules! MyExportedDerive { + derive() { $($body:tt)* } => { + println!("MyExportedDerive: body={:?}", stringify!($($body)*)); + }; + { $($args:tt)* } => { + println!("MyExportedDerive!({:?})", stringify!($($args)*)); + }; +} + +macro_rules! MyLocalDerive { + derive() { $($body:tt)* } => { + println!("MyLocalDerive: body={:?}", stringify!($($body)*)); + }; + { $($args:tt)* } => { + println!("MyLocalDerive!({:?})", stringify!($($args)*)); + }; +} + +trait MyTrait { + fn name() -> &'static str; +} + +macro_rules! MyTrait { + derive() { struct $name:ident; } => { + impl MyTrait for $name { + fn name() -> &'static str { + stringify!($name) + } + } + }; +} + +#[derive(MyTrait)] +struct MyGlobalType; + +fn main() { + #[derive(crate::MyExportedDerive)] + struct _S1; + #[derive(crate::MyExportedDerive, crate::MyExportedDerive)] + struct _Twice1; + + crate::MyExportedDerive!(); + crate::MyExportedDerive!(invoked, arguments); + + #[derive(MyExportedDerive)] + struct _S2; + #[derive(MyExportedDerive, MyExportedDerive)] + struct _Twice2; + + MyExportedDerive!(); + MyExportedDerive!(invoked, arguments); + + #[derive(MyLocalDerive)] + struct _S3; + #[derive(MyLocalDerive, MyLocalDerive)] + struct _Twice3; + + MyLocalDerive!(); + MyLocalDerive!(invoked, arguments); + + #[derive(MyTrait)] + struct MyLocalType; + + println!("MyGlobalType::name(): {}", MyGlobalType::name()); + println!("MyLocalType::name(): {}", MyLocalType::name()); +} diff --git a/tests/ui/macros/macro-rules-derive.run.stdout b/tests/ui/macros/macro-rules-derive.run.stdout new file mode 100644 index 00000000000..ee492873302 --- /dev/null +++ b/tests/ui/macros/macro-rules-derive.run.stdout @@ -0,0 +1,17 @@ +MyExportedDerive: body="struct _S1;" +MyExportedDerive: body="struct _Twice1;" +MyExportedDerive: body="struct _Twice1;" +MyExportedDerive!("") +MyExportedDerive!("invoked, arguments") +MyExportedDerive: body="struct _S2;" +MyExportedDerive: body="struct _Twice2;" +MyExportedDerive: body="struct _Twice2;" +MyExportedDerive!("") +MyExportedDerive!("invoked, arguments") +MyLocalDerive: body="struct _S3;" +MyLocalDerive: body="struct _Twice3;" +MyLocalDerive: body="struct _Twice3;" +MyLocalDerive!("") +MyLocalDerive!("invoked, arguments") +MyGlobalType::name(): MyGlobalType +MyLocalType::name(): MyLocalType diff --git a/tests/ui/issues/issue-7911.rs b/tests/ui/macros/macro-self-mutability-7911.rs index 11da4df5285..5313f86d97f 100644 --- a/tests/ui/issues/issue-7911.rs +++ b/tests/ui/macros/macro-self-mutability-7911.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/7911 //@ run-pass // (Closes #7911) Test that we can use the same self expression // with different mutability in macro in two methods diff --git a/tests/ui/issues/issue-7911.stderr b/tests/ui/macros/macro-self-mutability-7911.stderr index ead7ee191ac..43335aee3ea 100644 --- a/tests/ui/issues/issue-7911.stderr +++ b/tests/ui/macros/macro-self-mutability-7911.stderr @@ -1,12 +1,12 @@ warning: method `dummy` is never used - --> $DIR/issue-7911.rs:7:8 + --> $DIR/macro-self-mutability-7911.rs:8:8 | LL | trait FooBar { | ------ method in this trait LL | fn dummy(&self) { } | ^^^^^ | - = note: `#[warn(dead_code)]` on by default + = note: `#[warn(dead_code)]` (part of `#[warn(unused)]`) on by default warning: 1 warning emitted diff --git a/tests/ui/issues/issue-5554.rs b/tests/ui/macros/macro-variable-declaration-with-bounds-5554.rs index 7d219a0df70..8ccf8e80131 100644 --- a/tests/ui/issues/issue-5554.rs +++ b/tests/ui/macros/macro-variable-declaration-with-bounds-5554.rs @@ -1,7 +1,7 @@ +// https://github.com/rust-lang/rust/issues/5554 //@ run-pass #![allow(dead_code)] - pub struct X<T> { a: T, } diff --git a/tests/ui/issues/issue-5718.rs b/tests/ui/macros/macro-variable-unused-reporting-5718.rs index 234fb2e2222..55da925461d 100644 --- a/tests/ui/issues/issue-5718.rs +++ b/tests/ui/macros/macro-variable-unused-reporting-5718.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/5718 //@ run-pass struct Element; diff --git a/tests/ui/macros/missing-derive-3.stderr b/tests/ui/macros/missing-derive-3.stderr index 0a7ed8d0876..9ece0d3ba39 100644 --- a/tests/ui/macros/missing-derive-3.stderr +++ b/tests/ui/macros/missing-derive-3.stderr @@ -3,6 +3,11 @@ error: cannot find attribute `sede` in this scope | LL | #[sede(untagged)] | ^^^^ + | +help: the derive macros `Deserialize` and `Serialize` accept the similarly named `serde` attribute + | +LL | #[serde(untagged)] + | + error: cannot find attribute `serde` in this scope --> $DIR/missing-derive-3.rs:14:7 @@ -15,6 +20,11 @@ note: `serde` is imported here, but it is a crate, not an attribute | LL | extern crate serde; | ^^^^^^^^^^^^^^^^^^^ +help: `serde` is an attribute that can be used by the derive macros `Deserialize` and `Serialize`, you might be missing a `derive` attribute + | +LL + #[derive(Deserialize, Serialize)] +LL | enum B { + | error: cannot find attribute `serde` in this scope --> $DIR/missing-derive-3.rs:6:3 @@ -27,6 +37,11 @@ note: `serde` is imported here, but it is a crate, not an attribute | LL | extern crate serde; | ^^^^^^^^^^^^^^^^^^^ +help: `serde` is an attribute that can be used by the derive macros `Deserialize` and `Serialize`, you might be missing a `derive` attribute + | +LL + #[derive(Deserialize, Serialize)] +LL | enum A { + | error: aborting due to 3 previous errors diff --git a/tests/ui/macros/missing-writer-issue-139830.stderr b/tests/ui/macros/missing-writer-issue-139830.stderr index 34dd61328e0..0a1c6f6f3ea 100644 --- a/tests/ui/macros/missing-writer-issue-139830.stderr +++ b/tests/ui/macros/missing-writer-issue-139830.stderr @@ -3,10 +3,10 @@ error[E0599]: cannot write into `String` | LL | let _ = write!(buf, "foo"); | ^^^ + | --> $SRC_DIR/core/src/fmt/mod.rs:LL:COL | = note: the method is available for `String` here - | note: must implement `io::Write`, `fmt::Write`, or have a `write_fmt` method --> $DIR/missing-writer-issue-139830.rs:7:20 | diff --git a/tests/ui/macros/non-fmt-panic.stderr b/tests/ui/macros/non-fmt-panic.stderr index 83410d36586..1787316b48b 100644 --- a/tests/ui/macros/non-fmt-panic.stderr +++ b/tests/ui/macros/non-fmt-panic.stderr @@ -5,7 +5,7 @@ LL | panic!("here's a brace: {"); | ^ | = note: this message is not used as a format string, but will be in Rust 2021 - = note: `#[warn(non_fmt_panics)]` on by default + = note: `#[warn(non_fmt_panics)]` (part of `#[warn(rust_2021_compatibility)]`) on by default help: add a "{}" format string to use the message literally | LL | panic!("{}", "here's a brace: {"); diff --git a/tests/ui/malformed/malformed-regressions.rs b/tests/ui/malformed/malformed-regressions.rs index 99f0fc904a9..407920c4e4e 100644 --- a/tests/ui/malformed/malformed-regressions.rs +++ b/tests/ui/malformed/malformed-regressions.rs @@ -4,9 +4,7 @@ //~^ WARN this was previously accepted #[inline = ""] //~ ERROR valid forms for the attribute are //~^ WARN this was previously accepted -#[link] //~ ERROR valid forms for the attribute are -//~^ WARN this was previously accepted -#[link = ""] //~ ERROR valid forms for the attribute are -//~^ WARN this was previously accepted +#[link] //~ ERROR malformed +#[link = ""] //~ ERROR malformed fn main() {} diff --git a/tests/ui/malformed/malformed-regressions.stderr b/tests/ui/malformed/malformed-regressions.stderr index 4a00c9b4a7d..850bcb6cbc2 100644 --- a/tests/ui/malformed/malformed-regressions.stderr +++ b/tests/ui/malformed/malformed-regressions.stderr @@ -7,27 +7,49 @@ LL | #[doc] = 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 #57571 <https://github.com/rust-lang/rust/issues/57571> = note: for more information, visit <https://doc.rust-lang.org/rustdoc/write-documentation/the-doc-attribute.html> - = note: `#[deny(ill_formed_attribute_input)]` on by default + = note: `#[deny(ill_formed_attribute_input)]` (part of `#[deny(future_incompatible)]`) on by default -error: valid forms for the attribute are `#[link(name = "...")]`, `#[link(name = "...", kind = "dylib|static|...")]`, `#[link(name = "...", wasm_import_module = "...")]`, `#[link(name = "...", import_name_type = "decorated|noprefix|undecorated")]`, and `#[link(name = "...", kind = "dylib|static|...", wasm_import_module = "...", import_name_type = "decorated|noprefix|undecorated")]` +error[E0539]: malformed `link` attribute input --> $DIR/malformed-regressions.rs:7:1 | LL | #[link] - | ^^^^^^^ + | ^^^^^^^ expected this to be a list | - = 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 #57571 <https://github.com/rust-lang/rust/issues/57571> = note: for more information, visit <https://doc.rust-lang.org/reference/items/external-blocks.html#the-link-attribute> +help: try changing it to one of the following valid forms of the attribute + | +LL | #[link(name = "...")] + | ++++++++++++++ +LL | #[link(name = "...", import_name_type = "decorated|noprefix|undecorated")] + | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +LL | #[link(name = "...", kind = "dylib|static|...")] + | +++++++++++++++++++++++++++++++++++++++++ +LL | #[link(name = "...", kind = "dylib|static|...", wasm_import_module = "...", import_name_type = "decorated|noprefix|undecorated")] + | ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + = and 1 other candidate -error: valid forms for the attribute are `#[link(name = "...")]`, `#[link(name = "...", kind = "dylib|static|...")]`, `#[link(name = "...", wasm_import_module = "...")]`, `#[link(name = "...", import_name_type = "decorated|noprefix|undecorated")]`, and `#[link(name = "...", kind = "dylib|static|...", wasm_import_module = "...", import_name_type = "decorated|noprefix|undecorated")]` - --> $DIR/malformed-regressions.rs:9:1 +error[E0539]: malformed `link` attribute input + --> $DIR/malformed-regressions.rs:8:1 | LL | #[link = ""] - | ^^^^^^^^^^^^ + | ^^^^^^^^^^^^ expected this to be a list | - = 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 #57571 <https://github.com/rust-lang/rust/issues/57571> = note: for more information, visit <https://doc.rust-lang.org/reference/items/external-blocks.html#the-link-attribute> +help: try changing it to one of the following valid forms of the attribute + | +LL - #[link = ""] +LL + #[link(name = "...")] + | +LL - #[link = ""] +LL + #[link(name = "...", import_name_type = "decorated|noprefix|undecorated")] + | +LL - #[link = ""] +LL + #[link(name = "...", kind = "dylib|static|...")] + | +LL - #[link = ""] +LL + #[link(name = "...", kind = "dylib|static|...", wasm_import_module = "...", import_name_type = "decorated|noprefix|undecorated")] + | + = and 1 other candidate error: valid forms for the attribute are `#[ignore = "reason"]` and `#[ignore]` --> $DIR/malformed-regressions.rs:3:1 @@ -49,6 +71,7 @@ LL | #[inline = ""] error: aborting due to 5 previous errors +For more information about this error, try `rustc --explain E0539`. Future incompatibility report: Future breakage diagnostic: error: valid forms for the attribute are `#[doc(hidden)]`, `#[doc(inline)]`, and `#[doc = "string"]` --> $DIR/malformed-regressions.rs:1:1 @@ -59,31 +82,7 @@ LL | #[doc] = 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 #57571 <https://github.com/rust-lang/rust/issues/57571> = note: for more information, visit <https://doc.rust-lang.org/rustdoc/write-documentation/the-doc-attribute.html> - = note: `#[deny(ill_formed_attribute_input)]` on by default - -Future breakage diagnostic: -error: valid forms for the attribute are `#[link(name = "...")]`, `#[link(name = "...", kind = "dylib|static|...")]`, `#[link(name = "...", wasm_import_module = "...")]`, `#[link(name = "...", import_name_type = "decorated|noprefix|undecorated")]`, and `#[link(name = "...", kind = "dylib|static|...", wasm_import_module = "...", import_name_type = "decorated|noprefix|undecorated")]` - --> $DIR/malformed-regressions.rs:7:1 - | -LL | #[link] - | ^^^^^^^ - | - = 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 #57571 <https://github.com/rust-lang/rust/issues/57571> - = note: for more information, visit <https://doc.rust-lang.org/reference/items/external-blocks.html#the-link-attribute> - = note: `#[deny(ill_formed_attribute_input)]` on by default - -Future breakage diagnostic: -error: valid forms for the attribute are `#[link(name = "...")]`, `#[link(name = "...", kind = "dylib|static|...")]`, `#[link(name = "...", wasm_import_module = "...")]`, `#[link(name = "...", import_name_type = "decorated|noprefix|undecorated")]`, and `#[link(name = "...", kind = "dylib|static|...", wasm_import_module = "...", import_name_type = "decorated|noprefix|undecorated")]` - --> $DIR/malformed-regressions.rs:9:1 - | -LL | #[link = ""] - | ^^^^^^^^^^^^ - | - = 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 #57571 <https://github.com/rust-lang/rust/issues/57571> - = note: for more information, visit <https://doc.rust-lang.org/reference/items/external-blocks.html#the-link-attribute> - = note: `#[deny(ill_formed_attribute_input)]` on by default + = note: `#[deny(ill_formed_attribute_input)]` (part of `#[deny(future_incompatible)]`) on by default Future breakage diagnostic: error: valid forms for the attribute are `#[ignore = "reason"]` and `#[ignore]` @@ -94,7 +93,7 @@ LL | #[ignore()] | = 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 #57571 <https://github.com/rust-lang/rust/issues/57571> - = note: `#[deny(ill_formed_attribute_input)]` on by default + = note: `#[deny(ill_formed_attribute_input)]` (part of `#[deny(future_incompatible)]`) on by default Future breakage diagnostic: error: valid forms for the attribute are `#[inline(always)]`, `#[inline(never)]`, and `#[inline]` @@ -105,5 +104,5 @@ LL | #[inline = ""] | = 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 #57571 <https://github.com/rust-lang/rust/issues/57571> - = note: `#[deny(ill_formed_attribute_input)]` on by default + = note: `#[deny(ill_formed_attribute_input)]` (part of `#[deny(future_incompatible)]`) on by default diff --git a/tests/ui/marker_trait_attr/overlap-marker-trait.stderr b/tests/ui/marker_trait_attr/overlap-marker-trait.stderr index cdad382d11c..5516d034488 100644 --- a/tests/ui/marker_trait_attr/overlap-marker-trait.stderr +++ b/tests/ui/marker_trait_attr/overlap-marker-trait.stderr @@ -2,8 +2,13 @@ error[E0277]: the trait bound `NotDebugOrDisplay: Marker` is not satisfied --> $DIR/overlap-marker-trait.rs:28:17 | LL | is_marker::<NotDebugOrDisplay>(); - | ^^^^^^^^^^^^^^^^^ the trait `Marker` is not implemented for `NotDebugOrDisplay` + | ^^^^^^^^^^^^^^^^^ unsatisfied trait bound | +help: the trait `Marker` is not implemented for `NotDebugOrDisplay` + --> $DIR/overlap-marker-trait.rs:18:1 + | +LL | struct NotDebugOrDisplay; + | ^^^^^^^^^^^^^^^^^^^^^^^^ note: required by a bound in `is_marker` --> $DIR/overlap-marker-trait.rs:16:17 | diff --git a/tests/ui/issues/issue-5358-1.rs b/tests/ui/match/mismatched-types-in-match-5358.rs index 281f219c039..d096bf3a493 100644 --- a/tests/ui/issues/issue-5358-1.rs +++ b/tests/ui/match/mismatched-types-in-match-5358.rs @@ -1,8 +1,13 @@ -enum Either<T, U> { Left(T), Right(U) } +// https://github.com/rust-lang/rust/issues/5358 +enum Either<T, U> { + Left(T), + Right(U), +} struct S(Either<usize, usize>); fn main() { - match S(Either::Left(5)) { //~ NOTE this expression has type `S` + match S(Either::Left(5)) { + //~^ NOTE this expression has type `S` Either::Right(_) => {} //~^ ERROR mismatched types //~| NOTE expected `S`, found `Either<_, _>` diff --git a/tests/ui/issues/issue-5358-1.stderr b/tests/ui/match/mismatched-types-in-match-5358.stderr index e68db865dc4..6a6cf3ee269 100644 --- a/tests/ui/issues/issue-5358-1.stderr +++ b/tests/ui/match/mismatched-types-in-match-5358.stderr @@ -1,8 +1,9 @@ error[E0308]: mismatched types - --> $DIR/issue-5358-1.rs:6:9 + --> $DIR/mismatched-types-in-match-5358.rs:11:9 | LL | match S(Either::Left(5)) { | ------------------ this expression has type `S` +LL | LL | Either::Right(_) => {} | ^^^^^^^^^^^^^^^^ expected `S`, found `Either<_, _>` | diff --git a/tests/ui/issues/issue-7867.rs b/tests/ui/match/mismatched-types-in-match-7867.rs index 87e7c831e68..9ff8755c819 100644 --- a/tests/ui/issues/issue-7867.rs +++ b/tests/ui/match/mismatched-types-in-match-7867.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/7867 //@ dont-require-annotations: NOTE enum A { B, C } diff --git a/tests/ui/issues/issue-7867.stderr b/tests/ui/match/mismatched-types-in-match-7867.stderr index fcb69d775fa..e41a61e42f4 100644 --- a/tests/ui/issues/issue-7867.stderr +++ b/tests/ui/match/mismatched-types-in-match-7867.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/issue-7867.rs:9:9 + --> $DIR/mismatched-types-in-match-7867.rs:10:9 | LL | enum A { B, C } | - unit variant defined here diff --git a/tests/ui/methods/inherent-bound-in-probe.stderr b/tests/ui/methods/inherent-bound-in-probe.stderr index b7751ca4714..6502752bcb4 100644 --- a/tests/ui/methods/inherent-bound-in-probe.stderr +++ b/tests/ui/methods/inherent-bound-in-probe.stderr @@ -4,7 +4,11 @@ error[E0277]: `Helper<'a, T>` is not an iterator LL | type IntoIter = Helper<'a, T>; | ^^^^^^^^^^^^^ `Helper<'a, T>` is not an iterator | - = help: the trait `Iterator` is not implemented for `Helper<'a, T>` +help: the trait `Iterator` is not implemented for `Helper<'a, T>` + --> $DIR/inherent-bound-in-probe.rs:15:1 + | +LL | struct Helper<'a, T> + | ^^^^^^^^^^^^^^^^^^^^ note: required by a bound in `std::iter::IntoIterator::IntoIter` --> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL diff --git a/tests/ui/methods/method-call-lifetime-args-unresolved.stderr b/tests/ui/methods/method-call-lifetime-args-unresolved.stderr index d3bd74a49fb..cc8bd18449a 100644 --- a/tests/ui/methods/method-call-lifetime-args-unresolved.stderr +++ b/tests/ui/methods/method-call-lifetime-args-unresolved.stderr @@ -14,13 +14,14 @@ warning: cannot specify lifetime arguments explicitly if late bound lifetime par | LL | 0.clone::<'a>(); | ^^ + | --> $SRC_DIR/core/src/clone.rs:LL:COL | = note: the late bound lifetime parameter is introduced here | = 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 #42868 <https://github.com/rust-lang/rust/issues/42868> - = note: `#[warn(late_bound_lifetime_arguments)]` on by default + = note: `#[warn(late_bound_lifetime_arguments)]` (part of `#[warn(future_incompatible)]`) on by default error: aborting due to 1 previous error; 1 warning emitted diff --git a/tests/ui/methods/method-recursive-blanket-impl.stderr b/tests/ui/methods/method-recursive-blanket-impl.stderr index e358f80d3ff..1074893744a 100644 --- a/tests/ui/methods/method-recursive-blanket-impl.stderr +++ b/tests/ui/methods/method-recursive-blanket-impl.stderr @@ -4,7 +4,7 @@ warning: trait `Foo` is never used LL | trait Foo<A> { | ^^^ | - = note: `#[warn(dead_code)]` on by default + = note: `#[warn(dead_code)]` (part of `#[warn(unused)]`) on by default warning: 1 warning emitted diff --git a/tests/ui/methods/method-two-trait-defer-resolution-2.stderr b/tests/ui/methods/method-two-trait-defer-resolution-2.stderr index 4501ea5d243..17ceb745b90 100644 --- a/tests/ui/methods/method-two-trait-defer-resolution-2.stderr +++ b/tests/ui/methods/method-two-trait-defer-resolution-2.stderr @@ -6,7 +6,7 @@ LL | trait MyCopy { fn foo(&self) { } } | | | method in this trait | - = note: `#[warn(dead_code)]` on by default + = note: `#[warn(dead_code)]` (part of `#[warn(unused)]`) on by default warning: 1 warning emitted diff --git a/tests/ui/methods/method-two-traits-distinguished-via-where-clause.stderr b/tests/ui/methods/method-two-traits-distinguished-via-where-clause.stderr index fa87ce5cc49..40f91337052 100644 --- a/tests/ui/methods/method-two-traits-distinguished-via-where-clause.stderr +++ b/tests/ui/methods/method-two-traits-distinguished-via-where-clause.stderr @@ -4,7 +4,7 @@ warning: trait `A` is never used LL | trait A { | ^ | - = note: `#[warn(dead_code)]` on by default + = note: `#[warn(dead_code)]` (part of `#[warn(unused)]`) on by default warning: 1 warning emitted diff --git a/tests/ui/methods/missing-bound-on-tuple.rs b/tests/ui/methods/missing-bound-on-tuple.rs deleted file mode 100644 index 25deabf5926..00000000000 --- a/tests/ui/methods/missing-bound-on-tuple.rs +++ /dev/null @@ -1,39 +0,0 @@ -trait WorksOnDefault { - fn do_something() {} -} - -impl<T: Default> WorksOnDefault for T {} -//~^ NOTE the following trait bounds were not satisfied -//~| NOTE unsatisfied trait bound introduced here - -trait Foo {} - -trait WorksOnFoo { - fn do_be_do() {} -} - -impl<T: Foo> WorksOnFoo for T {} -//~^ NOTE the following trait bounds were not satisfied -//~| NOTE unsatisfied trait bound introduced here - -impl<A: Foo, B: Foo, C: Foo> Foo for (A, B, C) {} -//~^ NOTE `Foo` is implemented for `(i32, u32, String)` -impl Foo for i32 {} -impl Foo for &i32 {} -impl Foo for u32 {} -impl Foo for String {} - -fn main() { - let _success = <(i32, u32, String)>::do_something(); - let _failure = <(i32, &u32, String)>::do_something(); //~ ERROR E0599 - //~^ NOTE `Default` is implemented for `(i32, u32, String)` - //~| NOTE function or associated item cannot be called on - let _success = <(i32, u32, String)>::do_be_do(); - let _failure = <(i32, &u32, String)>::do_be_do(); //~ ERROR E0599 - //~^ NOTE function or associated item cannot be called on - let _success = <(i32, u32, String)>::default(); - let _failure = <(i32, &u32, String)>::default(); //~ ERROR E0599 - //~^ NOTE `Default` is implemented for `(i32, u32, String)` - //~| NOTE function or associated item cannot be called on - //~| NOTE the following trait bounds were not satisfied -} diff --git a/tests/ui/methods/missing-bound-on-tuple.stderr b/tests/ui/methods/missing-bound-on-tuple.stderr deleted file mode 100644 index f3e0897e5e6..00000000000 --- a/tests/ui/methods/missing-bound-on-tuple.stderr +++ /dev/null @@ -1,58 +0,0 @@ -error[E0599]: the function or associated item `do_something` exists for tuple `(i32, &u32, String)`, but its trait bounds were not satisfied - --> $DIR/missing-bound-on-tuple.rs:28:43 - | -LL | let _failure = <(i32, &u32, String)>::do_something(); - | ^^^^^^^^^^^^ function or associated item cannot be called on `(i32, &u32, String)` due to unsatisfied trait bounds - | -note: the following trait bounds were not satisfied: - `&(i32, &u32, String): Default` - `&mut (i32, &u32, String): Default` - `(i32, &u32, String): Default` - --> $DIR/missing-bound-on-tuple.rs:5:9 - | -LL | impl<T: Default> WorksOnDefault for T {} - | ^^^^^^^ -------------- - - | | - | unsatisfied trait bound introduced here -note: `Default` is implemented for `(i32, u32, String)` but not for `(i32, &u32, String)` - --> $SRC_DIR/core/src/tuple.rs:LL:COL - = note: this error originates in the macro `tuple_impls` (in Nightly builds, run with -Z macro-backtrace for more info) - -error[E0599]: the function or associated item `do_be_do` exists for tuple `(i32, &u32, String)`, but its trait bounds were not satisfied - --> $DIR/missing-bound-on-tuple.rs:32:43 - | -LL | let _failure = <(i32, &u32, String)>::do_be_do(); - | ^^^^^^^^ function or associated item cannot be called on `(i32, &u32, String)` due to unsatisfied trait bounds - | -note: the following trait bounds were not satisfied: - `&(i32, &u32, String): Foo` - `&mut (i32, &u32, String): Foo` - `(i32, &u32, String): Foo` - --> $DIR/missing-bound-on-tuple.rs:15:9 - | -LL | impl<T: Foo> WorksOnFoo for T {} - | ^^^ ---------- - - | | - | unsatisfied trait bound introduced here -note: `Foo` is implemented for `(i32, u32, String)` but not for `(i32, &u32, String)` - --> $DIR/missing-bound-on-tuple.rs:19:1 - | -LL | impl<A: Foo, B: Foo, C: Foo> Foo for (A, B, C) {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -error[E0599]: the function or associated item `default` exists for tuple `(i32, &u32, String)`, but its trait bounds were not satisfied - --> $DIR/missing-bound-on-tuple.rs:35:43 - | -LL | let _failure = <(i32, &u32, String)>::default(); - | ^^^^^^^ function or associated item cannot be called on `(i32, &u32, String)` due to unsatisfied trait bounds - | - = note: the following trait bounds were not satisfied: - `&u32: Default` - which is required by `(i32, &u32, String): Default` -note: `Default` is implemented for `(i32, u32, String)` but not for `(i32, &u32, String)` - --> $SRC_DIR/core/src/tuple.rs:LL:COL - = note: this error originates in the macro `tuple_impls` (in Nightly builds, run with -Z macro-backtrace for more info) - -error: aborting due to 3 previous errors - -For more information about this error, try `rustc --explain E0599`. diff --git a/tests/ui/methods/rigid-alias-bound-is-not-inherent-2.rs b/tests/ui/methods/rigid-alias-bound-is-not-inherent-2.rs new file mode 100644 index 00000000000..8363ec1b3fb --- /dev/null +++ b/tests/ui/methods/rigid-alias-bound-is-not-inherent-2.rs @@ -0,0 +1,17 @@ +// Regression test for <github.com/rust-lang/rust/issues/145185>. + +mod module { + pub trait Trait { + fn method(&self); + } +} + +// Note that we do not import Trait +use std::ops::Deref; + +fn foo(x: impl Deref<Target: module::Trait>) { + x.method(); + //~^ ERROR no method named `method` found for type parameter +} + +fn main() {} diff --git a/tests/ui/methods/rigid-alias-bound-is-not-inherent-2.stderr b/tests/ui/methods/rigid-alias-bound-is-not-inherent-2.stderr new file mode 100644 index 00000000000..433cab9cf9e --- /dev/null +++ b/tests/ui/methods/rigid-alias-bound-is-not-inherent-2.stderr @@ -0,0 +1,17 @@ +error[E0599]: no method named `method` found for type parameter `impl Deref<Target : module::Trait>` in the current scope + --> $DIR/rigid-alias-bound-is-not-inherent-2.rs:13:7 + | +LL | fn foo(x: impl Deref<Target: module::Trait>) { + | --------------------------------- method `method` not found for this type parameter +LL | x.method(); + | ^^^^^^ method not found in `impl Deref<Target : module::Trait>` + | + = help: items from traits can only be used if the trait is in scope +help: trait `Trait` which provides `method` is implemented but not in scope; perhaps you want to import it + | +LL + use module::Trait; + | + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0599`. diff --git a/tests/ui/methods/rigid-alias-bound-is-not-inherent-3.rs b/tests/ui/methods/rigid-alias-bound-is-not-inherent-3.rs new file mode 100644 index 00000000000..bb316eed34d --- /dev/null +++ b/tests/ui/methods/rigid-alias-bound-is-not-inherent-3.rs @@ -0,0 +1,26 @@ +use std::ops::Deref; + +trait Trait1 { + fn call_me(&self) {} +} + +impl<T> Trait1 for T {} + +trait Trait2 { + fn call_me(&self) {} +} + +impl<T> Trait2 for T {} + +pub fn foo<T, U>(x: T) +where + T: Deref<Target = U>, + U: Trait1, +{ + // This should be ambiguous. The fact that there's an inherent where-bound + // candidate for `U` should not impact the candidates for `T` + x.call_me(); + //~^ ERROR multiple applicable items in scope +} + +fn main() {} diff --git a/tests/ui/methods/rigid-alias-bound-is-not-inherent-3.stderr b/tests/ui/methods/rigid-alias-bound-is-not-inherent-3.stderr new file mode 100644 index 00000000000..466ad4d2abc --- /dev/null +++ b/tests/ui/methods/rigid-alias-bound-is-not-inherent-3.stderr @@ -0,0 +1,30 @@ +error[E0034]: multiple applicable items in scope + --> $DIR/rigid-alias-bound-is-not-inherent-3.rs:22:7 + | +LL | x.call_me(); + | ^^^^^^^ multiple `call_me` found + | +note: candidate #1 is defined in an impl of the trait `Trait1` for the type `T` + --> $DIR/rigid-alias-bound-is-not-inherent-3.rs:4:5 + | +LL | fn call_me(&self) {} + | ^^^^^^^^^^^^^^^^^ +note: candidate #2 is defined in an impl of the trait `Trait2` for the type `T` + --> $DIR/rigid-alias-bound-is-not-inherent-3.rs:10:5 + | +LL | fn call_me(&self) {} + | ^^^^^^^^^^^^^^^^^ +help: disambiguate the method for candidate #1 + | +LL - x.call_me(); +LL + Trait1::call_me(&x); + | +help: disambiguate the method for candidate #2 + | +LL - x.call_me(); +LL + Trait2::call_me(&x); + | + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0034`. diff --git a/tests/ui/methods/rigid-alias-bound-is-not-inherent.current.stderr b/tests/ui/methods/rigid-alias-bound-is-not-inherent.current.stderr new file mode 100644 index 00000000000..4652bf5e3c5 --- /dev/null +++ b/tests/ui/methods/rigid-alias-bound-is-not-inherent.current.stderr @@ -0,0 +1,30 @@ +error[E0034]: multiple applicable items in scope + --> $DIR/rigid-alias-bound-is-not-inherent.rs:42:7 + | +LL | x.method(); + | ^^^^^^ multiple `method` found + | +note: candidate #1 is defined in the trait `Trait1` + --> $DIR/rigid-alias-bound-is-not-inherent.rs:21:5 + | +LL | fn method(&self) { + | ^^^^^^^^^^^^^^^^ +note: candidate #2 is defined in an impl of the trait `Trait2` for the type `T` + --> $DIR/rigid-alias-bound-is-not-inherent.rs:27:5 + | +LL | fn method(&self) { + | ^^^^^^^^^^^^^^^^ +help: disambiguate the method for candidate #1 + | +LL - x.method(); +LL + Trait1::method(&x); + | +help: disambiguate the method for candidate #2 + | +LL - x.method(); +LL + Trait2::method(&x); + | + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0034`. diff --git a/tests/ui/methods/rigid-alias-bound-is-not-inherent.next.stderr b/tests/ui/methods/rigid-alias-bound-is-not-inherent.next.stderr new file mode 100644 index 00000000000..afacb3a7d52 --- /dev/null +++ b/tests/ui/methods/rigid-alias-bound-is-not-inherent.next.stderr @@ -0,0 +1,30 @@ +error[E0034]: multiple applicable items in scope + --> $DIR/rigid-alias-bound-is-not-inherent.rs:42:7 + | +LL | x.method(); + | ^^^^^^ multiple `method` found + | +note: candidate #1 is defined in the trait `Trait1` + --> $DIR/rigid-alias-bound-is-not-inherent.rs:21:5 + | +LL | fn method(&self) { + | ^^^^^^^^^^^^^^^^ +note: candidate #2 is defined in the trait `Trait2` + --> $DIR/rigid-alias-bound-is-not-inherent.rs:27:5 + | +LL | fn method(&self) { + | ^^^^^^^^^^^^^^^^ +help: disambiguate the method for candidate #1 + | +LL - x.method(); +LL + Trait1::method(&x); + | +help: disambiguate the method for candidate #2 + | +LL - x.method(); +LL + Trait2::method(&x); + | + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0034`. diff --git a/tests/ui/methods/rigid-alias-bound-is-not-inherent.rs b/tests/ui/methods/rigid-alias-bound-is-not-inherent.rs new file mode 100644 index 00000000000..3dd63df3f39 --- /dev/null +++ b/tests/ui/methods/rigid-alias-bound-is-not-inherent.rs @@ -0,0 +1,46 @@ +//@ revisions: current next +//@ ignore-compare-mode-next-solver (explicit revisions) +//@[next] compile-flags: -Znext-solver + +// See the code below. +// +// We were using `DeepRejectCtxt` to ensure that `assemble_inherent_candidates_from_param` +// did not rely on the param-env being eagerly normalized. Since aliases unify with all +// types, this meant that a rigid param-env candidate like `<T as Deref>::Target: Trait1` +// would be registered as a "WhereClauseCandidate", which is treated as inherent. Since +// we evaluate these candidates for all self types in the deref chain, this candidate +// would be satisfied for `<T as Deref>::Target`, meaning that it would be preferred over +// an "extension" candidate like `<T as Deref>::Target: Trait2` even though it holds. +// This is problematic, since it causes ambiguities to be broken somewhat arbitrarily. +// And as a side-effect, it also caused our computation of "used" traits to be miscalculated +// since inherent candidates don't count as an import usage. + +use std::ops::Deref; + +trait Trait1 { + fn method(&self) { + println!("1"); + } +} + +trait Trait2 { + fn method(&self) { + println!("2"); + } +} +impl<T: Other + ?Sized> Trait2 for T {} + +trait Other {} + +fn foo<T>(x: T) +where + T: Deref, + <T as Deref>::Target: Trait1 + Other, +{ + // Make sure that we don't prefer methods from where clauses for rigid aliases, + // just for params. We could revisit this behavior, but it would be a lang change. + x.method(); + //~^ ERROR multiple applicable items in scope +} + +fn main() {} diff --git a/tests/ui/issues/issue-7575.rs b/tests/ui/methods/trait-method-resolution-7575.rs index 8b1fdf6c851..9793d43cc24 100644 --- a/tests/ui/issues/issue-7575.rs +++ b/tests/ui/methods/trait-method-resolution-7575.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/7575 //@ run-pass trait Foo { //~ WARN trait `Foo` is never used diff --git a/tests/ui/methods/trait-method-resolution-7575.stderr b/tests/ui/methods/trait-method-resolution-7575.stderr new file mode 100644 index 00000000000..8bbc360de57 --- /dev/null +++ b/tests/ui/methods/trait-method-resolution-7575.stderr @@ -0,0 +1,10 @@ +warning: trait `Foo` is never used + --> $DIR/trait-method-resolution-7575.rs:4:7 + | +LL | trait Foo { + | ^^^ + | + = note: `#[warn(dead_code)]` (part of `#[warn(unused)]`) on by default + +warning: 1 warning emitted + diff --git a/tests/ui/methods/tuple-suggestions-issue-142488.rs b/tests/ui/methods/tuple-suggestions-issue-142488.rs new file mode 100644 index 00000000000..f6c58fce9a1 --- /dev/null +++ b/tests/ui/methods/tuple-suggestions-issue-142488.rs @@ -0,0 +1,48 @@ +// Regression test for issue #142488, a diagnostics ICE when trying to suggest missing methods +// present in similar tuple types. +// This is a few of the MCVEs from the issues and its many duplicates. + +// 1 +fn main() { + for a in x { + //~^ ERROR: cannot find value `x` in this scope + (a,).to_string() + //~^ ERROR: the method `to_string` exists for tuple + } +} + +// 2 +trait Trait { + fn meth(self); +} + +impl<T, U: Trait> Trait for (T, U) { + fn meth(self) {} +} + +fn mcve2() { + ((), std::collections::HashMap::new()).meth() + //~^ ERROR: the method `meth` exists for tuple +} + +// 3 +trait I {} + +struct Struct; +impl I for Struct {} + +trait Tr { + fn f<A>(self) -> (A,) + where + Self: Sized, + { + loop {} + } +} + +impl<T> Tr for T where T: I {} + +fn mcve3() { + Struct.f().f(); + //~^ ERROR: the method `f` exists for tuple +} diff --git a/tests/ui/methods/tuple-suggestions-issue-142488.stderr b/tests/ui/methods/tuple-suggestions-issue-142488.stderr new file mode 100644 index 00000000000..f9363bb216f --- /dev/null +++ b/tests/ui/methods/tuple-suggestions-issue-142488.stderr @@ -0,0 +1,61 @@ +error[E0425]: cannot find value `x` in this scope + --> $DIR/tuple-suggestions-issue-142488.rs:7:14 + | +LL | for a in x { + | ^ not found in this scope + +error[E0599]: the method `to_string` exists for tuple `(_,)`, but its trait bounds were not satisfied + --> $DIR/tuple-suggestions-issue-142488.rs:9:14 + | +LL | (a,).to_string() + | ^^^^^^^^^ method cannot be called on `(_,)` due to unsatisfied trait bounds + | + = note: the following trait bounds were not satisfied: + `(_,): std::fmt::Display` + which is required by `(_,): ToString` + +error[E0599]: the method `meth` exists for tuple `((), HashMap<_, _>)`, but its trait bounds were not satisfied + --> $DIR/tuple-suggestions-issue-142488.rs:24:44 + | +LL | ((), std::collections::HashMap::new()).meth() + | ^^^^ method cannot be called on `((), HashMap<_, _>)` due to unsatisfied trait bounds + | +note: trait bound `HashMap<_, _>: Trait` was not satisfied + --> $DIR/tuple-suggestions-issue-142488.rs:19:12 + | +LL | impl<T, U: Trait> Trait for (T, U) { + | ^^^^^ ----- ------ + | | + | unsatisfied trait bound introduced here + = help: items from traits can only be used if the trait is implemented and in scope +note: `Trait` defines an item `meth`, perhaps you need to implement it + --> $DIR/tuple-suggestions-issue-142488.rs:15:1 + | +LL | trait Trait { + | ^^^^^^^^^^^ + +error[E0599]: the method `f` exists for tuple `(_,)`, but its trait bounds were not satisfied + --> $DIR/tuple-suggestions-issue-142488.rs:46:16 + | +LL | Struct.f().f(); + | ^ method cannot be called on `(_,)` due to unsatisfied trait bounds + | +note: the following trait bounds were not satisfied: + `&(_,): I` + `&mut (_,): I` + `(_,): I` + --> $DIR/tuple-suggestions-issue-142488.rs:43:27 + | +LL | impl<T> Tr for T where T: I {} + | -- - ^ unsatisfied trait bound introduced here + = help: items from traits can only be used if the trait is implemented and in scope +note: `Tr` defines an item `f`, perhaps you need to implement it + --> $DIR/tuple-suggestions-issue-142488.rs:34:1 + | +LL | trait Tr { + | ^^^^^^^^ + +error: aborting due to 4 previous errors + +Some errors have detailed explanations: E0425, E0599. +For more information about an error, try `rustc --explain E0425`. diff --git a/tests/ui/issues/issue-81918.rs b/tests/ui/mir/mir-cfg-unpretty-check-81918.rs index ee9721c2493..4798a654375 100644 --- a/tests/ui/issues/issue-81918.rs +++ b/tests/ui/mir/mir-cfg-unpretty-check-81918.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/81918 //@ check-pass //@ dont-check-compiler-stdout //@ compile-flags: -Z unpretty=mir-cfg diff --git a/tests/ui/mir/mir_raw_fat_ptr.stderr b/tests/ui/mir/mir_raw_fat_ptr.stderr index cd99d566654..d1f91a79acc 100644 --- a/tests/ui/mir/mir_raw_fat_ptr.stderr +++ b/tests/ui/mir/mir_raw_fat_ptr.stderr @@ -6,7 +6,7 @@ LL | trait Foo { fn foo(&self) -> usize; } | | | method in this trait | - = note: `#[warn(dead_code)]` on by default + = note: `#[warn(dead_code)]` (part of `#[warn(unused)]`) on by default warning: 1 warning emitted diff --git a/tests/ui/mir/validate/ice-zst-as-discr-145786.rs b/tests/ui/mir/validate/ice-zst-as-discr-145786.rs new file mode 100644 index 00000000000..616736bcf12 --- /dev/null +++ b/tests/ui/mir/validate/ice-zst-as-discr-145786.rs @@ -0,0 +1,14 @@ +// Do not attempt to take the discriminant as the source +// converted to a `u128`, that won't work for ZST. +// +//@ compile-flags: -Zvalidate-mir + +enum A { + B, + C, +} + +fn main() { + let _: A = unsafe { std::mem::transmute(()) }; + //~^ ERROR cannot transmute between types of different sizes, or dependently-sized types +} diff --git a/tests/ui/mir/validate/ice-zst-as-discr-145786.stderr b/tests/ui/mir/validate/ice-zst-as-discr-145786.stderr new file mode 100644 index 00000000000..b0bca1eb39c --- /dev/null +++ b/tests/ui/mir/validate/ice-zst-as-discr-145786.stderr @@ -0,0 +1,12 @@ +error[E0512]: cannot transmute between types of different sizes, or dependently-sized types + --> $DIR/ice-zst-as-discr-145786.rs:12:25 + | +LL | let _: A = unsafe { std::mem::transmute(()) }; + | ^^^^^^^^^^^^^^^^^^^ + | + = note: source type: `()` (0 bits) + = note: target type: `A` (8 bits) + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0512`. diff --git a/tests/ui/mismatched_types/closure-arg-type-mismatch.stderr b/tests/ui/mismatched_types/closure-arg-type-mismatch.stderr index abc5d150a3f..62e87263967 100644 --- a/tests/ui/mismatched_types/closure-arg-type-mismatch.stderr +++ b/tests/ui/mismatched_types/closure-arg-type-mismatch.stderr @@ -57,7 +57,7 @@ LL | baz(f); = note: requirement occurs because of a mutable pointer to `&u32` = note: mutable pointers are invariant over their type parameter = help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance -note: due to current limitations in the borrow checker, this implies a `'static` lifetime +note: due to a current limitation of the type system, this implies a `'static` lifetime --> $DIR/closure-arg-type-mismatch.rs:8:11 | LL | fn baz<F: Fn(*mut &u32)>(_: F) {} diff --git a/tests/ui/mismatched_types/hr-projection-mismatch.current.stderr b/tests/ui/mismatched_types/hr-projection-mismatch.current.stderr index a2cec972e4a..6bda7840f7b 100644 --- a/tests/ui/mismatched_types/hr-projection-mismatch.current.stderr +++ b/tests/ui/mismatched_types/hr-projection-mismatch.current.stderr @@ -2,7 +2,7 @@ error[E0308]: mismatched types --> $DIR/hr-projection-mismatch.rs:20:5 | LL | wrap::<_, Thing>(); - | ^^^^^^^^^^^^^^^^ one type is more general than the other + | ^^^^^^^^^^^^^^^^^^ one type is more general than the other | = note: expected reference `&'a _` found reference `&_` diff --git a/tests/ui/issues/issue-87490.rs b/tests/ui/mismatched_types/mismatched-types-in-trait-implementation-87490.rs index 998f61a6bd3..67e16ec6ce3 100644 --- a/tests/ui/issues/issue-87490.rs +++ b/tests/ui/mismatched_types/mismatched-types-in-trait-implementation-87490.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/87490 fn main() {} trait StreamOnce { type Position; diff --git a/tests/ui/issues/issue-87490.stderr b/tests/ui/mismatched_types/mismatched-types-in-trait-implementation-87490.stderr index 5a4ec55833b..bbd73347d02 100644 --- a/tests/ui/issues/issue-87490.stderr +++ b/tests/ui/mismatched_types/mismatched-types-in-trait-implementation-87490.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/issue-87490.rs:9:5 + --> $DIR/mismatched-types-in-trait-implementation-87490.rs:10:5 | LL | fn follow(_: &str) -> <&str as StreamOnce>::Position { | ------------------------------ expected `usize` because of return type diff --git a/tests/ui/issues/issue-5950.rs b/tests/ui/modules/pub-use-module-alias-5950.rs index 6015560fcf8..91d3f9b16ff 100644 --- a/tests/ui/issues/issue-5950.rs +++ b/tests/ui/modules/pub-use-module-alias-5950.rs @@ -1,6 +1,6 @@ +// https://github.com/rust-lang/rust/issues/5950 //@ check-pass - pub use local as local_alias; pub mod local { } diff --git a/tests/ui/issues/issue-7663.rs b/tests/ui/modules/use-statement-duplicate-check-7663.rs index d2b2c727cab..872806594fc 100644 --- a/tests/ui/issues/issue-7663.rs +++ b/tests/ui/modules/use-statement-duplicate-check-7663.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/7663 //@ run-pass #![allow(unused_imports, dead_code)] diff --git a/tests/ui/moves/issue-22536-copy-mustnt-zero.stderr b/tests/ui/moves/issue-22536-copy-mustnt-zero.stderr index b1fcdfa44c3..1be612af44c 100644 --- a/tests/ui/moves/issue-22536-copy-mustnt-zero.stderr +++ b/tests/ui/moves/issue-22536-copy-mustnt-zero.stderr @@ -7,7 +7,7 @@ LL | type Buffer: Copy; LL | fn foo(&self) {} | ^^^ | - = note: `#[warn(dead_code)]` on by default + = note: `#[warn(dead_code)]` (part of `#[warn(unused)]`) on by default warning: 1 warning emitted diff --git a/tests/ui/mut/mutable-enum-indirect.stderr b/tests/ui/mut/mutable-enum-indirect.stderr index 0b7783b3318..b15492357f5 100644 --- a/tests/ui/mut/mutable-enum-indirect.stderr +++ b/tests/ui/mut/mutable-enum-indirect.stderr @@ -6,7 +6,11 @@ LL | bar(&x); | | | required by a bound introduced by this call | - = help: within `&Foo`, the trait `Sync` is not implemented for `NoSync` +help: within `&Foo`, the trait `Sync` is not implemented for `NoSync` + --> $DIR/mutable-enum-indirect.rs:8:1 + | +LL | struct NoSync; + | ^^^^^^^^^^^^^ note: required because it appears within the type `Foo` --> $DIR/mutable-enum-indirect.rs:11:6 | diff --git a/tests/ui/namespace/namespace-mix.stderr b/tests/ui/namespace/namespace-mix.stderr index 200d31cc710..7c889f34e91 100644 --- a/tests/ui/namespace/namespace-mix.stderr +++ b/tests/ui/namespace/namespace-mix.stderr @@ -106,10 +106,15 @@ error[E0277]: the trait bound `c::Item: Impossible` is not satisfied --> $DIR/namespace-mix.rs:33:11 | LL | check(m1::S{}); - | ----- ^^^^^^^ the trait `Impossible` is not implemented for `c::Item` + | ----- ^^^^^^^ unsatisfied trait bound | | | required by a bound introduced by this call | +help: the trait `Impossible` is not implemented for `c::Item` + --> $DIR/namespace-mix.rs:16:5 + | +LL | pub struct Item; + | ^^^^^^^^^^^^^^^ help: this trait has no implementations, consider adding one --> $DIR/namespace-mix.rs:20:1 | @@ -125,10 +130,15 @@ error[E0277]: the trait bound `c::S: Impossible` is not satisfied --> $DIR/namespace-mix.rs:35:11 | LL | check(m2::S{}); - | ----- ^^^^^^^ the trait `Impossible` is not implemented for `c::S` + | ----- ^^^^^^^ unsatisfied trait bound | | | required by a bound introduced by this call | +help: the trait `Impossible` is not implemented for `c::S` + --> $DIR/namespace-mix.rs:7:5 + | +LL | pub struct S {} + | ^^^^^^^^^^^^ help: this trait has no implementations, consider adding one --> $DIR/namespace-mix.rs:20:1 | @@ -144,10 +154,15 @@ error[E0277]: the trait bound `c::Item: Impossible` is not satisfied --> $DIR/namespace-mix.rs:36:11 | LL | check(m2::S); - | ----- ^^^^^ the trait `Impossible` is not implemented for `c::Item` + | ----- ^^^^^ unsatisfied trait bound | | | required by a bound introduced by this call | +help: the trait `Impossible` is not implemented for `c::Item` + --> $DIR/namespace-mix.rs:16:5 + | +LL | pub struct Item; + | ^^^^^^^^^^^^^^^ help: this trait has no implementations, consider adding one --> $DIR/namespace-mix.rs:20:1 | @@ -220,10 +235,15 @@ error[E0277]: the trait bound `c::Item: Impossible` is not satisfied --> $DIR/namespace-mix.rs:55:11 | LL | check(m3::TS{}); - | ----- ^^^^^^^^ the trait `Impossible` is not implemented for `c::Item` + | ----- ^^^^^^^^ unsatisfied trait bound | | | required by a bound introduced by this call | +help: the trait `Impossible` is not implemented for `c::Item` + --> $DIR/namespace-mix.rs:16:5 + | +LL | pub struct Item; + | ^^^^^^^^^^^^^^^ help: this trait has no implementations, consider adding one --> $DIR/namespace-mix.rs:20:1 | @@ -258,10 +278,15 @@ error[E0277]: the trait bound `c::TS: Impossible` is not satisfied --> $DIR/namespace-mix.rs:57:11 | LL | check(m4::TS{}); - | ----- ^^^^^^^^ the trait `Impossible` is not implemented for `c::TS` + | ----- ^^^^^^^^ unsatisfied trait bound | | | required by a bound introduced by this call | +help: the trait `Impossible` is not implemented for `c::TS` + --> $DIR/namespace-mix.rs:8:5 + | +LL | pub struct TS(); + | ^^^^^^^^^^^^^ help: this trait has no implementations, consider adding one --> $DIR/namespace-mix.rs:20:1 | @@ -277,10 +302,15 @@ error[E0277]: the trait bound `c::Item: Impossible` is not satisfied --> $DIR/namespace-mix.rs:58:11 | LL | check(m4::TS); - | ----- ^^^^^^ the trait `Impossible` is not implemented for `c::Item` + | ----- ^^^^^^ unsatisfied trait bound | | | required by a bound introduced by this call | +help: the trait `Impossible` is not implemented for `c::Item` + --> $DIR/namespace-mix.rs:16:5 + | +LL | pub struct Item; + | ^^^^^^^^^^^^^^^ help: this trait has no implementations, consider adding one --> $DIR/namespace-mix.rs:20:1 | @@ -372,10 +402,15 @@ error[E0277]: the trait bound `c::Item: Impossible` is not satisfied --> $DIR/namespace-mix.rs:77:11 | LL | check(m5::US{}); - | ----- ^^^^^^^^ the trait `Impossible` is not implemented for `c::Item` + | ----- ^^^^^^^^ unsatisfied trait bound | | | required by a bound introduced by this call | +help: the trait `Impossible` is not implemented for `c::Item` + --> $DIR/namespace-mix.rs:16:5 + | +LL | pub struct Item; + | ^^^^^^^^^^^^^^^ help: this trait has no implementations, consider adding one --> $DIR/namespace-mix.rs:20:1 | @@ -391,10 +426,15 @@ error[E0277]: the trait bound `c::US: Impossible` is not satisfied --> $DIR/namespace-mix.rs:78:11 | LL | check(m5::US); - | ----- ^^^^^^ the trait `Impossible` is not implemented for `c::US` + | ----- ^^^^^^ unsatisfied trait bound | | | required by a bound introduced by this call | +help: the trait `Impossible` is not implemented for `c::US` + --> $DIR/namespace-mix.rs:9:5 + | +LL | pub struct US; + | ^^^^^^^^^^^^^ help: this trait has no implementations, consider adding one --> $DIR/namespace-mix.rs:20:1 | @@ -410,10 +450,15 @@ error[E0277]: the trait bound `c::US: Impossible` is not satisfied --> $DIR/namespace-mix.rs:79:11 | LL | check(m6::US{}); - | ----- ^^^^^^^^ the trait `Impossible` is not implemented for `c::US` + | ----- ^^^^^^^^ unsatisfied trait bound | | | required by a bound introduced by this call | +help: the trait `Impossible` is not implemented for `c::US` + --> $DIR/namespace-mix.rs:9:5 + | +LL | pub struct US; + | ^^^^^^^^^^^^^ help: this trait has no implementations, consider adding one --> $DIR/namespace-mix.rs:20:1 | @@ -429,10 +474,15 @@ error[E0277]: the trait bound `c::Item: Impossible` is not satisfied --> $DIR/namespace-mix.rs:80:11 | LL | check(m6::US); - | ----- ^^^^^^ the trait `Impossible` is not implemented for `c::Item` + | ----- ^^^^^^ unsatisfied trait bound | | | required by a bound introduced by this call | +help: the trait `Impossible` is not implemented for `c::Item` + --> $DIR/namespace-mix.rs:16:5 + | +LL | pub struct Item; + | ^^^^^^^^^^^^^^^ help: this trait has no implementations, consider adding one --> $DIR/namespace-mix.rs:20:1 | @@ -524,10 +574,15 @@ error[E0277]: the trait bound `c::Item: Impossible` is not satisfied --> $DIR/namespace-mix.rs:99:11 | LL | check(m7::V{}); - | ----- ^^^^^^^ the trait `Impossible` is not implemented for `c::Item` + | ----- ^^^^^^^ unsatisfied trait bound | | | required by a bound introduced by this call | +help: the trait `Impossible` is not implemented for `c::Item` + --> $DIR/namespace-mix.rs:16:5 + | +LL | pub struct Item; + | ^^^^^^^^^^^^^^^ help: this trait has no implementations, consider adding one --> $DIR/namespace-mix.rs:20:1 | @@ -543,10 +598,15 @@ error[E0277]: the trait bound `c::E: Impossible` is not satisfied --> $DIR/namespace-mix.rs:101:11 | LL | check(m8::V{}); - | ----- ^^^^^^^ the trait `Impossible` is not implemented for `c::E` + | ----- ^^^^^^^ unsatisfied trait bound | | | required by a bound introduced by this call | +help: the trait `Impossible` is not implemented for `c::E` + --> $DIR/namespace-mix.rs:10:5 + | +LL | pub enum E { + | ^^^^^^^^^^ help: this trait has no implementations, consider adding one --> $DIR/namespace-mix.rs:20:1 | @@ -562,10 +622,15 @@ error[E0277]: the trait bound `c::Item: Impossible` is not satisfied --> $DIR/namespace-mix.rs:102:11 | LL | check(m8::V); - | ----- ^^^^^ the trait `Impossible` is not implemented for `c::Item` + | ----- ^^^^^ unsatisfied trait bound | | | required by a bound introduced by this call | +help: the trait `Impossible` is not implemented for `c::Item` + --> $DIR/namespace-mix.rs:16:5 + | +LL | pub struct Item; + | ^^^^^^^^^^^^^^^ help: this trait has no implementations, consider adding one --> $DIR/namespace-mix.rs:20:1 | @@ -638,10 +703,15 @@ error[E0277]: the trait bound `c::Item: Impossible` is not satisfied --> $DIR/namespace-mix.rs:121:11 | LL | check(m9::TV{}); - | ----- ^^^^^^^^ the trait `Impossible` is not implemented for `c::Item` + | ----- ^^^^^^^^ unsatisfied trait bound | | | required by a bound introduced by this call | +help: the trait `Impossible` is not implemented for `c::Item` + --> $DIR/namespace-mix.rs:16:5 + | +LL | pub struct Item; + | ^^^^^^^^^^^^^^^ help: this trait has no implementations, consider adding one --> $DIR/namespace-mix.rs:20:1 | @@ -676,10 +746,15 @@ error[E0277]: the trait bound `c::E: Impossible` is not satisfied --> $DIR/namespace-mix.rs:123:11 | LL | check(mA::TV{}); - | ----- ^^^^^^^^ the trait `Impossible` is not implemented for `c::E` + | ----- ^^^^^^^^ unsatisfied trait bound | | | required by a bound introduced by this call | +help: the trait `Impossible` is not implemented for `c::E` + --> $DIR/namespace-mix.rs:10:5 + | +LL | pub enum E { + | ^^^^^^^^^^ help: this trait has no implementations, consider adding one --> $DIR/namespace-mix.rs:20:1 | @@ -695,10 +770,15 @@ error[E0277]: the trait bound `c::Item: Impossible` is not satisfied --> $DIR/namespace-mix.rs:124:11 | LL | check(mA::TV); - | ----- ^^^^^^ the trait `Impossible` is not implemented for `c::Item` + | ----- ^^^^^^ unsatisfied trait bound | | | required by a bound introduced by this call | +help: the trait `Impossible` is not implemented for `c::Item` + --> $DIR/namespace-mix.rs:16:5 + | +LL | pub struct Item; + | ^^^^^^^^^^^^^^^ help: this trait has no implementations, consider adding one --> $DIR/namespace-mix.rs:20:1 | @@ -790,10 +870,15 @@ error[E0277]: the trait bound `c::Item: Impossible` is not satisfied --> $DIR/namespace-mix.rs:143:11 | LL | check(mB::UV{}); - | ----- ^^^^^^^^ the trait `Impossible` is not implemented for `c::Item` + | ----- ^^^^^^^^ unsatisfied trait bound | | | required by a bound introduced by this call | +help: the trait `Impossible` is not implemented for `c::Item` + --> $DIR/namespace-mix.rs:16:5 + | +LL | pub struct Item; + | ^^^^^^^^^^^^^^^ help: this trait has no implementations, consider adding one --> $DIR/namespace-mix.rs:20:1 | @@ -809,10 +894,15 @@ error[E0277]: the trait bound `c::E: Impossible` is not satisfied --> $DIR/namespace-mix.rs:144:11 | LL | check(mB::UV); - | ----- ^^^^^^ the trait `Impossible` is not implemented for `c::E` + | ----- ^^^^^^ unsatisfied trait bound | | | required by a bound introduced by this call | +help: the trait `Impossible` is not implemented for `c::E` + --> $DIR/namespace-mix.rs:10:5 + | +LL | pub enum E { + | ^^^^^^^^^^ help: this trait has no implementations, consider adding one --> $DIR/namespace-mix.rs:20:1 | @@ -828,10 +918,15 @@ error[E0277]: the trait bound `c::E: Impossible` is not satisfied --> $DIR/namespace-mix.rs:145:11 | LL | check(mC::UV{}); - | ----- ^^^^^^^^ the trait `Impossible` is not implemented for `c::E` + | ----- ^^^^^^^^ unsatisfied trait bound | | | required by a bound introduced by this call | +help: the trait `Impossible` is not implemented for `c::E` + --> $DIR/namespace-mix.rs:10:5 + | +LL | pub enum E { + | ^^^^^^^^^^ help: this trait has no implementations, consider adding one --> $DIR/namespace-mix.rs:20:1 | @@ -847,10 +942,15 @@ error[E0277]: the trait bound `c::Item: Impossible` is not satisfied --> $DIR/namespace-mix.rs:146:11 | LL | check(mC::UV); - | ----- ^^^^^^ the trait `Impossible` is not implemented for `c::Item` + | ----- ^^^^^^ unsatisfied trait bound | | | required by a bound introduced by this call | +help: the trait `Impossible` is not implemented for `c::Item` + --> $DIR/namespace-mix.rs:16:5 + | +LL | pub struct Item; + | ^^^^^^^^^^^^^^^ help: this trait has no implementations, consider adding one --> $DIR/namespace-mix.rs:20:1 | diff --git a/tests/ui/never_type/defaulted-never-note.nofallback.stderr b/tests/ui/never_type/defaulted-never-note.nofallback.stderr index b7df6fb7a67..b82bea0bc48 100644 --- a/tests/ui/never_type/defaulted-never-note.nofallback.stderr +++ b/tests/ui/never_type/defaulted-never-note.nofallback.stderr @@ -12,7 +12,7 @@ note: in edition 2024, the requirement `!: ImplementedForUnitButNotNever` will f | LL | foo(_x); | ^^ - = note: `#[warn(dependency_on_unit_never_type_fallback)]` on by default + = note: `#[warn(dependency_on_unit_never_type_fallback)]` (part of `#[warn(rust_2024_compatibility)]`) on by default help: use `()` annotations to avoid fallback changes | LL | let _x: () = return; @@ -35,7 +35,7 @@ note: in edition 2024, the requirement `!: ImplementedForUnitButNotNever` will f | LL | foo(_x); | ^^ - = note: `#[warn(dependency_on_unit_never_type_fallback)]` on by default + = note: `#[warn(dependency_on_unit_never_type_fallback)]` (part of `#[warn(rust_2024_compatibility)]`) on by default help: use `()` annotations to avoid fallback changes | LL | let _x: () = return; diff --git a/tests/ui/never_type/dependency-on-fallback-to-unit.stderr b/tests/ui/never_type/dependency-on-fallback-to-unit.stderr index 6ee57d531fb..6394bab8952 100644 --- a/tests/ui/never_type/dependency-on-fallback-to-unit.stderr +++ b/tests/ui/never_type/dependency-on-fallback-to-unit.stderr @@ -12,7 +12,7 @@ note: in edition 2024, the requirement `!: Default` will fail | LL | false => <_>::default(), | ^ - = note: `#[warn(dependency_on_unit_never_type_fallback)]` on by default + = note: `#[warn(dependency_on_unit_never_type_fallback)]` (part of `#[warn(rust_2024_compatibility)]`) on by default help: use `()` annotations to avoid fallback changes | LL - false => <_>::default(), @@ -55,7 +55,7 @@ note: in edition 2024, the requirement `!: Default` will fail | LL | false => <_>::default(), | ^ - = note: `#[warn(dependency_on_unit_never_type_fallback)]` on by default + = note: `#[warn(dependency_on_unit_never_type_fallback)]` (part of `#[warn(rust_2024_compatibility)]`) on by default help: use `()` annotations to avoid fallback changes | LL - false => <_>::default(), @@ -77,7 +77,7 @@ note: in edition 2024, the requirement `!: Default` will fail | LL | deserialize()?; | ^^^^^^^^^^^^^ - = note: `#[warn(dependency_on_unit_never_type_fallback)]` on by default + = note: `#[warn(dependency_on_unit_never_type_fallback)]` (part of `#[warn(rust_2024_compatibility)]`) on by default help: use `()` annotations to avoid fallback changes | LL | deserialize::<()>()?; diff --git a/tests/ui/never_type/diverging-fallback-control-flow.nofallback.stderr b/tests/ui/never_type/diverging-fallback-control-flow.nofallback.stderr index 64a8ecdf546..7f857c83655 100644 --- a/tests/ui/never_type/diverging-fallback-control-flow.nofallback.stderr +++ b/tests/ui/never_type/diverging-fallback-control-flow.nofallback.stderr @@ -12,7 +12,7 @@ note: in edition 2024, the requirement `!: UnitDefault` will fail | LL | x = UnitDefault::default(); | ^^^^^^^^^^^^^^^^^^^^^^ - = note: `#[warn(dependency_on_unit_never_type_fallback)]` on by default + = note: `#[warn(dependency_on_unit_never_type_fallback)]` (part of `#[warn(rust_2024_compatibility)]`) on by default help: use `()` annotations to avoid fallback changes | LL | let x: (); @@ -54,7 +54,7 @@ note: in edition 2024, the requirement `!: UnitDefault` will fail | LL | x = UnitDefault::default(); | ^^^^^^^^^^^^^^^^^^^^^^ - = note: `#[warn(dependency_on_unit_never_type_fallback)]` on by default + = note: `#[warn(dependency_on_unit_never_type_fallback)]` (part of `#[warn(rust_2024_compatibility)]`) on by default help: use `()` annotations to avoid fallback changes | LL | let x: (); @@ -75,7 +75,7 @@ note: in edition 2024, the requirement `!: UnitDefault` will fail | LL | x = UnitDefault::default(); | ^^^^^^^^^^^^^^^^^^^^^^ - = note: `#[warn(dependency_on_unit_never_type_fallback)]` on by default + = note: `#[warn(dependency_on_unit_never_type_fallback)]` (part of `#[warn(rust_2024_compatibility)]`) on by default help: use `()` annotations to avoid fallback changes | LL | let x: (); diff --git a/tests/ui/never_type/diverging-fallback-no-leak.nofallback.stderr b/tests/ui/never_type/diverging-fallback-no-leak.nofallback.stderr index ec48c38b6d7..d4bb5f9442e 100644 --- a/tests/ui/never_type/diverging-fallback-no-leak.nofallback.stderr +++ b/tests/ui/never_type/diverging-fallback-no-leak.nofallback.stderr @@ -12,7 +12,7 @@ note: in edition 2024, the requirement `!: Test` will fail | LL | unconstrained_arg(return); | ^^^^^^ - = note: `#[warn(dependency_on_unit_never_type_fallback)]` on by default + = note: `#[warn(dependency_on_unit_never_type_fallback)]` (part of `#[warn(rust_2024_compatibility)]`) on by default help: use `()` annotations to avoid fallback changes | LL | unconstrained_arg::<()>(return); @@ -35,7 +35,7 @@ note: in edition 2024, the requirement `!: Test` will fail | LL | unconstrained_arg(return); | ^^^^^^ - = note: `#[warn(dependency_on_unit_never_type_fallback)]` on by default + = note: `#[warn(dependency_on_unit_never_type_fallback)]` (part of `#[warn(rust_2024_compatibility)]`) on by default help: use `()` annotations to avoid fallback changes | LL | unconstrained_arg::<()>(return); diff --git a/tests/ui/never_type/diverging-fallback-unconstrained-return.nofallback.stderr b/tests/ui/never_type/diverging-fallback-unconstrained-return.nofallback.stderr index 48debdd61c8..a706ad8b09b 100644 --- a/tests/ui/never_type/diverging-fallback-unconstrained-return.nofallback.stderr +++ b/tests/ui/never_type/diverging-fallback-unconstrained-return.nofallback.stderr @@ -12,7 +12,7 @@ note: in edition 2024, the requirement `!: UnitReturn` will fail | LL | let _ = if true { unconstrained_return() } else { panic!() }; | ^^^^^^^^^^^^^^^^^^^^^^ - = note: `#[warn(dependency_on_unit_never_type_fallback)]` on by default + = note: `#[warn(dependency_on_unit_never_type_fallback)]` (part of `#[warn(rust_2024_compatibility)]`) on by default help: use `()` annotations to avoid fallback changes | LL | let _: () = if true { unconstrained_return() } else { panic!() }; @@ -35,7 +35,7 @@ note: in edition 2024, the requirement `!: UnitReturn` will fail | LL | let _ = if true { unconstrained_return() } else { panic!() }; | ^^^^^^^^^^^^^^^^^^^^^^ - = note: `#[warn(dependency_on_unit_never_type_fallback)]` on by default + = note: `#[warn(dependency_on_unit_never_type_fallback)]` (part of `#[warn(rust_2024_compatibility)]`) on by default help: use `()` annotations to avoid fallback changes | LL | let _: () = if true { unconstrained_return() } else { panic!() }; diff --git a/tests/ui/never_type/fallback-closure-ret.nofallback.stderr b/tests/ui/never_type/fallback-closure-ret.nofallback.stderr index 5651a265888..39b40cdd76d 100644 --- a/tests/ui/never_type/fallback-closure-ret.nofallback.stderr +++ b/tests/ui/never_type/fallback-closure-ret.nofallback.stderr @@ -12,7 +12,7 @@ note: in edition 2024, the requirement `!: Bar` will fail | LL | foo(|| panic!()); | ^^^^^^^^^^^^^^^^ - = note: `#[warn(dependency_on_unit_never_type_fallback)]` on by default + = note: `#[warn(dependency_on_unit_never_type_fallback)]` (part of `#[warn(rust_2024_compatibility)]`) on by default help: use `()` annotations to avoid fallback changes | LL | foo::<()>(|| panic!()); @@ -35,7 +35,7 @@ note: in edition 2024, the requirement `!: Bar` will fail | LL | foo(|| panic!()); | ^^^^^^^^^^^^^^^^ - = note: `#[warn(dependency_on_unit_never_type_fallback)]` on by default + = note: `#[warn(dependency_on_unit_never_type_fallback)]` (part of `#[warn(rust_2024_compatibility)]`) on by default help: use `()` annotations to avoid fallback changes | LL | foo::<()>(|| panic!()); diff --git a/tests/ui/never_type/from_infer_breaking_with_unit_fallback.unit.stderr b/tests/ui/never_type/from_infer_breaking_with_unit_fallback.unit.stderr index 9eacab9a0b7..891b6ea8046 100644 --- a/tests/ui/never_type/from_infer_breaking_with_unit_fallback.unit.stderr +++ b/tests/ui/never_type/from_infer_breaking_with_unit_fallback.unit.stderr @@ -2,7 +2,7 @@ error[E0277]: the trait bound `E: From<()>` is not satisfied --> $DIR/from_infer_breaking_with_unit_fallback.rs:25:6 | LL | <E as From<_>>::from(never); // Should the inference fail? - | ^ the trait `From<()>` is not implemented for `E` + | ^ unsatisfied trait bound | = help: the trait `From<()>` is not implemented for `E` but trait `From<!>` is implemented for it diff --git a/tests/ui/never_type/impl_trait_fallback.stderr b/tests/ui/never_type/impl_trait_fallback.stderr index 36d2eae1df2..7d8624b1fe5 100644 --- a/tests/ui/never_type/impl_trait_fallback.stderr +++ b/tests/ui/never_type/impl_trait_fallback.stderr @@ -12,7 +12,7 @@ note: in edition 2024, the requirement `!: T` will fail | LL | fn should_ret_unit() -> impl T { | ^^^^^^ - = note: `#[warn(dependency_on_unit_never_type_fallback)]` on by default + = note: `#[warn(dependency_on_unit_never_type_fallback)]` (part of `#[warn(rust_2024_compatibility)]`) on by default warning: 1 warning emitted @@ -31,5 +31,5 @@ note: in edition 2024, the requirement `!: T` will fail | LL | fn should_ret_unit() -> impl T { | ^^^^^^ - = note: `#[warn(dependency_on_unit_never_type_fallback)]` on by default + = note: `#[warn(dependency_on_unit_never_type_fallback)]` (part of `#[warn(rust_2024_compatibility)]`) on by default diff --git a/tests/ui/never_type/lint-never-type-fallback-flowing-into-unsafe.e2015.stderr b/tests/ui/never_type/lint-never-type-fallback-flowing-into-unsafe.e2015.stderr index 48734f3b3f8..f9d0a89eabc 100644 --- a/tests/ui/never_type/lint-never-type-fallback-flowing-into-unsafe.e2015.stderr +++ b/tests/ui/never_type/lint-never-type-fallback-flowing-into-unsafe.e2015.stderr @@ -7,7 +7,7 @@ LL | unsafe { mem::zeroed() } = warning: this changes meaning in Rust 2024 and in a future release in all editions! = note: for more information, see <https://doc.rust-lang.org/edition-guide/rust-2024/never-type-fallback.html> = help: specify the type explicitly - = note: `#[warn(never_type_fallback_flowing_into_unsafe)]` on by default + = note: `#[warn(never_type_fallback_flowing_into_unsafe)]` (part of `#[warn(rust_2024_compatibility)]`) on by default help: use `()` annotations to avoid fallback changes | LL | unsafe { mem::zeroed::<()>() } @@ -143,7 +143,7 @@ LL | unsafe { mem::zeroed() } = warning: this changes meaning in Rust 2024 and in a future release in all editions! = note: for more information, see <https://doc.rust-lang.org/edition-guide/rust-2024/never-type-fallback.html> = help: specify the type explicitly - = note: `#[warn(never_type_fallback_flowing_into_unsafe)]` on by default + = note: `#[warn(never_type_fallback_flowing_into_unsafe)]` (part of `#[warn(rust_2024_compatibility)]`) on by default help: use `()` annotations to avoid fallback changes | LL | unsafe { mem::zeroed::<()>() } @@ -159,7 +159,7 @@ LL | core::mem::transmute(Zst) = warning: this changes meaning in Rust 2024 and in a future release in all editions! = note: for more information, see <https://doc.rust-lang.org/edition-guide/rust-2024/never-type-fallback.html> = help: specify the type explicitly - = note: `#[warn(never_type_fallback_flowing_into_unsafe)]` on by default + = note: `#[warn(never_type_fallback_flowing_into_unsafe)]` (part of `#[warn(rust_2024_compatibility)]`) on by default help: use `()` annotations to avoid fallback changes | LL | core::mem::transmute::<_, ()>(Zst) @@ -175,7 +175,7 @@ LL | unsafe { Union { a: () }.b } = warning: this changes meaning in Rust 2024 and in a future release in all editions! = note: for more information, see <https://doc.rust-lang.org/edition-guide/rust-2024/never-type-fallback.html> = help: specify the type explicitly - = note: `#[warn(never_type_fallback_flowing_into_unsafe)]` on by default + = note: `#[warn(never_type_fallback_flowing_into_unsafe)]` (part of `#[warn(rust_2024_compatibility)]`) on by default Future breakage diagnostic: warning: never type fallback affects this raw pointer dereference @@ -187,7 +187,7 @@ LL | unsafe { *ptr::from_ref(&()).cast() } = warning: this changes meaning in Rust 2024 and in a future release in all editions! = note: for more information, see <https://doc.rust-lang.org/edition-guide/rust-2024/never-type-fallback.html> = help: specify the type explicitly - = note: `#[warn(never_type_fallback_flowing_into_unsafe)]` on by default + = note: `#[warn(never_type_fallback_flowing_into_unsafe)]` (part of `#[warn(rust_2024_compatibility)]`) on by default help: use `()` annotations to avoid fallback changes | LL | unsafe { *ptr::from_ref(&()).cast::<()>() } @@ -203,7 +203,7 @@ LL | unsafe { internally_create(x) } = warning: this changes meaning in Rust 2024 and in a future release in all editions! = note: for more information, see <https://doc.rust-lang.org/edition-guide/rust-2024/never-type-fallback.html> = help: specify the type explicitly - = note: `#[warn(never_type_fallback_flowing_into_unsafe)]` on by default + = note: `#[warn(never_type_fallback_flowing_into_unsafe)]` (part of `#[warn(rust_2024_compatibility)]`) on by default help: use `()` annotations to avoid fallback changes | LL | unsafe { internally_create::<()>(x) } @@ -219,7 +219,7 @@ LL | unsafe { zeroed() } = warning: this changes meaning in Rust 2024 and in a future release in all editions! = note: for more information, see <https://doc.rust-lang.org/edition-guide/rust-2024/never-type-fallback.html> = help: specify the type explicitly - = note: `#[warn(never_type_fallback_flowing_into_unsafe)]` on by default + = note: `#[warn(never_type_fallback_flowing_into_unsafe)]` (part of `#[warn(rust_2024_compatibility)]`) on by default help: use `()` annotations to avoid fallback changes | LL | let zeroed = mem::zeroed::<()>; @@ -235,7 +235,7 @@ LL | let zeroed = mem::zeroed; = warning: this changes meaning in Rust 2024 and in a future release in all editions! = note: for more information, see <https://doc.rust-lang.org/edition-guide/rust-2024/never-type-fallback.html> = help: specify the type explicitly - = note: `#[warn(never_type_fallback_flowing_into_unsafe)]` on by default + = note: `#[warn(never_type_fallback_flowing_into_unsafe)]` (part of `#[warn(rust_2024_compatibility)]`) on by default help: use `()` annotations to avoid fallback changes | LL | let zeroed = mem::zeroed::<()>; @@ -251,7 +251,7 @@ LL | let f = internally_create; = warning: this changes meaning in Rust 2024 and in a future release in all editions! = note: for more information, see <https://doc.rust-lang.org/edition-guide/rust-2024/never-type-fallback.html> = help: specify the type explicitly - = note: `#[warn(never_type_fallback_flowing_into_unsafe)]` on by default + = note: `#[warn(never_type_fallback_flowing_into_unsafe)]` (part of `#[warn(rust_2024_compatibility)]`) on by default help: use `()` annotations to avoid fallback changes | LL | let f = internally_create::<()>; @@ -267,7 +267,7 @@ LL | S(marker::PhantomData).create_out_of_thin_air() = warning: this changes meaning in Rust 2024 and in a future release in all editions! = note: for more information, see <https://doc.rust-lang.org/edition-guide/rust-2024/never-type-fallback.html> = help: specify the type explicitly - = note: `#[warn(never_type_fallback_flowing_into_unsafe)]` on by default + = note: `#[warn(never_type_fallback_flowing_into_unsafe)]` (part of `#[warn(rust_2024_compatibility)]`) on by default Future breakage diagnostic: warning: never type fallback affects this call to an `unsafe` function @@ -282,6 +282,6 @@ LL | msg_send!(); = warning: this changes meaning in Rust 2024 and in a future release in all editions! = note: for more information, see <https://doc.rust-lang.org/edition-guide/rust-2024/never-type-fallback.html> = help: specify the type explicitly - = note: `#[warn(never_type_fallback_flowing_into_unsafe)]` on by default + = note: `#[warn(never_type_fallback_flowing_into_unsafe)]` (part of `#[warn(rust_2024_compatibility)]`) on by default = note: this warning originates in the macro `msg_send` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/tests/ui/never_type/lint-never-type-fallback-flowing-into-unsafe.e2024.stderr b/tests/ui/never_type/lint-never-type-fallback-flowing-into-unsafe.e2024.stderr index 8039ef427c1..7205c13cc2a 100644 --- a/tests/ui/never_type/lint-never-type-fallback-flowing-into-unsafe.e2024.stderr +++ b/tests/ui/never_type/lint-never-type-fallback-flowing-into-unsafe.e2024.stderr @@ -7,7 +7,7 @@ LL | unsafe { mem::zeroed() } = warning: this changes meaning in Rust 2024 and in a future release in all editions! = note: for more information, see <https://doc.rust-lang.org/edition-guide/rust-2024/never-type-fallback.html> = help: specify the type explicitly - = note: `#[deny(never_type_fallback_flowing_into_unsafe)]` on by default + = note: `#[deny(never_type_fallback_flowing_into_unsafe)]` (part of `#[deny(rust_2024_compatibility)]`) on by default help: use `()` annotations to avoid fallback changes | LL | unsafe { mem::zeroed::<()>() } @@ -152,7 +152,7 @@ LL | unsafe { mem::zeroed() } = warning: this changes meaning in Rust 2024 and in a future release in all editions! = note: for more information, see <https://doc.rust-lang.org/edition-guide/rust-2024/never-type-fallback.html> = help: specify the type explicitly - = note: `#[deny(never_type_fallback_flowing_into_unsafe)]` on by default + = note: `#[deny(never_type_fallback_flowing_into_unsafe)]` (part of `#[deny(rust_2024_compatibility)]`) on by default help: use `()` annotations to avoid fallback changes | LL | unsafe { mem::zeroed::<()>() } @@ -168,7 +168,7 @@ LL | core::mem::transmute(Zst) = warning: this changes meaning in Rust 2024 and in a future release in all editions! = note: for more information, see <https://doc.rust-lang.org/edition-guide/rust-2024/never-type-fallback.html> = help: specify the type explicitly - = note: `#[deny(never_type_fallback_flowing_into_unsafe)]` on by default + = note: `#[deny(never_type_fallback_flowing_into_unsafe)]` (part of `#[deny(rust_2024_compatibility)]`) on by default help: use `()` annotations to avoid fallback changes | LL | core::mem::transmute::<_, ()>(Zst) @@ -184,7 +184,7 @@ LL | unsafe { Union { a: () }.b } = warning: this changes meaning in Rust 2024 and in a future release in all editions! = note: for more information, see <https://doc.rust-lang.org/edition-guide/rust-2024/never-type-fallback.html> = help: specify the type explicitly - = note: `#[deny(never_type_fallback_flowing_into_unsafe)]` on by default + = note: `#[deny(never_type_fallback_flowing_into_unsafe)]` (part of `#[deny(rust_2024_compatibility)]`) on by default Future breakage diagnostic: error: never type fallback affects this raw pointer dereference @@ -196,7 +196,7 @@ LL | unsafe { *ptr::from_ref(&()).cast() } = warning: this changes meaning in Rust 2024 and in a future release in all editions! = note: for more information, see <https://doc.rust-lang.org/edition-guide/rust-2024/never-type-fallback.html> = help: specify the type explicitly - = note: `#[deny(never_type_fallback_flowing_into_unsafe)]` on by default + = note: `#[deny(never_type_fallback_flowing_into_unsafe)]` (part of `#[deny(rust_2024_compatibility)]`) on by default help: use `()` annotations to avoid fallback changes | LL | unsafe { *ptr::from_ref(&()).cast::<()>() } @@ -212,7 +212,7 @@ LL | unsafe { internally_create(x) } = warning: this changes meaning in Rust 2024 and in a future release in all editions! = note: for more information, see <https://doc.rust-lang.org/edition-guide/rust-2024/never-type-fallback.html> = help: specify the type explicitly - = note: `#[deny(never_type_fallback_flowing_into_unsafe)]` on by default + = note: `#[deny(never_type_fallback_flowing_into_unsafe)]` (part of `#[deny(rust_2024_compatibility)]`) on by default help: use `()` annotations to avoid fallback changes | LL | unsafe { internally_create::<()>(x) } @@ -228,7 +228,7 @@ LL | unsafe { zeroed() } = warning: this changes meaning in Rust 2024 and in a future release in all editions! = note: for more information, see <https://doc.rust-lang.org/edition-guide/rust-2024/never-type-fallback.html> = help: specify the type explicitly - = note: `#[deny(never_type_fallback_flowing_into_unsafe)]` on by default + = note: `#[deny(never_type_fallback_flowing_into_unsafe)]` (part of `#[deny(rust_2024_compatibility)]`) on by default help: use `()` annotations to avoid fallback changes | LL | let zeroed = mem::zeroed::<()>; @@ -244,7 +244,7 @@ LL | let zeroed = mem::zeroed; = warning: this changes meaning in Rust 2024 and in a future release in all editions! = note: for more information, see <https://doc.rust-lang.org/edition-guide/rust-2024/never-type-fallback.html> = help: specify the type explicitly - = note: `#[deny(never_type_fallback_flowing_into_unsafe)]` on by default + = note: `#[deny(never_type_fallback_flowing_into_unsafe)]` (part of `#[deny(rust_2024_compatibility)]`) on by default help: use `()` annotations to avoid fallback changes | LL | let zeroed = mem::zeroed::<()>; @@ -260,7 +260,7 @@ LL | let f = internally_create; = warning: this changes meaning in Rust 2024 and in a future release in all editions! = note: for more information, see <https://doc.rust-lang.org/edition-guide/rust-2024/never-type-fallback.html> = help: specify the type explicitly - = note: `#[deny(never_type_fallback_flowing_into_unsafe)]` on by default + = note: `#[deny(never_type_fallback_flowing_into_unsafe)]` (part of `#[deny(rust_2024_compatibility)]`) on by default help: use `()` annotations to avoid fallback changes | LL | let f = internally_create::<()>; @@ -276,7 +276,7 @@ LL | S(marker::PhantomData).create_out_of_thin_air() = warning: this changes meaning in Rust 2024 and in a future release in all editions! = note: for more information, see <https://doc.rust-lang.org/edition-guide/rust-2024/never-type-fallback.html> = help: specify the type explicitly - = note: `#[deny(never_type_fallback_flowing_into_unsafe)]` on by default + = note: `#[deny(never_type_fallback_flowing_into_unsafe)]` (part of `#[deny(rust_2024_compatibility)]`) on by default Future breakage diagnostic: error: never type fallback affects this call to an `unsafe` function @@ -291,6 +291,6 @@ LL | msg_send!(); = warning: this changes meaning in Rust 2024 and in a future release in all editions! = note: for more information, see <https://doc.rust-lang.org/edition-guide/rust-2024/never-type-fallback.html> = help: specify the type explicitly - = note: `#[deny(never_type_fallback_flowing_into_unsafe)]` on by default + = note: `#[deny(never_type_fallback_flowing_into_unsafe)]` (part of `#[deny(rust_2024_compatibility)]`) on by default = note: this error originates in the macro `msg_send` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/tests/ui/never_type/never-value-fallback-issue-66757.nofallback.stderr b/tests/ui/never_type/never-value-fallback-issue-66757.nofallback.stderr index d6234c8e7e1..cd34cd9e88e 100644 --- a/tests/ui/never_type/never-value-fallback-issue-66757.nofallback.stderr +++ b/tests/ui/never_type/never-value-fallback-issue-66757.nofallback.stderr @@ -2,7 +2,7 @@ error[E0277]: the trait bound `E: From<()>` is not satisfied --> $DIR/never-value-fallback-issue-66757.rs:28:6 | LL | <E as From<_>>::from(never); - | ^ the trait `From<()>` is not implemented for `E` + | ^ unsatisfied trait bound | = help: the trait `From<()>` is not implemented for `E` but trait `From<!>` is implemented for it diff --git a/tests/ui/nll/borrowck-thread-local-static-mut-borrow-outlives-fn.stderr b/tests/ui/nll/borrowck-thread-local-static-mut-borrow-outlives-fn.stderr index 331c6510ce7..63744c15fda 100644 --- a/tests/ui/nll/borrowck-thread-local-static-mut-borrow-outlives-fn.stderr +++ b/tests/ui/nll/borrowck-thread-local-static-mut-borrow-outlives-fn.stderr @@ -6,7 +6,7 @@ LL | S1 { a: unsafe { &mut X1 } } | = note: for more information, see <https://doc.rust-lang.org/edition-guide/rust-2024/static-mut-references.html> = note: mutable references to mutable statics are dangerous; it's undefined behavior if any other pointer to the static is used or if any other reference is created for the static while the mutable reference lives - = note: `#[warn(static_mut_refs)]` on by default + = note: `#[warn(static_mut_refs)]` (part of `#[warn(rust_2024_compatibility)]`) on by default help: use `&raw mut` instead to create a raw pointer | LL | S1 { a: unsafe { &raw mut X1 } } diff --git a/tests/ui/nll/ice-106874.stderr b/tests/ui/nll/ice-106874.stderr index ead4d490a62..0edbd7b44ef 100644 --- a/tests/ui/nll/ice-106874.stderr +++ b/tests/ui/nll/ice-106874.stderr @@ -17,6 +17,15 @@ LL | A(B(C::new(D::new(move |st| f(st))))) = note: ...but it actually implements `FnOnce<(&'1 mut V,)>`, for some specific lifetime `'1` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` +error: implementation of `FnOnce` is not general enough + --> $DIR/ice-106874.rs:8:7 + | +LL | A(B(C::new(D::new(move |st| f(st))))) + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ implementation of `FnOnce` is not general enough + | + = note: closure with signature `fn(&'2 mut V)` must implement `FnOnce<(&'1 mut V,)>`, for any lifetime `'1`... + = note: ...but it actually implements `FnOnce<(&'2 mut V,)>`, for some specific lifetime `'2` + error: implementation of `Fn` is not general enough --> $DIR/ice-106874.rs:8:7 | @@ -34,6 +43,7 @@ LL | A(B(C::new(D::new(move |st| f(st))))) | = note: closure with signature `fn(&'2 mut V)` must implement `FnOnce<(&'1 mut V,)>`, for any lifetime `'1`... = note: ...but it actually implements `FnOnce<(&'2 mut V,)>`, for some specific lifetime `'2` + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error: implementation of `Fn` is not general enough --> $DIR/ice-106874.rs:8:7 @@ -46,45 +56,36 @@ LL | A(B(C::new(D::new(move |st| f(st))))) = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error: implementation of `FnOnce` is not general enough - --> $DIR/ice-106874.rs:8:9 + --> $DIR/ice-106874.rs:8:7 | LL | A(B(C::new(D::new(move |st| f(st))))) - | ^^^^^^ implementation of `FnOnce` is not general enough + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ implementation of `FnOnce` is not general enough | = note: closure with signature `fn(&'2 mut V)` must implement `FnOnce<(&'1 mut V,)>`, for any lifetime `'1`... = note: ...but it actually implements `FnOnce<(&'2 mut V,)>`, for some specific lifetime `'2` + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error: implementation of `Fn` is not general enough - --> $DIR/ice-106874.rs:8:9 + --> $DIR/ice-106874.rs:8:7 | LL | A(B(C::new(D::new(move |st| f(st))))) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ implementation of `Fn` is not general enough + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ implementation of `Fn` is not general enough | = note: closure with signature `fn(&'2 mut V)` must implement `Fn<(&'1 mut V,)>`, for any lifetime `'1`... = note: ...but it actually implements `Fn<(&'2 mut V,)>`, for some specific lifetime `'2` - -error: implementation of `FnOnce` is not general enough - --> $DIR/ice-106874.rs:8:9 - | -LL | A(B(C::new(D::new(move |st| f(st))))) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ implementation of `FnOnce` is not general enough - | - = note: closure with signature `fn(&'2 mut V)` must implement `FnOnce<(&'1 mut V,)>`, for any lifetime `'1`... - = note: ...but it actually implements `FnOnce<(&'2 mut V,)>`, for some specific lifetime `'2` + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error: higher-ranked subtype error - --> $DIR/ice-106874.rs:8:41 + --> $DIR/ice-106874.rs:8:7 | LL | A(B(C::new(D::new(move |st| f(st))))) - | ^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: higher-ranked subtype error --> $DIR/ice-106874.rs:8:41 | LL | A(B(C::new(D::new(move |st| f(st))))) | ^ - | - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error: aborting due to 10 previous errors diff --git a/tests/ui/nll/issue-48623-coroutine.stderr b/tests/ui/nll/issue-48623-coroutine.stderr index 4e4cd28ef2a..2862d7b2a2f 100644 --- a/tests/ui/nll/issue-48623-coroutine.stderr +++ b/tests/ui/nll/issue-48623-coroutine.stderr @@ -5,7 +5,7 @@ LL | #[coroutine] move || { d; yield; &mut *r }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: coroutines are lazy and do nothing unless resumed - = note: `#[warn(unused_must_use)]` on by default + = note: `#[warn(unused_must_use)]` (part of `#[warn(unused)]`) on by default warning: 1 warning emitted diff --git a/tests/ui/nll/local-outlives-static-via-hrtb.stderr b/tests/ui/nll/local-outlives-static-via-hrtb.stderr index a6b3328b5a2..a98f11ce513 100644 --- a/tests/ui/nll/local-outlives-static-via-hrtb.stderr +++ b/tests/ui/nll/local-outlives-static-via-hrtb.stderr @@ -12,11 +12,11 @@ LL | assert_static_via_hrtb_with_assoc_type(&&local); LL | } | - `local` dropped here while still borrowed | -note: due to current limitations in the borrow checker, this implies a `'static` lifetime - --> $DIR/local-outlives-static-via-hrtb.rs:15:53 +note: due to a current limitation of the type system, this implies a `'static` lifetime + --> $DIR/local-outlives-static-via-hrtb.rs:15:42 | LL | fn assert_static_via_hrtb<G>(_: G) where for<'a> G: Outlives<'a> {} - | ^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^ error[E0597]: `local` does not live long enough --> $DIR/local-outlives-static-via-hrtb.rs:25:45 @@ -32,11 +32,11 @@ LL | assert_static_via_hrtb_with_assoc_type(&&local); LL | } | - `local` dropped here while still borrowed | -note: due to current limitations in the borrow checker, this implies a `'static` lifetime - --> $DIR/local-outlives-static-via-hrtb.rs:19:20 +note: due to a current limitation of the type system, this implies a `'static` lifetime + --> $DIR/local-outlives-static-via-hrtb.rs:19:5 | LL | for<'a> &'a T: Reference<AssociatedType = &'a ()>, - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 2 previous errors diff --git a/tests/ui/nll/member-constraints/non-root-universe-existential-1.rs b/tests/ui/nll/member-constraints/non-root-universe-existential-1.rs new file mode 100644 index 00000000000..39dbfebce10 --- /dev/null +++ b/tests/ui/nll/member-constraints/non-root-universe-existential-1.rs @@ -0,0 +1,29 @@ +//@ check-pass +//@ revisions: current next +//@ ignore-compare-mode-next-solver (explicit revisions) +//@[next] compile-flags: -Znext-solver + +trait Proj<'a> { + type Assoc; +} + +impl<'a, 'b, F: FnOnce() -> &'b ()> Proj<'a> for F { + type Assoc = (); +} + +fn is_proj<F: for<'a> Proj<'a>>(f: F) {} + +fn define<'a>() -> impl Sized + use<'a> { + // This defines the RPIT to `&'unconstrained_b ()`, an inference + // variable which is in a higher universe as gets created inside + // of the binder of `F: for<'a> Proj<'a>`. This previously caused + // us to not apply member constraints. + // + // This was unnecessary. It is totally acceptable for member regions + // to be able to name placeholders from higher universes, as long as + // they don't actually do so. + is_proj(define::<'a>); + &() +} + +fn main() {} diff --git a/tests/ui/nll/member-constraints/non-root-universe-existential-2.rs b/tests/ui/nll/member-constraints/non-root-universe-existential-2.rs new file mode 100644 index 00000000000..c5ddde0d7d8 --- /dev/null +++ b/tests/ui/nll/member-constraints/non-root-universe-existential-2.rs @@ -0,0 +1,31 @@ +//@ check-pass + +// Unlike `non-root-universe-existential-1.rs` this previously +// compiled as it simply didn't define the hidden type of +// `impl Iterator` when projecting through it. We will do so +// with the new solver. Further minimizing this is challenging. + +struct Type(Vec<Type>); +enum TypeTreeValueIter<'a, T> { + Once(T), + Ref(&'a ()), +} + +impl<'a, T> Iterator for TypeTreeValueIter<'a, T> { + type Item = T; + + fn next(&mut self) -> Option<Self::Item> { + loop {} + } +} + +fn item<I: Iterator<Item: Iterator>>(x: I) -> <I::Item as Iterator>::Item { + loop {} +} + +fn get_type_tree_values<'a>(ty: &'a Type) -> impl Iterator<Item = &'a Type> { + let _: &'a Type = item(std::iter::once(ty).map(get_type_tree_values)); + TypeTreeValueIter::<'a, &'a Type>::Once(ty) +} + +fn main() {} diff --git a/tests/ui/nll/missing-universe-cause-issue-114907.stderr b/tests/ui/nll/missing-universe-cause-issue-114907.stderr index 26ad1efec05..c2e91edd138 100644 --- a/tests/ui/nll/missing-universe-cause-issue-114907.stderr +++ b/tests/ui/nll/missing-universe-cause-issue-114907.stderr @@ -38,18 +38,16 @@ LL | accept(callback); = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error: higher-ranked subtype error - --> $DIR/missing-universe-cause-issue-114907.rs:33:21 + --> $DIR/missing-universe-cause-issue-114907.rs:33:5 | LL | accept(callback); - | ^ + | ^^^^^^^^^^^^^^^^ error: higher-ranked subtype error --> $DIR/missing-universe-cause-issue-114907.rs:33:21 | LL | accept(callback); | ^ - | - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error: aborting due to 6 previous errors diff --git a/tests/ui/nll/polonius/location-insensitive-scopes-issue-117146.nll.stderr b/tests/ui/nll/polonius/location-insensitive-scopes-issue-117146.nll.stderr index 1d086c658df..6e47b8e59f5 100644 --- a/tests/ui/nll/polonius/location-insensitive-scopes-issue-117146.nll.stderr +++ b/tests/ui/nll/polonius/location-insensitive-scopes-issue-117146.nll.stderr @@ -13,11 +13,11 @@ LL | let b = |_| &a; LL | } | - `a` dropped here while still borrowed | -note: due to current limitations in the borrow checker, this implies a `'static` lifetime - --> $DIR/location-insensitive-scopes-issue-117146.rs:20:22 +note: due to a current limitation of the type system, this implies a `'static` lifetime + --> $DIR/location-insensitive-scopes-issue-117146.rs:20:11 | LL | fn bad<F: Fn(&()) -> &()>(_: F) {} - | ^^^ + | ^^^^^^^^^^^^^^ error: implementation of `Fn` is not general enough --> $DIR/location-insensitive-scopes-issue-117146.rs:13:5 diff --git a/tests/ui/nll/polonius/location-insensitive-scopes-issue-117146.polonius.stderr b/tests/ui/nll/polonius/location-insensitive-scopes-issue-117146.polonius.stderr index 1d086c658df..6e47b8e59f5 100644 --- a/tests/ui/nll/polonius/location-insensitive-scopes-issue-117146.polonius.stderr +++ b/tests/ui/nll/polonius/location-insensitive-scopes-issue-117146.polonius.stderr @@ -13,11 +13,11 @@ LL | let b = |_| &a; LL | } | - `a` dropped here while still borrowed | -note: due to current limitations in the borrow checker, this implies a `'static` lifetime - --> $DIR/location-insensitive-scopes-issue-117146.rs:20:22 +note: due to a current limitation of the type system, this implies a `'static` lifetime + --> $DIR/location-insensitive-scopes-issue-117146.rs:20:11 | LL | fn bad<F: Fn(&()) -> &()>(_: F) {} - | ^^^ + | ^^^^^^^^^^^^^^ error: implementation of `Fn` is not general enough --> $DIR/location-insensitive-scopes-issue-117146.rs:13:5 diff --git a/tests/ui/nll/type-test-universe.stderr b/tests/ui/nll/type-test-universe.stderr index 31e17d64b8c..54b48c1597b 100644 --- a/tests/ui/nll/type-test-universe.stderr +++ b/tests/ui/nll/type-test-universe.stderr @@ -12,11 +12,11 @@ LL | fn test2<'a>() { LL | outlives_forall::<Value<'a>>(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ requires that `'a` must outlive `'static` | -note: due to current limitations in the borrow checker, this implies a `'static` lifetime - --> $DIR/type-test-universe.rs:6:16 +note: due to a current limitation of the type system, this implies a `'static` lifetime + --> $DIR/type-test-universe.rs:6:5 | LL | for<'u> T: 'u, - | ^^ + | ^^^^^^^^^^^^^ error: aborting due to 2 previous errors diff --git a/tests/ui/issues/issue-6130.rs b/tests/ui/numeric/type-limit-comparisons-6130.rs index c675a8a41dd..54b3f631e67 100644 --- a/tests/ui/issues/issue-6130.rs +++ b/tests/ui/numeric/type-limit-comparisons-6130.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/6130 //@ run-pass pub fn main() { diff --git a/tests/ui/on-unimplemented/no-debug.stderr b/tests/ui/on-unimplemented/no-debug.stderr index 5b0b060d40e..1e6fa7d52fa 100644 --- a/tests/ui/on-unimplemented/no-debug.stderr +++ b/tests/ui/on-unimplemented/no-debug.stderr @@ -34,7 +34,11 @@ LL | println!("{} {}", Foo, Bar); | | | required by this formatting parameter | - = help: the trait `std::fmt::Display` is not implemented for `Foo` +help: the trait `std::fmt::Display` is not implemented for `Foo` + --> $DIR/no-debug.rs:7:1 + | +LL | struct Foo; + | ^^^^^^^^^^ = note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead = note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/tests/ui/on-unimplemented/parent-label.stderr b/tests/ui/on-unimplemented/parent-label.stderr index 101a41512d2..1160b24e325 100644 --- a/tests/ui/on-unimplemented/parent-label.stderr +++ b/tests/ui/on-unimplemented/parent-label.stderr @@ -4,10 +4,15 @@ error[E0277]: the trait bound `Foo: Trait` is not satisfied LL | let x = || { | -- in this scope LL | f(Foo {}); - | - ^^^^^^ the trait `Trait` is not implemented for `Foo` + | - ^^^^^^ unsatisfied trait bound | | | required by a bound introduced by this call | +help: the trait `Trait` is not implemented for `Foo` + --> $DIR/parent-label.rs:8:1 + | +LL | struct Foo; + | ^^^^^^^^^^ help: this trait has no implementations, consider adding one --> $DIR/parent-label.rs:6:1 | @@ -25,10 +30,15 @@ error[E0277]: the trait bound `Foo: Trait` is not satisfied LL | let y = || { | -- in this scope LL | f(Foo {}); - | - ^^^^^^ the trait `Trait` is not implemented for `Foo` + | - ^^^^^^ unsatisfied trait bound | | | required by a bound introduced by this call | +help: the trait `Trait` is not implemented for `Foo` + --> $DIR/parent-label.rs:8:1 + | +LL | struct Foo; + | ^^^^^^^^^^ help: this trait has no implementations, consider adding one --> $DIR/parent-label.rs:6:1 | @@ -47,10 +57,15 @@ LL | fn main() { | --------- in this scope ... LL | f(Foo {}); - | - ^^^^^^ the trait `Trait` is not implemented for `Foo` + | - ^^^^^^ unsatisfied trait bound | | | required by a bound introduced by this call | +help: the trait `Trait` is not implemented for `Foo` + --> $DIR/parent-label.rs:8:1 + | +LL | struct Foo; + | ^^^^^^^^^^ help: this trait has no implementations, consider adding one --> $DIR/parent-label.rs:6:1 | @@ -69,10 +84,15 @@ LL | fn main() { | --------- in this scope ... LL | f(Foo {}); - | - ^^^^^^ the trait `Trait` is not implemented for `Foo` + | - ^^^^^^ unsatisfied trait bound | | | required by a bound introduced by this call | +help: the trait `Trait` is not implemented for `Foo` + --> $DIR/parent-label.rs:8:1 + | +LL | struct Foo; + | ^^^^^^^^^^ help: this trait has no implementations, consider adding one --> $DIR/parent-label.rs:6:1 | diff --git a/tests/ui/on-unimplemented/suggest_tuple_wrap_root_obligation.rs b/tests/ui/on-unimplemented/suggest_tuple_wrap_root_obligation.rs index e0036d30187..0c195a58d57 100644 --- a/tests/ui/on-unimplemented/suggest_tuple_wrap_root_obligation.rs +++ b/tests/ui/on-unimplemented/suggest_tuple_wrap_root_obligation.rs @@ -1,4 +1,4 @@ -struct Tuple; +struct Tuple; //~ HELP the trait `From<u8>` is not implemented for `Tuple` impl From<(u8,)> for Tuple { fn from(_: (u8,)) -> Self { diff --git a/tests/ui/on-unimplemented/suggest_tuple_wrap_root_obligation.stderr b/tests/ui/on-unimplemented/suggest_tuple_wrap_root_obligation.stderr index 6ee08d2cd1b..c4156e1f128 100644 --- a/tests/ui/on-unimplemented/suggest_tuple_wrap_root_obligation.stderr +++ b/tests/ui/on-unimplemented/suggest_tuple_wrap_root_obligation.stderr @@ -2,10 +2,15 @@ error[E0277]: the trait bound `Tuple: From<u8>` is not satisfied --> $DIR/suggest_tuple_wrap_root_obligation.rs:22:24 | LL | convert_into_tuple(42_u8); - | ------------------ ^^^^^ the trait `From<u8>` is not implemented for `Tuple` + | ------------------ ^^^^^ unsatisfied trait bound | | | required by a bound introduced by this call | +help: the trait `From<u8>` is not implemented for `Tuple` + --> $DIR/suggest_tuple_wrap_root_obligation.rs:1:1 + | +LL | struct Tuple; + | ^^^^^^^^^^^^ = help: the following other types implement trait `From<T>`: `Tuple` implements `From<(u8, u8)>` `Tuple` implements `From<(u8, u8, u8)>` diff --git a/tests/ui/or-patterns/exhaustiveness-non-exhaustive.rs b/tests/ui/or-patterns/exhaustiveness-non-exhaustive.rs index 5999e04e0e2..9c0b2648384 100644 --- a/tests/ui/or-patterns/exhaustiveness-non-exhaustive.rs +++ b/tests/ui/or-patterns/exhaustiveness-non-exhaustive.rs @@ -7,11 +7,11 @@ fn main() { (0 | 1, 2 | 3) => {} } match ((0u8,),) { - //~^ ERROR non-exhaustive patterns: `((4_u8..=u8::MAX))` + //~^ ERROR non-exhaustive patterns: `((4_u8..=u8::MAX,),)` ((0 | 1,) | (2 | 3,),) => {} } match (Some(0u8),) { - //~^ ERROR non-exhaustive patterns: `(Some(2_u8..=u8::MAX))` + //~^ ERROR non-exhaustive patterns: `(Some(2_u8..=u8::MAX),)` (None | Some(0 | 1),) => {} } } diff --git a/tests/ui/or-patterns/exhaustiveness-non-exhaustive.stderr b/tests/ui/or-patterns/exhaustiveness-non-exhaustive.stderr index 9f691aea8a7..fe3a4aa2afc 100644 --- a/tests/ui/or-patterns/exhaustiveness-non-exhaustive.stderr +++ b/tests/ui/or-patterns/exhaustiveness-non-exhaustive.stderr @@ -11,30 +11,30 @@ LL ~ (0 | 1, 2 | 3) => {}, LL + (2_u8..=u8::MAX, _) => todo!() | -error[E0004]: non-exhaustive patterns: `((4_u8..=u8::MAX))` not covered +error[E0004]: non-exhaustive patterns: `((4_u8..=u8::MAX,),)` not covered --> $DIR/exhaustiveness-non-exhaustive.rs:9:11 | LL | match ((0u8,),) { - | ^^^^^^^^^ pattern `((4_u8..=u8::MAX))` not covered + | ^^^^^^^^^ pattern `((4_u8..=u8::MAX,),)` not covered | = note: the matched value is of type `((u8,),)` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ ((0 | 1,) | (2 | 3,),) => {}, -LL + ((4_u8..=u8::MAX)) => todo!() +LL + ((4_u8..=u8::MAX,),) => todo!() | -error[E0004]: non-exhaustive patterns: `(Some(2_u8..=u8::MAX))` not covered +error[E0004]: non-exhaustive patterns: `(Some(2_u8..=u8::MAX),)` not covered --> $DIR/exhaustiveness-non-exhaustive.rs:13:11 | LL | match (Some(0u8),) { - | ^^^^^^^^^^^^ pattern `(Some(2_u8..=u8::MAX))` not covered + | ^^^^^^^^^^^^ pattern `(Some(2_u8..=u8::MAX),)` not covered | = note: the matched value is of type `(Option<u8>,)` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ (None | Some(0 | 1),) => {}, -LL + (Some(2_u8..=u8::MAX)) => todo!() +LL + (Some(2_u8..=u8::MAX),) => todo!() | error: aborting due to 3 previous errors diff --git a/tests/ui/overloaded/issue-14958.stderr b/tests/ui/overloaded/issue-14958.stderr index e4f527319e7..d07dba78dc3 100644 --- a/tests/ui/overloaded/issue-14958.stderr +++ b/tests/ui/overloaded/issue-14958.stderr @@ -6,7 +6,7 @@ LL | trait Foo { fn dummy(&self) { }} | | | method in this trait | - = note: `#[warn(dead_code)]` on by default + = note: `#[warn(dead_code)]` (part of `#[warn(unused)]`) on by default warning: 1 warning emitted diff --git a/tests/ui/overloaded/overloaded-index-in-field.stderr b/tests/ui/overloaded/overloaded-index-in-field.stderr index 10c0a3faeb5..5ff15ba0bcb 100644 --- a/tests/ui/overloaded/overloaded-index-in-field.stderr +++ b/tests/ui/overloaded/overloaded-index-in-field.stderr @@ -9,7 +9,7 @@ LL | fn get_from_ref(&self) -> isize; LL | fn inc(&mut self); | ^^^ | - = note: `#[warn(dead_code)]` on by default + = note: `#[warn(dead_code)]` (part of `#[warn(unused)]`) on by default warning: 1 warning emitted diff --git a/tests/ui/panics/issue-47429-short-backtraces.rs b/tests/ui/panics/issue-47429-short-backtraces.rs index 378ade67bfd..21428d876e2 100644 --- a/tests/ui/panics/issue-47429-short-backtraces.rs +++ b/tests/ui/panics/issue-47429-short-backtraces.rs @@ -6,6 +6,9 @@ //@ check-run-results //@ exec-env:RUST_BACKTRACE=1 +// FIXME(#61117): Respect debuginfo-level-tests, do not force debuginfo-level=0 +//@ compile-flags: -Cdebuginfo=0 + // This is needed to avoid test output differences across std being built with v0 symbols vs legacy // symbols. //@ normalize-stderr: "begin_panic::<&str>" -> "begin_panic" diff --git a/tests/ui/panics/issue-47429-short-backtraces.run.stderr b/tests/ui/panics/issue-47429-short-backtraces.run.stderr index 13b59a7c7af..32aa6a3502e 100644 --- a/tests/ui/panics/issue-47429-short-backtraces.run.stderr +++ b/tests/ui/panics/issue-47429-short-backtraces.run.stderr @@ -1,5 +1,5 @@ -thread 'main' ($TID) panicked at $DIR/issue-47429-short-backtraces.rs:24:5: +thread 'main' ($TID) panicked at $DIR/issue-47429-short-backtraces.rs:27:5: explicit panic stack backtrace: 0: std::panicking::begin_panic diff --git a/tests/ui/panics/runtime-switch.rs b/tests/ui/panics/runtime-switch.rs index 7d5b4169340..61c07a97c70 100644 --- a/tests/ui/panics/runtime-switch.rs +++ b/tests/ui/panics/runtime-switch.rs @@ -6,6 +6,9 @@ //@ check-run-results //@ exec-env:RUST_BACKTRACE=0 +// FIXME(#61117): Respect debuginfo-level-tests, do not force debuginfo-level=0 +//@ compile-flags: -Cdebuginfo=0 + // This is needed to avoid test output differences across std being built with v0 symbols vs legacy // symbols. //@ normalize-stderr: "begin_panic::<&str>" -> "begin_panic" diff --git a/tests/ui/panics/runtime-switch.run.stderr b/tests/ui/panics/runtime-switch.run.stderr index f3f60445952..48a12b59b69 100644 --- a/tests/ui/panics/runtime-switch.run.stderr +++ b/tests/ui/panics/runtime-switch.run.stderr @@ -1,5 +1,5 @@ -thread 'main' ($TID) panicked at $DIR/runtime-switch.rs:28:5: +thread 'main' ($TID) panicked at $DIR/runtime-switch.rs:31:5: explicit panic stack backtrace: 0: std::panicking::begin_panic diff --git a/tests/ui/parallel-rustc/cache-after-waiting-issue-111528.rs b/tests/ui/parallel-rustc/cache-after-waiting-issue-111528.rs index 73d173022f6..a357040a4e4 100644 --- a/tests/ui/parallel-rustc/cache-after-waiting-issue-111528.rs +++ b/tests/ui/parallel-rustc/cache-after-waiting-issue-111528.rs @@ -1,16 +1,18 @@ +// Test for #111528, the ice issue cause waiting on a query that panicked +// //@ compile-flags: -Z threads=16 //@ build-fail +//@ compare-output-by-lines -#![crate_type="rlib"] +#![crate_type = "rlib"] #![allow(warnings)] -#[export_name="fail"] -pub fn a() { -} +#[export_name = "fail"] +pub fn a() {} -#[export_name="fail"] +#[export_name = "fail"] pub fn b() { -//~^ ERROR symbol `fail` is already defined + //~^ ERROR symbol `fail` is already defined } fn main() {} diff --git a/tests/ui/parallel-rustc/cache-after-waiting-issue-111528.stderr b/tests/ui/parallel-rustc/cache-after-waiting-issue-111528.stderr index 7963165e31b..80f63733fb3 100644 --- a/tests/ui/parallel-rustc/cache-after-waiting-issue-111528.stderr +++ b/tests/ui/parallel-rustc/cache-after-waiting-issue-111528.stderr @@ -1,5 +1,5 @@ error: symbol `fail` is already defined - --> $DIR/cache-after-waiting-issue-111528.rs:12:1 + --> $DIR/cache-after-waiting-issue-111528.rs:14:1 | LL | pub fn b() { | ^^^^^^^^^^ diff --git a/tests/ui/parallel-rustc/cycle_crash-issue-135870.rs b/tests/ui/parallel-rustc/cycle_crash-issue-135870.rs new file mode 100644 index 00000000000..4407e3aca80 --- /dev/null +++ b/tests/ui/parallel-rustc/cycle_crash-issue-135870.rs @@ -0,0 +1,8 @@ +// Test for #135870, which causes a deadlock bug +// +//@ compile-flags: -Z threads=2 +//@ compare-output-by-lines + +const FOO: usize = FOO; //~ ERROR cycle detected when simplifying constant for the type system `FOO` + +fn main() {} diff --git a/tests/ui/parallel-rustc/cycle_crash.stderr b/tests/ui/parallel-rustc/cycle_crash-issue-135870.stderr index 7af3b8ee532..6e588d1f894 100644 --- a/tests/ui/parallel-rustc/cycle_crash.stderr +++ b/tests/ui/parallel-rustc/cycle_crash-issue-135870.stderr @@ -1,11 +1,11 @@ error[E0391]: cycle detected when simplifying constant for the type system `FOO` - --> $DIR/cycle_crash.rs:3:1 + --> $DIR/cycle_crash-issue-135870.rs:6:1 | LL | const FOO: usize = FOO; | ^^^^^^^^^^^^^^^^ | note: ...which requires const-evaluating + checking `FOO`... - --> $DIR/cycle_crash.rs:3:20 + --> $DIR/cycle_crash-issue-135870.rs:6:20 | LL | const FOO: usize = FOO; | ^^^ diff --git a/tests/ui/parallel-rustc/cycle_crash.rs b/tests/ui/parallel-rustc/cycle_crash.rs deleted file mode 100644 index 94ae11aef39..00000000000 --- a/tests/ui/parallel-rustc/cycle_crash.rs +++ /dev/null @@ -1,5 +0,0 @@ -//@ compile-flags: -Z threads=2 - -const FOO: usize = FOO; //~ERROR cycle detected when simplifying constant for the type system `FOO` - -fn main() {} diff --git a/tests/ui/parallel-rustc/export-symbols-deadlock-issue-118205-2.rs b/tests/ui/parallel-rustc/export-symbols-deadlock-issue-118205-2.rs index 024df728736..523b1b2d1f3 100644 --- a/tests/ui/parallel-rustc/export-symbols-deadlock-issue-118205-2.rs +++ b/tests/ui/parallel-rustc/export-symbols-deadlock-issue-118205-2.rs @@ -1,6 +1,10 @@ +// Test for #118205, which causes a deadlock bug +// //@ compile-flags:-C extra-filename=-1 -Z threads=16 //@ no-prefer-dynamic //@ build-pass +//@ compare-output-by-lines + #![crate_name = "crateresolve1"] #![crate_type = "lib"] diff --git a/tests/ui/parallel-rustc/export-symbols-deadlock-issue-118205.rs b/tests/ui/parallel-rustc/export-symbols-deadlock-issue-118205.rs index 3ccc1ea5f10..65f99c30643 100644 --- a/tests/ui/parallel-rustc/export-symbols-deadlock-issue-118205.rs +++ b/tests/ui/parallel-rustc/export-symbols-deadlock-issue-118205.rs @@ -1,5 +1,8 @@ +// Test for #118205, which causes a deadlock bug +// //@ compile-flags: -Z threads=16 //@ build-pass +//@ compare-output-by-lines pub static GLOBAL: isize = 3; diff --git a/tests/ui/parallel-rustc/hello_world.rs b/tests/ui/parallel-rustc/hello_world.rs index 56698fe2489..57891b92da0 100644 --- a/tests/ui/parallel-rustc/hello_world.rs +++ b/tests/ui/parallel-rustc/hello_world.rs @@ -1,5 +1,8 @@ +// Test for the basic function of parallel front end +// //@ compile-flags: -Z threads=8 //@ run-pass +//@ compare-output-by-lines fn main() { println!("Hello world!"); diff --git a/tests/ui/parallel-rustc/read-stolen-value-issue-111520.rs b/tests/ui/parallel-rustc/read-stolen-value-issue-111520.rs index ea8ecb67859..a6b37e62913 100644 --- a/tests/ui/parallel-rustc/read-stolen-value-issue-111520.rs +++ b/tests/ui/parallel-rustc/read-stolen-value-issue-111520.rs @@ -1,18 +1,21 @@ +// Test for #111520, which causes an ice bug cause of reading stolen value +// //@ compile-flags: -Z threads=16 //@ run-pass +//@ compare-output-by-lines #[repr(transparent)] struct Sched { i: i32, } impl Sched { - extern "C" fn get(self) -> i32 { self.i } + extern "C" fn get(self) -> i32 { + self.i + } } fn main() { let s = Sched { i: 4 }; - let f = || -> i32 { - s.get() - }; + let f = || -> i32 { s.get() }; println!("f: {}", f()); } diff --git a/tests/ui/parallel-rustc/ty-variance-issue-124423.rs b/tests/ui/parallel-rustc/ty-variance-issue-124423.rs new file mode 100644 index 00000000000..8d7f29f7764 --- /dev/null +++ b/tests/ui/parallel-rustc/ty-variance-issue-124423.rs @@ -0,0 +1,58 @@ +// Test for #124423, which causes an ice bug: only `variances_of` returns `&[ty::Variance]` +// +//@ compile-flags: -Z threads=16 +//@ compare-output-by-lines + +use std::fmt::Debug; + +fn elided(_: &impl Copy + 'a) -> _ { x } +//~^ ERROR ambiguous `+` in a type +//~| ERROR use of undeclared lifetime name `'a` +//~| ERROR the placeholder `_` is not allowed within types on item signatures for return types + +fn explicit<'b>(_: &'a impl Copy + 'a) -> impl 'a { x } +//~^ ERROR ambiguous `+` in a type +//~| ERROR at least one trait must be specified +//~| ERROR use of undeclared lifetime name `'a` +//~| ERROR use of undeclared lifetime name `'a` +//~| ERROR use of undeclared lifetime name `'a` + +fn elided2( impl 'b) -> impl 'a + 'a { x } +//~^ ERROR expected one of `:` or `|`, found `'b` +//~| ERROR expected identifier, found keyword `impl` +//~| ERROR at least one trait must be specified +//~| ERROR use of undeclared lifetime name `'a` +//~| ERROR use of undeclared lifetime name `'a` + +fn explicit2<'a>(_: &'a impl Copy + 'a) -> impl Copy + 'a { x } +//~^ ERROR ambiguous `+` in a type + +fn foo<'a>(_: &impl Copy + 'a) -> impl 'b + 'a { x } +//~^ ERROR ambiguous `+` in a type +//~| ERROR at least one trait must be specified +//~| ERROR use of undeclared lifetime name `'b` + +fn elided3(_: &impl Copy + 'a) -> Box<dyn 'a> { Box::new(x) } +//~^ ERROR ambiguous `+` in a type +//~| ERROR use of undeclared lifetime name `'a` +//~| ERROR use of undeclared lifetime name `'a` +//~| ERROR at least one trait is required for an object type + +fn x<'b>(_: &'a impl Copy + 'a) -> Box<dyn 'b> { Box::u32(x) } +//~^ ERROR ambiguous `+` in a type +//~| ERROR use of undeclared lifetime name `'a` +//~| ERROR use of undeclared lifetime name `'a` +//~| ERROR at least one trait is required for an object type +//~| ERROR no function or associated item named `u32` found for struct `Box<_, _>` in the current scope + +fn elided4(_: &impl Copy + 'a) -> new { x(x) } +//~^ ERROR ambiguous `+` in a type +//~| ERROR use of undeclared lifetime name `'a` +//~| ERROR cannot find type `new` in this scope + +trait LifetimeTrait<'a> {} + +impl<'a> LifetimeTrait<'a> for &'a Box<dyn 'a> {} +//~^ ERROR at least one trait is required for an object type + +fn main() {} diff --git a/tests/ui/parallel-rustc/ty-variance-issue-124423.stderr b/tests/ui/parallel-rustc/ty-variance-issue-124423.stderr new file mode 100644 index 00000000000..7ba89f75bd1 --- /dev/null +++ b/tests/ui/parallel-rustc/ty-variance-issue-124423.stderr @@ -0,0 +1,287 @@ +error: ambiguous `+` in a type + --> $DIR/ty-variance-issue-124423.rs:8:15 + | +LL | fn elided(_: &impl Copy + 'a) -> _ { x } + | ^^^^^^^^^^^^^^ + | +help: try adding parentheses + | +LL | fn elided(_: &(impl Copy + 'a)) -> _ { x } + | + + + +error: ambiguous `+` in a type + --> $DIR/ty-variance-issue-124423.rs:13:24 + | +LL | fn explicit<'b>(_: &'a impl Copy + 'a) -> impl 'a { x } + | ^^^^^^^^^^^^^^ + | +help: try adding parentheses + | +LL | fn explicit<'b>(_: &'a (impl Copy + 'a)) -> impl 'a { x } + | + + + +error: expected identifier, found keyword `impl` + --> $DIR/ty-variance-issue-124423.rs:20:13 + | +LL | fn elided2( impl 'b) -> impl 'a + 'a { x } + | ^^^^ expected identifier, found keyword + +error: expected one of `:` or `|`, found `'b` + --> $DIR/ty-variance-issue-124423.rs:20:18 + | +LL | fn elided2( impl 'b) -> impl 'a + 'a { x } + | ^^ expected one of `:` or `|` + +error: ambiguous `+` in a type + --> $DIR/ty-variance-issue-124423.rs:27:25 + | +LL | fn explicit2<'a>(_: &'a impl Copy + 'a) -> impl Copy + 'a { x } + | ^^^^^^^^^^^^^^ + | +help: try adding parentheses + | +LL | fn explicit2<'a>(_: &'a (impl Copy + 'a)) -> impl Copy + 'a { x } + | + + + +error: ambiguous `+` in a type + --> $DIR/ty-variance-issue-124423.rs:30:16 + | +LL | fn foo<'a>(_: &impl Copy + 'a) -> impl 'b + 'a { x } + | ^^^^^^^^^^^^^^ + | +help: try adding parentheses + | +LL | fn foo<'a>(_: &(impl Copy + 'a)) -> impl 'b + 'a { x } + | + + + +error: ambiguous `+` in a type + --> $DIR/ty-variance-issue-124423.rs:35:16 + | +LL | fn elided3(_: &impl Copy + 'a) -> Box<dyn 'a> { Box::new(x) } + | ^^^^^^^^^^^^^^ + | +help: try adding parentheses + | +LL | fn elided3(_: &(impl Copy + 'a)) -> Box<dyn 'a> { Box::new(x) } + | + + + +error: ambiguous `+` in a type + --> $DIR/ty-variance-issue-124423.rs:41:17 + | +LL | fn x<'b>(_: &'a impl Copy + 'a) -> Box<dyn 'b> { Box::u32(x) } + | ^^^^^^^^^^^^^^ + | +help: try adding parentheses + | +LL | fn x<'b>(_: &'a (impl Copy + 'a)) -> Box<dyn 'b> { Box::u32(x) } + | + + + +error: ambiguous `+` in a type + --> $DIR/ty-variance-issue-124423.rs:48:16 + | +LL | fn elided4(_: &impl Copy + 'a) -> new { x(x) } + | ^^^^^^^^^^^^^^ + | +help: try adding parentheses + | +LL | fn elided4(_: &(impl Copy + 'a)) -> new { x(x) } + | + + + +error: at least one trait must be specified + --> $DIR/ty-variance-issue-124423.rs:13:43 + | +LL | fn explicit<'b>(_: &'a impl Copy + 'a) -> impl 'a { x } + | ^^^^^^^ + +error: at least one trait must be specified + --> $DIR/ty-variance-issue-124423.rs:20:25 + | +LL | fn elided2( impl 'b) -> impl 'a + 'a { x } + | ^^^^^^^^^^^^ + +error: at least one trait must be specified + --> $DIR/ty-variance-issue-124423.rs:30:35 + | +LL | fn foo<'a>(_: &impl Copy + 'a) -> impl 'b + 'a { x } + | ^^^^^^^^^^^^ + +error[E0261]: use of undeclared lifetime name `'a` + --> $DIR/ty-variance-issue-124423.rs:8:27 + | +LL | fn elided(_: &impl Copy + 'a) -> _ { x } + | ^^ undeclared lifetime + | +help: consider introducing lifetime `'a` here + | +LL | fn elided<'a>(_: &impl Copy + 'a) -> _ { x } + | ++++ + +error[E0261]: use of undeclared lifetime name `'a` + --> $DIR/ty-variance-issue-124423.rs:13:21 + | +LL | fn explicit<'b>(_: &'a impl Copy + 'a) -> impl 'a { x } + | ^^ undeclared lifetime + | +help: consider introducing lifetime `'a` here + | +LL | fn explicit<'a, 'b>(_: &'a impl Copy + 'a) -> impl 'a { x } + | +++ + +error[E0261]: use of undeclared lifetime name `'a` + --> $DIR/ty-variance-issue-124423.rs:13:36 + | +LL | fn explicit<'b>(_: &'a impl Copy + 'a) -> impl 'a { x } + | ^^ undeclared lifetime + | +help: consider introducing lifetime `'a` here + | +LL | fn explicit<'a, 'b>(_: &'a impl Copy + 'a) -> impl 'a { x } + | +++ + +error[E0261]: use of undeclared lifetime name `'a` + --> $DIR/ty-variance-issue-124423.rs:13:48 + | +LL | fn explicit<'b>(_: &'a impl Copy + 'a) -> impl 'a { x } + | ^^ undeclared lifetime + | +help: consider introducing lifetime `'a` here + | +LL | fn explicit<'a, 'b>(_: &'a impl Copy + 'a) -> impl 'a { x } + | +++ + +error[E0261]: use of undeclared lifetime name `'a` + --> $DIR/ty-variance-issue-124423.rs:20:30 + | +LL | fn elided2( impl 'b) -> impl 'a + 'a { x } + | ^^ undeclared lifetime + | +help: consider introducing lifetime `'a` here + | +LL | fn elided2<'a>( impl 'b) -> impl 'a + 'a { x } + | ++++ + +error[E0261]: use of undeclared lifetime name `'a` + --> $DIR/ty-variance-issue-124423.rs:20:35 + | +LL | fn elided2( impl 'b) -> impl 'a + 'a { x } + | ^^ undeclared lifetime + | +help: consider introducing lifetime `'a` here + | +LL | fn elided2<'a>( impl 'b) -> impl 'a + 'a { x } + | ++++ + +error[E0261]: use of undeclared lifetime name `'b` + --> $DIR/ty-variance-issue-124423.rs:30:40 + | +LL | fn foo<'a>(_: &impl Copy + 'a) -> impl 'b + 'a { x } + | ^^ undeclared lifetime + | +help: consider introducing lifetime `'b` here + | +LL | fn foo<'b, 'a>(_: &impl Copy + 'a) -> impl 'b + 'a { x } + | +++ + +error[E0261]: use of undeclared lifetime name `'a` + --> $DIR/ty-variance-issue-124423.rs:35:28 + | +LL | fn elided3(_: &impl Copy + 'a) -> Box<dyn 'a> { Box::new(x) } + | ^^ undeclared lifetime + | +help: consider introducing lifetime `'a` here + | +LL | fn elided3<'a>(_: &impl Copy + 'a) -> Box<dyn 'a> { Box::new(x) } + | ++++ + +error[E0261]: use of undeclared lifetime name `'a` + --> $DIR/ty-variance-issue-124423.rs:35:43 + | +LL | fn elided3(_: &impl Copy + 'a) -> Box<dyn 'a> { Box::new(x) } + | ^^ undeclared lifetime + | +help: consider introducing lifetime `'a` here + | +LL | fn elided3<'a>(_: &impl Copy + 'a) -> Box<dyn 'a> { Box::new(x) } + | ++++ + +error[E0261]: use of undeclared lifetime name `'a` + --> $DIR/ty-variance-issue-124423.rs:41:14 + | +LL | fn x<'b>(_: &'a impl Copy + 'a) -> Box<dyn 'b> { Box::u32(x) } + | ^^ undeclared lifetime + | +help: consider introducing lifetime `'a` here + | +LL | fn x<'a, 'b>(_: &'a impl Copy + 'a) -> Box<dyn 'b> { Box::u32(x) } + | +++ + +error[E0261]: use of undeclared lifetime name `'a` + --> $DIR/ty-variance-issue-124423.rs:41:29 + | +LL | fn x<'b>(_: &'a impl Copy + 'a) -> Box<dyn 'b> { Box::u32(x) } + | ^^ undeclared lifetime + | +help: consider introducing lifetime `'a` here + | +LL | fn x<'a, 'b>(_: &'a impl Copy + 'a) -> Box<dyn 'b> { Box::u32(x) } + | +++ + +error[E0261]: use of undeclared lifetime name `'a` + --> $DIR/ty-variance-issue-124423.rs:48:28 + | +LL | fn elided4(_: &impl Copy + 'a) -> new { x(x) } + | ^^ undeclared lifetime + | +help: consider introducing lifetime `'a` here + | +LL | fn elided4<'a>(_: &impl Copy + 'a) -> new { x(x) } + | ++++ + +error[E0412]: cannot find type `new` in this scope + --> $DIR/ty-variance-issue-124423.rs:48:36 + | +LL | fn elided4(_: &impl Copy + 'a) -> new { x(x) } + | ^^^ not found in this scope + +error[E0224]: at least one trait is required for an object type + --> $DIR/ty-variance-issue-124423.rs:35:39 + | +LL | fn elided3(_: &impl Copy + 'a) -> Box<dyn 'a> { Box::new(x) } + | ^^^^^^ + +error[E0224]: at least one trait is required for an object type + --> $DIR/ty-variance-issue-124423.rs:41:40 + | +LL | fn x<'b>(_: &'a impl Copy + 'a) -> Box<dyn 'b> { Box::u32(x) } + | ^^^^^^ + +error[E0224]: at least one trait is required for an object type + --> $DIR/ty-variance-issue-124423.rs:55:40 + | +LL | impl<'a> LifetimeTrait<'a> for &'a Box<dyn 'a> {} + | ^^^^^^ + +error[E0121]: the placeholder `_` is not allowed within types on item signatures for return types + --> $DIR/ty-variance-issue-124423.rs:8:34 + | +LL | fn elided(_: &impl Copy + 'a) -> _ { x } + | ^ not allowed in type signatures + +error[E0599]: no function or associated item named `u32` found for struct `Box<_, _>` in the current scope + --> $DIR/ty-variance-issue-124423.rs:41:55 + | +LL | fn x<'b>(_: &'a impl Copy + 'a) -> Box<dyn 'b> { Box::u32(x) } + | ^^^ function or associated item not found in `Box<_, _>` + | +note: if you're trying to build a new `Box<_, _>` consider using one of the following associated functions: + Box::<T>::new + Box::<T>::new_uninit + Box::<T>::new_zeroed + Box::<T>::try_new + and 22 others + --> $SRC_DIR/alloc/src/boxed.rs:LL:COL + +error: aborting due to 30 previous errors + +Some errors have detailed explanations: E0121, E0224, E0261, E0412, E0599. +For more information about an error, try `rustc --explain E0121`. diff --git a/tests/ui/parallel-rustc/ty-variance-issue-127971.rs b/tests/ui/parallel-rustc/ty-variance-issue-127971.rs new file mode 100644 index 00000000000..a17916843e7 --- /dev/null +++ b/tests/ui/parallel-rustc/ty-variance-issue-127971.rs @@ -0,0 +1,25 @@ +// Test for #127971, which causes an ice bug: only `variances_of` returns `&[ty::Variance]` +// +//@ compile-flags: -Z threads=16 +//@ compare-output-by-lines + +use std::fmt::Debug; + +fn elided(_: &impl Copy + 'a) -> _ { x } +//~^ ERROR ambiguous `+` in a type +//~| ERROR use of undeclared lifetime name `'a` +//~| ERROR the placeholder `_` is not allowed within types on item signatures for return types + +fn foo<'a>(_: &impl Copy + 'a) -> impl 'b + 'a { x } +//~^ ERROR ambiguous `+` in a type +//~| ERROR at least one trait must be specified +//~| ERROR use of undeclared lifetime name `'b` + +fn x<'b>(_: &'a impl Copy + 'a) -> Box<dyn 'b> { Box::u32(x) } +//~^ ERROR ambiguous `+` in a type +//~| ERROR use of undeclared lifetime name `'a` +//~| ERROR use of undeclared lifetime name `'a` +//~| ERROR at least one trait is required for an object type +//~| ERROR no function or associated item named `u32` found for struct `Box<_, _>` in the current scope + +fn main() {} diff --git a/tests/ui/parallel-rustc/ty-variance-issue-127971.stderr b/tests/ui/parallel-rustc/ty-variance-issue-127971.stderr new file mode 100644 index 00000000000..9929d3ee22c --- /dev/null +++ b/tests/ui/parallel-rustc/ty-variance-issue-127971.stderr @@ -0,0 +1,113 @@ +error: ambiguous `+` in a type + --> $DIR/ty-variance-issue-127971.rs:8:15 + | +LL | fn elided(_: &impl Copy + 'a) -> _ { x } + | ^^^^^^^^^^^^^^ + | +help: try adding parentheses + | +LL | fn elided(_: &(impl Copy + 'a)) -> _ { x } + | + + + +error: ambiguous `+` in a type + --> $DIR/ty-variance-issue-127971.rs:13:16 + | +LL | fn foo<'a>(_: &impl Copy + 'a) -> impl 'b + 'a { x } + | ^^^^^^^^^^^^^^ + | +help: try adding parentheses + | +LL | fn foo<'a>(_: &(impl Copy + 'a)) -> impl 'b + 'a { x } + | + + + +error: ambiguous `+` in a type + --> $DIR/ty-variance-issue-127971.rs:18:17 + | +LL | fn x<'b>(_: &'a impl Copy + 'a) -> Box<dyn 'b> { Box::u32(x) } + | ^^^^^^^^^^^^^^ + | +help: try adding parentheses + | +LL | fn x<'b>(_: &'a (impl Copy + 'a)) -> Box<dyn 'b> { Box::u32(x) } + | + + + +error: at least one trait must be specified + --> $DIR/ty-variance-issue-127971.rs:13:35 + | +LL | fn foo<'a>(_: &impl Copy + 'a) -> impl 'b + 'a { x } + | ^^^^^^^^^^^^ + +error[E0261]: use of undeclared lifetime name `'a` + --> $DIR/ty-variance-issue-127971.rs:8:27 + | +LL | fn elided(_: &impl Copy + 'a) -> _ { x } + | ^^ undeclared lifetime + | +help: consider introducing lifetime `'a` here + | +LL | fn elided<'a>(_: &impl Copy + 'a) -> _ { x } + | ++++ + +error[E0261]: use of undeclared lifetime name `'b` + --> $DIR/ty-variance-issue-127971.rs:13:40 + | +LL | fn foo<'a>(_: &impl Copy + 'a) -> impl 'b + 'a { x } + | ^^ undeclared lifetime + | +help: consider introducing lifetime `'b` here + | +LL | fn foo<'b, 'a>(_: &impl Copy + 'a) -> impl 'b + 'a { x } + | +++ + +error[E0261]: use of undeclared lifetime name `'a` + --> $DIR/ty-variance-issue-127971.rs:18:14 + | +LL | fn x<'b>(_: &'a impl Copy + 'a) -> Box<dyn 'b> { Box::u32(x) } + | ^^ undeclared lifetime + | +help: consider introducing lifetime `'a` here + | +LL | fn x<'a, 'b>(_: &'a impl Copy + 'a) -> Box<dyn 'b> { Box::u32(x) } + | +++ + +error[E0261]: use of undeclared lifetime name `'a` + --> $DIR/ty-variance-issue-127971.rs:18:29 + | +LL | fn x<'b>(_: &'a impl Copy + 'a) -> Box<dyn 'b> { Box::u32(x) } + | ^^ undeclared lifetime + | +help: consider introducing lifetime `'a` here + | +LL | fn x<'a, 'b>(_: &'a impl Copy + 'a) -> Box<dyn 'b> { Box::u32(x) } + | +++ + +error[E0224]: at least one trait is required for an object type + --> $DIR/ty-variance-issue-127971.rs:18:40 + | +LL | fn x<'b>(_: &'a impl Copy + 'a) -> Box<dyn 'b> { Box::u32(x) } + | ^^^^^^ + +error[E0121]: the placeholder `_` is not allowed within types on item signatures for return types + --> $DIR/ty-variance-issue-127971.rs:8:34 + | +LL | fn elided(_: &impl Copy + 'a) -> _ { x } + | ^ not allowed in type signatures + +error[E0599]: no function or associated item named `u32` found for struct `Box<_, _>` in the current scope + --> $DIR/ty-variance-issue-127971.rs:18:55 + | +LL | fn x<'b>(_: &'a impl Copy + 'a) -> Box<dyn 'b> { Box::u32(x) } + | ^^^ function or associated item not found in `Box<_, _>` + | +note: if you're trying to build a new `Box<_, _>` consider using one of the following associated functions: + Box::<T>::new + Box::<T>::new_uninit + Box::<T>::new_zeroed + Box::<T>::try_new + and 22 others + --> $SRC_DIR/alloc/src/boxed.rs:LL:COL + +error: aborting due to 11 previous errors + +Some errors have detailed explanations: E0121, E0224, E0261, E0599. +For more information about an error, try `rustc --explain E0121`. diff --git a/tests/ui/parallel-rustc/undefined-function-issue-120760.rs b/tests/ui/parallel-rustc/undefined-function-issue-120760.rs new file mode 100644 index 00000000000..2665c30945b --- /dev/null +++ b/tests/ui/parallel-rustc/undefined-function-issue-120760.rs @@ -0,0 +1,71 @@ +// Test for #120760, which causes an ice bug: no index for a field +// +//@ compile-flags: -Z threads=45 +//@ edition: 2021 +//@ compare-output-by-lines + +type BoxFuture<T> = std::pin::Pin<Box<dyn std::future::Future<Output = T>>>; + +fn main() { + let _ = f(); +} + +async fn f() { + run("dependency").await; //~ ERROR cannot find function `run` in this scope +} + +struct InMemoryStorage; + +pub struct User<'dep> { + pub name: &'a str, //~ ERROR use of undeclared lifetime name `'a` +} + +impl<'a> StorageRequest<InMemoryStorage> for SaveUser<'a> { + fn execute(&self) -> BoxFuture<Result<(), String>> { + todo!() + } +} + +trait Storage { + type Error; +} + +impl Storage for InMemoryStorage { + type Error = String; +} + +trait StorageRequestReturnType { + type Output; +} + +trait StorageRequest<S: Storage>: StorageRequestReturnType { + fn execute( + &self, + ) -> BoxFuture<Result<<SaveUser as StorageRequestReturnType>::Output, <S as Storage>::Error>>; +} + +pub struct SaveUser<'a> { + pub name: &'a str, +} + +impl<'a> StorageRequestReturnType for SaveUser<'a> { + type Output = (); +} + +impl<'dep> User<'dep> { + async fn save<S>(self) + where + S: Storage, + for<'a> SaveUser<'a>: StorageRequest<S>, + { + let _ = run("dependency").await; //~ ERROR cannot find function `run` in this scope + } +} + +async fn execute<S>(dep: &str) +where + S: Storage, + for<'a> SaveUser<'a>: StorageRequest<S>, +{ + User { dep }.save().await; //~ ERROR struct `User<'_>` has no field named `dep` +} diff --git a/tests/ui/parallel-rustc/undefined-function-issue-120760.stderr b/tests/ui/parallel-rustc/undefined-function-issue-120760.stderr new file mode 100644 index 00000000000..87af5372219 --- /dev/null +++ b/tests/ui/parallel-rustc/undefined-function-issue-120760.stderr @@ -0,0 +1,35 @@ +error[E0261]: use of undeclared lifetime name `'a` + --> $DIR/undefined-function-issue-120760.rs:20:16 + | +LL | pub name: &'a str, + | ^^ undeclared lifetime + | +help: consider introducing lifetime `'a` here + | +LL | pub struct User<'a, 'dep> { + | +++ + +error[E0425]: cannot find function `run` in this scope + --> $DIR/undefined-function-issue-120760.rs:14:5 + | +LL | run("dependency").await; + | ^^^ not found in this scope + +error[E0425]: cannot find function `run` in this scope + --> $DIR/undefined-function-issue-120760.rs:61:17 + | +LL | let _ = run("dependency").await; + | ^^^ not found in this scope + +error[E0560]: struct `User<'_>` has no field named `dep` + --> $DIR/undefined-function-issue-120760.rs:70:12 + | +LL | User { dep }.save().await; + | ^^^ `User<'_>` does not have this field + | + = note: available fields are: `name` + +error: aborting due to 4 previous errors + +Some errors have detailed explanations: E0261, E0425, E0560. +For more information about an error, try `rustc --explain E0261`. diff --git a/tests/ui/parallel-rustc/unexpected-type-issue-120601.rs b/tests/ui/parallel-rustc/unexpected-type-issue-120601.rs new file mode 100644 index 00000000000..2e215aa301a --- /dev/null +++ b/tests/ui/parallel-rustc/unexpected-type-issue-120601.rs @@ -0,0 +1,28 @@ +// Test for #120601, which causes an ice bug cause of unexpected type +// +//@ compile-flags: -Z threads=40 +//@ compare-output-by-lines + +struct T; +struct Tuple(i32); + +async fn foo() -> Result<(), ()> { + Unstable2(()) +} +//~^^^ ERROR `async fn` is not permitted in Rust 2015 +//~^^^ ERROR cannot find function, tuple struct or tuple variant `Unstable2` in this scope + +async fn tuple() -> Tuple { + Tuple(1i32) +} +//~^^^ ERROR `async fn` is not permitted in Rust 2015 + +async fn match_() { + match tuple() { + Tuple(_) => {} + } +} +//~^^^^^ ERROR `async fn` is not permitted in Rust 2015 +//~^^^^ ERROR mismatched types + +fn main() {} diff --git a/tests/ui/parallel-rustc/unexpected-type-issue-120601.stderr b/tests/ui/parallel-rustc/unexpected-type-issue-120601.stderr new file mode 100644 index 00000000000..ed563bb0c4e --- /dev/null +++ b/tests/ui/parallel-rustc/unexpected-type-issue-120601.stderr @@ -0,0 +1,52 @@ +error[E0670]: `async fn` is not permitted in Rust 2015 + --> $DIR/unexpected-type-issue-120601.rs:9:1 + | +LL | async fn foo() -> Result<(), ()> { + | ^^^^^ to use `async fn`, switch to Rust 2018 or later + | + = help: pass `--edition 2024` to `rustc` + = note: for more on editions, read https://doc.rust-lang.org/edition-guide + +error[E0670]: `async fn` is not permitted in Rust 2015 + --> $DIR/unexpected-type-issue-120601.rs:15:1 + | +LL | async fn tuple() -> Tuple { + | ^^^^^ to use `async fn`, switch to Rust 2018 or later + | + = help: pass `--edition 2024` to `rustc` + = note: for more on editions, read https://doc.rust-lang.org/edition-guide + +error[E0670]: `async fn` is not permitted in Rust 2015 + --> $DIR/unexpected-type-issue-120601.rs:20:1 + | +LL | async fn match_() { + | ^^^^^ to use `async fn`, switch to Rust 2018 or later + | + = help: pass `--edition 2024` to `rustc` + = note: for more on editions, read https://doc.rust-lang.org/edition-guide + +error[E0425]: cannot find function, tuple struct or tuple variant `Unstable2` in this scope + --> $DIR/unexpected-type-issue-120601.rs:10:5 + | +LL | Unstable2(()) + | ^^^^^^^^^ not found in this scope + +error[E0308]: mismatched types + --> $DIR/unexpected-type-issue-120601.rs:22:9 + | +LL | match tuple() { + | ------- this expression has type `impl Future<Output = Tuple>` +LL | Tuple(_) => {} + | ^^^^^^^^ expected future, found `Tuple` + | + = note: expected opaque type `impl Future<Output = Tuple>` + found struct `Tuple` +help: consider `await`ing on the `Future` + | +LL | match tuple().await { + | ++++++ + +error: aborting due to 5 previous errors + +Some errors have detailed explanations: E0308, E0425, E0670. +For more information about an error, try `rustc --explain E0308`. diff --git a/tests/ui/parser/attribute/attr-bad-meta-4.rs b/tests/ui/parser/attribute/attr-bad-meta-4.rs index 937390a6da5..606b41e89a5 100644 --- a/tests/ui/parser/attribute/attr-bad-meta-4.rs +++ b/tests/ui/parser/attribute/attr-bad-meta-4.rs @@ -1,7 +1,7 @@ macro_rules! mac { ($attr_item: meta) => { #[cfg($attr_item)] - //~^ ERROR expected unsuffixed literal, found `meta` metavariable + //~^ ERROR expected a literal (`1u8`, `1.0f32`, `"string"`, etc.) here, found `meta` metavariable struct S; } } @@ -9,7 +9,7 @@ macro_rules! mac { mac!(an(arbitrary token stream)); #[cfg(feature = -1)] -//~^ ERROR expected unsuffixed literal, found `-` +//~^ ERROR expected a literal (`1u8`, `1.0f32`, `"string"`, etc.) here, found `-` fn handler() {} fn main() {} diff --git a/tests/ui/parser/attribute/attr-bad-meta-4.stderr b/tests/ui/parser/attribute/attr-bad-meta-4.stderr index 9c6ab5adadf..1d939942fb9 100644 --- a/tests/ui/parser/attribute/attr-bad-meta-4.stderr +++ b/tests/ui/parser/attribute/attr-bad-meta-4.stderr @@ -1,10 +1,16 @@ -error: expected unsuffixed literal, found `-` +error: expected a literal (`1u8`, `1.0f32`, `"string"`, etc.) here, found `-` --> $DIR/attr-bad-meta-4.rs:11:17 | LL | #[cfg(feature = -1)] | ^ + | +help: negative numbers are not literals, try removing the `-` sign + | +LL - #[cfg(feature = -1)] +LL + #[cfg(feature = 1)] + | -error: expected unsuffixed literal, found `meta` metavariable +error: expected a literal (`1u8`, `1.0f32`, `"string"`, etc.) here, found `meta` metavariable --> $DIR/attr-bad-meta-4.rs:3:15 | LL | #[cfg($attr_item)] diff --git a/tests/ui/parser/attribute/attr-incomplete.rs b/tests/ui/parser/attribute/attr-incomplete.rs new file mode 100644 index 00000000000..49cb66e5f59 --- /dev/null +++ b/tests/ui/parser/attribute/attr-incomplete.rs @@ -0,0 +1,17 @@ +#[cfg(target-os = "windows")] +//~^ ERROR expected one of `(`, `,`, `::`, or `=`, found `-` +pub fn test1() { } + +#[cfg(target_os = %)] +//~^ ERROR expected a literal (`1u8`, `1.0f32`, `"string"`, etc.) here, found `%` +pub fn test2() { } + +#[cfg(target_os?)] +//~^ ERROR expected one of `(`, `,`, `::`, or `=`, found `?` +pub fn test3() { } + +#[cfg[target_os]] +//~^ ERROR wrong meta list delimiters +pub fn test4() { } + +pub fn main() {} diff --git a/tests/ui/parser/attribute/attr-incomplete.stderr b/tests/ui/parser/attribute/attr-incomplete.stderr new file mode 100644 index 00000000000..5909820cef3 --- /dev/null +++ b/tests/ui/parser/attribute/attr-incomplete.stderr @@ -0,0 +1,32 @@ +error: expected one of `(`, `,`, `::`, or `=`, found `-` + --> $DIR/attr-incomplete.rs:1:13 + | +LL | #[cfg(target-os = "windows")] + | ^ expected one of `(`, `,`, `::`, or `=` + +error: expected a literal (`1u8`, `1.0f32`, `"string"`, etc.) here, found `%` + --> $DIR/attr-incomplete.rs:5:19 + | +LL | #[cfg(target_os = %)] + | ^ + +error: expected one of `(`, `,`, `::`, or `=`, found `?` + --> $DIR/attr-incomplete.rs:9:16 + | +LL | #[cfg(target_os?)] + | ^ expected one of `(`, `,`, `::`, or `=` + +error: wrong meta list delimiters + --> $DIR/attr-incomplete.rs:13:6 + | +LL | #[cfg[target_os]] + | ^^^^^^^^^^^ + | +help: the delimiters should be `(` and `)` + | +LL - #[cfg[target_os]] +LL + #[cfg(target_os)] + | + +error: aborting due to 4 previous errors + diff --git a/tests/ui/parser/attribute/attr-unquoted-ident.rs b/tests/ui/parser/attribute/attr-unquoted-ident.rs index 396265f715e..8a0c65b783a 100644 --- a/tests/ui/parser/attribute/attr-unquoted-ident.rs +++ b/tests/ui/parser/attribute/attr-unquoted-ident.rs @@ -4,13 +4,13 @@ fn main() { #[cfg(key=foo)] - //~^ ERROR expected unsuffixed literal, found `foo` + //~^ ERROR expected a literal (`1u8`, `1.0f32`, `"string"`, etc.) here, found `foo` //~| HELP surround the identifier with quotation marks to make it into a string literal println!(); #[cfg(key="bar")] println!(); #[cfg(key=foo bar baz)] - //~^ ERROR expected unsuffixed literal, found `foo` + //~^ ERROR expected a literal (`1u8`, `1.0f32`, `"string"`, etc.) here, found `foo` //~| HELP surround the identifier with quotation marks to make it into a string literal println!(); } diff --git a/tests/ui/parser/attribute/attr-unquoted-ident.stderr b/tests/ui/parser/attribute/attr-unquoted-ident.stderr index 2d7997f1aea..8a2785280ad 100644 --- a/tests/ui/parser/attribute/attr-unquoted-ident.stderr +++ b/tests/ui/parser/attribute/attr-unquoted-ident.stderr @@ -1,4 +1,4 @@ -error: expected unsuffixed literal, found `foo` +error: expected a literal (`1u8`, `1.0f32`, `"string"`, etc.) here, found `foo` --> $DIR/attr-unquoted-ident.rs:6:15 | LL | #[cfg(key=foo)] @@ -9,7 +9,7 @@ help: surround the identifier with quotation marks to make it into a string lite LL | #[cfg(key="foo")] | + + -error: expected unsuffixed literal, found `foo` +error: expected a literal (`1u8`, `1.0f32`, `"string"`, etc.) here, found `foo` --> $DIR/attr-unquoted-ident.rs:12:15 | LL | #[cfg(key=foo bar baz)] diff --git a/tests/ui/parser/bad-lit-suffixes.rs b/tests/ui/parser/bad-lit-suffixes.rs index 0a01bb84f01..0a1ee120730 100644 --- a/tests/ui/parser/bad-lit-suffixes.rs +++ b/tests/ui/parser/bad-lit-suffixes.rs @@ -42,5 +42,10 @@ extern "C" {} #[rustc_layout_scalar_valid_range_start(0suffix)] //~^ ERROR invalid suffix `suffix` for number literal -//~| ERROR malformed `rustc_layout_scalar_valid_range_start` attribute input struct S; + +impl S { + #[rustc_confusables("blah"suffix)] + //~^ ERROR suffixes on string literals are invalid + fn woof() { } +} diff --git a/tests/ui/parser/bad-lit-suffixes.stderr b/tests/ui/parser/bad-lit-suffixes.stderr index 9a51cf70960..6c3dbbcec64 100644 --- a/tests/ui/parser/bad-lit-suffixes.stderr +++ b/tests/ui/parser/bad-lit-suffixes.stderr @@ -10,32 +10,6 @@ error: suffixes on string literals are invalid LL | "C"suffix | ^^^^^^^^^ invalid suffix `suffix` -error: suffixes on string literals are invalid - --> $DIR/bad-lit-suffixes.rs:30:17 - | -LL | #[rustc_dummy = "string"suffix] - | ^^^^^^^^^^^^^^ invalid suffix `suffix` - -error: suffixes on string literals are invalid - --> $DIR/bad-lit-suffixes.rs:34:14 - | -LL | #[must_use = "string"suffix] - | ^^^^^^^^^^^^^^ invalid suffix `suffix` - -error: suffixes on string literals are invalid - --> $DIR/bad-lit-suffixes.rs:39:15 - | -LL | #[link(name = "string"suffix)] - | ^^^^^^^^^^^^^^ invalid suffix `suffix` - -error: invalid suffix `suffix` for number literal - --> $DIR/bad-lit-suffixes.rs:43:41 - | -LL | #[rustc_layout_scalar_valid_range_start(0suffix)] - | ^^^^^^^ invalid suffix `suffix` - | - = help: the suffix must be one of the numeric types (`u32`, `isize`, `f32`, etc.) - warning: `extern` declarations without an explicit ABI are deprecated --> $DIR/bad-lit-suffixes.rs:3:1 | @@ -150,6 +124,18 @@ LL | 1.0e10suffix; | = help: valid suffixes are `f32` and `f64` +error: suffixes on string literals are invalid + --> $DIR/bad-lit-suffixes.rs:30:17 + | +LL | #[rustc_dummy = "string"suffix] + | ^^^^^^^^^^^^^^ invalid suffix `suffix` + +error: suffixes on string literals are invalid + --> $DIR/bad-lit-suffixes.rs:34:14 + | +LL | #[must_use = "string"suffix] + | ^^^^^^^^^^^^^^ invalid suffix `suffix` + error[E0539]: malformed `must_use` attribute input --> $DIR/bad-lit-suffixes.rs:34:1 | @@ -168,16 +154,26 @@ LL - #[must_use = "string"suffix] LL + #[must_use] | -error[E0805]: malformed `rustc_layout_scalar_valid_range_start` attribute input - --> $DIR/bad-lit-suffixes.rs:43:1 +error: suffixes on string literals are invalid + --> $DIR/bad-lit-suffixes.rs:39:15 + | +LL | #[link(name = "string"suffix)] + | ^^^^^^^^^^^^^^ invalid suffix `suffix` + +error: invalid suffix `suffix` for number literal + --> $DIR/bad-lit-suffixes.rs:43:41 | LL | #[rustc_layout_scalar_valid_range_start(0suffix)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^---------^ - | | | - | | expected a single argument here - | help: must be of the form: `#[rustc_layout_scalar_valid_range_start(start)]` + | ^^^^^^^ invalid suffix `suffix` + | + = help: the suffix must be one of the numeric types (`u32`, `isize`, `f32`, etc.) + +error: suffixes on string literals are invalid + --> $DIR/bad-lit-suffixes.rs:48:25 + | +LL | #[rustc_confusables("blah"suffix)] + | ^^^^^^^^^^^^ invalid suffix `suffix` error: aborting due to 22 previous errors; 2 warnings emitted -Some errors have detailed explanations: E0539, E0805. -For more information about an error, try `rustc --explain E0539`. +For more information about this error, try `rustc --explain E0539`. diff --git a/tests/ui/parser/macro/macro-attr-bad.rs b/tests/ui/parser/macro/macro-attr-bad.rs index 4313a4d04ab..9f50b057a7a 100644 --- a/tests/ui/parser/macro/macro-attr-bad.rs +++ b/tests/ui/parser/macro/macro-attr-bad.rs @@ -14,10 +14,10 @@ macro_rules! attr_incomplete_4 { attr() {} => } //~^ ERROR macro definition ended unexpectedly macro_rules! attr_noparens_1 { attr{} {} => {} } -//~^ ERROR macro attribute argument matchers require parentheses +//~^ ERROR `attr` rule argument matchers require parentheses macro_rules! attr_noparens_2 { attr[] {} => {} } -//~^ ERROR macro attribute argument matchers require parentheses +//~^ ERROR `attr` rule argument matchers require parentheses macro_rules! attr_noparens_3 { attr _ {} => {} } //~^ ERROR invalid macro matcher diff --git a/tests/ui/parser/macro/macro-attr-bad.stderr b/tests/ui/parser/macro/macro-attr-bad.stderr index 4d286b66649..bf0ed13cd55 100644 --- a/tests/ui/parser/macro/macro-attr-bad.stderr +++ b/tests/ui/parser/macro/macro-attr-bad.stderr @@ -22,7 +22,7 @@ error: macro definition ended unexpectedly LL | macro_rules! attr_incomplete_4 { attr() {} => } | ^ expected right-hand side of macro rule -error: macro attribute argument matchers require parentheses +error: `attr` rule argument matchers require parentheses --> $DIR/macro-attr-bad.rs:16:36 | LL | macro_rules! attr_noparens_1 { attr{} {} => {} } @@ -34,7 +34,7 @@ LL - macro_rules! attr_noparens_1 { attr{} {} => {} } LL + macro_rules! attr_noparens_1 { attr() {} => {} } | -error: macro attribute argument matchers require parentheses +error: `attr` rule argument matchers require parentheses --> $DIR/macro-attr-bad.rs:19:36 | LL | macro_rules! attr_noparens_2 { attr[] {} => {} } diff --git a/tests/ui/parser/macro/macro-attr-recovery.rs b/tests/ui/parser/macro/macro-attr-recovery.rs index dbb795f57aa..3a942973e5e 100644 --- a/tests/ui/parser/macro/macro-attr-recovery.rs +++ b/tests/ui/parser/macro/macro-attr-recovery.rs @@ -3,7 +3,7 @@ macro_rules! attr { attr[$($args:tt)*] { $($body:tt)* } => { - //~^ ERROR: macro attribute argument matchers require parentheses + //~^ ERROR: `attr` rule argument matchers require parentheses //~v ERROR: attr: compile_error!(concat!( "attr: args=\"", diff --git a/tests/ui/parser/macro/macro-attr-recovery.stderr b/tests/ui/parser/macro/macro-attr-recovery.stderr index ab3a0b7c607..e1f8dccf1b8 100644 --- a/tests/ui/parser/macro/macro-attr-recovery.stderr +++ b/tests/ui/parser/macro/macro-attr-recovery.stderr @@ -1,4 +1,4 @@ -error: macro attribute argument matchers require parentheses +error: `attr` rule argument matchers require parentheses --> $DIR/macro-attr-recovery.rs:5:9 | LL | attr[$($args:tt)*] { $($body:tt)* } => { diff --git a/tests/ui/parser/macro/macro-derive-bad.rs b/tests/ui/parser/macro/macro-derive-bad.rs new file mode 100644 index 00000000000..79b9eb8c113 --- /dev/null +++ b/tests/ui/parser/macro/macro-derive-bad.rs @@ -0,0 +1,43 @@ +#![crate_type = "lib"] +#![feature(macro_derive)] + +macro_rules! derive_incomplete_1 { derive } +//~^ ERROR macro definition ended unexpectedly +//~| NOTE expected `()` after `derive` + +macro_rules! derive_incomplete_2 { derive() } +//~^ ERROR macro definition ended unexpectedly +//~| NOTE expected macro derive body + +macro_rules! derive_incomplete_3 { derive() {} } +//~^ ERROR expected `=>` +//~| NOTE expected `=>` + +macro_rules! derive_incomplete_4 { derive() {} => } +//~^ ERROR macro definition ended unexpectedly +//~| NOTE expected right-hand side of macro rule + +macro_rules! derive_noparens_1 { derive{} {} => {} } +//~^ ERROR `derive` rule argument matchers require parentheses + +macro_rules! derive_noparens_2 { derive[] {} => {} } +//~^ ERROR `derive` rule argument matchers require parentheses + +macro_rules! derive_noparens_3 { derive _ {} => {} } +//~^ ERROR `derive` must be followed by `()` + +macro_rules! derive_args_1 { derive($x:ident) ($y:ident) => {} } +//~^ ERROR `derive` rules do not accept arguments + +macro_rules! derive_args_2 { derive() => {} } +//~^ ERROR expected macro derive body, got `=>` + +macro_rules! derive_args_3 { derive($x:ident) => {} } +//~^ ERROR `derive` rules do not accept arguments +//~| ERROR expected macro derive body, got `=>` +//~| NOTE need `()` after this `derive` + +macro_rules! derive_dup_matcher { derive() {$x:ident $x:ident} => {} } +//~^ ERROR duplicate matcher binding +//~| NOTE duplicate binding +//~| NOTE previous binding diff --git a/tests/ui/parser/macro/macro-derive-bad.stderr b/tests/ui/parser/macro/macro-derive-bad.stderr new file mode 100644 index 00000000000..ec750c9ac82 --- /dev/null +++ b/tests/ui/parser/macro/macro-derive-bad.stderr @@ -0,0 +1,90 @@ +error: macro definition ended unexpectedly + --> $DIR/macro-derive-bad.rs:4:42 + | +LL | macro_rules! derive_incomplete_1 { derive } + | ^ expected `()` after `derive` + +error: macro definition ended unexpectedly + --> $DIR/macro-derive-bad.rs:8:44 + | +LL | macro_rules! derive_incomplete_2 { derive() } + | ^ expected macro derive body + +error: expected `=>`, found end of macro arguments + --> $DIR/macro-derive-bad.rs:12:47 + | +LL | macro_rules! derive_incomplete_3 { derive() {} } + | ^ expected `=>` + +error: macro definition ended unexpectedly + --> $DIR/macro-derive-bad.rs:16:50 + | +LL | macro_rules! derive_incomplete_4 { derive() {} => } + | ^ expected right-hand side of macro rule + +error: `derive` rule argument matchers require parentheses + --> $DIR/macro-derive-bad.rs:20:40 + | +LL | macro_rules! derive_noparens_1 { derive{} {} => {} } + | ^^ + | +help: the delimiters should be `(` and `)` + | +LL - macro_rules! derive_noparens_1 { derive{} {} => {} } +LL + macro_rules! derive_noparens_1 { derive() {} => {} } + | + +error: `derive` rule argument matchers require parentheses + --> $DIR/macro-derive-bad.rs:23:40 + | +LL | macro_rules! derive_noparens_2 { derive[] {} => {} } + | ^^ + | +help: the delimiters should be `(` and `)` + | +LL - macro_rules! derive_noparens_2 { derive[] {} => {} } +LL + macro_rules! derive_noparens_2 { derive() {} => {} } + | + +error: `derive` rules do not accept arguments; `derive` must be followed by `()` + --> $DIR/macro-derive-bad.rs:26:41 + | +LL | macro_rules! derive_noparens_3 { derive _ {} => {} } + | ^ + +error: `derive` rules do not accept arguments; `derive` must be followed by `()` + --> $DIR/macro-derive-bad.rs:29:36 + | +LL | macro_rules! derive_args_1 { derive($x:ident) ($y:ident) => {} } + | ^^^^^^^^^^ + +error: expected macro derive body, got `=>` + --> $DIR/macro-derive-bad.rs:32:39 + | +LL | macro_rules! derive_args_2 { derive() => {} } + | ^^ + +error: `derive` rules do not accept arguments; `derive` must be followed by `()` + --> $DIR/macro-derive-bad.rs:35:36 + | +LL | macro_rules! derive_args_3 { derive($x:ident) => {} } + | ^^^^^^^^^^ + +error: expected macro derive body, got `=>` + --> $DIR/macro-derive-bad.rs:35:47 + | +LL | macro_rules! derive_args_3 { derive($x:ident) => {} } + | ------ ^^ + | | + | need `()` after this `derive` + +error: duplicate matcher binding + --> $DIR/macro-derive-bad.rs:40:54 + | +LL | macro_rules! derive_dup_matcher { derive() {$x:ident $x:ident} => {} } + | -------- ^^^^^^^^ duplicate binding + | | + | previous binding + +error: aborting due to 12 previous errors + diff --git a/tests/ui/parser/misspelled-keywords/ref.stderr b/tests/ui/parser/misspelled-keywords/ref.stderr index 21b99d6e663..dd33fdb21ba 100644 --- a/tests/ui/parser/misspelled-keywords/ref.stderr +++ b/tests/ui/parser/misspelled-keywords/ref.stderr @@ -15,6 +15,7 @@ error[E0023]: this pattern has 2 fields, but the corresponding tuple variant has | LL | Some(refe list) => println!("{list:?}"), | ^^^^ ^^^^ expected 1 field, found 2 + | --> $SRC_DIR/core/src/option.rs:LL:COL | = note: tuple variant has 1 field diff --git a/tests/ui/issues/issue-5572.rs b/tests/ui/parser/partial-eq-trait-bound-5572.rs index f27744ef0ac..7ee0cdc43ee 100644 --- a/tests/ui/issues/issue-5572.rs +++ b/tests/ui/parser/partial-eq-trait-bound-5572.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/5572 //@ check-pass #![allow(dead_code)] diff --git a/tests/ui/parser/recover/param-default.rs b/tests/ui/parser/recover/param-default.rs new file mode 100644 index 00000000000..5311d4dfae6 --- /dev/null +++ b/tests/ui/parser/recover/param-default.rs @@ -0,0 +1,5 @@ +fn foo(x: i32 = 1) {} //~ ERROR parameter defaults are not supported + +type Foo = fn(i32 = 0); //~ ERROR parameter defaults are not supported + +fn main() {} diff --git a/tests/ui/parser/recover/param-default.stderr b/tests/ui/parser/recover/param-default.stderr new file mode 100644 index 00000000000..93dea427daf --- /dev/null +++ b/tests/ui/parser/recover/param-default.stderr @@ -0,0 +1,14 @@ +error: parameter defaults are not supported + --> $DIR/param-default.rs:1:15 + | +LL | fn foo(x: i32 = 1) {} + | ^^^ + +error: parameter defaults are not supported + --> $DIR/param-default.rs:3:19 + | +LL | type Foo = fn(i32 = 0); + | ^^^ + +error: aborting due to 2 previous errors + diff --git a/tests/ui/parser/recover/recover-pat-exprs.stderr b/tests/ui/parser/recover/recover-pat-exprs.stderr index 33000022b8f..a99f7e16fca 100644 --- a/tests/ui/parser/recover/recover-pat-exprs.stderr +++ b/tests/ui/parser/recover/recover-pat-exprs.stderr @@ -690,6 +690,7 @@ error: expected one of `)`, `,`, `@`, `if`, or `|`, found `*` | LL | let b = matches!(x, (x * x | x.f()) | x[0]); | ^ expected one of `)`, `,`, `@`, `if`, or `|` + | --> $SRC_DIR/core/src/macros/mod.rs:LL:COL | = note: while parsing argument for this `pat` macro fragment diff --git a/tests/ui/parser/recover/recover-pat-ranges.stderr b/tests/ui/parser/recover/recover-pat-ranges.stderr index 246c704d53f..afa7f254054 100644 --- a/tests/ui/parser/recover/recover-pat-ranges.stderr +++ b/tests/ui/parser/recover/recover-pat-ranges.stderr @@ -192,7 +192,7 @@ LL | (1 + 4)...1 * 2 => (), | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! = note: for more information, see <https://doc.rust-lang.org/edition-guide/rust-2021/warnings-promoted-to-error.html> - = note: `#[warn(ellipsis_inclusive_range_patterns)]` on by default + = note: `#[warn(ellipsis_inclusive_range_patterns)]` (part of `#[warn(rust_2021_compatibility)]`) on by default error: aborting due to 13 previous errors; 1 warning emitted diff --git a/tests/ui/parser/removed-syntax/removed-syntax-fixed-vec.stderr b/tests/ui/parser/removed-syntax/removed-syntax-fixed-vec.stderr index 8d7938a1a46..f584197c98e 100644 --- a/tests/ui/parser/removed-syntax/removed-syntax-fixed-vec.stderr +++ b/tests/ui/parser/removed-syntax/removed-syntax-fixed-vec.stderr @@ -17,7 +17,7 @@ warning: type `v` should have an upper camel case name LL | type v = [isize * 3]; | ^ help: convert the identifier to upper camel case (notice the capitalization): `V` | - = note: `#[warn(non_camel_case_types)]` on by default + = note: `#[warn(non_camel_case_types)]` (part of `#[warn(nonstandard_style)]`) on by default error: aborting due to 1 previous error; 1 warning emitted diff --git a/tests/ui/parser/require-parens-for-chained-comparison.rs b/tests/ui/parser/require-parens-for-chained-comparison.rs index 21a908923f2..6152fff6c03 100644 --- a/tests/ui/parser/require-parens-for-chained-comparison.rs +++ b/tests/ui/parser/require-parens-for-chained-comparison.rs @@ -24,14 +24,14 @@ fn main() { //~| HELP use `::<...>` instead of `<...>` to specify lifetime, type, or const arguments //~| ERROR expected //~| HELP add `'` to close the char literal - //~| ERROR invalid label name + //~| ERROR labels cannot use keyword names f<'_>(); //~^ ERROR comparison operators cannot be chained //~| HELP use `::<...>` instead of `<...>` to specify lifetime, type, or const arguments //~| ERROR expected //~| HELP add `'` to close the char literal - //~| ERROR invalid label name + //~| ERROR labels cannot use keyword names let _ = f<u8>; //~^ ERROR comparison operators cannot be chained diff --git a/tests/ui/parser/require-parens-for-chained-comparison.stderr b/tests/ui/parser/require-parens-for-chained-comparison.stderr index 857c4a55788..9edfae36250 100644 --- a/tests/ui/parser/require-parens-for-chained-comparison.stderr +++ b/tests/ui/parser/require-parens-for-chained-comparison.stderr @@ -53,7 +53,7 @@ help: use `::<...>` instead of `<...>` to specify lifetime, type, or const argum LL | let _ = f::<u8, i8>(); | ++ -error: invalid label name `'_` +error: labels cannot use keyword names --> $DIR/require-parens-for-chained-comparison.rs:22:15 | LL | let _ = f<'_, i8>(); @@ -81,7 +81,7 @@ help: use `::<...>` instead of `<...>` to specify lifetime, type, or const argum LL | let _ = f::<'_, i8>(); | ++ -error: invalid label name `'_` +error: labels cannot use keyword names --> $DIR/require-parens-for-chained-comparison.rs:29:7 | LL | f<'_>(); diff --git a/tests/ui/parser/trait-object-lifetime-parens.e2015.stderr b/tests/ui/parser/trait-object-lifetime-parens.e2015.stderr index cf0b3d77f5b..4f4f89de5d1 100644 --- a/tests/ui/parser/trait-object-lifetime-parens.e2015.stderr +++ b/tests/ui/parser/trait-object-lifetime-parens.e2015.stderr @@ -1,4 +1,4 @@ -error: parenthesized lifetime bounds are not supported +error: lifetime bounds may not be parenthesized --> $DIR/trait-object-lifetime-parens.rs:9:21 | LL | fn f<'a, T: Trait + ('a)>() {} @@ -10,7 +10,7 @@ LL - fn f<'a, T: Trait + ('a)>() {} LL + fn f<'a, T: Trait + 'a>() {} | -error: parenthesized lifetime bounds are not supported +error: lifetime bounds may not be parenthesized --> $DIR/trait-object-lifetime-parens.rs:12:24 | LL | let _: Box<Trait + ('a)>; diff --git a/tests/ui/parser/trait-object-lifetime-parens.e2021.stderr b/tests/ui/parser/trait-object-lifetime-parens.e2021.stderr index b65c079788a..a4e2501cfdf 100644 --- a/tests/ui/parser/trait-object-lifetime-parens.e2021.stderr +++ b/tests/ui/parser/trait-object-lifetime-parens.e2021.stderr @@ -1,4 +1,4 @@ -error: parenthesized lifetime bounds are not supported +error: lifetime bounds may not be parenthesized --> $DIR/trait-object-lifetime-parens.rs:9:21 | LL | fn f<'a, T: Trait + ('a)>() {} @@ -10,7 +10,7 @@ LL - fn f<'a, T: Trait + ('a)>() {} LL + fn f<'a, T: Trait + 'a>() {} | -error: parenthesized lifetime bounds are not supported +error: lifetime bounds may not be parenthesized --> $DIR/trait-object-lifetime-parens.rs:12:24 | LL | let _: Box<Trait + ('a)>; diff --git a/tests/ui/parser/trait-object-lifetime-parens.rs b/tests/ui/parser/trait-object-lifetime-parens.rs index 0ff4660bb0d..47a6884b316 100644 --- a/tests/ui/parser/trait-object-lifetime-parens.rs +++ b/tests/ui/parser/trait-object-lifetime-parens.rs @@ -6,10 +6,10 @@ trait Trait {} -fn f<'a, T: Trait + ('a)>() {} //~ ERROR parenthesized lifetime bounds are not supported +fn f<'a, T: Trait + ('a)>() {} //~ ERROR lifetime bounds may not be parenthesized fn check<'a>() { - let _: Box<Trait + ('a)>; //~ ERROR parenthesized lifetime bounds are not supported + let _: Box<Trait + ('a)>; //~ ERROR lifetime bounds may not be parenthesized //[e2021]~^ ERROR expected a type, found a trait // FIXME: It'd be great if we could suggest removing the parentheses here too. //[e2015]~v ERROR lifetimes must be followed by `+` to form a trait object type diff --git a/tests/ui/parser/trait-object-trait-parens.stderr b/tests/ui/parser/trait-object-trait-parens.stderr index b2067547568..f498d7d36bb 100644 --- a/tests/ui/parser/trait-object-trait-parens.stderr +++ b/tests/ui/parser/trait-object-trait-parens.stderr @@ -24,7 +24,7 @@ LL | let _: Box<(Obj) + (?Sized) + (for<'a> Trait<'a>)>; | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! = note: for more information, see <https://doc.rust-lang.org/edition-guide/rust-2021/warnings-promoted-to-error.html> - = note: `#[warn(bare_trait_objects)]` on by default + = note: `#[warn(bare_trait_objects)]` (part of `#[warn(rust_2021_compatibility)]`) on by default help: if this is a dyn-compatible trait, use `dyn` | LL | let _: Box<dyn (Obj) + (?Sized) + (for<'a> Trait<'a>)>; diff --git a/tests/ui/pattern/deref-patterns/implicit-const-deref.stderr b/tests/ui/pattern/deref-patterns/implicit-const-deref.stderr index 21d09ec44c4..6d430184628 100644 --- a/tests/ui/pattern/deref-patterns/implicit-const-deref.stderr +++ b/tests/ui/pattern/deref-patterns/implicit-const-deref.stderr @@ -6,6 +6,7 @@ LL | const EMPTY: Vec<()> = Vec::new(); ... LL | EMPTY => {} | ^^^^^ constant of non-structural type + | --> $SRC_DIR/alloc/src/vec/mod.rs:LL:COL | = note: `Vec<()>` must be annotated with `#[derive(PartialEq)]` to be usable in patterns diff --git a/tests/ui/pattern/deref-patterns/recursion-limit.stderr b/tests/ui/pattern/deref-patterns/recursion-limit.stderr index 9a83d1eb5a4..f6aa92b23ad 100644 --- a/tests/ui/pattern/deref-patterns/recursion-limit.stderr +++ b/tests/ui/pattern/deref-patterns/recursion-limit.stderr @@ -10,7 +10,13 @@ error[E0277]: the trait bound `Cyclic: DerefPure` is not satisfied --> $DIR/recursion-limit.rs:18:9 | LL | () => {} - | ^^ the trait `DerefPure` is not implemented for `Cyclic` + | ^^ unsatisfied trait bound + | +help: the trait `DerefPure` is not implemented for `Cyclic` + --> $DIR/recursion-limit.rs:8:1 + | +LL | struct Cyclic; + | ^^^^^^^^^^^^^ error: aborting due to 2 previous errors diff --git a/tests/ui/pattern/deref-patterns/unsatisfied-bounds.stderr b/tests/ui/pattern/deref-patterns/unsatisfied-bounds.stderr index 983ce27865c..0b1e8ef4978 100644 --- a/tests/ui/pattern/deref-patterns/unsatisfied-bounds.stderr +++ b/tests/ui/pattern/deref-patterns/unsatisfied-bounds.stderr @@ -2,7 +2,13 @@ error[E0277]: the trait bound `MyPointer: DerefPure` is not satisfied --> $DIR/unsatisfied-bounds.rs:17:9 | LL | () => {} - | ^^ the trait `DerefPure` is not implemented for `MyPointer` + | ^^ unsatisfied trait bound + | +help: the trait `DerefPure` is not implemented for `MyPointer` + --> $DIR/unsatisfied-bounds.rs:4:1 + | +LL | struct MyPointer; + | ^^^^^^^^^^^^^^^^ error: aborting due to 1 previous error diff --git a/tests/ui/pattern/issue-115599.stderr b/tests/ui/pattern/issue-115599.stderr index 69d10728ccd..ed465ea0bba 100644 --- a/tests/ui/pattern/issue-115599.stderr +++ b/tests/ui/pattern/issue-115599.stderr @@ -6,6 +6,7 @@ LL | const CONST_STRING: String = String::new(); ... LL | if let CONST_STRING = empty_str {} | ^^^^^^^^^^^^ constant of non-structural type + | --> $SRC_DIR/alloc/src/vec/mod.rs:LL:COL | = note: `Vec<u8>` must be annotated with `#[derive(PartialEq)]` to be usable in patterns diff --git a/tests/ui/pattern/skipped-ref-pats-issue-125058.stderr b/tests/ui/pattern/skipped-ref-pats-issue-125058.stderr index f7fd4a4cc29..9580bab2b4f 100644 --- a/tests/ui/pattern/skipped-ref-pats-issue-125058.stderr +++ b/tests/ui/pattern/skipped-ref-pats-issue-125058.stderr @@ -4,7 +4,7 @@ warning: struct `Foo` is never constructed LL | struct Foo; | ^^^ | - = note: `#[warn(dead_code)]` on by default + = note: `#[warn(dead_code)]` (part of `#[warn(unused)]`) on by default warning: unused closure that must be used --> $DIR/skipped-ref-pats-issue-125058.rs:11:5 @@ -18,7 +18,7 @@ LL | | }; | |_____^ | = note: closures are lazy and do nothing unless called - = note: `#[warn(unused_must_use)]` on by default + = note: `#[warn(unused_must_use)]` (part of `#[warn(unused)]`) on by default warning: 2 warnings emitted diff --git a/tests/ui/issues/auxiliary/iss.rs b/tests/ui/privacy/auxiliary/iss-6919.rs index cf32f6c2d5d..cf32f6c2d5d 100644 --- a/tests/ui/issues/auxiliary/iss.rs +++ b/tests/ui/privacy/auxiliary/iss-6919.rs diff --git a/tests/ui/issues/issue-6919.rs b/tests/ui/privacy/deref-separate-compile-unit-6919.rs index 7fb8a2f33bc..5d8934987e5 100644 --- a/tests/ui/issues/issue-6919.rs +++ b/tests/ui/privacy/deref-separate-compile-unit-6919.rs @@ -1,7 +1,7 @@ +// https://github.com/rust-lang/rust/issues/6919 //@ run-pass #![allow(unused_attributes)] -//@ aux-build:iss.rs - +//@ aux-build:iss-6919.rs extern crate issue6919_3; diff --git a/tests/ui/issues/issue-76077-inaccesible-private-fields/issue-76077-1.fixed b/tests/ui/privacy/inaccessible-fields-pattern-matching-76077.fixed index 6fde4e390fa..7d648543a20 100644 --- a/tests/ui/issues/issue-76077-inaccesible-private-fields/issue-76077-1.fixed +++ b/tests/ui/privacy/inaccessible-fields-pattern-matching-76077.fixed @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/76077 //@ run-rustfix #![allow(dead_code, unused_variables)] diff --git a/tests/ui/issues/issue-76077-inaccesible-private-fields/issue-76077-1.rs b/tests/ui/privacy/inaccessible-fields-pattern-matching-76077.rs index 30a8535faf5..f3b51187ae3 100644 --- a/tests/ui/issues/issue-76077-inaccesible-private-fields/issue-76077-1.rs +++ b/tests/ui/privacy/inaccessible-fields-pattern-matching-76077.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/76077 //@ run-rustfix #![allow(dead_code, unused_variables)] diff --git a/tests/ui/issues/issue-76077-inaccesible-private-fields/issue-76077-1.stderr b/tests/ui/privacy/inaccessible-fields-pattern-matching-76077.stderr index f54990d5d86..070fa1a53a5 100644 --- a/tests/ui/issues/issue-76077-inaccesible-private-fields/issue-76077-1.stderr +++ b/tests/ui/privacy/inaccessible-fields-pattern-matching-76077.stderr @@ -1,5 +1,5 @@ error: pattern requires `..` due to inaccessible fields - --> $DIR/issue-76077-1.rs:13:9 + --> $DIR/inaccessible-fields-pattern-matching-76077.rs:14:9 | LL | let foo::Foo {} = foo::Foo::default(); | ^^^^^^^^^^^ @@ -10,7 +10,7 @@ LL | let foo::Foo { .. } = foo::Foo::default(); | ++ error: pattern requires `..` due to inaccessible fields - --> $DIR/issue-76077-1.rs:16:9 + --> $DIR/inaccessible-fields-pattern-matching-76077.rs:17:9 | LL | let foo::Bar { visible } = foo::Bar::default(); | ^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/privacy/macro-private-reexport.stderr b/tests/ui/privacy/macro-private-reexport.stderr index b8768f3612e..aa02715c202 100644 --- a/tests/ui/privacy/macro-private-reexport.stderr +++ b/tests/ui/privacy/macro-private-reexport.stderr @@ -11,6 +11,10 @@ LL | / macro_rules! bar { LL | | () => {}; LL | | } | |_____^ +help: in case you want to use the macro within this crate only, reduce the visibility to `pub(crate)` + | +LL | pub(crate) use bar as _; + | +++++++ error[E0364]: `baz` is private, and cannot be re-exported --> $DIR/macro-private-reexport.rs:14:13 diff --git a/tests/ui/issues/issue-76077-inaccesible-private-fields/issue-76077.rs b/tests/ui/privacy/private-field-struct-construction-76077.rs index 2d29093b01b..7fc3473e8de 100644 --- a/tests/ui/issues/issue-76077-inaccesible-private-fields/issue-76077.rs +++ b/tests/ui/privacy/private-field-struct-construction-76077.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/76077 pub mod foo { pub struct Foo { you_cant_use_this_field: bool, diff --git a/tests/ui/issues/issue-76077-inaccesible-private-fields/issue-76077.stderr b/tests/ui/privacy/private-field-struct-construction-76077.stderr index 3fef5ffce30..5131db72fe3 100644 --- a/tests/ui/issues/issue-76077-inaccesible-private-fields/issue-76077.stderr +++ b/tests/ui/privacy/private-field-struct-construction-76077.stderr @@ -1,5 +1,5 @@ error: cannot construct `Foo` with struct literal syntax due to private fields - --> $DIR/issue-76077.rs:8:5 + --> $DIR/private-field-struct-construction-76077.rs:9:5 | LL | foo::Foo {}; | ^^^^^^^^ diff --git a/tests/ui/issues/issue-55376.rs b/tests/ui/privacy/pub-restricted-path-usage-55376.rs index 5a6862b6530..ca4e27c30a8 100644 --- a/tests/ui/issues/issue-55376.rs +++ b/tests/ui/privacy/pub-restricted-path-usage-55376.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/55376 //@ run-pass // Tests that paths in `pub(...)` don't fail HIR verification. diff --git a/tests/ui/privacy/sealed-traits/false-sealed-traits-note.stderr b/tests/ui/privacy/sealed-traits/false-sealed-traits-note.stderr index df8016565da..c3cfaed3e43 100644 --- a/tests/ui/privacy/sealed-traits/false-sealed-traits-note.stderr +++ b/tests/ui/privacy/sealed-traits/false-sealed-traits-note.stderr @@ -2,8 +2,13 @@ error[E0277]: the trait bound `Struct: TraitA` is not satisfied --> $DIR/false-sealed-traits-note.rs:12:24 | LL | impl inner::TraitB for Struct {} - | ^^^^^^ the trait `TraitA` is not implemented for `Struct` + | ^^^^^^ unsatisfied trait bound | +help: the trait `TraitA` is not implemented for `Struct` + --> $DIR/false-sealed-traits-note.rs:10:1 + | +LL | struct Struct; + | ^^^^^^^^^^^^^ help: this trait has no implementations, consider adding one --> $DIR/false-sealed-traits-note.rs:5:5 | @@ -19,8 +24,13 @@ error[E0277]: the trait bound `C: A` is not satisfied --> $DIR/false-sealed-traits-note.rs:20:16 | LL | impl B for C {} - | ^ the trait `A` is not implemented for `C` + | ^ unsatisfied trait bound + | +help: the trait `A` is not implemented for `C` + --> $DIR/false-sealed-traits-note.rs:19:5 | +LL | pub struct C; + | ^^^^^^^^^^^^ help: this trait has no implementations, consider adding one --> $DIR/false-sealed-traits-note.rs:16:5 | diff --git a/tests/ui/privacy/sealed-traits/sealed-trait-local.stderr b/tests/ui/privacy/sealed-traits/sealed-trait-local.stderr index a7f77a1c0c0..4d00d067d75 100644 --- a/tests/ui/privacy/sealed-traits/sealed-trait-local.stderr +++ b/tests/ui/privacy/sealed-traits/sealed-trait-local.stderr @@ -2,8 +2,13 @@ error[E0277]: the trait bound `S: b::Hidden` is not satisfied --> $DIR/sealed-trait-local.rs:52:20 | LL | impl a::Sealed for S {} - | ^ the trait `b::Hidden` is not implemented for `S` + | ^ unsatisfied trait bound | +help: the trait `b::Hidden` is not implemented for `S` + --> $DIR/sealed-trait-local.rs:51:1 + | +LL | struct S; + | ^^^^^^^^ note: required by a bound in `a::Sealed` --> $DIR/sealed-trait-local.rs:3:23 | @@ -17,8 +22,13 @@ error[E0277]: the trait bound `S: d::Hidden` is not satisfied --> $DIR/sealed-trait-local.rs:53:20 | LL | impl c::Sealed for S {} - | ^ the trait `d::Hidden` is not implemented for `S` + | ^ unsatisfied trait bound + | +help: the trait `d::Hidden` is not implemented for `S` + --> $DIR/sealed-trait-local.rs:51:1 | +LL | struct S; + | ^^^^^^^^ note: required by a bound in `c::Sealed` --> $DIR/sealed-trait-local.rs:17:23 | @@ -33,8 +43,13 @@ error[E0277]: the trait bound `S: f::Hidden` is not satisfied --> $DIR/sealed-trait-local.rs:54:20 | LL | impl e::Sealed for S {} - | ^ the trait `f::Hidden` is not implemented for `S` + | ^ unsatisfied trait bound + | +help: the trait `f::Hidden` is not implemented for `S` + --> $DIR/sealed-trait-local.rs:51:1 | +LL | struct S; + | ^^^^^^^^ note: required by a bound in `e::Sealed` --> $DIR/sealed-trait-local.rs:35:23 | diff --git a/tests/ui/privacy/suggest-box-new.stderr b/tests/ui/privacy/suggest-box-new.stderr index 6c47b52c9de..2b48e9046bf 100644 --- a/tests/ui/privacy/suggest-box-new.stderr +++ b/tests/ui/privacy/suggest-box-new.stderr @@ -3,10 +3,10 @@ error[E0423]: expected function, tuple struct or tuple variant, found struct `st | LL | let _ = std::collections::HashMap(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | --> $SRC_DIR/std/src/collections/hash/map.rs:LL:COL | = note: `std::collections::HashMap` defined here - | help: you might have meant to use an associated function to build this type | LL | let _ = std::collections::HashMap::new(); diff --git a/tests/ui/proc-macro/derive-helper-shadowing.stderr b/tests/ui/proc-macro/derive-helper-shadowing.stderr index 65989375ab5..2e4ddd19b7e 100644 --- a/tests/ui/proc-macro/derive-helper-shadowing.stderr +++ b/tests/ui/proc-macro/derive-helper-shadowing.stderr @@ -69,7 +69,7 @@ LL | #[derive(Empty)] | = 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 #79202 <https://github.com/rust-lang/rust/issues/79202> - = note: `#[deny(legacy_derive_helpers)]` on by default + = note: `#[deny(legacy_derive_helpers)]` (part of `#[deny(future_incompatible)]`) on by default error: aborting due to 5 previous errors @@ -86,5 +86,5 @@ LL | #[derive(Empty)] | = 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 #79202 <https://github.com/rust-lang/rust/issues/79202> - = note: `#[deny(legacy_derive_helpers)]` on by default + = note: `#[deny(legacy_derive_helpers)]` (part of `#[deny(future_incompatible)]`) on by default diff --git a/tests/ui/proc-macro/generate-mod.stderr b/tests/ui/proc-macro/generate-mod.stderr index cbe6b14ca9a..142ff1abeed 100644 --- a/tests/ui/proc-macro/generate-mod.stderr +++ b/tests/ui/proc-macro/generate-mod.stderr @@ -46,7 +46,7 @@ LL | #[derive(generate_mod::CheckDerive)] | = 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 #83583 <https://github.com/rust-lang/rust/issues/83583> - = note: `#[deny(proc_macro_derive_resolution_fallback)]` on by default + = note: `#[deny(proc_macro_derive_resolution_fallback)]` (part of `#[deny(future_incompatible)]`) on by default = note: this error originates in the derive macro `generate_mod::CheckDerive` (in Nightly builds, run with -Z macro-backtrace for more info) error: cannot find type `OuterDerive` in this scope @@ -91,7 +91,7 @@ LL | #[derive(generate_mod::CheckDerive)] | = 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 #83583 <https://github.com/rust-lang/rust/issues/83583> - = note: `#[deny(proc_macro_derive_resolution_fallback)]` on by default + = note: `#[deny(proc_macro_derive_resolution_fallback)]` (part of `#[deny(future_incompatible)]`) on by default = note: this error originates in the derive macro `generate_mod::CheckDerive` (in Nightly builds, run with -Z macro-backtrace for more info) Future breakage diagnostic: @@ -103,7 +103,7 @@ LL | #[derive(generate_mod::CheckDerive)] | = 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 #83583 <https://github.com/rust-lang/rust/issues/83583> - = note: `#[deny(proc_macro_derive_resolution_fallback)]` on by default + = note: `#[deny(proc_macro_derive_resolution_fallback)]` (part of `#[deny(future_incompatible)]`) on by default = note: this error originates in the derive macro `generate_mod::CheckDerive` (in Nightly builds, run with -Z macro-backtrace for more info) Future breakage diagnostic: @@ -115,7 +115,7 @@ LL | #[derive(generate_mod::CheckDerive)] | = 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 #83583 <https://github.com/rust-lang/rust/issues/83583> - = note: `#[deny(proc_macro_derive_resolution_fallback)]` on by default + = note: `#[deny(proc_macro_derive_resolution_fallback)]` (part of `#[deny(future_incompatible)]`) on by default = note: this error originates in the derive macro `generate_mod::CheckDerive` (in Nightly builds, run with -Z macro-backtrace for more info) Future breakage diagnostic: @@ -127,7 +127,7 @@ LL | #[derive(generate_mod::CheckDerive)] | = 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 #83583 <https://github.com/rust-lang/rust/issues/83583> - = note: `#[deny(proc_macro_derive_resolution_fallback)]` on by default + = note: `#[deny(proc_macro_derive_resolution_fallback)]` (part of `#[deny(future_incompatible)]`) on by default = note: this error originates in the derive macro `generate_mod::CheckDerive` (in Nightly builds, run with -Z macro-backtrace for more info) Future breakage diagnostic: diff --git a/tests/ui/proc-macro/helper-attr-blocked-by-import-ambig.stderr b/tests/ui/proc-macro/helper-attr-blocked-by-import-ambig.stderr index df7951464fb..88e829521f9 100644 --- a/tests/ui/proc-macro/helper-attr-blocked-by-import-ambig.stderr +++ b/tests/ui/proc-macro/helper-attr-blocked-by-import-ambig.stderr @@ -28,7 +28,7 @@ LL | #[derive(Empty)] | = 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 #79202 <https://github.com/rust-lang/rust/issues/79202> - = note: `#[deny(legacy_derive_helpers)]` on by default + = note: `#[deny(legacy_derive_helpers)]` (part of `#[deny(future_incompatible)]`) on by default error: aborting due to 2 previous errors @@ -45,5 +45,5 @@ LL | #[derive(Empty)] | = 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 #79202 <https://github.com/rust-lang/rust/issues/79202> - = note: `#[deny(legacy_derive_helpers)]` on by default + = note: `#[deny(legacy_derive_helpers)]` (part of `#[deny(future_incompatible)]`) on by default diff --git a/tests/ui/proc-macro/issue-104884-trait-impl-sugg-err.stderr b/tests/ui/proc-macro/issue-104884-trait-impl-sugg-err.stderr index c12c8d03361..f3ed9e5761d 100644 --- a/tests/ui/proc-macro/issue-104884-trait-impl-sugg-err.stderr +++ b/tests/ui/proc-macro/issue-104884-trait-impl-sugg-err.stderr @@ -4,7 +4,11 @@ error[E0277]: can't compare `PriorityQueue<T>` with `PriorityQueue<T>` LL | #[derive(PartialOrd, AddImpl)] | ^^^^^^^^^^ no implementation for `PriorityQueue<T> == PriorityQueue<T>` | - = help: the trait `PartialEq` is not implemented for `PriorityQueue<T>` +help: the trait `PartialEq` is not implemented for `PriorityQueue<T>` + --> $DIR/issue-104884-trait-impl-sugg-err.rs:20:1 + | +LL | struct PriorityQueue<T>(BinaryHeap<PriorityQueueEntry<T>>); + | ^^^^^^^^^^^^^^^^^^^^^^^ note: required by a bound in `PartialOrd` --> $SRC_DIR/core/src/cmp.rs:LL:COL @@ -12,8 +16,13 @@ error[E0277]: the trait bound `PriorityQueue<T>: Eq` is not satisfied --> $DIR/issue-104884-trait-impl-sugg-err.rs:13:22 | LL | #[derive(PartialOrd, AddImpl)] - | ^^^^^^^ the trait `Eq` is not implemented for `PriorityQueue<T>` + | ^^^^^^^ unsatisfied trait bound | +help: the trait `Eq` is not implemented for `PriorityQueue<T>` + --> $DIR/issue-104884-trait-impl-sugg-err.rs:20:1 + | +LL | struct PriorityQueue<T>(BinaryHeap<PriorityQueueEntry<T>>); + | ^^^^^^^^^^^^^^^^^^^^^^^ note: required by a bound in `Ord` --> $SRC_DIR/core/src/cmp.rs:LL:COL = note: this error originates in the derive macro `AddImpl` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/tests/ui/proc-macro/parent-source-spans.stderr b/tests/ui/proc-macro/parent-source-spans.stderr index a3b27fd7bcc..db1eed5e458 100644 --- a/tests/ui/proc-macro/parent-source-spans.stderr +++ b/tests/ui/proc-macro/parent-source-spans.stderr @@ -144,6 +144,7 @@ LL | parent_source_spans!($($tokens)*); ... LL | one!("hello", "world"); | ---------------------- in this macro invocation + | --> $SRC_DIR/core/src/result.rs:LL:COL | = note: similarly named tuple variant `Ok` defined here @@ -158,6 +159,7 @@ LL | parent_source_spans!($($tokens)*); ... LL | two!("yay", "rust"); | ------------------- in this macro invocation + | --> $SRC_DIR/core/src/result.rs:LL:COL | = note: similarly named tuple variant `Ok` defined here @@ -172,6 +174,7 @@ LL | parent_source_spans!($($tokens)*); ... LL | three!("hip", "hop"); | -------------------- in this macro invocation + | --> $SRC_DIR/core/src/result.rs:LL:COL | = note: similarly named tuple variant `Ok` defined here diff --git a/tests/ui/proc-macro/proc-macro-attributes.stderr b/tests/ui/proc-macro/proc-macro-attributes.stderr index 892728901fb..6a1387a3b1c 100644 --- a/tests/ui/proc-macro/proc-macro-attributes.stderr +++ b/tests/ui/proc-macro/proc-macro-attributes.stderr @@ -93,7 +93,7 @@ LL | #[derive(B)] | = 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 #79202 <https://github.com/rust-lang/rust/issues/79202> - = note: `#[deny(legacy_derive_helpers)]` on by default + = note: `#[deny(legacy_derive_helpers)]` (part of `#[deny(future_incompatible)]`) on by default error: derive helper attribute is used before it is introduced --> $DIR/proc-macro-attributes.rs:10:3 @@ -146,7 +146,7 @@ LL | #[derive(B)] | = 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 #79202 <https://github.com/rust-lang/rust/issues/79202> - = note: `#[deny(legacy_derive_helpers)]` on by default + = note: `#[deny(legacy_derive_helpers)]` (part of `#[deny(future_incompatible)]`) on by default Future breakage diagnostic: error: derive helper attribute is used before it is introduced @@ -160,7 +160,7 @@ LL | #[derive(B)] | = 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 #79202 <https://github.com/rust-lang/rust/issues/79202> - = note: `#[deny(legacy_derive_helpers)]` on by default + = note: `#[deny(legacy_derive_helpers)]` (part of `#[deny(future_incompatible)]`) on by default Future breakage diagnostic: error: derive helper attribute is used before it is introduced @@ -174,7 +174,7 @@ LL | #[derive(B)] | = 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 #79202 <https://github.com/rust-lang/rust/issues/79202> - = note: `#[deny(legacy_derive_helpers)]` on by default + = note: `#[deny(legacy_derive_helpers)]` (part of `#[deny(future_incompatible)]`) on by default Future breakage diagnostic: error: derive helper attribute is used before it is introduced @@ -188,5 +188,5 @@ LL | #[derive(B)] | = 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 #79202 <https://github.com/rust-lang/rust/issues/79202> - = note: `#[deny(legacy_derive_helpers)]` on by default + = note: `#[deny(legacy_derive_helpers)]` (part of `#[deny(future_incompatible)]`) on by default diff --git a/tests/ui/proc-macro/resolve-error.stderr b/tests/ui/proc-macro/resolve-error.stderr index 963298311ef..45b71a3e7b3 100644 --- a/tests/ui/proc-macro/resolve-error.stderr +++ b/tests/ui/proc-macro/resolve-error.stderr @@ -76,6 +76,7 @@ error: cannot find derive macro `Dlone` in this scope | LL | #[derive(Dlone)] | ^^^^^ help: a derive macro with a similar name exists: `Clone` + | --> $SRC_DIR/core/src/clone.rs:LL:COL | = note: similarly named derive macro `Clone` defined here @@ -85,6 +86,7 @@ error: cannot find derive macro `Dlone` in this scope | LL | #[derive(Dlone)] | ^^^^^ help: a derive macro with a similar name exists: `Clone` + | --> $SRC_DIR/core/src/clone.rs:LL:COL | = note: similarly named derive macro `Clone` defined here diff --git a/tests/ui/pub/pub-reexport-priv-extern-crate.stderr b/tests/ui/pub/pub-reexport-priv-extern-crate.stderr index 9bb64a3325b..dbb080e1b09 100644 --- a/tests/ui/pub/pub-reexport-priv-extern-crate.stderr +++ b/tests/ui/pub/pub-reexport-priv-extern-crate.stderr @@ -30,7 +30,7 @@ LL | pub use core as reexported_core; | = 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 #127909 <https://github.com/rust-lang/rust/issues/127909> - = note: `#[deny(pub_use_of_private_extern_crate)]` on by default + = note: `#[deny(pub_use_of_private_extern_crate)]` (part of `#[deny(future_incompatible)]`) on by default help: consider making the `extern crate` item publicly accessible | LL | pub extern crate core; @@ -49,7 +49,7 @@ LL | pub use core as reexported_core; | = 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 #127909 <https://github.com/rust-lang/rust/issues/127909> - = note: `#[deny(pub_use_of_private_extern_crate)]` on by default + = note: `#[deny(pub_use_of_private_extern_crate)]` (part of `#[deny(future_incompatible)]`) on by default help: consider making the `extern crate` item publicly accessible | LL | pub extern crate core; diff --git a/tests/ui/reachable/expr_cast.rs b/tests/ui/reachable/expr_cast.rs index e8e477ea4f6..aa412c99b2e 100644 --- a/tests/ui/reachable/expr_cast.rs +++ b/tests/ui/reachable/expr_cast.rs @@ -1,13 +1,21 @@ -#![allow(unused_variables)] -#![allow(unused_assignments)] -#![allow(dead_code)] +//@ check-pass +//@ edition: 2024 +// +// Check that we don't warn on `as` casts of never to any as unreachable. +// While they *are* unreachable, sometimes they are required to appeal typeck. #![deny(unreachable_code)] -#![feature(never_type, type_ascription)] fn a() { - // the cast is unreachable: - let x = {return} as !; //~ ERROR unreachable - //~| ERROR non-primitive cast + _ = {return} as u32; } -fn main() { } +fn b() { + (return) as u32; +} + +// example that needs an explicit never-to-any `as` cast +fn example() -> impl Iterator<Item = u8> { + todo!() as std::iter::Empty<_> +} + +fn main() {} diff --git a/tests/ui/reachable/expr_cast.stderr b/tests/ui/reachable/expr_cast.stderr deleted file mode 100644 index 6643f1784a1..00000000000 --- a/tests/ui/reachable/expr_cast.stderr +++ /dev/null @@ -1,24 +0,0 @@ -error: unreachable expression - --> $DIR/expr_cast.rs:9:13 - | -LL | let x = {return} as !; - | ^------^^^^^^ - | || - | |any code following this expression is unreachable - | unreachable expression - | -note: the lint level is defined here - --> $DIR/expr_cast.rs:4:9 - | -LL | #![deny(unreachable_code)] - | ^^^^^^^^^^^^^^^^ - -error[E0605]: non-primitive cast: `()` as `!` - --> $DIR/expr_cast.rs:9:13 - | -LL | let x = {return} as !; - | ^^^^^^^^^^^^^ an `as` expression can only be used to convert between primitive types or to coerce to a specific trait object - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0605`. diff --git a/tests/ui/reachable/unreachable-try-pattern.rs b/tests/ui/reachable/unreachable-try-pattern.rs index 22cbfb95af0..1358722e229 100644 --- a/tests/ui/reachable/unreachable-try-pattern.rs +++ b/tests/ui/reachable/unreachable-try-pattern.rs @@ -18,7 +18,7 @@ fn bar(x: Result<!, i32>) -> Result<u32, i32> { fn foo(x: Result<!, i32>) -> Result<u32, i32> { let y = (match x { Ok(n) => Ok(n as u32), Err(e) => Err(e) })?; //~^ WARN unreachable pattern - //~| WARN unreachable expression + //~| WARN unreachable call Ok(y) } diff --git a/tests/ui/reachable/unreachable-try-pattern.stderr b/tests/ui/reachable/unreachable-try-pattern.stderr index 40b11613105..468af427249 100644 --- a/tests/ui/reachable/unreachable-try-pattern.stderr +++ b/tests/ui/reachable/unreachable-try-pattern.stderr @@ -1,11 +1,10 @@ -warning: unreachable expression - --> $DIR/unreachable-try-pattern.rs:19:36 +warning: unreachable call + --> $DIR/unreachable-try-pattern.rs:19:33 | LL | let y = (match x { Ok(n) => Ok(n as u32), Err(e) => Err(e) })?; - | -^^^^^^^ - | | - | unreachable expression - | any code following this expression is unreachable + | ^^ - any code following this expression is unreachable + | | + | unreachable call | note: the lint level is defined here --> $DIR/unreachable-try-pattern.rs:3:9 diff --git a/tests/ui/issues/issue-8727.rs b/tests/ui/recursion/infinite-function-recursion-error-8727.rs index c1b60e8e085..a4037f76109 100644 --- a/tests/ui/issues/issue-8727.rs +++ b/tests/ui/recursion/infinite-function-recursion-error-8727.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/8727 // Verify the compiler fails with an error on infinite function // recursions. @@ -9,7 +10,6 @@ fn generic<T>() { //~ WARN function cannot return without recursing } //~^^ ERROR reached the recursion limit while instantiating `generic::<Option< - fn main () { // Use generic<T> at least once to trigger instantiation. generic::<i32>(); diff --git a/tests/ui/issues/issue-8727.stderr b/tests/ui/recursion/infinite-function-recursion-error-8727.stderr index 9fb09a7d4f4..13d57ecb3b2 100644 --- a/tests/ui/issues/issue-8727.stderr +++ b/tests/ui/recursion/infinite-function-recursion-error-8727.stderr @@ -1,5 +1,5 @@ warning: function cannot return without recursing - --> $DIR/issue-8727.rs:7:1 + --> $DIR/infinite-function-recursion-error-8727.rs:8: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<...>>>>>` - --> $DIR/issue-8727.rs:8:5 + --> $DIR/infinite-function-recursion-error-8727.rs:9:5 | LL | generic::<Option<T>>(); | ^^^^^^^^^^^^^^^^^^^^^^ | note: `generic` defined here - --> $DIR/issue-8727.rs:7:1 + --> $DIR/infinite-function-recursion-error-8727.rs:8:1 | LL | fn generic<T>() { | ^^^^^^^^^^^^^^^ - = note: the full name for the type has been written to '$TEST_BUILD_DIR/issue-8727.long-type-$LONG_TYPE_HASH.txt' + = note: the full name for the type has been written to '$TEST_BUILD_DIR/infinite-function-recursion-error-8727.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; 1 warning emitted diff --git a/tests/ui/repr/conflicting-repr-hints.stderr b/tests/ui/repr/conflicting-repr-hints.stderr index fbfa69e7fb1..4da3d454e03 100644 --- a/tests/ui/repr/conflicting-repr-hints.stderr +++ b/tests/ui/repr/conflicting-repr-hints.stderr @@ -6,7 +6,7 @@ LL | #[repr(C, u64)] | = 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 #68585 <https://github.com/rust-lang/rust/issues/68585> - = note: `#[deny(conflicting_repr_hints)]` on by default + = note: `#[deny(conflicting_repr_hints)]` (part of `#[deny(future_incompatible)]`) on by default error[E0566]: conflicting representation hints --> $DIR/conflicting-repr-hints.rs:19:8 @@ -90,7 +90,7 @@ LL | #[repr(C, u64)] | = 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 #68585 <https://github.com/rust-lang/rust/issues/68585> - = note: `#[deny(conflicting_repr_hints)]` on by default + = note: `#[deny(conflicting_repr_hints)]` (part of `#[deny(future_incompatible)]`) on by default Future breakage diagnostic: error[E0566]: conflicting representation hints @@ -101,5 +101,5 @@ LL | #[repr(u32, u64)] | = 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 #68585 <https://github.com/rust-lang/rust/issues/68585> - = note: `#[deny(conflicting_repr_hints)]` on by default + = note: `#[deny(conflicting_repr_hints)]` (part of `#[deny(future_incompatible)]`) on by default diff --git a/tests/ui/issues/issue-53728.rs b/tests/ui/repr/packed-struct-with-enum-53728.rs index 364965228c6..6ce65ed634f 100644 --- a/tests/ui/issues/issue-53728.rs +++ b/tests/ui/repr/packed-struct-with-enum-53728.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/53728 //@ run-pass #![allow(dead_code)] diff --git a/tests/ui/issues/issue-6936.rs b/tests/ui/resolve/duplicate-name-in-module-6936.rs index e9aa80b4eb3..ae9282c0c24 100644 --- a/tests/ui/issues/issue-6936.rs +++ b/tests/ui/resolve/duplicate-name-in-module-6936.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/6936 struct T; mod t1 { @@ -30,5 +31,4 @@ mod t6 { impl Foo {} // ok } - fn main() {} diff --git a/tests/ui/issues/issue-6936.stderr b/tests/ui/resolve/duplicate-name-in-module-6936.stderr index 03cc50636b4..76bb8f57386 100644 --- a/tests/ui/issues/issue-6936.stderr +++ b/tests/ui/resolve/duplicate-name-in-module-6936.stderr @@ -1,5 +1,5 @@ error[E0428]: the name `Foo` is defined multiple times - --> $DIR/issue-6936.rs:5:5 + --> $DIR/duplicate-name-in-module-6936.rs:6:5 | LL | type Foo = crate::T; | -------------------- previous definition of the type `Foo` here @@ -9,7 +9,7 @@ LL | mod Foo {} = note: `Foo` must be defined only once in the type namespace of this module error[E0428]: the name `Foo` is defined multiple times - --> $DIR/issue-6936.rs:10:5 + --> $DIR/duplicate-name-in-module-6936.rs:11:5 | LL | type Foo = crate::T; | -------------------- previous definition of the type `Foo` here @@ -19,7 +19,7 @@ LL | struct Foo; = note: `Foo` must be defined only once in the type namespace of this module error[E0428]: the name `Foo` is defined multiple times - --> $DIR/issue-6936.rs:15:5 + --> $DIR/duplicate-name-in-module-6936.rs:16:5 | LL | type Foo = crate::T; | -------------------- previous definition of the type `Foo` here @@ -29,7 +29,7 @@ LL | enum Foo {} = note: `Foo` must be defined only once in the type namespace of this module error[E0428]: the name `Bar` is defined multiple times - --> $DIR/issue-6936.rs:25:5 + --> $DIR/duplicate-name-in-module-6936.rs:26:5 | LL | type Bar<T> = T; | ---------------- previous definition of the type `Bar` here diff --git a/tests/ui/resolve/issue-102946.rs b/tests/ui/resolve/issue-102946.rs index c6feca6f32f..8d90e61bb5d 100644 --- a/tests/ui/resolve/issue-102946.rs +++ b/tests/ui/resolve/issue-102946.rs @@ -1,7 +1,6 @@ impl Error for str::Utf8Error { //~^ ERROR cannot find trait `Error` in this scope //~| ERROR ambiguous associated type - fn description(&self) {} } fn main() {} diff --git a/tests/ui/resolve/levenshtein.stderr b/tests/ui/resolve/levenshtein.stderr index cf478210132..7fc5710c35e 100644 --- a/tests/ui/resolve/levenshtein.stderr +++ b/tests/ui/resolve/levenshtein.stderr @@ -18,6 +18,7 @@ error[E0412]: cannot find type `Opiton` in this scope | LL | type B = Opiton<u8>; // Misspelled type name from the prelude. | ^^^^^^ help: an enum with a similar name exists: `Option` + | --> $SRC_DIR/core/src/option.rs:LL:COL | = note: similarly named enum `Option` defined here diff --git a/tests/ui/resolve/path-attr-in-const-block.rs b/tests/ui/resolve/path-attr-in-const-block.rs index 69be65bda3f..0ca356b1ddf 100644 --- a/tests/ui/resolve/path-attr-in-const-block.rs +++ b/tests/ui/resolve/path-attr-in-const-block.rs @@ -5,6 +5,6 @@ fn main() { const { #![path = foo!()] //~^ ERROR: cannot find macro `foo` in this scope - //~| ERROR malformed `path` attribute input + //~| ERROR: attribute value must be a literal } } diff --git a/tests/ui/resolve/path-attr-in-const-block.stderr b/tests/ui/resolve/path-attr-in-const-block.stderr index f3ae5b60c4f..19d2745577b 100644 --- a/tests/ui/resolve/path-attr-in-const-block.stderr +++ b/tests/ui/resolve/path-attr-in-const-block.stderr @@ -4,17 +4,11 @@ error: cannot find macro `foo` in this scope LL | #![path = foo!()] | ^^^ -error[E0539]: malformed `path` attribute input - --> $DIR/path-attr-in-const-block.rs:6:9 +error: attribute value must be a literal + --> $DIR/path-attr-in-const-block.rs:6:19 | LL | #![path = foo!()] - | ^^^^^^^^^^------^ - | | | - | | expected a string literal here - | help: must be of the form: `#[path = "file"]` - | - = note: for more information, visit <https://doc.rust-lang.org/reference/items/modules.html#the-path-attribute> + | ^^^^^^ error: aborting due to 2 previous errors -For more information about this error, try `rustc --explain E0539`. diff --git a/tests/ui/issues/issue-7044.rs b/tests/ui/resolve/unit-like-struct-masks-constant-7044.rs index a6e22bc5237..f48dd695f01 100644 --- a/tests/ui/issues/issue-7044.rs +++ b/tests/ui/resolve/unit-like-struct-masks-constant-7044.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/7044 static X: isize = 0; struct X; //~ ERROR the name `X` is defined multiple times diff --git a/tests/ui/issues/issue-7044.stderr b/tests/ui/resolve/unit-like-struct-masks-constant-7044.stderr index 9d1fb3a10dd..48aa6fce455 100644 --- a/tests/ui/issues/issue-7044.stderr +++ b/tests/ui/resolve/unit-like-struct-masks-constant-7044.stderr @@ -1,5 +1,5 @@ error[E0428]: the name `X` is defined multiple times - --> $DIR/issue-7044.rs:2:1 + --> $DIR/unit-like-struct-masks-constant-7044.rs:3:1 | LL | static X: isize = 0; | -------------------- previous definition of the value `X` here diff --git a/tests/ui/rfcs/rfc-1789-as-cell/from-mut.rs b/tests/ui/rfcs/rfc-1789-as-cell/from-mut.rs index d3b441fbe88..700f875a4f6 100644 --- a/tests/ui/rfcs/rfc-1789-as-cell/from-mut.rs +++ b/tests/ui/rfcs/rfc-1789-as-cell/from-mut.rs @@ -1,7 +1,5 @@ //@ run-pass -#![feature(as_array_of_cells)] - use std::cell::Cell; fn main() { diff --git a/tests/ui/rfcs/rfc-1937-termination-trait/issue-103052-1.stderr b/tests/ui/rfcs/rfc-1937-termination-trait/issue-103052-1.stderr index 6c3d576cfba..7baa09b02b8 100644 --- a/tests/ui/rfcs/rfc-1937-termination-trait/issue-103052-1.stderr +++ b/tests/ui/rfcs/rfc-1937-termination-trait/issue-103052-1.stderr @@ -2,10 +2,15 @@ error[E0277]: the trait bound `Something: Termination` is not satisfied --> $DIR/issue-103052-1.rs:10:13 | LL | receive(Something); - | ------- ^^^^^^^^^ the trait `Termination` is not implemented for `Something` + | ------- ^^^^^^^^^ unsatisfied trait bound | | | required by a bound introduced by this call | +help: the trait `Termination` is not implemented for `Something` + --> $DIR/issue-103052-1.rs:7:1 + | +LL | struct Something; + | ^^^^^^^^^^^^^^^^ note: required by a bound in `receive` --> $DIR/issue-103052-1.rs:5:20 | diff --git a/tests/ui/rfcs/rfc-1937-termination-trait/issue-103052-2.stderr b/tests/ui/rfcs/rfc-1937-termination-trait/issue-103052-2.stderr index 99fd83e7b6f..643e3d3b680 100644 --- a/tests/ui/rfcs/rfc-1937-termination-trait/issue-103052-2.stderr +++ b/tests/ui/rfcs/rfc-1937-termination-trait/issue-103052-2.stderr @@ -2,8 +2,13 @@ error[E0277]: the trait bound `Something: Termination` is not satisfied --> $DIR/issue-103052-2.rs:9:22 | LL | fn main() -> Something { - | ^^^^^^^^^ the trait `Termination` is not implemented for `Something` + | ^^^^^^^^^ unsatisfied trait bound | +help: the trait `Termination` is not implemented for `Something` + --> $DIR/issue-103052-2.rs:6:5 + | +LL | struct Something; + | ^^^^^^^^^^^^^^^^ note: required by a bound in `Main::main::{anon_assoc#0}` --> $DIR/issue-103052-2.rs:3:27 | diff --git a/tests/ui/rfcs/rfc-1937-termination-trait/termination-trait-not-satisfied.stderr b/tests/ui/rfcs/rfc-1937-termination-trait/termination-trait-not-satisfied.stderr index 1b842c206ee..e799ba3f1b9 100644 --- a/tests/ui/rfcs/rfc-1937-termination-trait/termination-trait-not-satisfied.stderr +++ b/tests/ui/rfcs/rfc-1937-termination-trait/termination-trait-not-satisfied.stderr @@ -4,7 +4,11 @@ error[E0277]: `main` has invalid return type `ReturnType` LL | fn main() -> ReturnType { | ^^^^^^^^^^ `main` can only return types that implement `Termination` | - = help: consider using `()`, or a `Result` +help: consider using `()`, or a `Result` + --> $DIR/termination-trait-not-satisfied.rs:1:1 + | +LL | struct ReturnType {} + | ^^^^^^^^^^^^^^^^^ error: aborting due to 1 previous error diff --git a/tests/ui/rfcs/rfc-2008-non-exhaustive/invalid-attribute.stderr b/tests/ui/rfcs/rfc-2008-non-exhaustive/invalid-attribute.stderr index 3522c459977..98e8f1235e6 100644 --- a/tests/ui/rfcs/rfc-2008-non-exhaustive/invalid-attribute.stderr +++ b/tests/ui/rfcs/rfc-2008-non-exhaustive/invalid-attribute.stderr @@ -13,7 +13,7 @@ error: `#[non_exhaustive]` attribute cannot be used on traits LL | #[non_exhaustive] | ^^^^^^^^^^^^^^^^^ | - = help: `#[non_exhaustive]` can be applied to data types, enum variants + = help: `#[non_exhaustive]` can be applied to data types and enum variants error: `#[non_exhaustive]` attribute cannot be used on unions --> $DIR/invalid-attribute.rs:9:1 @@ -21,7 +21,7 @@ error: `#[non_exhaustive]` attribute cannot be used on unions LL | #[non_exhaustive] | ^^^^^^^^^^^^^^^^^ | - = help: `#[non_exhaustive]` can be applied to data types, enum variants + = help: `#[non_exhaustive]` can be applied to data types and enum variants error: aborting due to 3 previous errors diff --git a/tests/ui/rfcs/rfc-2091-track-caller/file-is-nul-terminated.rs b/tests/ui/rfcs/rfc-2091-track-caller/file-is-nul-terminated.rs index 65e61a21f1a..7902f40b09b 100644 --- a/tests/ui/rfcs/rfc-2091-track-caller/file-is-nul-terminated.rs +++ b/tests/ui/rfcs/rfc-2091-track-caller/file-is-nul-terminated.rs @@ -5,12 +5,12 @@ const fn assert_file_has_trailing_zero() { let caller = core::panic::Location::caller(); let file_str = caller.file(); - let file_with_nul = caller.file_with_nul(); - if file_str.len() != file_with_nul.count_bytes() { + let file_cstr = caller.file_as_c_str(); + if file_str.len() != file_cstr.count_bytes() { panic!("mismatched lengths"); } let trailing_byte: core::ffi::c_char = unsafe { - *file_with_nul.as_ptr().offset(file_with_nul.count_bytes() as _) + *file_cstr.as_ptr().offset(file_cstr.count_bytes() as _) }; if trailing_byte != 0 { panic!("trailing byte was nonzero") diff --git a/tests/ui/rfcs/rfc-2497-if-let-chains/protect-precedences.stderr b/tests/ui/rfcs/rfc-2497-if-let-chains/protect-precedences.stderr index 24b35a2ab31..689ccb4bc9a 100644 --- a/tests/ui/rfcs/rfc-2497-if-let-chains/protect-precedences.stderr +++ b/tests/ui/rfcs/rfc-2497-if-let-chains/protect-precedences.stderr @@ -6,7 +6,7 @@ LL | if let _ = return true && false {}; | | | any code following this expression is unreachable | - = note: `#[warn(unreachable_code)]` on by default + = note: `#[warn(unreachable_code)]` (part of `#[warn(unused)]`) on by default warning: 1 warning emitted diff --git a/tests/ui/rfcs/type-alias-impl-trait/higher-ranked-regions-basic.rs b/tests/ui/rfcs/type-alias-impl-trait/higher-ranked-regions-basic.rs index 80a4ab35527..5fa13152653 100644 --- a/tests/ui/rfcs/type-alias-impl-trait/higher-ranked-regions-basic.rs +++ b/tests/ui/rfcs/type-alias-impl-trait/higher-ranked-regions-basic.rs @@ -31,6 +31,7 @@ mod capture_tait { #[define_opaque(Opq2)] fn test() -> Opq2 {} //~^ ERROR hidden type for `capture_tait::Opq0` captures lifetime that does not appear in bounds + //~| ERROR expected generic lifetime parameter, found `'a` } mod capture_tait_complex_pass { @@ -52,7 +53,8 @@ mod capture_tait_complex_fail { type Opq2 = impl for<'a> Trait<'a, Ty = Opq1<'a>>; #[define_opaque(Opq2)] fn test() -> Opq2 {} - //~^ ERROR hidden type for `capture_tait_complex_fail::Opq0<'a>` captures lifetime that does not appear in bounds + //~^ ERROR expected generic lifetime parameter, found `'a` + //~| ERROR expected generic lifetime parameter, found `'a` } // non-defining use because 'static is used. diff --git a/tests/ui/rfcs/type-alias-impl-trait/higher-ranked-regions-basic.stderr b/tests/ui/rfcs/type-alias-impl-trait/higher-ranked-regions-basic.stderr index 665b9a91696..8e2c02f15c5 100644 --- a/tests/ui/rfcs/type-alias-impl-trait/higher-ranked-regions-basic.stderr +++ b/tests/ui/rfcs/type-alias-impl-trait/higher-ranked-regions-basic.stderr @@ -16,6 +16,15 @@ LL | fn test() -> impl for<'a> Trait<'a, Ty = impl Sized> {} | | opaque type defined here | hidden type `&'a ()` captures the lifetime `'a` as defined here +error[E0792]: expected generic lifetime parameter, found `'a` + --> $DIR/higher-ranked-regions-basic.rs:32:23 + | +LL | type Opq1<'a> = impl for<'b> Trait<'b, Ty = Opq0>; + | -- this generic parameter must be used with a generic lifetime parameter +... +LL | fn test() -> Opq2 {} + | ^^ + error[E0700]: hidden type for `capture_tait::Opq0` captures lifetime that does not appear in bounds --> $DIR/higher-ranked-regions-basic.rs:32:23 | @@ -28,7 +37,7 @@ LL | fn test() -> Opq2 {} | ^^ error[E0792]: expected generic lifetime parameter, found `'a` - --> $DIR/higher-ranked-regions-basic.rs:42:23 + --> $DIR/higher-ranked-regions-basic.rs:43:23 | LL | type Opq1<'a> = impl for<'b> Trait<'b, Ty = Opq0<'b>>; // <- Note 'b | -- this generic parameter must be used with a generic lifetime parameter @@ -37,7 +46,7 @@ LL | fn test() -> Opq2 {} | ^^ error[E0792]: expected generic lifetime parameter, found `'b` - --> $DIR/higher-ranked-regions-basic.rs:42:23 + --> $DIR/higher-ranked-regions-basic.rs:43:23 | LL | type Opq0<'a> = impl Sized; | -- this generic parameter must be used with a generic lifetime parameter @@ -45,19 +54,26 @@ LL | type Opq0<'a> = impl Sized; LL | fn test() -> Opq2 {} | ^^ -error[E0700]: hidden type for `capture_tait_complex_fail::Opq0<'a>` captures lifetime that does not appear in bounds - --> $DIR/higher-ranked-regions-basic.rs:54:23 +error[E0792]: expected generic lifetime parameter, found `'a` + --> $DIR/higher-ranked-regions-basic.rs:55:23 | -LL | type Opq0<'a> = impl Sized; - | ---------- opaque type defined here LL | type Opq1<'a> = impl for<'b> Trait<'b, Ty = Opq0<'a>>; // <- Note 'a - | -- hidden type `&'b ()` captures the lifetime `'b` as defined here + | -- this generic parameter must be used with a generic lifetime parameter +... +LL | fn test() -> Opq2 {} + | ^^ + +error[E0792]: expected generic lifetime parameter, found `'a` + --> $DIR/higher-ranked-regions-basic.rs:55:23 + | +LL | type Opq0<'a> = impl Sized; + | -- this generic parameter must be used with a generic lifetime parameter ... LL | fn test() -> Opq2 {} | ^^ error[E0792]: expected generic lifetime parameter, found `'a` - --> $DIR/higher-ranked-regions-basic.rs:63:65 + --> $DIR/higher-ranked-regions-basic.rs:65:65 | LL | type Opq0<'a, 'b> = impl Sized; | -- this generic parameter must be used with a generic lifetime parameter @@ -66,7 +82,7 @@ LL | fn test() -> impl for<'a> Trait<'a, Ty = Opq0<'a, 'static>> {} | ^^ error[E0792]: expected generic lifetime parameter, found `'a` - --> $DIR/higher-ranked-regions-basic.rs:72:60 + --> $DIR/higher-ranked-regions-basic.rs:74:60 | LL | type Opq0<'a, 'b> = impl Sized; | -- this generic parameter must be used with a generic lifetime parameter @@ -75,7 +91,7 @@ LL | fn test() -> impl for<'a> Trait<'a, Ty = Opq0<'a, 'a>> {} | ^^ error[E0792]: expected generic lifetime parameter, found `'a` - --> $DIR/higher-ranked-regions-basic.rs:82:23 + --> $DIR/higher-ranked-regions-basic.rs:84:23 | LL | type Opq1<'a> = impl for<'b> Trait<'b, Ty = Opq0<'a, 'b>>; | -- this generic parameter must be used with a generic lifetime parameter @@ -84,7 +100,7 @@ LL | fn test() -> Opq2 {} | ^^ error[E0792]: expected generic lifetime parameter, found `'a` - --> $DIR/higher-ranked-regions-basic.rs:82:23 + --> $DIR/higher-ranked-regions-basic.rs:84:23 | LL | type Opq0<'a, 'b> = impl Sized; | -- this generic parameter must be used with a generic lifetime parameter @@ -92,7 +108,7 @@ LL | type Opq0<'a, 'b> = impl Sized; LL | fn test() -> Opq2 {} | ^^ -error: aborting due to 10 previous errors +error: aborting due to 12 previous errors Some errors have detailed explanations: E0700, E0792. For more information about an error, try `rustc --explain E0700`. diff --git a/tests/ui/rust-2018/uniform-paths/macro-rules.stderr b/tests/ui/rust-2018/uniform-paths/macro-rules.stderr index 661d667eb9a..43eacd5413f 100644 --- a/tests/ui/rust-2018/uniform-paths/macro-rules.stderr +++ b/tests/ui/rust-2018/uniform-paths/macro-rules.stderr @@ -9,6 +9,10 @@ help: consider adding a `#[macro_export]` to the macro in the imported module | LL | macro_rules! legacy_macro { () => () } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +help: in case you want to use the macro within this crate only, reduce the visibility to `pub(crate)` + | +LL | pub(crate) use legacy_macro as _; + | +++++++ error: aborting due to 1 previous error diff --git a/tests/ui/sanitize-attr/invalid-sanitize.rs b/tests/ui/sanitize-attr/invalid-sanitize.rs new file mode 100644 index 00000000000..957ce780ad0 --- /dev/null +++ b/tests/ui/sanitize-attr/invalid-sanitize.rs @@ -0,0 +1,21 @@ +#![feature(sanitize)] + +#[sanitize(brontosaurus = "off")] //~ ERROR malformed `sanitize` attribute input +fn main() {} + +#[sanitize(address = "off")] //~ ERROR multiple `sanitize` attributes +#[sanitize(address = "off")] +fn multiple_consistent() {} + +#[sanitize(address = "on")] //~ ERROR multiple `sanitize` attributes +#[sanitize(address = "off")] +fn multiple_inconsistent() {} + +#[sanitize(address = "bogus")] //~ ERROR malformed `sanitize` attribute input +fn wrong_value() {} + +#[sanitize = "off"] //~ ERROR malformed `sanitize` attribute input +fn name_value() {} + +#[sanitize] //~ ERROR malformed `sanitize` attribute input +fn just_word() {} diff --git a/tests/ui/sanitize-attr/invalid-sanitize.stderr b/tests/ui/sanitize-attr/invalid-sanitize.stderr new file mode 100644 index 00000000000..ec0a93be142 --- /dev/null +++ b/tests/ui/sanitize-attr/invalid-sanitize.stderr @@ -0,0 +1,115 @@ +error[E0539]: malformed `sanitize` attribute input + --> $DIR/invalid-sanitize.rs:3:1 + | +LL | #[sanitize(brontosaurus = "off")] + | ^^^^^^^^^^^------------^^^^^^^^^^ + | | + | valid arguments are "address", "cfi", "kcfi", "memory", "memtag", "shadow_call_stack", "thread" or "hwaddress" + | +help: try changing it to one of the following valid forms of the attribute + | +LL - #[sanitize(brontosaurus = "off")] +LL + #[sanitize(address = "on|off")] + | +LL - #[sanitize(brontosaurus = "off")] +LL + #[sanitize(cfi = "on|off")] + | +LL - #[sanitize(brontosaurus = "off")] +LL + #[sanitize(hwaddress = "on|off")] + | +LL - #[sanitize(brontosaurus = "off")] +LL + #[sanitize(kcfi = "on|off")] + | + = and 5 other candidates + +error: multiple `sanitize` attributes + --> $DIR/invalid-sanitize.rs:6:1 + | +LL | #[sanitize(address = "off")] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute + | +note: attribute also specified here + --> $DIR/invalid-sanitize.rs:7:1 + | +LL | #[sanitize(address = "off")] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: multiple `sanitize` attributes + --> $DIR/invalid-sanitize.rs:10:1 + | +LL | #[sanitize(address = "on")] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute + | +note: attribute also specified here + --> $DIR/invalid-sanitize.rs:11:1 + | +LL | #[sanitize(address = "off")] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error[E0539]: malformed `sanitize` attribute input + --> $DIR/invalid-sanitize.rs:14:1 + | +LL | #[sanitize(address = "bogus")] + | ^^^^^^^^^^^^^^^^^^^^^-------^^ + | | + | valid arguments are "on" or "off" + | +help: try changing it to one of the following valid forms of the attribute + | +LL - #[sanitize(address = "bogus")] +LL + #[sanitize(address = "on|off")] + | +LL - #[sanitize(address = "bogus")] +LL + #[sanitize(cfi = "on|off")] + | +LL - #[sanitize(address = "bogus")] +LL + #[sanitize(hwaddress = "on|off")] + | +LL - #[sanitize(address = "bogus")] +LL + #[sanitize(kcfi = "on|off")] + | + = and 5 other candidates + +error[E0539]: malformed `sanitize` attribute input + --> $DIR/invalid-sanitize.rs:17:1 + | +LL | #[sanitize = "off"] + | ^^^^^^^^^^^^^^^^^^^ expected this to be a list + | +help: try changing it to one of the following valid forms of the attribute + | +LL - #[sanitize = "off"] +LL + #[sanitize(address = "on|off")] + | +LL - #[sanitize = "off"] +LL + #[sanitize(cfi = "on|off")] + | +LL - #[sanitize = "off"] +LL + #[sanitize(hwaddress = "on|off")] + | +LL - #[sanitize = "off"] +LL + #[sanitize(kcfi = "on|off")] + | + = and 5 other candidates + +error[E0539]: malformed `sanitize` attribute input + --> $DIR/invalid-sanitize.rs:20:1 + | +LL | #[sanitize] + | ^^^^^^^^^^^ expected this to be a list + | +help: try changing it to one of the following valid forms of the attribute + | +LL | #[sanitize(address = "on|off")] + | ++++++++++++++++++++ +LL | #[sanitize(cfi = "on|off")] + | ++++++++++++++++ +LL | #[sanitize(hwaddress = "on|off")] + | ++++++++++++++++++++++ +LL | #[sanitize(kcfi = "on|off")] + | +++++++++++++++++ + = and 5 other candidates + +error: aborting due to 6 previous errors + +For more information about this error, try `rustc --explain E0539`. diff --git a/tests/ui/sanitize-attr/valid-sanitize.rs b/tests/ui/sanitize-attr/valid-sanitize.rs new file mode 100644 index 00000000000..ebe76fcba04 --- /dev/null +++ b/tests/ui/sanitize-attr/valid-sanitize.rs @@ -0,0 +1,115 @@ +//! Tests where the `#[sanitize(..)]` attribute can and cannot be used. + +#![feature(sanitize)] +#![feature(extern_types)] +#![feature(impl_trait_in_assoc_type)] +#![warn(unused_attributes)] +#![sanitize(address = "off", thread = "on")] + +#[sanitize(address = "off", thread = "on")] +mod submod {} + +#[sanitize(address = "off")] +static FOO: u32 = 0; + +#[sanitize(thread = "off")] //~ ERROR sanitize attribute not allowed here +static BAR: u32 = 0; + +#[sanitize(address = "off")] //~ ERROR sanitize attribute not allowed here +type MyTypeAlias = (); + +#[sanitize(address = "off")] //~ ERROR sanitize attribute not allowed here +trait MyTrait { + #[sanitize(address = "off")] //~ ERROR sanitize attribute not allowed here + const TRAIT_ASSOC_CONST: u32; + + #[sanitize(address = "off")] //~ ERROR sanitize attribute not allowed here + type TraitAssocType; + + #[sanitize(address = "off")] //~ ERROR sanitize attribute not allowed here + fn trait_method(&self); + + #[sanitize(address = "off", thread = "on")] + fn trait_method_with_default(&self) {} + + #[sanitize(address = "off")] //~ ERROR sanitize attribute not allowed here + fn trait_assoc_fn(); +} + +#[sanitize(address = "off")] +impl MyTrait for () { + const TRAIT_ASSOC_CONST: u32 = 0; + + #[sanitize(address = "off")] //~ ERROR sanitize attribute not allowed here + type TraitAssocType = Self; + + #[sanitize(address = "off", thread = "on")] + fn trait_method(&self) {} + #[sanitize(address = "off", thread = "on")] + fn trait_method_with_default(&self) {} + #[sanitize(address = "off", thread = "on")] + fn trait_assoc_fn() {} +} + +trait HasAssocType { + type T; + fn constrain_assoc_type() -> Self::T; +} + +impl HasAssocType for () { + #[sanitize(address = "off")] //~ ERROR sanitize attribute not allowed here + type T = impl Copy; + fn constrain_assoc_type() -> Self::T {} +} + +#[sanitize(address = "off")] //~ ERROR sanitize attribute not allowed here +struct MyStruct { + #[sanitize(address = "off")] //~ ERROR sanitize attribute not allowed here + field: u32, +} + +#[sanitize(address = "off", thread = "on")] +impl MyStruct { + #[sanitize(address = "off", thread = "on")] + fn method(&self) {} + #[sanitize(address = "off", thread = "on")] + fn assoc_fn() {} +} + +extern "C" { + #[sanitize(address = "off", thread = "on")] //~ ERROR sanitize attribute not allowed here + static X: u32; + + #[sanitize(address = "off", thread = "on")] //~ ERROR sanitize attribute not allowed here + type T; + + #[sanitize(address = "off", thread = "on")] //~ ERROR sanitize attribute not allowed here + fn foreign_fn(); +} + +#[sanitize(address = "off", thread = "on")] +fn main() { + #[sanitize(address = "off", thread = "on")] //~ ERROR sanitize attribute not allowed here + let _ = (); + + // Currently not allowed on let statements, even if they bind to a closure. + // It might be nice to support this as a special case someday, but trying + // to define the precise boundaries of that special case might be tricky. + #[sanitize(address = "off")] //~ ERROR sanitize attribute not allowed here + let _let_closure = || (); + + // In situations where attributes can already be applied to expressions, + // the sanitize attribute is allowed on closure expressions. + let _closure_tail_expr = { + #[sanitize(address = "off", thread = "on")] + || () + }; + + match () { + #[sanitize(address = "off")] //~ ERROR sanitize attribute not allowed here + () => (), + } + + #[sanitize(address = "off")] //~ ERROR sanitize attribute not allowed here + return (); +} diff --git a/tests/ui/sanitize-attr/valid-sanitize.stderr b/tests/ui/sanitize-attr/valid-sanitize.stderr new file mode 100644 index 00000000000..ff9fe63eaf5 --- /dev/null +++ b/tests/ui/sanitize-attr/valid-sanitize.stderr @@ -0,0 +1,190 @@ +error: sanitize attribute not allowed here + --> $DIR/valid-sanitize.rs:15:1 + | +LL | #[sanitize(thread = "off")] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | static BAR: u32 = 0; + | -------------------- not a function, impl block, or module + | + = help: sanitize attribute can be applied to a function (with body), impl block, or module + +error: sanitize attribute not allowed here + --> $DIR/valid-sanitize.rs:18:1 + | +LL | #[sanitize(address = "off")] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | type MyTypeAlias = (); + | ---------------------- not a function, impl block, or module + | + = help: sanitize attribute can be applied to a function (with body), impl block, or module + +error: sanitize attribute not allowed here + --> $DIR/valid-sanitize.rs:21:1 + | +LL | #[sanitize(address = "off")] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | / trait MyTrait { +LL | | #[sanitize(address = "off")] +LL | | const TRAIT_ASSOC_CONST: u32; +... | +LL | | fn trait_assoc_fn(); +LL | | } + | |_- not a function, impl block, or module + | + = help: sanitize attribute can be applied to a function (with body), impl block, or module + +error: sanitize attribute not allowed here + --> $DIR/valid-sanitize.rs:65:1 + | +LL | #[sanitize(address = "off")] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | / struct MyStruct { +LL | | #[sanitize(address = "off")] +LL | | field: u32, +LL | | } + | |_- not a function, impl block, or module + | + = help: sanitize attribute can be applied to a function (with body), impl block, or module + +error: sanitize attribute not allowed here + --> $DIR/valid-sanitize.rs:67:5 + | +LL | #[sanitize(address = "off")] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | field: u32, + | ---------- not a function, impl block, or module + | + = help: sanitize attribute can be applied to a function (with body), impl block, or module + +error: sanitize attribute not allowed here + --> $DIR/valid-sanitize.rs:92:5 + | +LL | #[sanitize(address = "off", thread = "on")] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | let _ = (); + | ----------- not a function, impl block, or module + | + = help: sanitize attribute can be applied to a function (with body), impl block, or module + +error: sanitize attribute not allowed here + --> $DIR/valid-sanitize.rs:98:5 + | +LL | #[sanitize(address = "off")] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | let _let_closure = || (); + | ------------------------- not a function, impl block, or module + | + = help: sanitize attribute can be applied to a function (with body), impl block, or module + +error: sanitize attribute not allowed here + --> $DIR/valid-sanitize.rs:109:9 + | +LL | #[sanitize(address = "off")] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | () => (), + | -------- not a function, impl block, or module + | + = help: sanitize attribute can be applied to a function (with body), impl block, or module + +error: sanitize attribute not allowed here + --> $DIR/valid-sanitize.rs:113:5 + | +LL | #[sanitize(address = "off")] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | return (); + | --------- not a function, impl block, or module + | + = help: sanitize attribute can be applied to a function (with body), impl block, or module + +error: sanitize attribute not allowed here + --> $DIR/valid-sanitize.rs:23:5 + | +LL | #[sanitize(address = "off")] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | const TRAIT_ASSOC_CONST: u32; + | ----------------------------- not a function, impl block, or module + | + = help: sanitize attribute can be applied to a function (with body), impl block, or module + +error: sanitize attribute not allowed here + --> $DIR/valid-sanitize.rs:26:5 + | +LL | #[sanitize(address = "off")] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | type TraitAssocType; + | -------------------- not a function, impl block, or module + | + = help: sanitize attribute can be applied to a function (with body), impl block, or module + +error: sanitize attribute not allowed here + --> $DIR/valid-sanitize.rs:29:5 + | +LL | #[sanitize(address = "off")] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | fn trait_method(&self); + | ----------------------- function has no body + | + = help: sanitize attribute can be applied to a function (with body), impl block, or module + +error: sanitize attribute not allowed here + --> $DIR/valid-sanitize.rs:35:5 + | +LL | #[sanitize(address = "off")] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | fn trait_assoc_fn(); + | -------------------- function has no body + | + = help: sanitize attribute can be applied to a function (with body), impl block, or module + +error: sanitize attribute not allowed here + --> $DIR/valid-sanitize.rs:43:5 + | +LL | #[sanitize(address = "off")] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | type TraitAssocType = Self; + | --------------------------- not a function, impl block, or module + | + = help: sanitize attribute can be applied to a function (with body), impl block, or module + +error: sanitize attribute not allowed here + --> $DIR/valid-sanitize.rs:60:5 + | +LL | #[sanitize(address = "off")] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | type T = impl Copy; + | ------------------- not a function, impl block, or module + | + = help: sanitize attribute can be applied to a function (with body), impl block, or module + +error: sanitize attribute not allowed here + --> $DIR/valid-sanitize.rs:80:5 + | +LL | #[sanitize(address = "off", thread = "on")] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | static X: u32; + | -------------- not a function, impl block, or module + | + = help: sanitize attribute can be applied to a function (with body), impl block, or module + +error: sanitize attribute not allowed here + --> $DIR/valid-sanitize.rs:83:5 + | +LL | #[sanitize(address = "off", thread = "on")] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | type T; + | ------- not a function, impl block, or module + | + = help: sanitize attribute can be applied to a function (with body), impl block, or module + +error: sanitize attribute not allowed here + --> $DIR/valid-sanitize.rs:86:5 + | +LL | #[sanitize(address = "off", thread = "on")] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | fn foreign_fn(); + | ---------------- function has no body + | + = help: sanitize attribute can be applied to a function (with body), impl block, or module + +error: aborting due to 18 previous errors + diff --git a/tests/ui/sanitizer/cfi/no_builtins.rs b/tests/ui/sanitizer/cfi/no_builtins.rs new file mode 100644 index 00000000000..949057689ab --- /dev/null +++ b/tests/ui/sanitizer/cfi/no_builtins.rs @@ -0,0 +1,22 @@ +// Verifies that `#![no_builtins]` crates can be built with linker-plugin-lto and CFI. +// See Issue #142284 +// +//@ needs-sanitizer-cfi +//@ compile-flags: -Clinker-plugin-lto -Copt-level=0 -Zsanitizer=cfi -Ctarget-feature=-crt-static +//@ compile-flags: --crate-type rlib +//@ build-pass + +#![no_builtins] +#![no_std] + +pub static FUNC: fn() = initializer; + +pub fn initializer() { + call(fma_with_fma); +} + +pub fn call(fn_ptr: fn()) { + fn_ptr(); +} + +pub fn fma_with_fma() {} diff --git a/tests/ui/sanitizer/inline-always.rs b/tests/ui/sanitizer/inline-always-sanitize.rs index d92daee3026..d6ee214e9b3 100644 --- a/tests/ui/sanitizer/inline-always.rs +++ b/tests/ui/sanitizer/inline-always-sanitize.rs @@ -1,11 +1,11 @@ //@ check-pass -#![feature(no_sanitize)] +#![feature(sanitize)] #[inline(always)] //~^ NOTE inlining requested here -#[no_sanitize(address)] -//~^ WARN will have no effect after inlining +#[sanitize(address = "off")] +//~^ WARN setting `sanitize` off will have no effect after inlining //~| NOTE on by default fn x() { } diff --git a/tests/ui/sanitizer/inline-always-sanitize.stderr b/tests/ui/sanitizer/inline-always-sanitize.stderr new file mode 100644 index 00000000000..ed479472169 --- /dev/null +++ b/tests/ui/sanitizer/inline-always-sanitize.stderr @@ -0,0 +1,15 @@ +warning: setting `sanitize` off will have no effect after inlining + --> $DIR/inline-always-sanitize.rs:7:1 + | +LL | #[sanitize(address = "off")] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +note: inlining requested here + --> $DIR/inline-always-sanitize.rs:5:1 + | +LL | #[inline(always)] + | ^^^^^^^^^^^^^^^^^ + = note: `#[warn(inline_no_sanitize)]` on by default + +warning: 1 warning emitted + diff --git a/tests/ui/sanitizer/inline-always.stderr b/tests/ui/sanitizer/inline-always.stderr deleted file mode 100644 index 74fba3c0e0e..00000000000 --- a/tests/ui/sanitizer/inline-always.stderr +++ /dev/null @@ -1,15 +0,0 @@ -warning: `no_sanitize` will have no effect after inlining - --> $DIR/inline-always.rs:7:1 - | -LL | #[no_sanitize(address)] - | ^^^^^^^^^^^^^^^^^^^^^^^ - | -note: inlining requested here - --> $DIR/inline-always.rs:5:1 - | -LL | #[inline(always)] - | ^^^^^^^^^^^^^^^^^ - = note: `#[warn(inline_no_sanitize)]` on by default - -warning: 1 warning emitted - diff --git a/tests/ui/self/elision/ignore-non-reference-lifetimes.stderr b/tests/ui/self/elision/ignore-non-reference-lifetimes.stderr index 7108fa1a290..1a5c87114d4 100644 --- a/tests/ui/self/elision/ignore-non-reference-lifetimes.stderr +++ b/tests/ui/self/elision/ignore-non-reference-lifetimes.stderr @@ -1,8 +1,8 @@ warning: eliding a lifetime that's named elsewhere is confusing - --> $DIR/ignore-non-reference-lifetimes.rs:6:30 + --> $DIR/ignore-non-reference-lifetimes.rs:6:41 | LL | fn a<'a>(self: Self, a: &'a str) -> &str { - | ^^ ---- the same lifetime is elided here + | -- ^^^^ the same lifetime is elided here | | | the lifetime is named here | @@ -14,10 +14,10 @@ LL | fn a<'a>(self: Self, a: &'a str) -> &'a str { | ++ warning: eliding a lifetime that's named elsewhere is confusing - --> $DIR/ignore-non-reference-lifetimes.rs:10:33 + --> $DIR/ignore-non-reference-lifetimes.rs:10:44 | LL | fn b<'a>(self: Foo<'b>, a: &'a str) -> &str { - | ^^ ---- the same lifetime is elided here + | -- ^^^^ the same lifetime is elided here | | | the lifetime is named here | diff --git a/tests/ui/self/self-ctor-nongeneric.stderr b/tests/ui/self/self-ctor-nongeneric.stderr index 6c03c6f3e38..b53ecbe55b5 100644 --- a/tests/ui/self/self-ctor-nongeneric.stderr +++ b/tests/ui/self/self-ctor-nongeneric.stderr @@ -9,7 +9,7 @@ LL | const C: S0 = Self(0); | = 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 #124186 <https://github.com/rust-lang/rust/issues/124186> - = note: `#[warn(self_constructor_from_outer_item)]` on by default + = note: `#[warn(self_constructor_from_outer_item)]` (part of `#[warn(future_incompatible)]`) on by default warning: can't reference `Self` constructor from outer item --> $DIR/self-ctor-nongeneric.rs:12:13 diff --git a/tests/ui/self/self_lifetime-async.stderr b/tests/ui/self/self_lifetime-async.stderr index 43dc96abdc2..78cc610fd04 100644 --- a/tests/ui/self/self_lifetime-async.stderr +++ b/tests/ui/self/self_lifetime-async.stderr @@ -1,8 +1,8 @@ warning: eliding a lifetime that's named elsewhere is confusing - --> $DIR/self_lifetime-async.rs:6:29 + --> $DIR/self_lifetime-async.rs:6:44 | LL | async fn foo<'b>(self: &'b Foo<'a>) -> &() { self.0 } - | ^^ --- the same lifetime is elided here + | -- ^^^ the same lifetime is elided here | | | the lifetime is named here | @@ -14,10 +14,10 @@ LL | async fn foo<'b>(self: &'b Foo<'a>) -> &'b () { self.0 } | ++ warning: eliding a lifetime that's named elsewhere is confusing - --> $DIR/self_lifetime-async.rs:12:42 + --> $DIR/self_lifetime-async.rs:12:52 | LL | async fn bar<'a>(self: &Alias, arg: &'a ()) -> &() { arg } - | ^^ --- the same lifetime is elided here + | -- ^^^ the same lifetime is elided here | | | the lifetime is named here | diff --git a/tests/ui/self/self_lifetime.stderr b/tests/ui/self/self_lifetime.stderr index 4f9b2fcd2ad..84f63454633 100644 --- a/tests/ui/self/self_lifetime.stderr +++ b/tests/ui/self/self_lifetime.stderr @@ -1,8 +1,8 @@ warning: eliding a lifetime that's named elsewhere is confusing - --> $DIR/self_lifetime.rs:7:23 + --> $DIR/self_lifetime.rs:7:38 | LL | fn foo<'b>(self: &'b Foo<'a>) -> &() { self.0 } - | ^^ --- the same lifetime is elided here + | -- ^^^ the same lifetime is elided here | | | the lifetime is named here | @@ -14,10 +14,10 @@ LL | fn foo<'b>(self: &'b Foo<'a>) -> &'b () { self.0 } | ++ warning: eliding a lifetime that's named elsewhere is confusing - --> $DIR/self_lifetime.rs:13:36 + --> $DIR/self_lifetime.rs:13:46 | LL | fn bar<'a>(self: &Alias, arg: &'a ()) -> &() { arg } - | ^^ --- the same lifetime is elided here + | -- ^^^ the same lifetime is elided here | | | the lifetime is named here | diff --git a/tests/ui/sized/coinductive-2.stderr b/tests/ui/sized/coinductive-2.stderr index 1390b1f8d7b..5faec7397e2 100644 --- a/tests/ui/sized/coinductive-2.stderr +++ b/tests/ui/sized/coinductive-2.stderr @@ -4,7 +4,7 @@ warning: trait `Collection` is never used LL | trait Collection<T>: Sized { | ^^^^^^^^^^ | - = note: `#[warn(dead_code)]` on by default + = note: `#[warn(dead_code)]` (part of `#[warn(unused)]`) on by default warning: 1 warning emitted diff --git a/tests/ui/span/issue-24690.stderr b/tests/ui/span/issue-24690.stderr index 73e166e6403..8626108c0be 100644 --- a/tests/ui/span/issue-24690.stderr +++ b/tests/ui/span/issue-24690.stderr @@ -17,7 +17,7 @@ warning: variable `theTwo` should have a snake case name LL | let theTwo = 2; | ^^^^^^ help: convert the identifier to snake case: `the_two` | - = note: `#[warn(non_snake_case)]` on by default + = note: `#[warn(non_snake_case)]` (part of `#[warn(nonstandard_style)]`) on by default warning: variable `theOtherTwo` should have a snake case name --> $DIR/issue-24690.rs:13:9 diff --git a/tests/ui/span/issue-71363.stderr b/tests/ui/span/issue-71363.stderr index 31069914daa..d2f780bdbcb 100644 --- a/tests/ui/span/issue-71363.stderr +++ b/tests/ui/span/issue-71363.stderr @@ -2,8 +2,13 @@ error[E0277]: `MyError` doesn't implement `std::fmt::Display` --> $DIR/issue-71363.rs:4:28 | 4 | impl std::error::Error for MyError {} - | ^^^^^^^ the trait `std::fmt::Display` is not implemented for `MyError` + | ^^^^^^^ unsatisfied trait bound | +help: the trait `std::fmt::Display` is not implemented for `MyError` + --> $DIR/issue-71363.rs:3:1 + | +3 | struct MyError; + | ^^^^^^^^^^^^^^ note: required by a bound in `std::error::Error` --> $SRC_DIR/core/src/error.rs:LL:COL diff --git a/tests/ui/issues/issue-55380.rs b/tests/ui/specialization/trait-specialization-default-methods-55380.rs index 54894cdede0..b3d79fb5ffb 100644 --- a/tests/ui/issues/issue-55380.rs +++ b/tests/ui/specialization/trait-specialization-default-methods-55380.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/55380 //@ run-pass #![feature(specialization)] //~^ WARN the feature `specialization` is incomplete diff --git a/tests/ui/issues/issue-55380.stderr b/tests/ui/specialization/trait-specialization-default-methods-55380.stderr index 403844c726f..f7c1903da62 100644 --- a/tests/ui/issues/issue-55380.stderr +++ b/tests/ui/specialization/trait-specialization-default-methods-55380.stderr @@ -1,5 +1,5 @@ warning: the feature `specialization` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/issue-55380.rs:2:12 + --> $DIR/trait-specialization-default-methods-55380.rs:3:12 | LL | #![feature(specialization)] | ^^^^^^^^^^^^^^ diff --git a/tests/ui/issues/issue-7364.rs b/tests/ui/static/global-variable-promotion-error-7364.rs index 4ce9beb68cd..dba4a484d61 100644 --- a/tests/ui/issues/issue-7364.rs +++ b/tests/ui/static/global-variable-promotion-error-7364.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/7364 use std::cell::RefCell; // Regression test for issue 7364 diff --git a/tests/ui/issues/issue-7364.stderr b/tests/ui/static/global-variable-promotion-error-7364.stderr index a47a90c90ce..b9d75676bef 100644 --- a/tests/ui/issues/issue-7364.stderr +++ b/tests/ui/static/global-variable-promotion-error-7364.stderr @@ -1,5 +1,5 @@ error[E0277]: `RefCell<isize>` cannot be shared between threads safely - --> $DIR/issue-7364.rs:4:15 + --> $DIR/global-variable-promotion-error-7364.rs:5:15 | LL | static boxed: Box<RefCell<isize>> = Box::new(RefCell::new(0)); | ^^^^^^^^^^^^^^^^^^^ `RefCell<isize>` cannot be shared between threads safely @@ -12,7 +12,7 @@ note: required because it appears within the type `Box<RefCell<isize>>` = note: shared static variables must have a type that implements `Sync` error[E0015]: cannot call non-const associated function `Box::<RefCell<isize>>::new` in statics - --> $DIR/issue-7364.rs:4:37 + --> $DIR/global-variable-promotion-error-7364.rs:5:37 | LL | static boxed: Box<RefCell<isize>> = Box::new(RefCell::new(0)); | ^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/static/static-closures.rs b/tests/ui/static/static-closures.rs index 1bd518d6ffe..e836f1b85eb 100644 --- a/tests/ui/static/static-closures.rs +++ b/tests/ui/static/static-closures.rs @@ -1,4 +1,5 @@ fn main() { static || {}; //~^ ERROR closures cannot be static + //~| ERROR coroutine syntax is experimental } diff --git a/tests/ui/static/static-closures.stderr b/tests/ui/static/static-closures.stderr index b11c0b5a530..ecc961cc1e4 100644 --- a/tests/ui/static/static-closures.stderr +++ b/tests/ui/static/static-closures.stderr @@ -1,9 +1,20 @@ +error[E0658]: coroutine syntax is experimental + --> $DIR/static-closures.rs:2:5 + | +LL | static || {}; + | ^^^^^^ + | + = 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[E0697]: closures cannot be static --> $DIR/static-closures.rs:2:5 | LL | static || {}; | ^^^^^^^^^ -error: aborting due to 1 previous error +error: aborting due to 2 previous errors -For more information about this error, try `rustc --explain E0697`. +Some errors have detailed explanations: E0658, E0697. +For more information about an error, try `rustc --explain E0658`. diff --git a/tests/ui/issues/issue-5917.rs b/tests/ui/static/static-list-initialization-5917.rs index 8e91b1052a2..c6c32f7582e 100644 --- a/tests/ui/issues/issue-5917.rs +++ b/tests/ui/static/static-list-initialization-5917.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/5917 //@ run-pass #![allow(non_upper_case_globals)] diff --git a/tests/ui/issues/issue-5688.rs b/tests/ui/static/static-struct-initialization-5688.rs index a7db1dfb15f..6a4c2f45b6b 100644 --- a/tests/ui/issues/issue-5688.rs +++ b/tests/ui/static/static-struct-initialization-5688.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/5688 //@ run-pass /* # Corrupted initialization in the static struct diff --git a/tests/ui/issues/issue-8578.rs b/tests/ui/static/static-struct-with-option-8578.rs index 9baa2f70a02..d490a3f50b4 100644 --- a/tests/ui/issues/issue-8578.rs +++ b/tests/ui/static/static-struct-with-option-8578.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/8578 //@ check-pass #![allow(dead_code)] #![allow(non_camel_case_types)] diff --git a/tests/ui/statics/issue-15261.stderr b/tests/ui/statics/issue-15261.stderr index 60c5fb93dba..20ac0785245 100644 --- a/tests/ui/statics/issue-15261.stderr +++ b/tests/ui/statics/issue-15261.stderr @@ -6,7 +6,7 @@ LL | static n: &'static usize = unsafe { &n_mut }; | = note: for more information, see <https://doc.rust-lang.org/edition-guide/rust-2024/static-mut-references.html> = note: shared references to mutable statics are dangerous; it's undefined behavior if the static is mutated or if a mutable reference is created for it while the shared reference lives - = note: `#[warn(static_mut_refs)]` on by default + = note: `#[warn(static_mut_refs)]` (part of `#[warn(rust_2024_compatibility)]`) on by default help: use `&raw const` instead to create a raw pointer | LL | static n: &'static usize = unsafe { &raw const n_mut }; diff --git a/tests/ui/statics/issue-17718-static-sync.stderr b/tests/ui/statics/issue-17718-static-sync.stderr index 96f894146c5..3a6e3becbad 100644 --- a/tests/ui/statics/issue-17718-static-sync.stderr +++ b/tests/ui/statics/issue-17718-static-sync.stderr @@ -4,7 +4,11 @@ error[E0277]: `Foo` cannot be shared between threads safely LL | static BAR: Foo = Foo; | ^^^ `Foo` cannot be shared between threads safely | - = help: the trait `Sync` is not implemented for `Foo` +help: the trait `Sync` is not implemented for `Foo` + --> $DIR/issue-17718-static-sync.rs:5:1 + | +LL | struct Foo; + | ^^^^^^^^^^ = note: shared static variables must have a type that implements `Sync` error: aborting due to 1 previous error diff --git a/tests/ui/statics/static-impl.stderr b/tests/ui/statics/static-impl.stderr index 83c3ffbefe1..77785d1df0e 100644 --- a/tests/ui/statics/static-impl.stderr +++ b/tests/ui/statics/static-impl.stderr @@ -7,7 +7,7 @@ LL | fn length_(&self, ) -> usize; LL | fn iter_<F>(&self, f: F) where F: FnMut(&T); | ^^^^^ | - = note: `#[warn(dead_code)]` on by default + = note: `#[warn(dead_code)]` (part of `#[warn(unused)]`) on by default warning: 1 warning emitted diff --git a/tests/ui/statics/static-mut-shared-parens.stderr b/tests/ui/statics/static-mut-shared-parens.stderr index 16daee091a8..c900fcde16f 100644 --- a/tests/ui/statics/static-mut-shared-parens.stderr +++ b/tests/ui/statics/static-mut-shared-parens.stderr @@ -6,7 +6,7 @@ LL | let _ = unsafe { (&TEST) as *const usize }; | = note: for more information, see <https://doc.rust-lang.org/edition-guide/rust-2024/static-mut-references.html> = note: shared references to mutable statics are dangerous; it's undefined behavior if the static is mutated or if a mutable reference is created for it while the shared reference lives - = note: `#[warn(static_mut_refs)]` on by default + = note: `#[warn(static_mut_refs)]` (part of `#[warn(rust_2024_compatibility)]`) on by default help: use `&raw const` instead to create a raw pointer | LL | let _ = unsafe { (&raw const TEST) as *const usize }; diff --git a/tests/ui/statics/static-mut-xc.stderr b/tests/ui/statics/static-mut-xc.stderr index 2e5aa1b2645..73c4e91b8e0 100644 --- a/tests/ui/statics/static-mut-xc.stderr +++ b/tests/ui/statics/static-mut-xc.stderr @@ -6,7 +6,7 @@ LL | assert_eq!(static_mut_xc::a, 3); | = note: for more information, see <https://doc.rust-lang.org/edition-guide/rust-2024/static-mut-references.html> = note: shared references to mutable statics are dangerous; it's undefined behavior if the static is mutated or if a mutable reference is created for it while the shared reference lives - = note: `#[warn(static_mut_refs)]` on by default + = note: `#[warn(static_mut_refs)]` (part of `#[warn(rust_2024_compatibility)]`) on by default warning: creating a shared reference to mutable static --> $DIR/static-mut-xc.rs:22:16 diff --git a/tests/ui/statics/static-recursive.stderr b/tests/ui/statics/static-recursive.stderr index 0c3f961372b..16d5e183ccb 100644 --- a/tests/ui/statics/static-recursive.stderr +++ b/tests/ui/statics/static-recursive.stderr @@ -6,7 +6,7 @@ LL | static mut S: *const u8 = unsafe { &S as *const *const u8 as *const u8 }; | = note: for more information, see <https://doc.rust-lang.org/edition-guide/rust-2024/static-mut-references.html> = note: shared references to mutable statics are dangerous; it's undefined behavior if the static is mutated or if a mutable reference is created for it while the shared reference lives - = note: `#[warn(static_mut_refs)]` on by default + = note: `#[warn(static_mut_refs)]` (part of `#[warn(rust_2024_compatibility)]`) on by default help: use `&raw const` instead to create a raw pointer | LL | static mut S: *const u8 = unsafe { &raw const S as *const *const u8 as *const u8 }; diff --git a/tests/ui/std/issue-3563-3.stderr b/tests/ui/std/issue-3563-3.stderr index bd65c1e3fd5..5885bafeb99 100644 --- a/tests/ui/std/issue-3563-3.stderr +++ b/tests/ui/std/issue-3563-3.stderr @@ -7,7 +7,7 @@ LL | trait Canvas { LL | fn add_points(&mut self, shapes: &[Point]) { | ^^^^^^^^^^ | - = note: `#[warn(dead_code)]` on by default + = note: `#[warn(dead_code)]` (part of `#[warn(unused)]`) on by default warning: 1 warning emitted diff --git a/tests/ui/stdlib-unit-tests/raw-fat-ptr.stderr b/tests/ui/stdlib-unit-tests/raw-fat-ptr.stderr index 670fa5bb922..8108296621c 100644 --- a/tests/ui/stdlib-unit-tests/raw-fat-ptr.stderr +++ b/tests/ui/stdlib-unit-tests/raw-fat-ptr.stderr @@ -6,7 +6,7 @@ LL | trait Foo { fn foo(&self) -> usize; } | | | method in this trait | - = note: `#[warn(dead_code)]` on by default + = note: `#[warn(dead_code)]` (part of `#[warn(unused)]`) on by default warning: 1 warning emitted diff --git a/tests/ui/structs-enums/enum-null-pointer-opt.stderr b/tests/ui/structs-enums/enum-null-pointer-opt.stderr index 64e93ffaffd..178d76cd732 100644 --- a/tests/ui/structs-enums/enum-null-pointer-opt.stderr +++ b/tests/ui/structs-enums/enum-null-pointer-opt.stderr @@ -6,7 +6,7 @@ LL | trait Trait { fn dummy(&self) { } } | | | method in this trait | - = note: `#[warn(dead_code)]` on by default + = note: `#[warn(dead_code)]` (part of `#[warn(unused)]`) on by default warning: 1 warning emitted diff --git a/tests/ui/issues/auxiliary/issue-8044.rs b/tests/ui/structs/auxiliary/aux-8044.rs index 2ec25f51cde..2ec25f51cde 100644 --- a/tests/ui/issues/auxiliary/issue-8044.rs +++ b/tests/ui/structs/auxiliary/aux-8044.rs diff --git a/tests/ui/structs/btree-struct-usage-8044.rs b/tests/ui/structs/btree-struct-usage-8044.rs new file mode 100644 index 00000000000..9b544f33f1c --- /dev/null +++ b/tests/ui/structs/btree-struct-usage-8044.rs @@ -0,0 +1,10 @@ +// https://github.com/rust-lang/rust/issues/8044 +//@ run-pass +//@ aux-build:aux-8044.rs + +extern crate aux_8044 as minimal; +use minimal::{BTree, leaf}; + +pub fn main() { + BTree::<isize> { node: leaf(1) }; +} diff --git a/tests/ui/issues/issue-8783.rs b/tests/ui/structs/destructuring-struct-type-inference-8783.rs index d0ff79f8ac8..60bc4bf3289 100644 --- a/tests/ui/issues/issue-8783.rs +++ b/tests/ui/structs/destructuring-struct-type-inference-8783.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/8783 //@ run-pass #![allow(unused_variables)] diff --git a/tests/ui/issues/issue-6344-let.rs b/tests/ui/structs/destructuring-struct-with-dtor-6344.rs index 1e1bdfa17be..b107a99e89f 100644 --- a/tests/ui/issues/issue-6344-let.rs +++ b/tests/ui/structs/destructuring-struct-with-dtor-6344.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/6344 //@ run-pass #![allow(non_shorthand_field_patterns)] diff --git a/tests/ui/issues/issue-5439.rs b/tests/ui/structs/nonexistent-struct-field-error-5439.rs index 852b264dc5d..b2b3293ac91 100644 --- a/tests/ui/issues/issue-5439.rs +++ b/tests/ui/structs/nonexistent-struct-field-error-5439.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/5439 struct Foo { foo: isize, } diff --git a/tests/ui/issues/issue-5439.stderr b/tests/ui/structs/nonexistent-struct-field-error-5439.stderr index 6d1d74e3045..b560772fbf0 100644 --- a/tests/ui/issues/issue-5439.stderr +++ b/tests/ui/structs/nonexistent-struct-field-error-5439.stderr @@ -1,5 +1,5 @@ error[E0560]: struct `Foo` has no field named `nonexistent` - --> $DIR/issue-5439.rs:11:31 + --> $DIR/nonexistent-struct-field-error-5439.rs:12:31 | LL | return Box::new(Foo { nonexistent: self, foo: i }); | ^^^^^^^^^^^ `Foo` does not have this field diff --git a/tests/ui/suggestions/attribute-typos.stderr b/tests/ui/suggestions/attribute-typos.stderr index a1a01c0abd6..1816a27dcdc 100644 --- a/tests/ui/suggestions/attribute-typos.stderr +++ b/tests/ui/suggestions/attribute-typos.stderr @@ -15,6 +15,7 @@ error: cannot find attribute `tests` in this scope | LL | #[tests] | ^^^^^ help: an attribute macro with a similar name exists: `test` + | --> $SRC_DIR/core/src/macros/mod.rs:LL:COL | = note: similarly named attribute macro `test` defined here diff --git a/tests/ui/suggestions/do-not-attempt-to-add-suggestions-with-no-changes.stderr b/tests/ui/suggestions/do-not-attempt-to-add-suggestions-with-no-changes.stderr index 0cd6267b3b3..c81ac34aaf4 100644 --- a/tests/ui/suggestions/do-not-attempt-to-add-suggestions-with-no-changes.stderr +++ b/tests/ui/suggestions/do-not-attempt-to-add-suggestions-with-no-changes.stderr @@ -3,6 +3,7 @@ error[E0573]: expected type, found module `result` | LL | impl result { | ^^^^^^ help: an enum with a similar name exists: `Result` + | --> $SRC_DIR/core/src/result.rs:LL:COL | = note: similarly named enum `Result` defined here diff --git a/tests/ui/suggestions/dont-suggest-borrowing-existing-borrow.stderr b/tests/ui/suggestions/dont-suggest-borrowing-existing-borrow.stderr index c2e2fe941a6..86d9a745b87 100644 --- a/tests/ui/suggestions/dont-suggest-borrowing-existing-borrow.stderr +++ b/tests/ui/suggestions/dont-suggest-borrowing-existing-borrow.stderr @@ -20,8 +20,13 @@ error[E0277]: the trait bound `S: Trait` is not satisfied --> $DIR/dont-suggest-borrowing-existing-borrow.rs:17:18 | LL | let _ = &mut S::foo(); - | ^ the trait `Trait` is not implemented for `S` + | ^ unsatisfied trait bound | +help: the trait `Trait` is not implemented for `S` + --> $DIR/dont-suggest-borrowing-existing-borrow.rs:3:1 + | +LL | struct S; + | ^^^^^^^^ = help: the trait `Trait` is implemented for `&mut S` help: you likely meant to call the associated function `foo` for type `&mut S`, but the code as written calls associated function `foo` on type `S` | @@ -32,8 +37,13 @@ error[E0277]: the trait bound `S: Trait` is not satisfied --> $DIR/dont-suggest-borrowing-existing-borrow.rs:19:14 | LL | let _ = &S::foo(); - | ^ the trait `Trait` is not implemented for `S` + | ^ unsatisfied trait bound + | +help: the trait `Trait` is not implemented for `S` + --> $DIR/dont-suggest-borrowing-existing-borrow.rs:3:1 | +LL | struct S; + | ^^^^^^^^ = help: the trait `Trait` is implemented for `&mut S` help: you likely meant to call the associated function `foo` for type `&S`, but the code as written calls associated function `foo` on type `S` | @@ -56,8 +66,13 @@ error[E0277]: the trait bound `S: Trait2` is not satisfied --> $DIR/dont-suggest-borrowing-existing-borrow.rs:23:18 | LL | let _ = &mut S::bar(); - | ^ the trait `Trait2` is not implemented for `S` + | ^ unsatisfied trait bound | +help: the trait `Trait2` is not implemented for `S` + --> $DIR/dont-suggest-borrowing-existing-borrow.rs:3:1 + | +LL | struct S; + | ^^^^^^^^ = help: the following other types implement trait `Trait2`: &S &mut S @@ -70,8 +85,13 @@ error[E0277]: the trait bound `S: Trait2` is not satisfied --> $DIR/dont-suggest-borrowing-existing-borrow.rs:25:14 | LL | let _ = &S::bar(); - | ^ the trait `Trait2` is not implemented for `S` + | ^ unsatisfied trait bound + | +help: the trait `Trait2` is not implemented for `S` + --> $DIR/dont-suggest-borrowing-existing-borrow.rs:3:1 | +LL | struct S; + | ^^^^^^^^ = help: the following other types implement trait `Trait2`: &S &mut S diff --git a/tests/ui/suggestions/dont-try-removing-the-field.stderr b/tests/ui/suggestions/dont-try-removing-the-field.stderr index 263171a4ac4..e327b21417a 100644 --- a/tests/ui/suggestions/dont-try-removing-the-field.stderr +++ b/tests/ui/suggestions/dont-try-removing-the-field.stderr @@ -4,7 +4,7 @@ warning: unused variable: `baz` LL | let Foo { foo, bar, baz } = x; | ^^^ help: try ignoring the field: `baz: _` | - = note: `#[warn(unused_variables)]` on by default + = note: `#[warn(unused_variables)]` (part of `#[warn(unused)]`) on by default warning: 1 warning emitted diff --git a/tests/ui/suggestions/enum-method-probe.stderr b/tests/ui/suggestions/enum-method-probe.stderr index 5aa0fc44c7b..7d97495af82 100644 --- a/tests/ui/suggestions/enum-method-probe.stderr +++ b/tests/ui/suggestions/enum-method-probe.stderr @@ -99,10 +99,10 @@ error[E0624]: method `len` is private | LL | res.len(); | ^^^ private method + | --> $SRC_DIR/core/src/option.rs:LL:COL | = note: private method defined here - | note: the method `len` exists on the type `Vec<{integer}>` --> $SRC_DIR/alloc/src/vec/mod.rs:LL:COL help: consider using `Option::expect` to unwrap the `Vec<{integer}>` value, panicking if the value is an `Option::None` diff --git a/tests/ui/suggestions/ice-unwrap-probe-many-result-125876.stderr b/tests/ui/suggestions/ice-unwrap-probe-many-result-125876.stderr index 696151b6ee2..8bb2bb290d3 100644 --- a/tests/ui/suggestions/ice-unwrap-probe-many-result-125876.stderr +++ b/tests/ui/suggestions/ice-unwrap-probe-many-result-125876.stderr @@ -12,7 +12,7 @@ LL | std::ptr::from_ref(num).cast_mut().as_deref(); | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! = note: for more information, see issue #46906 <https://github.com/rust-lang/rust/issues/46906> - = note: `#[warn(tyvar_behind_raw_pointer)]` on by default + = note: `#[warn(tyvar_behind_raw_pointer)]` (part of `#[warn(rust_2018_compatibility)]`) on by default warning: type annotations needed --> $DIR/ice-unwrap-probe-many-result-125876.rs:5:40 diff --git a/tests/ui/suggestions/impl-on-dyn-trait-with-implicit-static-bound-needing-more-suggestions.rs b/tests/ui/suggestions/impl-on-dyn-trait-with-implicit-static-bound-needing-more-suggestions.rs index c24672816ac..eb9b376686a 100644 --- a/tests/ui/suggestions/impl-on-dyn-trait-with-implicit-static-bound-needing-more-suggestions.rs +++ b/tests/ui/suggestions/impl-on-dyn-trait-with-implicit-static-bound-needing-more-suggestions.rs @@ -18,7 +18,7 @@ mod bav { impl Bar for i32 {} fn use_it<'a>(val: Box<dyn ObjectTrait<Assoc = i32>>) -> impl OtherTrait<'a> { - val.use_self() //~ ERROR cannot return value referencing function parameter + val.use_self() //~ ERROR cannot return value referencing function parameter `val` } } diff --git a/tests/ui/suggestions/import-trait-for-method-call.stderr b/tests/ui/suggestions/import-trait-for-method-call.stderr index 58b07fe7a42..177ab76cd1f 100644 --- a/tests/ui/suggestions/import-trait-for-method-call.stderr +++ b/tests/ui/suggestions/import-trait-for-method-call.stderr @@ -3,6 +3,7 @@ error[E0599]: no method named `finish` found for struct `DefaultHasher` in the c | LL | h.finish() | ^^^^^^ method not found in `DefaultHasher` + | --> $SRC_DIR/core/src/hash/mod.rs:LL:COL | = note: the method is available for `DefaultHasher` here diff --git a/tests/ui/suggestions/inner_type.fixed b/tests/ui/suggestions/inner_type.fixed index 8174f8e204e..8671c43226c 100644 --- a/tests/ui/suggestions/inner_type.fixed +++ b/tests/ui/suggestions/inner_type.fixed @@ -31,10 +31,10 @@ fn main() { let another_item = std::sync::RwLock::new(Struct { p: 42_u32 }); another_item.read().unwrap().method(); - //~^ ERROR no method named `method` found for struct `RwLock<T>` in the current scope [E0599] + //~^ ERROR no method named `method` found for struct `std::sync::RwLock<T>` in the current scope [E0599] //~| HELP use `.read().unwrap()` to borrow the `Struct<u32>`, blocking the current thread until it can be acquired another_item.write().unwrap().some_mutable_method(); - //~^ ERROR no method named `some_mutable_method` found for struct `RwLock<T>` in the current scope [E0599] + //~^ ERROR no method named `some_mutable_method` found for struct `std::sync::RwLock<T>` in the current scope [E0599] //~| HELP use `.write().unwrap()` to mutably borrow the `Struct<u32>`, blocking the current thread until it can be acquired } diff --git a/tests/ui/suggestions/inner_type.rs b/tests/ui/suggestions/inner_type.rs index e4eaf07ca8b..793372c7deb 100644 --- a/tests/ui/suggestions/inner_type.rs +++ b/tests/ui/suggestions/inner_type.rs @@ -31,10 +31,10 @@ fn main() { let another_item = std::sync::RwLock::new(Struct { p: 42_u32 }); another_item.method(); - //~^ ERROR no method named `method` found for struct `RwLock<T>` in the current scope [E0599] + //~^ ERROR no method named `method` found for struct `std::sync::RwLock<T>` in the current scope [E0599] //~| HELP use `.read().unwrap()` to borrow the `Struct<u32>`, blocking the current thread until it can be acquired another_item.some_mutable_method(); - //~^ ERROR no method named `some_mutable_method` found for struct `RwLock<T>` in the current scope [E0599] + //~^ ERROR no method named `some_mutable_method` found for struct `std::sync::RwLock<T>` in the current scope [E0599] //~| HELP use `.write().unwrap()` to mutably borrow the `Struct<u32>`, blocking the current thread until it can be acquired } diff --git a/tests/ui/suggestions/inner_type.stderr b/tests/ui/suggestions/inner_type.stderr index 017ddb5ad6d..d2f7fa92bc6 100644 --- a/tests/ui/suggestions/inner_type.stderr +++ b/tests/ui/suggestions/inner_type.stderr @@ -46,11 +46,11 @@ help: use `.lock().unwrap()` to borrow the `Struct<u32>`, blocking the current t LL | another_item.lock().unwrap().method(); | ++++++++++++++++ -error[E0599]: no method named `method` found for struct `RwLock<T>` in the current scope +error[E0599]: no method named `method` found for struct `std::sync::RwLock<T>` in the current scope --> $DIR/inner_type.rs:33:18 | LL | another_item.method(); - | ^^^^^^ method not found in `RwLock<Struct<u32>>` + | ^^^^^^ method not found in `std::sync::RwLock<Struct<u32>>` | note: the method `method` exists on the type `Struct<u32>` --> $DIR/inner_type.rs:9:5 @@ -62,11 +62,11 @@ help: use `.read().unwrap()` to borrow the `Struct<u32>`, blocking the current t LL | another_item.read().unwrap().method(); | ++++++++++++++++ -error[E0599]: no method named `some_mutable_method` found for struct `RwLock<T>` in the current scope +error[E0599]: no method named `some_mutable_method` found for struct `std::sync::RwLock<T>` in the current scope --> $DIR/inner_type.rs:37:18 | LL | another_item.some_mutable_method(); - | ^^^^^^^^^^^^^^^^^^^ method not found in `RwLock<Struct<u32>>` + | ^^^^^^^^^^^^^^^^^^^ method not found in `std::sync::RwLock<Struct<u32>>` | note: the method `some_mutable_method` exists on the type `Struct<u32>` --> $DIR/inner_type.rs:11:5 diff --git a/tests/ui/suggestions/issue-116434-2015.stderr b/tests/ui/suggestions/issue-116434-2015.stderr index e7173d91438..475cc849625 100644 --- a/tests/ui/suggestions/issue-116434-2015.stderr +++ b/tests/ui/suggestions/issue-116434-2015.stderr @@ -6,7 +6,7 @@ LL | fn foo() -> Clone; | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! = note: for more information, see <https://doc.rust-lang.org/edition-guide/rust-2021/warnings-promoted-to-error.html> - = note: `#[warn(bare_trait_objects)]` on by default + = note: `#[warn(bare_trait_objects)]` (part of `#[warn(rust_2021_compatibility)]`) on by default help: if this is a dyn-compatible trait, use `dyn` | LL | fn foo() -> dyn Clone; diff --git a/tests/ui/suggestions/issue-96223.stderr b/tests/ui/suggestions/issue-96223.stderr index a54a4e7b3be..89dd094276a 100644 --- a/tests/ui/suggestions/issue-96223.stderr +++ b/tests/ui/suggestions/issue-96223.stderr @@ -2,10 +2,15 @@ error[E0277]: the trait bound `for<'de> EmptyBis<'de>: Foo<'_>` is not satisfied --> $DIR/issue-96223.rs:49:17 | LL | icey_bounds(&p); - | ----------- ^^ the trait `for<'de> Foo<'_>` is not implemented for `EmptyBis<'de>` + | ----------- ^^ unsatisfied trait bound | | | required by a bound introduced by this call | +help: the trait `for<'de> Foo<'_>` is not implemented for `EmptyBis<'de>` + --> $DIR/issue-96223.rs:33:1 + | +LL | pub struct EmptyBis<'a>(&'a [u8]); + | ^^^^^^^^^^^^^^^^^^^^^^^ = help: the trait `Foo<'de>` is implemented for `Baz<T>` note: required for `Baz<EmptyBis<'de>>` to implement `for<'de> Foo<'de>` --> $DIR/issue-96223.rs:16:14 diff --git a/tests/ui/suggestions/lifetimes/explicit-lifetime-suggestion-in-proper-span-issue-121267.stderr b/tests/ui/suggestions/lifetimes/explicit-lifetime-suggestion-in-proper-span-issue-121267.stderr index 3a1f685f16b..9a3cfa9987a 100644 --- a/tests/ui/suggestions/lifetimes/explicit-lifetime-suggestion-in-proper-span-issue-121267.stderr +++ b/tests/ui/suggestions/lifetimes/explicit-lifetime-suggestion-in-proper-span-issue-121267.stderr @@ -8,7 +8,7 @@ LL | | LL | | .filter_map(|_| foo(src)) | |_________________________________^ | - = note: hidden type `FilterMap<std::slice::Iter<'static, i32>, {closure@$DIR/explicit-lifetime-suggestion-in-proper-span-issue-121267.rs:9:21: 9:24}>` captures lifetime `'_` + = note: hidden type `FilterMap<std::slice::Iter<'_, i32>, {closure@$DIR/explicit-lifetime-suggestion-in-proper-span-issue-121267.rs:9:21: 9:24}>` captures lifetime `'_` error: aborting due to 1 previous error diff --git a/tests/ui/suggestions/multi-suggestion.ascii.stderr b/tests/ui/suggestions/multi-suggestion.ascii.stderr index f2a146fbd52..1744162e6ce 100644 --- a/tests/ui/suggestions/multi-suggestion.ascii.stderr +++ b/tests/ui/suggestions/multi-suggestion.ascii.stderr @@ -3,10 +3,10 @@ error[E0423]: expected function, tuple struct or tuple variant, found struct `st | LL | let _ = std::collections::HashMap(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | --> $SRC_DIR/std/src/collections/hash/map.rs:LL:COL | = note: `std::collections::HashMap` defined here - | help: you might have meant to use an associated function to build this type | LL | let _ = std::collections::HashMap::new(); diff --git a/tests/ui/suggestions/multi-suggestion.unicode.stderr b/tests/ui/suggestions/multi-suggestion.unicode.stderr index 69df481579b..4835c263f19 100644 --- a/tests/ui/suggestions/multi-suggestion.unicode.stderr +++ b/tests/ui/suggestions/multi-suggestion.unicode.stderr @@ -3,10 +3,10 @@ error[E0423]: expected function, tuple struct or tuple variant, found struct `st │ LL │ let _ = std::collections::HashMap(); │ ━━━━━━━━━━━━━━━━━━━━━━━━━━━ + ╰╴ ╭▸ $SRC_DIR/std/src/collections/hash/map.rs:LL:COL │ ╰ note: `std::collections::HashMap` defined here - ╰╴ help: you might have meant to use an associated function to build this type ╭╴ LL │ let _ = std::collections::HashMap::new(); @@ -34,7 +34,7 @@ LL │ wtf: Some(Box(U { note: constructor is not visible here due to private fields ╭▸ $SRC_DIR/alloc/src/boxed.rs:LL:COL │ - ╰ note: private field + ├ note: private field │ ╰ note: private field help: you might have meant to use an associated function to build this type diff --git a/tests/ui/suggestions/partialeq_suggest_swap_on_e0277.stderr b/tests/ui/suggestions/partialeq_suggest_swap_on_e0277.stderr index ebe103ef19a..c5984f53f68 100644 --- a/tests/ui/suggestions/partialeq_suggest_swap_on_e0277.stderr +++ b/tests/ui/suggestions/partialeq_suggest_swap_on_e0277.stderr @@ -10,6 +10,8 @@ LL | String::from("Girls Band Cry") == T(String::from("Girls Band Cry")); `String` implements `PartialEq<ByteStr>` `String` implements `PartialEq<ByteString>` `String` implements `PartialEq<Cow<'_, str>>` + `String` implements `PartialEq<Path>` + `String` implements `PartialEq<PathBuf>` `String` implements `PartialEq<str>` `String` implements `PartialEq` = note: `T` implements `PartialEq<String>` diff --git a/tests/ui/suggestions/suggest-swapping-self-ty-and-trait.stderr b/tests/ui/suggestions/suggest-swapping-self-ty-and-trait.stderr index d90dd201bcf..72ac7209bdf 100644 --- a/tests/ui/suggestions/suggest-swapping-self-ty-and-trait.stderr +++ b/tests/ui/suggestions/suggest-swapping-self-ty-and-trait.stderr @@ -69,7 +69,7 @@ LL | impl<'a, T> Struct<T> for Trait<'a, T> {} | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! = note: for more information, see <https://doc.rust-lang.org/edition-guide/rust-2021/warnings-promoted-to-error.html> - = note: `#[warn(bare_trait_objects)]` on by default + = note: `#[warn(bare_trait_objects)]` (part of `#[warn(rust_2021_compatibility)]`) on by default help: if this is a dyn-compatible trait, use `dyn` | LL | impl<'a, T> Struct<T> for dyn Trait<'a, T> {} diff --git a/tests/ui/suggestions/suggest-tryinto-edition-change.stderr b/tests/ui/suggestions/suggest-tryinto-edition-change.stderr index 0008b4fb5ed..8ab8a1716b1 100644 --- a/tests/ui/suggestions/suggest-tryinto-edition-change.stderr +++ b/tests/ui/suggestions/suggest-tryinto-edition-change.stderr @@ -44,6 +44,7 @@ error[E0599]: no method named `try_into` found for type `i32` in the current sco | LL | let _i: i16 = 0_i32.try_into().unwrap(); | ^^^^^^^^ + | --> $SRC_DIR/core/src/convert/mod.rs:LL:COL | = note: the method is available for `i32` here diff --git a/tests/ui/suggestions/try-removing-the-field.stderr b/tests/ui/suggestions/try-removing-the-field.stderr index 7a6013d4a6e..aaf260bb86e 100644 --- a/tests/ui/suggestions/try-removing-the-field.stderr +++ b/tests/ui/suggestions/try-removing-the-field.stderr @@ -6,7 +6,7 @@ LL | let Foo { foo, bar, .. } = x; | | | help: try removing the field | - = note: `#[warn(unused_variables)]` on by default + = note: `#[warn(unused_variables)]` (part of `#[warn(unused)]`) on by default warning: unused variable: `unused` --> $DIR/try-removing-the-field.rs:20:20 diff --git a/tests/ui/suggestions/use-parentheses-to-call-closure-issue-145404.fixed b/tests/ui/suggestions/use-parentheses-to-call-closure-issue-145404.fixed new file mode 100644 index 00000000000..2835743fca2 --- /dev/null +++ b/tests/ui/suggestions/use-parentheses-to-call-closure-issue-145404.fixed @@ -0,0 +1,13 @@ +//@ run-rustfix + +use std::fmt::Display; + +struct S; + +impl S { + fn call(&self, _: impl Display) {} +} + +fn main() { + S.call((|| "hello")()); //~ ERROR [E0277] +} diff --git a/tests/ui/suggestions/use-parentheses-to-call-closure-issue-145404.rs b/tests/ui/suggestions/use-parentheses-to-call-closure-issue-145404.rs new file mode 100644 index 00000000000..848629a6700 --- /dev/null +++ b/tests/ui/suggestions/use-parentheses-to-call-closure-issue-145404.rs @@ -0,0 +1,13 @@ +//@ run-rustfix + +use std::fmt::Display; + +struct S; + +impl S { + fn call(&self, _: impl Display) {} +} + +fn main() { + S.call(|| "hello"); //~ ERROR [E0277] +} diff --git a/tests/ui/suggestions/use-parentheses-to-call-closure-issue-145404.stderr b/tests/ui/suggestions/use-parentheses-to-call-closure-issue-145404.stderr new file mode 100644 index 00000000000..cb6df5af7fb --- /dev/null +++ b/tests/ui/suggestions/use-parentheses-to-call-closure-issue-145404.stderr @@ -0,0 +1,23 @@ +error[E0277]: `{closure@$DIR/use-parentheses-to-call-closure-issue-145404.rs:12:12: 12:14}` doesn't implement `std::fmt::Display` + --> $DIR/use-parentheses-to-call-closure-issue-145404.rs:12:12 + | +LL | S.call(|| "hello"); + | ---- ^^^^^^^^^^ unsatisfied trait bound + | | + | required by a bound introduced by this call + | + = help: the trait `std::fmt::Display` is not implemented for closure `{closure@$DIR/use-parentheses-to-call-closure-issue-145404.rs:12:12: 12:14}` +note: required by a bound in `S::call` + --> $DIR/use-parentheses-to-call-closure-issue-145404.rs:8:28 + | +LL | fn call(&self, _: impl Display) {} + | ^^^^^^^ required by this bound in `S::call` +help: use parentheses to call this closure + | +LL - S.call(|| "hello"); +LL + S.call((|| "hello")()); + | + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/target-feature/invalid-attribute.stderr b/tests/ui/target-feature/invalid-attribute.stderr index a0117649a57..7b75367b48c 100644 --- a/tests/ui/target-feature/invalid-attribute.stderr +++ b/tests/ui/target-feature/invalid-attribute.stderr @@ -143,7 +143,7 @@ error: `#[target_feature]` attribute cannot be used on closures LL | #[target_feature(enable = "sse2")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = help: `#[target_feature]` can be applied to methods, functions + = help: `#[target_feature]` can be applied to methods and functions error: cannot use `#[inline(always)]` with `#[target_feature]` --> $DIR/invalid-attribute.rs:62:1 diff --git a/tests/ui/issues/issue-83048.rs b/tests/ui/thir-print/break-outside-loop-error-83048.rs index 6c941133a15..6dcebd77c27 100644 --- a/tests/ui/issues/issue-83048.rs +++ b/tests/ui/thir-print/break-outside-loop-error-83048.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/83048 //@ compile-flags: -Z unpretty=thir-tree pub fn main() { diff --git a/tests/ui/issues/issue-83048.stderr b/tests/ui/thir-print/break-outside-loop-error-83048.stderr index 672bf69a732..65a08e62e3d 100644 --- a/tests/ui/issues/issue-83048.stderr +++ b/tests/ui/thir-print/break-outside-loop-error-83048.stderr @@ -1,5 +1,5 @@ error[E0268]: `break` outside of a loop or labeled block - --> $DIR/issue-83048.rs:4:5 + --> $DIR/break-outside-loop-error-83048.rs:5:5 | LL | break; | ^^^^^ cannot `break` outside of a loop or labeled block diff --git a/tests/ui/issues/issue-87707.rs b/tests/ui/track-diagnostics/track-caller-for-once-87707.rs index a0da8a740ac..9b450943f5d 100644 --- a/tests/ui/issues/issue-87707.rs +++ b/tests/ui/track-diagnostics/track-caller-for-once-87707.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/87707 // test for #87707 //@ edition:2018 //@ run-fail diff --git a/tests/ui/issues/issue-87707.run.stderr b/tests/ui/track-diagnostics/track-caller-for-once-87707.run.stderr index 8485c0578b8..093df62836b 100644 --- a/tests/ui/issues/issue-87707.run.stderr +++ b/tests/ui/track-diagnostics/track-caller-for-once-87707.run.stderr @@ -1,7 +1,7 @@ -thread 'main' ($TID) panicked at $DIR/issue-87707.rs:14:24: +thread 'main' ($TID) panicked at $DIR/track-caller-for-once-87707.rs:15:24: Here Once instance is poisoned. note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace -thread 'main' ($TID) panicked at $DIR/issue-87707.rs:16:7: +thread 'main' ($TID) panicked at $DIR/track-caller-for-once-87707.rs:17:7: Once instance has previously been poisoned diff --git a/tests/ui/issues/issue-87199.rs b/tests/ui/trait-bounds/relaxed-bounds-assumed-unsized-87199.rs index dd9dfc74ca3..f3baa4b1feb 100644 --- a/tests/ui/issues/issue-87199.rs +++ b/tests/ui/trait-bounds/relaxed-bounds-assumed-unsized-87199.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/87199 // Regression test for issue #87199, where attempting to relax a bound // other than the only supported `?Sized` would still cause the compiler // to assume that the `Sized` bound was relaxed. diff --git a/tests/ui/issues/issue-87199.stderr b/tests/ui/trait-bounds/relaxed-bounds-assumed-unsized-87199.stderr index 8a930a3d704..16223676c06 100644 --- a/tests/ui/issues/issue-87199.stderr +++ b/tests/ui/trait-bounds/relaxed-bounds-assumed-unsized-87199.stderr @@ -1,23 +1,23 @@ error: bound modifier `?` can only be applied to `Sized` - --> $DIR/issue-87199.rs:8:11 + --> $DIR/relaxed-bounds-assumed-unsized-87199.rs:9:11 | LL | fn arg<T: ?Send>(_: T) {} | ^^^^^ error: bound modifier `?` can only be applied to `Sized` - --> $DIR/issue-87199.rs:10:15 + --> $DIR/relaxed-bounds-assumed-unsized-87199.rs:11:15 | LL | fn ref_arg<T: ?Send>(_: &T) {} | ^^^^^ error: bound modifier `?` can only be applied to `Sized` - --> $DIR/issue-87199.rs:12:40 + --> $DIR/relaxed-bounds-assumed-unsized-87199.rs:13:40 | LL | fn ret() -> impl Iterator<Item = ()> + ?Send { std::iter::empty() } | ^^^^^ error: bound modifier `?` can only be applied to `Sized` - --> $DIR/issue-87199.rs:12:40 + --> $DIR/relaxed-bounds-assumed-unsized-87199.rs:13:40 | LL | fn ret() -> impl Iterator<Item = ()> + ?Send { std::iter::empty() } | ^^^^^ @@ -25,14 +25,14 @@ LL | fn ret() -> impl Iterator<Item = ()> + ?Send { std::iter::empty() } = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error[E0277]: the size for values of type `[i32]` cannot be known at compilation time - --> $DIR/issue-87199.rs:19:15 + --> $DIR/relaxed-bounds-assumed-unsized-87199.rs:20:15 | LL | ref_arg::<[i32]>(&[5]); | ^^^^^ doesn't have a size known at compile-time | = help: the trait `Sized` is not implemented for `[i32]` note: required by an implicit `Sized` bound in `ref_arg` - --> $DIR/issue-87199.rs:10:12 + --> $DIR/relaxed-bounds-assumed-unsized-87199.rs:11:12 | LL | fn ref_arg<T: ?Send>(_: &T) {} | ^ required by the implicit `Sized` requirement on this type parameter in `ref_arg` diff --git a/tests/ui/trait-bounds/trait-bound-adt-issue-145611.rs b/tests/ui/trait-bounds/trait-bound-adt-issue-145611.rs new file mode 100644 index 00000000000..74551ce493f --- /dev/null +++ b/tests/ui/trait-bounds/trait-bound-adt-issue-145611.rs @@ -0,0 +1,11 @@ +// This test is for regression of issue #145611 +// There should not be cycle error in effective_visibilities query. + +trait LocalTrait {} +struct SomeType; +fn impls_trait<T: LocalTrait>() {} +fn foo() -> impl Sized { + impls_trait::<SomeType>(); //~ ERROR the trait bound `SomeType: LocalTrait` is not satisfied [E0277] +} + +fn main() {} diff --git a/tests/ui/trait-bounds/trait-bound-adt-issue-145611.stderr b/tests/ui/trait-bounds/trait-bound-adt-issue-145611.stderr new file mode 100644 index 00000000000..9f47f9bc02a --- /dev/null +++ b/tests/ui/trait-bounds/trait-bound-adt-issue-145611.stderr @@ -0,0 +1,25 @@ +error[E0277]: the trait bound `SomeType: LocalTrait` is not satisfied + --> $DIR/trait-bound-adt-issue-145611.rs:8:19 + | +LL | impls_trait::<SomeType>(); + | ^^^^^^^^ unsatisfied trait bound + | +help: the trait `LocalTrait` is not implemented for `SomeType` + --> $DIR/trait-bound-adt-issue-145611.rs:5:1 + | +LL | struct SomeType; + | ^^^^^^^^^^^^^^^ +help: this trait has no implementations, consider adding one + --> $DIR/trait-bound-adt-issue-145611.rs:4:1 + | +LL | trait LocalTrait {} + | ^^^^^^^^^^^^^^^^ +note: required by a bound in `impls_trait` + --> $DIR/trait-bound-adt-issue-145611.rs:6:19 + | +LL | fn impls_trait<T: LocalTrait>() {} + | ^^^^^^^^^^ required by this bound in `impls_trait` + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/traits/alias/bounds.stderr b/tests/ui/traits/alias/bounds.stderr index 7fb8e918da3..215a9b57fbf 100644 --- a/tests/ui/traits/alias/bounds.stderr +++ b/tests/ui/traits/alias/bounds.stderr @@ -4,7 +4,7 @@ warning: trait `Empty` is never used LL | trait Empty {} | ^^^^^ | - = note: `#[warn(dead_code)]` on by default + = note: `#[warn(dead_code)]` (part of `#[warn(unused)]`) on by default warning: 1 warning emitted diff --git a/tests/ui/traits/alias/style_lint.stderr b/tests/ui/traits/alias/style_lint.stderr index 91e2ea90eb9..e11e51c018f 100644 --- a/tests/ui/traits/alias/style_lint.stderr +++ b/tests/ui/traits/alias/style_lint.stderr @@ -4,7 +4,7 @@ warning: trait alias `bar` should have an upper camel case name LL | trait bar = std::fmt::Display + std::fmt::Debug; | ^^^ help: convert the identifier to upper camel case: `Bar` | - = note: `#[warn(non_camel_case_types)]` on by default + = note: `#[warn(non_camel_case_types)]` (part of `#[warn(nonstandard_style)]`) on by default warning: 1 warning emitted diff --git a/tests/ui/traits/associated_type_bound/assoc_type_bound_with_struct.stderr b/tests/ui/traits/associated_type_bound/assoc_type_bound_with_struct.stderr index 2288bd1129c..40936ce1ec3 100644 --- a/tests/ui/traits/associated_type_bound/assoc_type_bound_with_struct.stderr +++ b/tests/ui/traits/associated_type_bound/assoc_type_bound_with_struct.stderr @@ -3,10 +3,10 @@ error[E0404]: expected trait, found struct `String` | LL | struct Foo<T> where T: Bar, <T as Bar>::Baz: String { | ^^^^^^ not a trait + | --> $SRC_DIR/alloc/src/string.rs:LL:COL | = note: similarly named trait `ToString` defined here - | help: constrain the associated type to `String` | LL - struct Foo<T> where T: Bar, <T as Bar>::Baz: String { @@ -22,10 +22,10 @@ error[E0404]: expected trait, found struct `String` | LL | struct Qux<'a, T> where T: Bar, <&'a T as Bar>::Baz: String { | ^^^^^^ not a trait + | --> $SRC_DIR/alloc/src/string.rs:LL:COL | = note: similarly named trait `ToString` defined here - | help: constrain the associated type to `String` | LL - struct Qux<'a, T> where T: Bar, <&'a T as Bar>::Baz: String { @@ -41,10 +41,10 @@ error[E0404]: expected trait, found struct `String` | LL | fn foo<T: Bar>(_: T) where <T as Bar>::Baz: String { | ^^^^^^ not a trait + | --> $SRC_DIR/alloc/src/string.rs:LL:COL | = note: similarly named trait `ToString` defined here - | help: constrain the associated type to `String` | LL - fn foo<T: Bar>(_: T) where <T as Bar>::Baz: String { @@ -60,10 +60,10 @@ error[E0404]: expected trait, found struct `String` | LL | fn qux<'a, T: Bar>(_: &'a T) where <&'a T as Bar>::Baz: String { | ^^^^^^ not a trait + | --> $SRC_DIR/alloc/src/string.rs:LL:COL | = note: similarly named trait `ToString` defined here - | help: constrain the associated type to `String` | LL - fn qux<'a, T: Bar>(_: &'a T) where <&'a T as Bar>::Baz: String { @@ -85,6 +85,7 @@ error[E0404]: expected trait, found struct `String` | LL | fn issue_95327() where <u8 as Unresolved>::Assoc: String {} | ^^^^^^ help: a trait with a similar name exists: `ToString` + | --> $SRC_DIR/alloc/src/string.rs:LL:COL | = note: similarly named trait `ToString` defined here diff --git a/tests/ui/issues/auxiliary/issue-9123.rs b/tests/ui/traits/auxiliary/aux-9123.rs index 60af53359e8..60af53359e8 100644 --- a/tests/ui/issues/auxiliary/issue-9123.rs +++ b/tests/ui/traits/auxiliary/aux-9123.rs diff --git a/tests/ui/traits/bound/not-on-bare-trait.stderr b/tests/ui/traits/bound/not-on-bare-trait.stderr index 69413ca96cd..fa2c531d535 100644 --- a/tests/ui/traits/bound/not-on-bare-trait.stderr +++ b/tests/ui/traits/bound/not-on-bare-trait.stderr @@ -6,7 +6,7 @@ LL | fn foo(_x: Foo + Send) { | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! = note: for more information, see <https://doc.rust-lang.org/edition-guide/rust-2021/warnings-promoted-to-error.html> - = note: `#[warn(bare_trait_objects)]` on by default + = note: `#[warn(bare_trait_objects)]` (part of `#[warn(rust_2021_compatibility)]`) on by default help: if this is a dyn-compatible trait, use `dyn` | LL | fn foo(_x: dyn Foo + Send) { diff --git a/tests/ui/traits/coercion-generic-bad.stderr b/tests/ui/traits/coercion-generic-bad.stderr index c0553ea62c5..6af96b9daf7 100644 --- a/tests/ui/traits/coercion-generic-bad.stderr +++ b/tests/ui/traits/coercion-generic-bad.stderr @@ -2,7 +2,7 @@ error[E0277]: the trait bound `Struct: Trait<isize>` is not satisfied --> $DIR/coercion-generic-bad.rs:16:36 | LL | let s: Box<dyn Trait<isize>> = Box::new(Struct { person: "Fred" }); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Trait<isize>` is not implemented for `Struct` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unsatisfied trait bound | = help: the trait `Trait<isize>` is not implemented for `Struct` but trait `Trait<&'static str>` is implemented for it diff --git a/tests/ui/traits/const-traits/const-supertraits-dyn-compat.rs b/tests/ui/traits/const-traits/const-supertraits-dyn-compat.rs new file mode 100644 index 00000000000..2d12bc81af6 --- /dev/null +++ b/tests/ui/traits/const-traits/const-supertraits-dyn-compat.rs @@ -0,0 +1,18 @@ +#![feature(const_trait_impl)] + +const trait Super {} + +// Not ok +const trait Unconditionally: const Super {} +fn test() { + let _: &dyn Unconditionally; + //~^ ERROR the trait `Unconditionally` is not dyn compatible +} + +// Okay +const trait Conditionally: [const] Super {} +fn test2() { + let _: &dyn Conditionally; +} + +fn main() {} diff --git a/tests/ui/traits/const-traits/const-supertraits-dyn-compat.stderr b/tests/ui/traits/const-traits/const-supertraits-dyn-compat.stderr new file mode 100644 index 00000000000..ceb07081c9e --- /dev/null +++ b/tests/ui/traits/const-traits/const-supertraits-dyn-compat.stderr @@ -0,0 +1,18 @@ +error[E0038]: the trait `Unconditionally` is not dyn compatible + --> $DIR/const-supertraits-dyn-compat.rs:8:17 + | +LL | let _: &dyn Unconditionally; + | ^^^^^^^^^^^^^^^ `Unconditionally` 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/const-supertraits-dyn-compat.rs:6:30 + | +LL | const trait Unconditionally: const Super {} + | --------------- ^^^^^^^^^^^ ...because it cannot have a `const` supertrait + | | + | this trait is not dyn compatible... + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0038`. diff --git a/tests/ui/traits/const-traits/const-trait-async-assoc-fn.rs b/tests/ui/traits/const-traits/const-trait-async-assoc-fn.rs new file mode 100644 index 00000000000..00fdccc2ac8 --- /dev/null +++ b/tests/ui/traits/const-traits/const-trait-async-assoc-fn.rs @@ -0,0 +1,18 @@ +//@ edition: 2021 +#![feature(const_trait_impl)] + +const trait Tr { + async fn ft1() {} +//~^ ERROR async functions are not allowed in `const` traits +} + +const trait Tr2 { + fn f() -> impl std::future::Future<Output = ()>; +} + +impl const Tr2 for () { + async fn f() {} +//~^ ERROR async functions are not allowed in `const` trait impls +} + +fn main() {} diff --git a/tests/ui/traits/const-traits/const-trait-async-assoc-fn.stderr b/tests/ui/traits/const-traits/const-trait-async-assoc-fn.stderr new file mode 100644 index 00000000000..09ba0969dc9 --- /dev/null +++ b/tests/ui/traits/const-traits/const-trait-async-assoc-fn.stderr @@ -0,0 +1,18 @@ +error: async functions are not allowed in `const` traits + --> $DIR/const-trait-async-assoc-fn.rs:5:5 + | +LL | const trait Tr { + | ----- associated functions of `const` cannot be declared `async` +LL | async fn ft1() {} + | ^^^^^ + +error: async functions are not allowed in `const` trait impls + --> $DIR/const-trait-async-assoc-fn.rs:14:5 + | +LL | impl const Tr2 for () { + | ----- associated functions of `const` cannot be declared `async` +LL | async fn f() {} + | ^^^^^ + +error: aborting due to 2 previous errors + diff --git a/tests/ui/traits/const-traits/constructor-const-fn.rs b/tests/ui/traits/const-traits/constructor-const-fn.rs new file mode 100644 index 00000000000..4a7bf531df2 --- /dev/null +++ b/tests/ui/traits/const-traits/constructor-const-fn.rs @@ -0,0 +1,15 @@ +//@ check-pass +//@ compile-flags: -Znext-solver +#![feature(const_trait_impl)] +const fn impls_fn<F: ~const Fn(u32) -> Foo>(_: &F) {} + +struct Foo(u32); + +const fn foo() { + // This previously triggered an incorrect assert + // when checking whether the constructor of `Foo` + // is const. + impls_fn(&Foo) +} + +fn main() {} diff --git a/tests/ui/traits/const-traits/macro-const-trait-bound-theoretical-regression.stderr b/tests/ui/traits/const-traits/macro-const-trait-bound-theoretical-regression.stderr index 9fad260f0be..7a4061d9c18 100644 --- a/tests/ui/traits/const-traits/macro-const-trait-bound-theoretical-regression.stderr +++ b/tests/ui/traits/const-traits/macro-const-trait-bound-theoretical-regression.stderr @@ -45,7 +45,7 @@ LL | demo! { impl const Trait } | = warning: this is accepted in the current edition (Rust 2018) but is a hard error in Rust 2021! = note: for more information, see <https://doc.rust-lang.org/edition-guide/rust-2021/warnings-promoted-to-error.html> - = note: `#[warn(bare_trait_objects)]` on by default + = note: `#[warn(bare_trait_objects)]` (part of `#[warn(rust_2021_compatibility)]`) on by default = note: this warning originates in the macro `demo` (in Nightly builds, run with -Z macro-backtrace for more info) help: you might have intended to implement this trait for a given type | diff --git a/tests/ui/traits/const-traits/reservation-impl-ice.rs b/tests/ui/traits/const-traits/reservation-impl-ice.rs new file mode 100644 index 00000000000..efaea1cc6b2 --- /dev/null +++ b/tests/ui/traits/const-traits/reservation-impl-ice.rs @@ -0,0 +1,13 @@ +//@ compile-flags: -Znext-solver +#![feature(const_from, never_type, const_trait_impl)] + +const fn impls_from<T: ~const From<!>>() {} + +const fn foo() { + // This previously ICE'd when encountering the reservation impl + // from the standard library. + impls_from::<()>(); + //~^ ERROR the trait bound `(): From<!>` is not satisfied +} + +fn main() {} diff --git a/tests/ui/traits/const-traits/reservation-impl-ice.stderr b/tests/ui/traits/const-traits/reservation-impl-ice.stderr new file mode 100644 index 00000000000..a3fdcbac69e --- /dev/null +++ b/tests/ui/traits/const-traits/reservation-impl-ice.stderr @@ -0,0 +1,25 @@ +error[E0277]: the trait bound `(): From<!>` is not satisfied + --> $DIR/reservation-impl-ice.rs:9:18 + | +LL | impls_from::<()>(); + | ^^ the trait `From<!>` is not implemented for `()` + | + = help: the following other types implement trait `From<T>`: + `(T, T)` implements `From<[T; 2]>` + `(T, T, T)` implements `From<[T; 3]>` + `(T, T, T, T)` implements `From<[T; 4]>` + `(T, T, T, T, T)` implements `From<[T; 5]>` + `(T, T, T, T, T, T)` implements `From<[T; 6]>` + `(T, T, T, T, T, T, T)` implements `From<[T; 7]>` + `(T, T, T, T, T, T, T, T)` implements `From<[T; 8]>` + `(T, T, T, T, T, T, T, T, T)` implements `From<[T; 9]>` + and 4 others +note: required by a bound in `impls_from` + --> $DIR/reservation-impl-ice.rs:4:24 + | +LL | const fn impls_from<T: ~const From<!>>() {} + | ^^^^^^^^^^^^^^ required by this bound in `impls_from` + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/traits/default-method-fn-call-9123.rs b/tests/ui/traits/default-method-fn-call-9123.rs new file mode 100644 index 00000000000..266b95ca960 --- /dev/null +++ b/tests/ui/traits/default-method-fn-call-9123.rs @@ -0,0 +1,7 @@ +// https://github.com/rust-lang/rust/issues/9123 +//@ run-pass +//@ aux-build:aux-9123.rs + +extern crate aux_9123; + +pub fn main() {} diff --git a/tests/ui/traits/default-method/bound-subst4.stderr b/tests/ui/traits/default-method/bound-subst4.stderr index 548c46f1233..62be4c3a8fc 100644 --- a/tests/ui/traits/default-method/bound-subst4.stderr +++ b/tests/ui/traits/default-method/bound-subst4.stderr @@ -7,7 +7,7 @@ LL | fn g(&self, x: usize) -> usize { x } LL | fn h(&self, x: T) { } | ^ | - = note: `#[warn(dead_code)]` on by default + = note: `#[warn(dead_code)]` (part of `#[warn(unused)]`) on by default warning: 1 warning emitted diff --git a/tests/ui/traits/default_auto_traits/default-bounds.stderr b/tests/ui/traits/default_auto_traits/default-bounds.stderr index 318fc57fc9c..ae1b0e842ff 100644 --- a/tests/ui/traits/default_auto_traits/default-bounds.stderr +++ b/tests/ui/traits/default_auto_traits/default-bounds.stderr @@ -2,10 +2,15 @@ error[E0277]: the trait bound `Forbidden: SyncDrop` is not satisfied --> $DIR/default-bounds.rs:43:9 | LL | bar(Forbidden); - | --- ^^^^^^^^^ the trait `SyncDrop` is not implemented for `Forbidden` + | --- ^^^^^^^^^ unsatisfied trait bound | | | required by a bound introduced by this call | +help: the trait `SyncDrop` is not implemented for `Forbidden` + --> $DIR/default-bounds.rs:32:1 + | +LL | struct Forbidden; + | ^^^^^^^^^^^^^^^^ note: required by a bound in `bar` --> $DIR/default-bounds.rs:39:8 | @@ -16,10 +21,15 @@ error[E0277]: the trait bound `Forbidden: Leak` is not satisfied --> $DIR/default-bounds.rs:43:9 | LL | bar(Forbidden); - | --- ^^^^^^^^^ the trait `Leak` is not implemented for `Forbidden` + | --- ^^^^^^^^^ unsatisfied trait bound | | | required by a bound introduced by this call | +help: the trait `Leak` is not implemented for `Forbidden` + --> $DIR/default-bounds.rs:32:1 + | +LL | struct Forbidden; + | ^^^^^^^^^^^^^^^^ note: required by a bound in `bar` --> $DIR/default-bounds.rs:39:11 | diff --git a/tests/ui/traits/default_auto_traits/maybe-bounds-in-dyn-traits.stderr b/tests/ui/traits/default_auto_traits/maybe-bounds-in-dyn-traits.stderr index 350233b7cbe..b19c082a1b8 100644 --- a/tests/ui/traits/default_auto_traits/maybe-bounds-in-dyn-traits.stderr +++ b/tests/ui/traits/default_auto_traits/maybe-bounds-in-dyn-traits.stderr @@ -2,8 +2,13 @@ error[E0277]: the trait bound `NonLeakS: Leak` is not satisfied --> $DIR/maybe-bounds-in-dyn-traits.rs:59:25 | LL | let _: &dyn Trait = &NonLeakS; - | ^^^^^^^^^ the trait `Leak` is not implemented for `NonLeakS` + | ^^^^^^^^^ unsatisfied trait bound | +help: the trait `Leak` is not implemented for `NonLeakS` + --> $DIR/maybe-bounds-in-dyn-traits.rs:46:1 + | +LL | struct NonLeakS; + | ^^^^^^^^^^^^^^^ = note: required for the cast from `&NonLeakS` to `&dyn Trait + Leak` error[E0277]: the trait bound `dyn Trait: Leak` is not satisfied diff --git a/tests/ui/traits/default_auto_traits/maybe-bounds-in-traits.stderr b/tests/ui/traits/default_auto_traits/maybe-bounds-in-traits.stderr index bc797c9d976..372bf817600 100644 --- a/tests/ui/traits/default_auto_traits/maybe-bounds-in-traits.stderr +++ b/tests/ui/traits/default_auto_traits/maybe-bounds-in-traits.stderr @@ -2,8 +2,13 @@ error[E0277]: the trait bound `NonLeakS: Leak` is not satisfied --> $DIR/maybe-bounds-in-traits.rs:67:22 | LL | type Leak2 = NonLeakS; - | ^^^^^^^^ the trait `Leak` is not implemented for `NonLeakS` + | ^^^^^^^^ unsatisfied trait bound | +help: the trait `Leak` is not implemented for `NonLeakS` + --> $DIR/maybe-bounds-in-traits.rs:34:1 + | +LL | struct NonLeakS; + | ^^^^^^^^^^^^^^^ note: required by a bound in `Test3::Leak2` --> $DIR/maybe-bounds-in-traits.rs:67:9 | @@ -57,8 +62,13 @@ error[E0277]: the trait bound `NonLeakS: Leak` is not satisfied --> $DIR/maybe-bounds-in-traits.rs:115:18 | LL | NonLeakS.leak_foo(); - | ^^^^^^^^ the trait `Leak` is not implemented for `NonLeakS` + | ^^^^^^^^ unsatisfied trait bound + | +help: the trait `Leak` is not implemented for `NonLeakS` + --> $DIR/maybe-bounds-in-traits.rs:34:1 | +LL | struct NonLeakS; + | ^^^^^^^^^^^^^^^ note: required by a bound in `methods::Trait::leak_foo` --> $DIR/maybe-bounds-in-traits.rs:101:9 | diff --git a/tests/ui/issues/issue-5666.rs b/tests/ui/traits/dynamic-dispatch-trait-objects-5666.rs index 76e2f8229a0..e335949d832 100644 --- a/tests/ui/issues/issue-5666.rs +++ b/tests/ui/traits/dynamic-dispatch-trait-objects-5666.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/5666 //@ run-pass struct Dog { @@ -14,7 +15,6 @@ impl Barks for Dog { } } - pub fn main() { let snoopy = Box::new(Dog{name: "snoopy".to_string()}); let bubbles = Box::new(Dog{name: "bubbles".to_string()}); diff --git a/tests/ui/traits/enum-negative-send-impl.stderr b/tests/ui/traits/enum-negative-send-impl.stderr index 1992becccf4..2aad2265797 100644 --- a/tests/ui/traits/enum-negative-send-impl.stderr +++ b/tests/ui/traits/enum-negative-send-impl.stderr @@ -6,7 +6,11 @@ LL | requires_send(container); | | | required by a bound introduced by this call | - = help: within `Container`, the trait `Send` is not implemented for `NoSend` +help: within `Container`, the trait `Send` is not implemented for `NoSend` + --> $DIR/enum-negative-send-impl.rs:9:1 + | +LL | struct NoSend; + | ^^^^^^^^^^^^^ note: required because it appears within the type `Container` --> $DIR/enum-negative-send-impl.rs:12:6 | diff --git a/tests/ui/traits/enum-negative-sync-impl.stderr b/tests/ui/traits/enum-negative-sync-impl.stderr index a97b7a36a7b..b4ab69afb42 100644 --- a/tests/ui/traits/enum-negative-sync-impl.stderr +++ b/tests/ui/traits/enum-negative-sync-impl.stderr @@ -6,7 +6,11 @@ LL | requires_sync(container); | | | required by a bound introduced by this call | - = help: within `Container`, the trait `Sync` is not implemented for `NoSync` +help: within `Container`, the trait `Sync` is not implemented for `NoSync` + --> $DIR/enum-negative-sync-impl.rs:9:1 + | +LL | struct NoSync; + | ^^^^^^^^^^^^^ note: required because it appears within the type `Container` --> $DIR/enum-negative-sync-impl.rs:12:6 | diff --git a/tests/ui/traits/impl-inherent-prefer-over-trait.stderr b/tests/ui/traits/impl-inherent-prefer-over-trait.stderr index f0bb21402d8..14b3e4d903f 100644 --- a/tests/ui/traits/impl-inherent-prefer-over-trait.stderr +++ b/tests/ui/traits/impl-inherent-prefer-over-trait.stderr @@ -6,7 +6,7 @@ LL | trait Trait { LL | fn bar(&self); | ^^^ | - = note: `#[warn(dead_code)]` on by default + = note: `#[warn(dead_code)]` (part of `#[warn(unused)]`) on by default warning: 1 warning emitted diff --git a/tests/ui/traits/impl-object-overlap-issue-23853.stderr b/tests/ui/traits/impl-object-overlap-issue-23853.stderr index 9fa7a36816e..bdab0ae3532 100644 --- a/tests/ui/traits/impl-object-overlap-issue-23853.stderr +++ b/tests/ui/traits/impl-object-overlap-issue-23853.stderr @@ -6,7 +6,7 @@ LL | trait Foo { fn dummy(&self) { } } | | | method in this trait | - = note: `#[warn(dead_code)]` on by default + = note: `#[warn(dead_code)]` (part of `#[warn(unused)]`) on by default warning: 1 warning emitted diff --git a/tests/ui/traits/impl.stderr b/tests/ui/traits/impl.stderr index 9216a33c1d0..c17957f1e64 100644 --- a/tests/ui/traits/impl.stderr +++ b/tests/ui/traits/impl.stderr @@ -6,7 +6,7 @@ LL | trait T { LL | fn t(&self) {} | ^ | - = note: `#[warn(dead_code)]` on by default + = note: `#[warn(dead_code)]` (part of `#[warn(unused)]`) on by default warning: 1 warning emitted diff --git a/tests/ui/traits/issue-38033.stderr b/tests/ui/traits/issue-38033.stderr index 05385e8cf4d..fb713c564cf 100644 --- a/tests/ui/traits/issue-38033.stderr +++ b/tests/ui/traits/issue-38033.stderr @@ -7,7 +7,7 @@ LL | trait IntoFuture { LL | fn into_future(self) -> Self::Future; | ^^^^^^^^^^^ | - = note: `#[warn(dead_code)]` on by default + = note: `#[warn(dead_code)]` (part of `#[warn(unused)]`) on by default warning: 1 warning emitted diff --git a/tests/ui/traits/issue-6128.stderr b/tests/ui/traits/issue-6128.stderr index c9518ea41ea..1c0460df69e 100644 --- a/tests/ui/traits/issue-6128.stderr +++ b/tests/ui/traits/issue-6128.stderr @@ -8,7 +8,7 @@ LL | fn f(&self, _: Edge); LL | fn g(&self, _: Node); | ^ | - = note: `#[warn(dead_code)]` on by default + = note: `#[warn(dead_code)]` (part of `#[warn(unused)]`) on by default warning: 1 warning emitted diff --git a/tests/ui/traits/issue-87558.stderr b/tests/ui/traits/issue-87558.stderr index dc5bd6ece36..ca908a3062d 100644 --- a/tests/ui/traits/issue-87558.stderr +++ b/tests/ui/traits/issue-87558.stderr @@ -38,7 +38,11 @@ error[E0277]: expected a `FnMut(&isize)` closure, found `Error` LL | impl Fn(&isize) for Error { | ^^^^^ expected an `FnMut(&isize)` closure, found `Error` | - = help: the trait `FnMut(&isize)` is not implemented for `Error` +help: the trait `FnMut(&isize)` is not implemented for `Error` + --> $DIR/issue-87558.rs:2:1 + | +LL | struct Error(ErrorKind); + | ^^^^^^^^^^^^ note: required by a bound in `Fn` --> $SRC_DIR/core/src/ops/function.rs:LL:COL diff --git a/tests/ui/traits/issue-91594.stderr b/tests/ui/traits/issue-91594.stderr index 13568179e81..04abd02aac4 100644 --- a/tests/ui/traits/issue-91594.stderr +++ b/tests/ui/traits/issue-91594.stderr @@ -2,8 +2,13 @@ error[E0277]: the trait bound `Foo: HasComponent<()>` is not satisfied --> $DIR/issue-91594.rs:10:19 | LL | impl HasComponent<<Foo as Component<Foo>>::Interface> for Foo {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `HasComponent<()>` is not implemented for `Foo` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unsatisfied trait bound | +help: the trait `HasComponent<()>` is not implemented for `Foo` + --> $DIR/issue-91594.rs:8:1 + | +LL | struct Foo; + | ^^^^^^^^^^ = help: the trait `HasComponent<<Foo as Component<Foo>>::Interface>` is implemented for `Foo` note: required for `Foo` to implement `Component<Foo>` --> $DIR/issue-91594.rs:13:27 diff --git a/tests/ui/traits/missing-for-type-in-impl.e2015.stderr b/tests/ui/traits/missing-for-type-in-impl.e2015.stderr index a0bfc524252..40ebf8f36af 100644 --- a/tests/ui/traits/missing-for-type-in-impl.e2015.stderr +++ b/tests/ui/traits/missing-for-type-in-impl.e2015.stderr @@ -6,7 +6,7 @@ LL | impl Foo<i64> { | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! = note: for more information, see <https://doc.rust-lang.org/edition-guide/rust-2021/warnings-promoted-to-error.html> - = note: `#[warn(bare_trait_objects)]` on by default + = note: `#[warn(bare_trait_objects)]` (part of `#[warn(rust_2021_compatibility)]`) on by default help: if this is a dyn-compatible trait, use `dyn` | LL | impl dyn Foo<i64> { diff --git a/tests/ui/traits/multidispatch-conditional-impl-not-considered.stderr b/tests/ui/traits/multidispatch-conditional-impl-not-considered.stderr index 25313a477f7..8a9c2206331 100644 --- a/tests/ui/traits/multidispatch-conditional-impl-not-considered.stderr +++ b/tests/ui/traits/multidispatch-conditional-impl-not-considered.stderr @@ -4,7 +4,7 @@ warning: trait `Foo` is never used LL | trait Foo { | ^^^ | - = note: `#[warn(dead_code)]` on by default + = note: `#[warn(dead_code)]` (part of `#[warn(unused)]`) on by default warning: 1 warning emitted diff --git a/tests/ui/traits/multidispatch-infer-convert-target.stderr b/tests/ui/traits/multidispatch-infer-convert-target.stderr index c8c1b642719..fbf57e9327f 100644 --- a/tests/ui/traits/multidispatch-infer-convert-target.stderr +++ b/tests/ui/traits/multidispatch-infer-convert-target.stderr @@ -6,7 +6,7 @@ LL | trait Convert<Target> { LL | fn convert(&self) -> Target; | ^^^^^^^ | - = note: `#[warn(dead_code)]` on by default + = note: `#[warn(dead_code)]` (part of `#[warn(unused)]`) on by default warning: 1 warning emitted diff --git a/tests/ui/issues/issue-8249.rs b/tests/ui/traits/mut-trait-in-struct-8249.rs index 2364fc14d31..b6dcd848b8b 100644 --- a/tests/ui/issues/issue-8249.rs +++ b/tests/ui/traits/mut-trait-in-struct-8249.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/8249 //@ run-pass #![allow(dead_code)] diff --git a/tests/ui/traits/negative-bounds/negative-metasized.current.stderr b/tests/ui/traits/negative-bounds/negative-metasized.current.stderr new file mode 100644 index 00000000000..4ff51651336 --- /dev/null +++ b/tests/ui/traits/negative-bounds/negative-metasized.current.stderr @@ -0,0 +1,39 @@ +error[E0277]: the trait bound `T: !MetaSized` is not satisfied + --> $DIR/negative-metasized.rs:12:11 + | +LL | foo::<T>(); + | ^ the trait bound `T: !MetaSized` is not satisfied + | +note: required by a bound in `foo` + --> $DIR/negative-metasized.rs:9:11 + | +LL | fn foo<T: !MetaSized>() {} + | ^^^^^^^^^^ required by this bound in `foo` + +error[E0277]: the trait bound `(): !MetaSized` is not satisfied + --> $DIR/negative-metasized.rs:17:11 + | +LL | foo::<()>(); + | ^^ the trait bound `(): !MetaSized` is not satisfied + | +note: required by a bound in `foo` + --> $DIR/negative-metasized.rs:9:11 + | +LL | fn foo<T: !MetaSized>() {} + | ^^^^^^^^^^ required by this bound in `foo` + +error[E0277]: the trait bound `str: !MetaSized` is not satisfied + --> $DIR/negative-metasized.rs:19:11 + | +LL | foo::<str>(); + | ^^^ the trait bound `str: !MetaSized` is not satisfied + | +note: required by a bound in `foo` + --> $DIR/negative-metasized.rs:9:11 + | +LL | fn foo<T: !MetaSized>() {} + | ^^^^^^^^^^ required by this bound in `foo` + +error: aborting due to 3 previous errors + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/traits/negative-bounds/negative-metasized.next.stderr b/tests/ui/traits/negative-bounds/negative-metasized.next.stderr new file mode 100644 index 00000000000..4ff51651336 --- /dev/null +++ b/tests/ui/traits/negative-bounds/negative-metasized.next.stderr @@ -0,0 +1,39 @@ +error[E0277]: the trait bound `T: !MetaSized` is not satisfied + --> $DIR/negative-metasized.rs:12:11 + | +LL | foo::<T>(); + | ^ the trait bound `T: !MetaSized` is not satisfied + | +note: required by a bound in `foo` + --> $DIR/negative-metasized.rs:9:11 + | +LL | fn foo<T: !MetaSized>() {} + | ^^^^^^^^^^ required by this bound in `foo` + +error[E0277]: the trait bound `(): !MetaSized` is not satisfied + --> $DIR/negative-metasized.rs:17:11 + | +LL | foo::<()>(); + | ^^ the trait bound `(): !MetaSized` is not satisfied + | +note: required by a bound in `foo` + --> $DIR/negative-metasized.rs:9:11 + | +LL | fn foo<T: !MetaSized>() {} + | ^^^^^^^^^^ required by this bound in `foo` + +error[E0277]: the trait bound `str: !MetaSized` is not satisfied + --> $DIR/negative-metasized.rs:19:11 + | +LL | foo::<str>(); + | ^^^ the trait bound `str: !MetaSized` is not satisfied + | +note: required by a bound in `foo` + --> $DIR/negative-metasized.rs:9:11 + | +LL | fn foo<T: !MetaSized>() {} + | ^^^^^^^^^^ required by this bound in `foo` + +error: aborting due to 3 previous errors + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/traits/negative-bounds/negative-metasized.rs b/tests/ui/traits/negative-bounds/negative-metasized.rs new file mode 100644 index 00000000000..479037be852 --- /dev/null +++ b/tests/ui/traits/negative-bounds/negative-metasized.rs @@ -0,0 +1,21 @@ +//@ revisions: current next +//@ ignore-compare-mode-next-solver (explicit revisions) +//@[next] compile-flags: -Znext-solver +#![feature(negative_bounds)] +#![feature(sized_hierarchy)] + +use std::marker::MetaSized; + +fn foo<T: !MetaSized>() {} + +fn bar<T: !Sized + MetaSized>() { + foo::<T>(); + //~^ ERROR the trait bound `T: !MetaSized` is not satisfied +} + +fn main() { + foo::<()>(); + //~^ ERROR the trait bound `(): !MetaSized` is not satisfied + foo::<str>(); + //~^ ERROR the trait bound `str: !MetaSized` is not satisfied +} diff --git a/tests/ui/traits/negative-bounds/on-unimplemented.stderr b/tests/ui/traits/negative-bounds/on-unimplemented.stderr index 8a295611010..008ff865018 100644 --- a/tests/ui/traits/negative-bounds/on-unimplemented.stderr +++ b/tests/ui/traits/negative-bounds/on-unimplemented.stderr @@ -2,10 +2,16 @@ error[E0277]: the trait bound `NotFoo: !Foo` is not satisfied --> $DIR/on-unimplemented.rs:9:15 | LL | fn hello() -> impl !Foo { - | ^^^^^^^^^ the trait bound `NotFoo: !Foo` is not satisfied + | ^^^^^^^^^ unsatisfied trait bound LL | LL | NotFoo | ------ return type was inferred to be `NotFoo` here + | +help: the trait bound `NotFoo: !Foo` is not satisfied + --> $DIR/on-unimplemented.rs:7:1 + | +LL | struct NotFoo; + | ^^^^^^^^^^^^^ error: aborting due to 1 previous error diff --git a/tests/ui/traits/negative-bounds/simple.stderr b/tests/ui/traits/negative-bounds/simple.stderr index 499c19bb854..5b204c47d9c 100644 --- a/tests/ui/traits/negative-bounds/simple.stderr +++ b/tests/ui/traits/negative-bounds/simple.stderr @@ -26,8 +26,13 @@ error[E0277]: the trait bound `Copyable: !Copy` is not satisfied --> $DIR/simple.rs:30:16 | LL | not_copy::<Copyable>(); - | ^^^^^^^^ the trait bound `Copyable: !Copy` is not satisfied + | ^^^^^^^^ unsatisfied trait bound | +help: the trait bound `Copyable: !Copy` is not satisfied + --> $DIR/simple.rs:27:1 + | +LL | struct Copyable; + | ^^^^^^^^^^^^^^^ note: required by a bound in `not_copy` --> $DIR/simple.rs:3:16 | @@ -38,8 +43,13 @@ error[E0277]: the trait bound `NotNecessarilyCopyable: !Copy` is not satisfied --> $DIR/simple.rs:37:16 | LL | not_copy::<NotNecessarilyCopyable>(); - | ^^^^^^^^^^^^^^^^^^^^^^ the trait bound `NotNecessarilyCopyable: !Copy` is not satisfied + | ^^^^^^^^^^^^^^^^^^^^^^ unsatisfied trait bound + | +help: the trait bound `NotNecessarilyCopyable: !Copy` is not satisfied + --> $DIR/simple.rs:34:1 | +LL | struct NotNecessarilyCopyable; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ note: required by a bound in `not_copy` --> $DIR/simple.rs:3:16 | diff --git a/tests/ui/traits/negative-impls/negated-auto-traits-error.stderr b/tests/ui/traits/negative-impls/negated-auto-traits-error.stderr index 8f5b937e586..f450f786f60 100644 --- a/tests/ui/traits/negative-impls/negated-auto-traits-error.stderr +++ b/tests/ui/traits/negative-impls/negated-auto-traits-error.stderr @@ -6,7 +6,11 @@ LL | Outer(TestType); | | | required by a bound introduced by this call | - = help: the trait `Send` is not implemented for `dummy::TestType` +help: the trait `Send` is not implemented for `dummy::TestType` + --> $DIR/negated-auto-traits-error.rs:20:5 + | +LL | struct TestType; + | ^^^^^^^^^^^^^^^ note: required by a bound in `Outer` --> $DIR/negated-auto-traits-error.rs:10:17 | @@ -19,7 +23,11 @@ error[E0277]: `dummy::TestType` cannot be sent between threads safely LL | Outer(TestType); | ^^^^^^^^^^^^^^^ `dummy::TestType` cannot be sent between threads safely | - = help: the trait `Send` is not implemented for `dummy::TestType` +help: the trait `Send` is not implemented for `dummy::TestType` + --> $DIR/negated-auto-traits-error.rs:20:5 + | +LL | struct TestType; + | ^^^^^^^^^^^^^^^ note: required by a bound in `Outer` --> $DIR/negated-auto-traits-error.rs:10:17 | @@ -34,7 +42,11 @@ LL | is_send(TestType); | | | required by a bound introduced by this call | - = help: the trait `Send` is not implemented for `dummy1b::TestType` +help: the trait `Send` is not implemented for `dummy1b::TestType` + --> $DIR/negated-auto-traits-error.rs:29:5 + | +LL | struct TestType; + | ^^^^^^^^^^^^^^^ note: required by a bound in `is_send` --> $DIR/negated-auto-traits-error.rs:16:15 | @@ -49,7 +61,11 @@ LL | is_send((8, TestType)); | | | required by a bound introduced by this call | - = help: within `({integer}, dummy1c::TestType)`, the trait `Send` is not implemented for `dummy1c::TestType` +help: within `({integer}, dummy1c::TestType)`, the trait `Send` is not implemented for `dummy1c::TestType` + --> $DIR/negated-auto-traits-error.rs:37:5 + | +LL | struct TestType; + | ^^^^^^^^^^^^^^^ = note: required because it appears within the type `({integer}, dummy1c::TestType)` note: required by a bound in `is_send` --> $DIR/negated-auto-traits-error.rs:16:15 @@ -87,7 +103,11 @@ LL | is_send(Box::new(Outer2(TestType))); | | | required by a bound introduced by this call | - = help: within `Outer2<dummy3::TestType>`, the trait `Send` is not implemented for `dummy3::TestType` +help: within `Outer2<dummy3::TestType>`, the trait `Send` is not implemented for `dummy3::TestType` + --> $DIR/negated-auto-traits-error.rs:53:5 + | +LL | struct TestType; + | ^^^^^^^^^^^^^^^ note: required because it appears within the type `Outer2<dummy3::TestType>` --> $DIR/negated-auto-traits-error.rs:12:8 | @@ -110,7 +130,11 @@ LL | is_sync(Outer2(TestType)); | | | required by a bound introduced by this call | - = help: the trait `Send` is not implemented for `main::TestType` +help: the trait `Send` is not implemented for `main::TestType` + --> $DIR/negated-auto-traits-error.rs:61:5 + | +LL | struct TestType; + | ^^^^^^^^^^^^^^^ note: required for `Outer2<main::TestType>` to implement `Sync` --> $DIR/negated-auto-traits-error.rs:14:22 | diff --git a/tests/ui/traits/next-solver/assembly/ambiguity-due-to-uniquification-2.next.stderr b/tests/ui/traits/next-solver/assembly/ambiguity-due-to-uniquification-2.next.stderr index 3b478889996..e75be1e8137 100644 --- a/tests/ui/traits/next-solver/assembly/ambiguity-due-to-uniquification-2.next.stderr +++ b/tests/ui/traits/next-solver/assembly/ambiguity-due-to-uniquification-2.next.stderr @@ -1,10 +1,10 @@ -error[E0283]: type annotations needed: cannot satisfy `impl Trait<'x> + Trait<'y>: Trait<'y>` - --> $DIR/ambiguity-due-to-uniquification-2.rs:16:23 +error[E0283]: type annotations needed: cannot satisfy `impl Trait<'_> + Trait<'_>: Trait<'_>` + --> $DIR/ambiguity-due-to-uniquification-2.rs:16:5 | LL | impls_trait::<'y, _>(foo::<'x, 'y>()); - | ^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: cannot satisfy `impl Trait<'x> + Trait<'y>: Trait<'y>` + = note: cannot satisfy `impl Trait<'_> + Trait<'_>: Trait<'_>` = help: the trait `Trait<'t>` is implemented for `()` note: required by a bound in `impls_trait` --> $DIR/ambiguity-due-to-uniquification-2.rs:13:23 diff --git a/tests/ui/traits/next-solver/assembly/ambiguity-due-to-uniquification-2.rs b/tests/ui/traits/next-solver/assembly/ambiguity-due-to-uniquification-2.rs index 2a9a8b80cc0..30df70396f4 100644 --- a/tests/ui/traits/next-solver/assembly/ambiguity-due-to-uniquification-2.rs +++ b/tests/ui/traits/next-solver/assembly/ambiguity-due-to-uniquification-2.rs @@ -14,7 +14,7 @@ fn impls_trait<'x, T: Trait<'x>>(_: T) {} fn bar<'x, 'y>() { impls_trait::<'y, _>(foo::<'x, 'y>()); - //[next]~^ ERROR type annotations needed: cannot satisfy `impl Trait<'x> + Trait<'y>: Trait<'y>` + //[next]~^ ERROR type annotations needed: cannot satisfy `impl Trait<'_> + Trait<'_>: Trait<'_>` } fn main() {} diff --git a/tests/ui/traits/next-solver/assembly/ambiguity-due-to-uniquification-3.next.stderr b/tests/ui/traits/next-solver/assembly/ambiguity-due-to-uniquification-3.next.stderr index e25f892b365..7fa89054931 100644 --- a/tests/ui/traits/next-solver/assembly/ambiguity-due-to-uniquification-3.next.stderr +++ b/tests/ui/traits/next-solver/assembly/ambiguity-due-to-uniquification-3.next.stderr @@ -1,12 +1,10 @@ -error[E0283]: type annotations needed: cannot satisfy `(dyn Object<&(), &()> + 'static): Trait<&()>` - --> $DIR/ambiguity-due-to-uniquification-3.rs:28:17 +error[E0283]: type annotations needed: cannot satisfy `dyn Object<&(), &()>: Trait<&()>` + --> $DIR/ambiguity-due-to-uniquification-3.rs:28:5 | LL | impls_trait(obj, t); - | ----------- ^^^ - | | - | required by a bound introduced by this call + | ^^^^^^^^^^^^^^^^^^^ | - = note: cannot satisfy `(dyn Object<&(), &()> + 'static): Trait<&()>` + = note: cannot satisfy `dyn Object<&(), &()>: Trait<&()>` = help: the trait `Trait<T>` is implemented for `()` note: required by a bound in `impls_trait` --> $DIR/ambiguity-due-to-uniquification-3.rs:24:19 diff --git a/tests/ui/traits/next-solver/auto-with-drop_tracking_mir.fail.stderr b/tests/ui/traits/next-solver/auto-with-drop_tracking_mir.fail.stderr index 55f52181ec9..0375e64ac66 100644 --- a/tests/ui/traits/next-solver/auto-with-drop_tracking_mir.fail.stderr +++ b/tests/ui/traits/next-solver/auto-with-drop_tracking_mir.fail.stderr @@ -4,7 +4,11 @@ error: future cannot be sent between threads safely LL | is_send(foo()); | ^^^^^ future returned by `foo` is not `Send` | - = help: the trait `Sync` is not implemented for `NotSync` +help: the trait `Sync` is not implemented for `NotSync` + --> $DIR/auto-with-drop_tracking_mir.rs:8:1 + | +LL | struct NotSync; + | ^^^^^^^^^^^^^^ note: future is not `Send` as this value is used across an await --> $DIR/auto-with-drop_tracking_mir.rs:16:11 | diff --git a/tests/ui/traits/next-solver/cycles/coinduction/incompleteness-unstable-result.with.stderr b/tests/ui/traits/next-solver/cycles/coinduction/incompleteness-unstable-result.with.stderr index d27104de541..8cad9408810 100644 --- a/tests/ui/traits/next-solver/cycles/coinduction/incompleteness-unstable-result.with.stderr +++ b/tests/ui/traits/next-solver/cycles/coinduction/incompleteness-unstable-result.with.stderr @@ -2,8 +2,13 @@ error[E0277]: the trait bound `A<X>: Trait<_, _, _>` is not satisfied --> $DIR/incompleteness-unstable-result.rs:66:19 | LL | impls_trait::<A<X>, _, _, _>(); - | ^^^^ the trait `Trait<_, _, _>` is not implemented for `A<X>` + | ^^^^ unsatisfied trait bound | +help: the trait `Trait<_, _, _>` is not implemented for `A<X>` + --> $DIR/incompleteness-unstable-result.rs:22:1 + | +LL | struct A<T>(*const T); + | ^^^^^^^^^^^ = help: the trait `Trait<U, V, D>` is implemented for `A<T>` note: required for `A<X>` to implement `Trait<_, _, _>` --> $DIR/incompleteness-unstable-result.rs:34:18 diff --git a/tests/ui/traits/next-solver/cycles/coinduction/incompleteness-unstable-result.without.stderr b/tests/ui/traits/next-solver/cycles/coinduction/incompleteness-unstable-result.without.stderr index d27104de541..8cad9408810 100644 --- a/tests/ui/traits/next-solver/cycles/coinduction/incompleteness-unstable-result.without.stderr +++ b/tests/ui/traits/next-solver/cycles/coinduction/incompleteness-unstable-result.without.stderr @@ -2,8 +2,13 @@ error[E0277]: the trait bound `A<X>: Trait<_, _, _>` is not satisfied --> $DIR/incompleteness-unstable-result.rs:66:19 | LL | impls_trait::<A<X>, _, _, _>(); - | ^^^^ the trait `Trait<_, _, _>` is not implemented for `A<X>` + | ^^^^ unsatisfied trait bound | +help: the trait `Trait<_, _, _>` is not implemented for `A<X>` + --> $DIR/incompleteness-unstable-result.rs:22:1 + | +LL | struct A<T>(*const T); + | ^^^^^^^^^^^ = help: the trait `Trait<U, V, D>` is implemented for `A<T>` note: required for `A<X>` to implement `Trait<_, _, _>` --> $DIR/incompleteness-unstable-result.rs:34:18 diff --git a/tests/ui/traits/next-solver/cycles/inductive-cycle-but-err.stderr b/tests/ui/traits/next-solver/cycles/inductive-cycle-but-err.stderr index 7895a263634..12a26a1bf60 100644 --- a/tests/ui/traits/next-solver/cycles/inductive-cycle-but-err.stderr +++ b/tests/ui/traits/next-solver/cycles/inductive-cycle-but-err.stderr @@ -14,8 +14,13 @@ error[E0277]: the trait bound `MultipleCandidates: Trait` is not satisfied --> $DIR/inductive-cycle-but-err.rs:54:19 | LL | impls_trait::<MultipleCandidates>(); - | ^^^^^^^^^^^^^^^^^^ the trait `Trait` is not implemented for `MultipleCandidates` + | ^^^^^^^^^^^^^^^^^^ unsatisfied trait bound | +help: the trait `Trait` is not implemented for `MultipleCandidates` + --> $DIR/inductive-cycle-but-err.rs:18:1 + | +LL | struct MultipleCandidates; + | ^^^^^^^^^^^^^^^^^^^^^^^^^ = help: the trait `Trait` is implemented for `MultipleCandidates` note: required by a bound in `impls_trait` --> $DIR/inductive-cycle-but-err.rs:51:19 diff --git a/tests/ui/traits/next-solver/cycles/normalizes-to-is-not-productive.stderr b/tests/ui/traits/next-solver/cycles/normalizes-to-is-not-productive.stderr index 8901805a20f..4934d8bf6fa 100644 --- a/tests/ui/traits/next-solver/cycles/normalizes-to-is-not-productive.stderr +++ b/tests/ui/traits/next-solver/cycles/normalizes-to-is-not-productive.stderr @@ -2,8 +2,13 @@ error[E0277]: the trait bound `Foo: Bound` is not satisfied --> $DIR/normalizes-to-is-not-productive.rs:42:31 | LL | <Foo as Trait<T>>::Assoc: Bound, - | ^^^^^ the trait `Bound` is not implemented for `Foo` + | ^^^^^ unsatisfied trait bound | +help: the trait `Bound` is not implemented for `Foo` + --> $DIR/normalizes-to-is-not-productive.rs:18:1 + | +LL | struct Foo; + | ^^^^^^^^^^ = help: the trait `Bound` is implemented for `u32` note: required for `Foo` to implement `Trait<T>` --> $DIR/normalizes-to-is-not-productive.rs:23:19 @@ -17,8 +22,13 @@ error[E0277]: the trait bound `Foo: Bound` is not satisfied --> $DIR/normalizes-to-is-not-productive.rs:47:19 | LL | impls_bound::<Foo>(); - | ^^^ the trait `Bound` is not implemented for `Foo` + | ^^^ unsatisfied trait bound + | +help: the trait `Bound` is not implemented for `Foo` + --> $DIR/normalizes-to-is-not-productive.rs:18:1 | +LL | struct Foo; + | ^^^^^^^^^^ = help: the trait `Bound` is implemented for `u32` note: required by a bound in `impls_bound` --> $DIR/normalizes-to-is-not-productive.rs:27:19 diff --git a/tests/ui/traits/next-solver/diagnostics/dont-pick-fnptr-bound-as-leaf.current.stderr b/tests/ui/traits/next-solver/diagnostics/dont-pick-fnptr-bound-as-leaf.current.stderr index a863886181c..6aa02879e7d 100644 --- a/tests/ui/traits/next-solver/diagnostics/dont-pick-fnptr-bound-as-leaf.current.stderr +++ b/tests/ui/traits/next-solver/diagnostics/dont-pick-fnptr-bound-as-leaf.current.stderr @@ -2,10 +2,15 @@ error[E0277]: the trait bound `Foo: Trait` is not satisfied --> $DIR/dont-pick-fnptr-bound-as-leaf.rs:24:20 | LL | requires_trait(Foo); - | -------------- ^^^ the trait `Trait` is not implemented for `Foo` + | -------------- ^^^ unsatisfied trait bound | | | required by a bound introduced by this call | +help: the trait `Trait` is not implemented for `Foo` + --> $DIR/dont-pick-fnptr-bound-as-leaf.rs:17:1 + | +LL | struct Foo; + | ^^^^^^^^^^ note: required by a bound in `requires_trait` --> $DIR/dont-pick-fnptr-bound-as-leaf.rs:19:22 | diff --git a/tests/ui/traits/next-solver/diagnostics/dont-pick-fnptr-bound-as-leaf.next.stderr b/tests/ui/traits/next-solver/diagnostics/dont-pick-fnptr-bound-as-leaf.next.stderr index a863886181c..6aa02879e7d 100644 --- a/tests/ui/traits/next-solver/diagnostics/dont-pick-fnptr-bound-as-leaf.next.stderr +++ b/tests/ui/traits/next-solver/diagnostics/dont-pick-fnptr-bound-as-leaf.next.stderr @@ -2,10 +2,15 @@ error[E0277]: the trait bound `Foo: Trait` is not satisfied --> $DIR/dont-pick-fnptr-bound-as-leaf.rs:24:20 | LL | requires_trait(Foo); - | -------------- ^^^ the trait `Trait` is not implemented for `Foo` + | -------------- ^^^ unsatisfied trait bound | | | required by a bound introduced by this call | +help: the trait `Trait` is not implemented for `Foo` + --> $DIR/dont-pick-fnptr-bound-as-leaf.rs:17:1 + | +LL | struct Foo; + | ^^^^^^^^^^ note: required by a bound in `requires_trait` --> $DIR/dont-pick-fnptr-bound-as-leaf.rs:19:22 | diff --git a/tests/ui/traits/next-solver/diagnostics/dont-pick-fnptr-bound-as-leaf.rs b/tests/ui/traits/next-solver/diagnostics/dont-pick-fnptr-bound-as-leaf.rs index 995f2c9fbee..0da7bb17a58 100644 --- a/tests/ui/traits/next-solver/diagnostics/dont-pick-fnptr-bound-as-leaf.rs +++ b/tests/ui/traits/next-solver/diagnostics/dont-pick-fnptr-bound-as-leaf.rs @@ -14,7 +14,7 @@ trait Trait {} impl<T: FnPtr> Trait for T {} -struct Foo; +struct Foo; //~ HELP: the trait `Trait` is not implemented for `Foo` fn requires_trait<T: Trait>(_: T) {} //~^ NOTE: required by a bound in `requires_trait` @@ -23,6 +23,6 @@ fn requires_trait<T: Trait>(_: T) {} fn main() { requires_trait(Foo); //~^ ERROR: the trait bound `Foo: Trait` is not satisfied - //~| NOTE: the trait `Trait` is not implemented for `Foo` + //~| NOTE: unsatisfied trait bound //~| NOTE: required by a bound introduced by this call } diff --git a/tests/ui/traits/next-solver/opaques/different-bound-vars.current.stderr b/tests/ui/traits/next-solver/opaques/different-bound-vars.current.stderr new file mode 100644 index 00000000000..32e92e46a88 --- /dev/null +++ b/tests/ui/traits/next-solver/opaques/different-bound-vars.current.stderr @@ -0,0 +1,14 @@ +error: concrete type differs from previous defining opaque type use + --> $DIR/different-bound-vars.rs:13:37 + | +LL | let _: for<'b> fn(&'b ()) = foo::<U, T>(false); + | ^^^^^^^^^^^^^^^^^^ expected `for<'a> fn(&'a ())`, got `for<'b> fn(&'b ())` + | +note: previous use here + --> $DIR/different-bound-vars.rs:12:37 + | +LL | let _: for<'a> fn(&'a ()) = foo::<T, U>(false); + | ^^^^^^^^^^^^^^^^^^ + +error: aborting due to 1 previous error + diff --git a/tests/ui/traits/next-solver/opaques/different-bound-vars.rs b/tests/ui/traits/next-solver/opaques/different-bound-vars.rs new file mode 100644 index 00000000000..5801a5edeb4 --- /dev/null +++ b/tests/ui/traits/next-solver/opaques/different-bound-vars.rs @@ -0,0 +1,20 @@ +// Check whether we support defining uses with different bound vars. +// This needs to handle both mismatches for the same opaque type storage +// entry, but also between different entries. + +//@ revisions: current next +//@ ignore-compare-mode-next-solver (explicit revisions) +//@[next] compile-flags: -Znext-solver +//@[next] check-pass + +fn foo<T, U>(b: bool) -> impl Sized { + if b { + let _: for<'a> fn(&'a ()) = foo::<T, U>(false); + let _: for<'b> fn(&'b ()) = foo::<U, T>(false); + //[current]~^ ERROR concrete type differs from previous defining opaque type use + } + + (|&()| ()) as for<'c> fn(&'c ()) +} + +fn main() {} diff --git a/tests/ui/traits/next-solver/opaques/dont-type_of-tait-in-defining-scope.is_send.stderr b/tests/ui/traits/next-solver/opaques/dont-type_of-tait-in-defining-scope.is_send.stderr index 6d2bbd8b08b..a188629a475 100644 --- a/tests/ui/traits/next-solver/opaques/dont-type_of-tait-in-defining-scope.is_send.stderr +++ b/tests/ui/traits/next-solver/opaques/dont-type_of-tait-in-defining-scope.is_send.stderr @@ -1,16 +1,9 @@ -error[E0283]: type annotations needed: cannot satisfy `Foo: Send` - --> $DIR/dont-type_of-tait-in-defining-scope.rs:16:18 +error[E0282]: type annotations needed + --> $DIR/dont-type_of-tait-in-defining-scope.rs:15:12 | -LL | needs_send::<Foo>(); - | ^^^ - | - = note: cannot satisfy `Foo: Send` -note: required by a bound in `needs_send` - --> $DIR/dont-type_of-tait-in-defining-scope.rs:12:18 - | -LL | fn needs_send<T: Send>() {} - | ^^^^ required by this bound in `needs_send` +LL | fn test(_: Foo) { + | ^^^ cannot infer type error: aborting due to 1 previous error -For more information about this error, try `rustc --explain E0283`. +For more information about this error, try `rustc --explain E0282`. diff --git a/tests/ui/traits/next-solver/opaques/dont-type_of-tait-in-defining-scope.not_send.stderr b/tests/ui/traits/next-solver/opaques/dont-type_of-tait-in-defining-scope.not_send.stderr index 6d2bbd8b08b..a188629a475 100644 --- a/tests/ui/traits/next-solver/opaques/dont-type_of-tait-in-defining-scope.not_send.stderr +++ b/tests/ui/traits/next-solver/opaques/dont-type_of-tait-in-defining-scope.not_send.stderr @@ -1,16 +1,9 @@ -error[E0283]: type annotations needed: cannot satisfy `Foo: Send` - --> $DIR/dont-type_of-tait-in-defining-scope.rs:16:18 +error[E0282]: type annotations needed + --> $DIR/dont-type_of-tait-in-defining-scope.rs:15:12 | -LL | needs_send::<Foo>(); - | ^^^ - | - = note: cannot satisfy `Foo: Send` -note: required by a bound in `needs_send` - --> $DIR/dont-type_of-tait-in-defining-scope.rs:12:18 - | -LL | fn needs_send<T: Send>() {} - | ^^^^ required by this bound in `needs_send` +LL | fn test(_: Foo) { + | ^^^ cannot infer type error: aborting due to 1 previous error -For more information about this error, try `rustc --explain E0283`. +For more information about this error, try `rustc --explain E0282`. diff --git a/tests/ui/traits/next-solver/opaques/dont-type_of-tait-in-defining-scope.rs b/tests/ui/traits/next-solver/opaques/dont-type_of-tait-in-defining-scope.rs index fddf892e1ef..8ff99d32f06 100644 --- a/tests/ui/traits/next-solver/opaques/dont-type_of-tait-in-defining-scope.rs +++ b/tests/ui/traits/next-solver/opaques/dont-type_of-tait-in-defining-scope.rs @@ -13,8 +13,8 @@ fn needs_send<T: Send>() {} #[define_opaque(Foo)] fn test(_: Foo) { - needs_send::<Foo>(); //~^ ERROR type annotations needed + needs_send::<Foo>(); } #[define_opaque(Foo)] diff --git a/tests/ui/traits/next-solver/opaques/non-defining-use-hir-typeck.rs b/tests/ui/traits/next-solver/opaques/non-defining-use-hir-typeck.rs new file mode 100644 index 00000000000..a55be5fde9e --- /dev/null +++ b/tests/ui/traits/next-solver/opaques/non-defining-use-hir-typeck.rs @@ -0,0 +1,28 @@ +//@ ignore-compare-mode-next-solver +//@ compile-flags: -Znext-solver +//@ check-pass +#![feature(type_alias_impl_trait)] + +// Make sure that we support non-defining uses in HIR typeck. +// Regression test for trait-system-refactor-initiative#135. + +fn non_defining_recurse<T>(b: bool) -> impl Sized { + if b { + // This results in an opaque type use `opaque<()> = ?unconstrained` + // during HIR typeck. + non_defining_recurse::<()>(false); + } +} + +trait Eq<T, U> {} +impl<T> Eq<T, T> for () {} +fn is_eq<T: Eq<U, V>, U, V>() {} +type Tait<T> = impl Sized; +#[define_opaque(Tait)] +fn non_defining_explicit<T>() { + is_eq::<(), Tait<_>, u32>(); // constrains opaque type args via hidden type + is_eq::<(), Tait<u64>, _>(); // constraints hidden type via args + is_eq::<(), Tait<T>, T>(); // actually defines +} + +fn main() {} diff --git a/tests/ui/traits/next-solver/opaques/universal-args-non-defining.rs b/tests/ui/traits/next-solver/opaques/universal-args-non-defining.rs new file mode 100644 index 00000000000..5e7e9738616 --- /dev/null +++ b/tests/ui/traits/next-solver/opaques/universal-args-non-defining.rs @@ -0,0 +1,16 @@ +//@ check-pass +//@ revisions: current next +//@ ignore-compare-mode-next-solver (explicit revisions) +//@[next] compile-flags: -Znext-solver + +// The recursive call to `foo` results in the opaque type use `opaque<U, T> = ?unconstrained`. +// This needs to be supported and treated as a revealing use. + +fn foo<T, U>(b: bool) -> impl Sized { + if b { + foo::<U, T>(b); + } + 1u16 +} + +fn main() {} diff --git a/tests/ui/issues/issue-53568.rs b/tests/ui/traits/nll-ice-custom-type-ops-53568.rs index 9862d4ced12..9b240cdc190 100644 --- a/tests/ui/issues/issue-53568.rs +++ b/tests/ui/traits/nll-ice-custom-type-ops-53568.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/53568 // Regression test for an NLL-related ICE (#53568) -- we failed to // resolve inference variables in "custom type-ops". // diff --git a/tests/ui/traits/no_send-struct.stderr b/tests/ui/traits/no_send-struct.stderr index fb7f26bb766..6b4a011280e 100644 --- a/tests/ui/traits/no_send-struct.stderr +++ b/tests/ui/traits/no_send-struct.stderr @@ -6,7 +6,11 @@ LL | bar(x); | | | required by a bound introduced by this call | - = help: the trait `Send` is not implemented for `Foo` +help: the trait `Send` is not implemented for `Foo` + --> $DIR/no_send-struct.rs:5:1 + | +LL | struct Foo { + | ^^^^^^^^^^ note: required by a bound in `bar` --> $DIR/no_send-struct.rs:11:11 | diff --git a/tests/ui/issues/issue-5883.rs b/tests/ui/traits/opaque-trait-size-error-5883.rs index dd4753e0344..e39e24e7342 100644 --- a/tests/ui/issues/issue-5883.rs +++ b/tests/ui/traits/opaque-trait-size-error-5883.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/5883 trait A {} struct Struct { diff --git a/tests/ui/issues/issue-5883.stderr b/tests/ui/traits/opaque-trait-size-error-5883.stderr index 2ca437b8c47..78de250b19a 100644 --- a/tests/ui/issues/issue-5883.stderr +++ b/tests/ui/traits/opaque-trait-size-error-5883.stderr @@ -1,19 +1,19 @@ error[E0277]: the size for values of type `(dyn A + 'static)` cannot be known at compilation time - --> $DIR/issue-5883.rs:9:6 + --> $DIR/opaque-trait-size-error-5883.rs:10:6 | LL | ) -> Struct { | ^^^^^^ doesn't have a size known at compile-time | = help: within `Struct`, the trait `Sized` is not implemented for `(dyn A + 'static)` note: required because it appears within the type `Struct` - --> $DIR/issue-5883.rs:3:8 + --> $DIR/opaque-trait-size-error-5883.rs:4:8 | LL | struct Struct { | ^^^^^^ = note: the return type of a function must have a statically known size error[E0277]: the size for values of type `(dyn A + 'static)` cannot be known at compilation time - --> $DIR/issue-5883.rs:8:8 + --> $DIR/opaque-trait-size-error-5883.rs:9:8 | LL | r: dyn A + 'static | ^^^^^^^^^^^^^^^ doesn't have a size known at compile-time diff --git a/tests/ui/issues/issue-7673-cast-generically-implemented-trait.rs b/tests/ui/traits/polymorphic-trait-creation-7673.rs index edba3284e31..643818ffe1e 100644 --- a/tests/ui/issues/issue-7673-cast-generically-implemented-trait.rs +++ b/tests/ui/traits/polymorphic-trait-creation-7673.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/7673 //@ check-pass #![allow(dead_code)] diff --git a/tests/ui/issues/issue-8171-default-method-self-inherit-builtin-trait.rs b/tests/ui/traits/self-not-send-in-default-method-8171.rs index 6a03404cdca..59ea62c7690 100644 --- a/tests/ui/issues/issue-8171-default-method-self-inherit-builtin-trait.rs +++ b/tests/ui/traits/self-not-send-in-default-method-8171.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/8171 //@ check-pass #![allow(dead_code)] diff --git a/tests/ui/traits/struct-negative-sync-impl.stderr b/tests/ui/traits/struct-negative-sync-impl.stderr index c5fd13f42e5..cfb74d54ea3 100644 --- a/tests/ui/traits/struct-negative-sync-impl.stderr +++ b/tests/ui/traits/struct-negative-sync-impl.stderr @@ -6,7 +6,11 @@ LL | requires_sync(not_sync); | | | required by a bound introduced by this call | - = help: the trait `Sync` is not implemented for `NotSync` +help: the trait `Sync` is not implemented for `NotSync` + --> $DIR/struct-negative-sync-impl.rs:9:1 + | +LL | struct NotSync { + | ^^^^^^^^^^^^^^ note: required by a bound in `requires_sync` --> $DIR/struct-negative-sync-impl.rs:15:21 | diff --git a/tests/ui/traits/suggest-dereferences/deref-argument.stderr b/tests/ui/traits/suggest-dereferences/deref-argument.stderr index 3dc92fd6ab6..fd57e1f37c3 100644 --- a/tests/ui/traits/suggest-dereferences/deref-argument.stderr +++ b/tests/ui/traits/suggest-dereferences/deref-argument.stderr @@ -2,10 +2,15 @@ error[E0277]: the trait bound `MyRef: Test` is not satisfied --> $DIR/deref-argument.rs:29:18 | LL | consume_test(my_ref); - | ------------ ^^^^^^ the trait `Test` is not implemented for `MyRef` + | ------------ ^^^^^^ unsatisfied trait bound | | | required by a bound introduced by this call | +help: the trait `Test` is not implemented for `MyRef` + --> $DIR/deref-argument.rs:14:1 + | +LL | struct MyRef(u32); + | ^^^^^^^^^^^^ note: required by a bound in `consume_test` --> $DIR/deref-argument.rs:9:25 | diff --git a/tests/ui/traits/suggest-dereferences/issue-39029.stderr b/tests/ui/traits/suggest-dereferences/issue-39029.stderr index fd45fa3cf74..279d616c264 100644 --- a/tests/ui/traits/suggest-dereferences/issue-39029.stderr +++ b/tests/ui/traits/suggest-dereferences/issue-39029.stderr @@ -2,10 +2,15 @@ error[E0277]: the trait bound `NoToSocketAddrs: ToSocketAddrs` is not satisfied --> $DIR/issue-39029.rs:16:38 | LL | let _errors = TcpListener::bind(&bad); - | ----------------- ^^^ the trait `ToSocketAddrs` is not implemented for `NoToSocketAddrs` + | ----------------- ^^^ unsatisfied trait bound | | | required by a bound introduced by this call | +help: the trait `ToSocketAddrs` is not implemented for `NoToSocketAddrs` + --> $DIR/issue-39029.rs:4:1 + | +LL | struct NoToSocketAddrs(String); + | ^^^^^^^^^^^^^^^^^^^^^^ = note: required for `&NoToSocketAddrs` to implement `ToSocketAddrs` note: required by a bound in `TcpListener::bind` --> $SRC_DIR/std/src/net/tcp.rs:LL:COL diff --git a/tests/ui/traits/suggest-dereferences/suggest-dereferencing-receiver-argument.stderr b/tests/ui/traits/suggest-dereferences/suggest-dereferencing-receiver-argument.stderr index d6033bc6baa..6045224b11e 100644 --- a/tests/ui/traits/suggest-dereferences/suggest-dereferencing-receiver-argument.stderr +++ b/tests/ui/traits/suggest-dereferences/suggest-dereferencing-receiver-argument.stderr @@ -2,8 +2,13 @@ error[E0277]: the trait bound `TargetStruct: From<&{integer}>` is not satisfied --> $DIR/suggest-dereferencing-receiver-argument.rs:13:30 | LL | let _b: TargetStruct = a.into(); - | ^^^^ the trait `From<&{integer}>` is not implemented for `TargetStruct` + | ^^^^ unsatisfied trait bound | +help: the trait `From<&{integer}>` is not implemented for `TargetStruct` + --> $DIR/suggest-dereferencing-receiver-argument.rs:3:1 + | +LL | struct TargetStruct; + | ^^^^^^^^^^^^^^^^^^^ = note: required for `&{integer}` to implement `Into<TargetStruct>` help: consider dereferencing here | diff --git a/tests/ui/traits/suggest-where-clause.stderr b/tests/ui/traits/suggest-where-clause.stderr index 08f3a8dc23d..d01cd26730c 100644 --- a/tests/ui/traits/suggest-where-clause.stderr +++ b/tests/ui/traits/suggest-where-clause.stderr @@ -63,7 +63,13 @@ error[E0277]: the trait bound `Misc<_>: From<T>` is not satisfied --> $DIR/suggest-where-clause.rs:23:6 | LL | <Misc<_> as From<T>>::from; - | ^^^^^^^ the trait `From<T>` is not implemented for `Misc<_>` + | ^^^^^^^ unsatisfied trait bound + | +help: the trait `From<T>` is not implemented for `Misc<_>` + --> $DIR/suggest-where-clause.rs:3:1 + | +LL | struct Misc<T:?Sized>(T); + | ^^^^^^^^^^^^^^^^^^^^^ error[E0277]: the size for values of type `[T]` cannot be known at compilation time --> $DIR/suggest-where-clause.rs:28:20 diff --git a/tests/ui/issues/issue-6898.rs b/tests/ui/traits/trait-implementation-generic-access-6898.rs index c810acaf61b..e9437b1c522 100644 --- a/tests/ui/issues/issue-6898.rs +++ b/tests/ui/traits/trait-implementation-generic-access-6898.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/6898 //@ check-pass use std::mem; diff --git a/tests/ui/issues/issue-5988.rs b/tests/ui/traits/trait-implementation-restriction-5988.rs index b7527d9bea8..d3a5b10569b 100644 --- a/tests/ui/issues/issue-5988.rs +++ b/tests/ui/traits/trait-implementation-restriction-5988.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/5988 //@ run-pass trait B { diff --git a/tests/ui/issues/issue-7563.rs b/tests/ui/traits/trait-object-lifetime-bounds-7563.rs index 9ee8857b999..8cfc7a14ffe 100644 --- a/tests/ui/issues/issue-7563.rs +++ b/tests/ui/traits/trait-object-lifetime-bounds-7563.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/7563 //@ run-pass #![allow(dead_code)] trait IDummy { diff --git a/tests/ui/traits/trait-upcasting/lifetime.stderr b/tests/ui/traits/trait-upcasting/lifetime.stderr index 589e9816d5a..f41ea68053a 100644 --- a/tests/ui/traits/trait-upcasting/lifetime.stderr +++ b/tests/ui/traits/trait-upcasting/lifetime.stderr @@ -10,7 +10,7 @@ LL | fn z(&self) -> i32 { LL | fn y(&self) -> i32 { | ^ | - = note: `#[warn(dead_code)]` on by default + = note: `#[warn(dead_code)]` (part of `#[warn(unused)]`) on by default warning: method `w` is never used --> $DIR/lifetime.rs:22:8 diff --git a/tests/ui/traits/trait-upcasting/replace-vptr.stderr b/tests/ui/traits/trait-upcasting/replace-vptr.stderr index 1a8bfd1bfa6..932112470c0 100644 --- a/tests/ui/traits/trait-upcasting/replace-vptr.stderr +++ b/tests/ui/traits/trait-upcasting/replace-vptr.stderr @@ -6,7 +6,7 @@ LL | trait A { LL | fn foo_a(&self); | ^^^^^ | - = note: `#[warn(dead_code)]` on by default + = note: `#[warn(dead_code)]` (part of `#[warn(unused)]`) on by default warning: method `foo_c` is never used --> $DIR/replace-vptr.rs:12:8 diff --git a/tests/ui/traits/unspecified-self-in-trait-ref.stderr b/tests/ui/traits/unspecified-self-in-trait-ref.stderr index 2e872453184..3fa74d79adc 100644 --- a/tests/ui/traits/unspecified-self-in-trait-ref.stderr +++ b/tests/ui/traits/unspecified-self-in-trait-ref.stderr @@ -6,7 +6,7 @@ LL | let a = Foo::lol(); | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! = note: for more information, see <https://doc.rust-lang.org/edition-guide/rust-2021/warnings-promoted-to-error.html> - = note: `#[warn(bare_trait_objects)]` on by default + = note: `#[warn(bare_trait_objects)]` (part of `#[warn(rust_2021_compatibility)]`) on by default help: if this is a dyn-compatible trait, use `dyn` | LL | let a = <dyn Foo>::lol(); diff --git a/tests/ui/traits/vtable/empty-supertrait-with-nonempty-supersupertrait.dump.stderr b/tests/ui/traits/vtable/empty-supertrait-with-nonempty-supersupertrait.dump.stderr new file mode 100644 index 00000000000..d90a786498e --- /dev/null +++ b/tests/ui/traits/vtable/empty-supertrait-with-nonempty-supersupertrait.dump.stderr @@ -0,0 +1,16 @@ +error: vtable entries: [ + MetadataDropInPlace, + MetadataSize, + MetadataAlign, + Method(<dyn OneTwo as One>::one - shim(reify)), + Method(<dyn OneTwo as Two>::two - shim(reify)), + TraitVPtr(<dyn OneTwo as Two>), + TraitVPtr(<dyn OneTwo as TwoAgain>), + ] + --> $DIR/empty-supertrait-with-nonempty-supersupertrait.rs:40:1 + | +LL | type T = dyn OneTwo; + | ^^^^^^ + +error: aborting due to 1 previous error + diff --git a/tests/ui/traits/vtable/empty-supertrait-with-nonempty-supersupertrait.rs b/tests/ui/traits/vtable/empty-supertrait-with-nonempty-supersupertrait.rs new file mode 100644 index 00000000000..507cda63868 --- /dev/null +++ b/tests/ui/traits/vtable/empty-supertrait-with-nonempty-supersupertrait.rs @@ -0,0 +1,49 @@ +//@ revisions: run dump +//@[run] run-pass +//@[dump] check-fail +//! Regression test for #145752 +//! Ensure that `OneTwo` contains a vptr for `TwoAgain` +#![allow(unused)] +#![cfg_attr(dump, feature(rustc_attrs))] + +trait One { + fn one(&self) { + panic!("don't call this"); + } +} +impl One for () {} + +trait Two { + fn two(&self) { + println!("good"); + } +} +impl Two for () {} + +trait TwoAgain: Two {} +impl<T: Two> TwoAgain for T {} + +trait OneTwo: One + TwoAgain {} +impl<T: One + Two> OneTwo for T {} + +fn main() { + (&()).two(); + (&() as &dyn OneTwo).two(); + (&() as &dyn OneTwo as &dyn Two).two(); + + // these two used to panic because they called `one` due to #145752 + (&() as &dyn OneTwo as &dyn TwoAgain).two(); + (&() as &dyn OneTwo as &dyn TwoAgain as &dyn Two).two(); +} + +#[cfg_attr(dump, rustc_dump_vtable)] +type T = dyn OneTwo; +//[dump]~^ ERROR vtable entries: [ +//[dump]~| ERROR MetadataDropInPlace, +//[dump]~| ERROR MetadataSize, +//[dump]~| ERROR MetadataAlign, +//[dump]~| ERROR Method(<dyn OneTwo as One>::one - shim(reify)), +//[dump]~| ERROR Method(<dyn OneTwo as Two>::two - shim(reify)), +//[dump]~| ERROR TraitVPtr(<dyn OneTwo as Two>), +//[dump]~| ERROR TraitVPtr(<dyn OneTwo as TwoAgain>), +//[dump]~| ERROR ] diff --git a/tests/ui/traits/vtable/multiple-auto.rs b/tests/ui/traits/vtable/multiple-auto.rs new file mode 100644 index 00000000000..87ee865868b --- /dev/null +++ b/tests/ui/traits/vtable/multiple-auto.rs @@ -0,0 +1,50 @@ +// Related to <https://github.com/rust-lang/rust/issues/113840> +// +// This test makes sure that multiple auto traits can reuse the +// same pointer for upcasting (e.g. `Send`/`Sync`) + +#![crate_type = "lib"] +#![feature(rustc_attrs, auto_traits)] + +// Markers +auto trait M0 {} +auto trait M1 {} +auto trait M2 {} + +// Just a trait with a method +trait T { + fn method(&self) {} +} + +trait A: M0 + M1 + M2 + T {} + +trait B: M0 + M1 + T + M2 {} + +trait C: M0 + T + M1 + M2 {} + +trait D: T + M0 + M1 + M2 {} + +struct S; + +impl M0 for S {} +impl M1 for S {} +impl M2 for S {} +impl T for S {} + +#[rustc_dump_vtable] +impl A for S {} +//~^ ERROR vtable entries + +#[rustc_dump_vtable] +impl B for S {} +//~^ ERROR vtable entries + +#[rustc_dump_vtable] +impl C for S {} +//~^ ERROR vtable entries + +#[rustc_dump_vtable] +impl D for S {} +//~^ ERROR vtable entries + +fn main() {} diff --git a/tests/ui/traits/vtable/multiple-auto.stderr b/tests/ui/traits/vtable/multiple-auto.stderr new file mode 100644 index 00000000000..0a7c3ebd36d --- /dev/null +++ b/tests/ui/traits/vtable/multiple-auto.stderr @@ -0,0 +1,46 @@ +error: vtable entries: [ + MetadataDropInPlace, + MetadataSize, + MetadataAlign, + Method(<S as T>::method), + ] + --> $DIR/multiple-auto.rs:35:1 + | +LL | impl A for S {} + | ^^^^^^^^^^^^ + +error: vtable entries: [ + MetadataDropInPlace, + MetadataSize, + MetadataAlign, + Method(<S as T>::method), + ] + --> $DIR/multiple-auto.rs:39:1 + | +LL | impl B for S {} + | ^^^^^^^^^^^^ + +error: vtable entries: [ + MetadataDropInPlace, + MetadataSize, + MetadataAlign, + Method(<S as T>::method), + ] + --> $DIR/multiple-auto.rs:43:1 + | +LL | impl C for S {} + | ^^^^^^^^^^^^ + +error: vtable entries: [ + MetadataDropInPlace, + MetadataSize, + MetadataAlign, + Method(<S as T>::method), + ] + --> $DIR/multiple-auto.rs:47:1 + | +LL | impl D for S {} + | ^^^^^^^^^^^^ + +error: aborting due to 4 previous errors + diff --git a/tests/ui/transmutability/references/reject_lifetime_extension.stderr b/tests/ui/transmutability/references/reject_lifetime_extension.stderr index a597041c6ca..b9702984145 100644 --- a/tests/ui/transmutability/references/reject_lifetime_extension.stderr +++ b/tests/ui/transmutability/references/reject_lifetime_extension.stderr @@ -67,11 +67,11 @@ LL | unsafe { extend_hrtb(src) } | `src` escapes the function body here | argument requires that `'a` must outlive `'static` | -note: due to current limitations in the borrow checker, this implies a `'static` lifetime - --> $DIR/reject_lifetime_extension.rs:85:25 +note: due to a current limitation of the type system, this implies a `'static` lifetime + --> $DIR/reject_lifetime_extension.rs:85:9 | LL | for<'b> &'b u8: TransmuteFrom<&'a u8>, - | ^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 8 previous errors diff --git a/tests/ui/tuple/builtin-fail.stderr b/tests/ui/tuple/builtin-fail.stderr index ccbc5ae2b75..44e79578f4c 100644 --- a/tests/ui/tuple/builtin-fail.stderr +++ b/tests/ui/tuple/builtin-fail.stderr @@ -42,8 +42,13 @@ error[E0277]: `TupleStruct` is not a tuple --> $DIR/builtin-fail.rs:17:23 | LL | assert_is_tuple::<TupleStruct>(); - | ^^^^^^^^^^^ the trait `Tuple` is not implemented for `TupleStruct` + | ^^^^^^^^^^^ unsatisfied trait bound | +help: the trait `Tuple` is not implemented for `TupleStruct` + --> $DIR/builtin-fail.rs:5:1 + | +LL | struct TupleStruct(i32, i32); + | ^^^^^^^^^^^^^^^^^^ note: required by a bound in `assert_is_tuple` --> $DIR/builtin-fail.rs:3:23 | diff --git a/tests/ui/type-alias-enum-variants/enum-variant-priority-lint-ambiguous_associated_items.stderr b/tests/ui/type-alias-enum-variants/enum-variant-priority-lint-ambiguous_associated_items.stderr index 0f42fcbe04d..79bd1f2adc1 100644 --- a/tests/ui/type-alias-enum-variants/enum-variant-priority-lint-ambiguous_associated_items.stderr +++ b/tests/ui/type-alias-enum-variants/enum-variant-priority-lint-ambiguous_associated_items.stderr @@ -16,7 +16,7 @@ note: `V` could also refer to the associated type defined here | LL | type V; | ^^^^^^ - = note: `#[deny(ambiguous_associated_items)]` on by default + = note: `#[deny(ambiguous_associated_items)]` (part of `#[deny(future_incompatible)]`) on by default error: aborting due to 1 previous error diff --git a/tests/ui/type-alias-impl-trait/constrain_in_projection.current.stderr b/tests/ui/type-alias-impl-trait/constrain_in_projection.current.stderr index c4c55d8e092..955ba69d3b6 100644 --- a/tests/ui/type-alias-impl-trait/constrain_in_projection.current.stderr +++ b/tests/ui/type-alias-impl-trait/constrain_in_projection.current.stderr @@ -2,7 +2,7 @@ error[E0277]: the trait bound `Foo: Trait<Bar>` is not satisfied --> $DIR/constrain_in_projection.rs:25:14 | LL | let x = <Foo as Trait<Bar>>::Assoc::default(); - | ^^^ the trait `Trait<Bar>` is not implemented for `Foo` + | ^^^ unsatisfied trait bound | = help: the trait `Trait<Bar>` is not implemented for `Foo` but trait `Trait<()>` is implemented for it @@ -11,7 +11,7 @@ error[E0277]: the trait bound `Foo: Trait<Bar>` is not satisfied --> $DIR/constrain_in_projection.rs:25:13 | LL | let x = <Foo as Trait<Bar>>::Assoc::default(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Trait<Bar>` is not implemented for `Foo` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unsatisfied trait bound | = help: the trait `Trait<Bar>` is not implemented for `Foo` but trait `Trait<()>` is implemented for it diff --git a/tests/ui/type-alias-impl-trait/constrain_in_projection2.current.stderr b/tests/ui/type-alias-impl-trait/constrain_in_projection2.current.stderr index d7fb6e67ad2..4e7788bf113 100644 --- a/tests/ui/type-alias-impl-trait/constrain_in_projection2.current.stderr +++ b/tests/ui/type-alias-impl-trait/constrain_in_projection2.current.stderr @@ -2,8 +2,13 @@ error[E0277]: the trait bound `Foo: Trait<Bar>` is not satisfied --> $DIR/constrain_in_projection2.rs:28:14 | LL | let x = <Foo as Trait<Bar>>::Assoc::default(); - | ^^^ the trait `Trait<Bar>` is not implemented for `Foo` + | ^^^ unsatisfied trait bound | +help: the trait `Trait<Bar>` is not implemented for `Foo` + --> $DIR/constrain_in_projection2.rs:10:1 + | +LL | struct Foo; + | ^^^^^^^^^^ = help: the following other types implement trait `Trait<T>`: `Foo` implements `Trait<()>` `Foo` implements `Trait<u32>` @@ -12,8 +17,13 @@ error[E0277]: the trait bound `Foo: Trait<Bar>` is not satisfied --> $DIR/constrain_in_projection2.rs:28:13 | LL | let x = <Foo as Trait<Bar>>::Assoc::default(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Trait<Bar>` is not implemented for `Foo` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unsatisfied trait bound + | +help: the trait `Trait<Bar>` is not implemented for `Foo` + --> $DIR/constrain_in_projection2.rs:10:1 | +LL | struct Foo; + | ^^^^^^^^^^ = help: the following other types implement trait `Trait<T>`: `Foo` implements `Trait<()>` `Foo` implements `Trait<u32>` diff --git a/tests/ui/type-alias-impl-trait/constrain_in_projection2.next.stderr b/tests/ui/type-alias-impl-trait/constrain_in_projection2.next.stderr index 72a253c4be8..b50d1b60c43 100644 --- a/tests/ui/type-alias-impl-trait/constrain_in_projection2.next.stderr +++ b/tests/ui/type-alias-impl-trait/constrain_in_projection2.next.stderr @@ -1,24 +1,9 @@ -error[E0283]: type annotations needed: cannot satisfy `Foo: Trait<Bar>` - --> $DIR/constrain_in_projection2.rs:28:14 +error[E0282]: type annotations needed + --> $DIR/constrain_in_projection2.rs:28:13 | LL | let x = <Foo as Trait<Bar>>::Assoc::default(); - | ^^^ - | -note: multiple `impl`s satisfying `Foo: Trait<Bar>` found - --> $DIR/constrain_in_projection2.rs:18:1 - | -LL | impl Trait<()> for Foo { - | ^^^^^^^^^^^^^^^^^^^^^^ -... -LL | impl Trait<u32> for Foo { - | ^^^^^^^^^^^^^^^^^^^^^^^ - = note: associated types cannot be accessed directly on a `trait`, they can only be accessed through a specific `impl` -help: use the fully qualified path to an implementation - | -LL - let x = <Foo as Trait<Bar>>::Assoc::default(); -LL + let x = <<Type as Trait>::Assoc as Trait<Bar>>::Assoc::default(); - | + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer type error: aborting due to 1 previous error -For more information about this error, try `rustc --explain E0283`. +For more information about this error, try `rustc --explain E0282`. diff --git a/tests/ui/type-alias-impl-trait/constrain_in_projection2.rs b/tests/ui/type-alias-impl-trait/constrain_in_projection2.rs index 61773cf59d4..c4aa6f32eab 100644 --- a/tests/ui/type-alias-impl-trait/constrain_in_projection2.rs +++ b/tests/ui/type-alias-impl-trait/constrain_in_projection2.rs @@ -26,7 +26,7 @@ impl Trait<u32> for Foo { #[define_opaque(Bar)] fn bop() { let x = <Foo as Trait<Bar>>::Assoc::default(); - //[next]~^ ERROR: cannot satisfy `Foo: Trait<Bar>` + //[next]~^ ERROR: type annotations needed //[current]~^^ ERROR: `Foo: Trait<Bar>` is not satisfied //[current]~| ERROR: `Foo: Trait<Bar>` is not satisfied } diff --git a/tests/ui/type-alias-impl-trait/different_args_considered_equal2.rs b/tests/ui/type-alias-impl-trait/different_args_considered_equal2.rs index 902d6ca57e6..5c6ad2cc725 100644 --- a/tests/ui/type-alias-impl-trait/different_args_considered_equal2.rs +++ b/tests/ui/type-alias-impl-trait/different_args_considered_equal2.rs @@ -8,7 +8,7 @@ fn get_one<'a>(a: *mut &'a str) -> impl IntoIterator<Item = Opaque<'a>> { Some(a) } else { None::<Opaque<'static>> - //~^ ERROR hidden type for `Opaque<'static>` captures lifetime that does not appear in bounds + //~^ ERROR expected generic lifetime parameter, found `'static` } } diff --git a/tests/ui/type-alias-impl-trait/different_args_considered_equal2.stderr b/tests/ui/type-alias-impl-trait/different_args_considered_equal2.stderr index 562ab4168b5..2cb8f03235a 100644 --- a/tests/ui/type-alias-impl-trait/different_args_considered_equal2.stderr +++ b/tests/ui/type-alias-impl-trait/different_args_considered_equal2.stderr @@ -1,15 +1,12 @@ -error[E0700]: hidden type for `Opaque<'static>` captures lifetime that does not appear in bounds +error[E0792]: expected generic lifetime parameter, found `'static` --> $DIR/different_args_considered_equal2.rs:10:9 | LL | pub type Opaque<'a> = impl Sized; - | ---------- opaque type defined here -... -LL | fn get_one<'a>(a: *mut &'a str) -> impl IntoIterator<Item = Opaque<'a>> { - | -- hidden type `*mut &'a str` captures the lifetime `'a` as defined here + | -- cannot use static lifetime; use a bound lifetime instead or remove the lifetime parameter from the opaque type ... LL | None::<Opaque<'static>> | ^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 1 previous error -For more information about this error, try `rustc --explain E0700`. +For more information about this error, try `rustc --explain E0792`. diff --git a/tests/ui/type-alias-impl-trait/generic-not-strictly-equal.member_constraints.stderr b/tests/ui/type-alias-impl-trait/generic-not-strictly-equal.member_constraints.stderr index 4a5360c9922..43e887f36c5 100644 --- a/tests/ui/type-alias-impl-trait/generic-not-strictly-equal.member_constraints.stderr +++ b/tests/ui/type-alias-impl-trait/generic-not-strictly-equal.member_constraints.stderr @@ -1,15 +1,12 @@ -error[E0700]: hidden type for `Opaque<'x>` captures lifetime that does not appear in bounds +error[E0792]: expected generic lifetime parameter, found `'_` --> $DIR/generic-not-strictly-equal.rs:34:5 | LL | type Opaque<'a> = impl Copy + Captures<'a>; - | ------------------------ opaque type defined here -... -LL | fn test<'x>(_: Opaque<'x>) { - | -- hidden type `&'x u8` captures the lifetime `'x` as defined here + | -- this generic parameter must be used with a generic lifetime parameter ... LL | relate(opaque, hidden); // defining use: Opaque<'?1> := u8 | ^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 1 previous error -For more information about this error, try `rustc --explain E0700`. +For more information about this error, try `rustc --explain E0792`. diff --git a/tests/ui/type-alias-impl-trait/generic-not-strictly-equal.rs b/tests/ui/type-alias-impl-trait/generic-not-strictly-equal.rs index c1059e3da33..42f363d0e57 100644 --- a/tests/ui/type-alias-impl-trait/generic-not-strictly-equal.rs +++ b/tests/ui/type-alias-impl-trait/generic-not-strictly-equal.rs @@ -32,8 +32,7 @@ fn test<'x>(_: Opaque<'x>) { ensure_outlives::<'x>(opaque); // outlives constraint: '?1: 'x relate(opaque, hidden); // defining use: Opaque<'?1> := u8 - //[basic]~^ ERROR expected generic lifetime parameter, found `'_` - //[member_constraints]~^^ ERROR captures lifetime that does not appear in bounds + //~^ ERROR expected generic lifetime parameter, found `'_` } fn main() {} diff --git a/tests/ui/type-alias-impl-trait/generic_nondefining_use.stderr b/tests/ui/type-alias-impl-trait/generic_nondefining_use.current.stderr index 71e415271ee..2a78860689b 100644 --- a/tests/ui/type-alias-impl-trait/generic_nondefining_use.stderr +++ b/tests/ui/type-alias-impl-trait/generic_nondefining_use.current.stderr @@ -1,5 +1,5 @@ error[E0792]: expected generic type parameter, found `u32` - --> $DIR/generic_nondefining_use.rs:16:21 + --> $DIR/generic_nondefining_use.rs:20:21 | LL | type OneTy<T> = impl Debug; | - this generic parameter must be used with a generic type parameter @@ -8,7 +8,7 @@ LL | fn concrete_ty() -> OneTy<u32> { | ^^^^^^^^^^ error[E0792]: expected generic lifetime parameter, found `'static` - --> $DIR/generic_nondefining_use.rs:23:5 + --> $DIR/generic_nondefining_use.rs:29:5 | LL | type OneLifetime<'a> = impl Debug; | -- cannot use static lifetime; use a bound lifetime instead or remove the lifetime parameter from the opaque type @@ -17,7 +17,7 @@ LL | 6u32 | ^^^^ error[E0792]: expected generic constant parameter, found `123` - --> $DIR/generic_nondefining_use.rs:28:24 + --> $DIR/generic_nondefining_use.rs:35:24 | LL | type OneConst<const X: usize> = impl Debug; | -------------- this generic parameter must be used with a generic constant parameter diff --git a/tests/ui/type-alias-impl-trait/generic_nondefining_use.next.stderr b/tests/ui/type-alias-impl-trait/generic_nondefining_use.next.stderr new file mode 100644 index 00000000000..2b53614ee3f --- /dev/null +++ b/tests/ui/type-alias-impl-trait/generic_nondefining_use.next.stderr @@ -0,0 +1,44 @@ +error: item does not constrain `OneTy::{opaque#0}` + --> $DIR/generic_nondefining_use.rs:20:4 + | +LL | fn concrete_ty() -> OneTy<u32> { + | ^^^^^^^^^^^ + | + = note: consider removing `#[define_opaque]` or adding an empty `#[define_opaque()]` +note: this opaque type is supposed to be constrained + --> $DIR/generic_nondefining_use.rs:11:17 + | +LL | type OneTy<T> = impl Debug; + | ^^^^^^^^^^ +note: this use of `OneTy<u32>` does not have unique universal generic arguments + --> $DIR/generic_nondefining_use.rs:23:5 + | +LL | 5u32 + | ^^^^ + +error: non-defining use of `OneLifetime<'_>` in the defining scope + --> $DIR/generic_nondefining_use.rs:27:1 + | +LL | fn concrete_lifetime() -> OneLifetime<'static> { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: item does not constrain `OneConst::{opaque#0}` + --> $DIR/generic_nondefining_use.rs:35:4 + | +LL | fn concrete_const() -> OneConst<{ 123 }> { + | ^^^^^^^^^^^^^^ + | + = note: consider removing `#[define_opaque]` or adding an empty `#[define_opaque()]` +note: this opaque type is supposed to be constrained + --> $DIR/generic_nondefining_use.rs:15:33 + | +LL | type OneConst<const X: usize> = impl Debug; + | ^^^^^^^^^^ +note: this use of `OneConst<123>` does not have unique universal generic arguments + --> $DIR/generic_nondefining_use.rs:38:5 + | +LL | 7u32 + | ^^^^ + +error: aborting due to 3 previous errors + diff --git a/tests/ui/type-alias-impl-trait/generic_nondefining_use.rs b/tests/ui/type-alias-impl-trait/generic_nondefining_use.rs index cf38c93bd92..7250a9ac0b3 100644 --- a/tests/ui/type-alias-impl-trait/generic_nondefining_use.rs +++ b/tests/ui/type-alias-impl-trait/generic_nondefining_use.rs @@ -1,5 +1,9 @@ #![feature(type_alias_impl_trait)] +//@ revisions: current next +//@ ignore-compare-mode-next-solver (explicit revisions) +//@[next] compile-flags: -Znext-solver + use std::fmt::Debug; fn main() {} @@ -14,18 +18,22 @@ type OneConst<const X: usize> = impl Debug; #[define_opaque(OneTy)] fn concrete_ty() -> OneTy<u32> { - //~^ ERROR: expected generic type parameter, found `u32` + //[current]~^ ERROR: expected generic type parameter, found `u32` + //[next]~^^ ERROR: item does not constrain `OneTy::{opaque#0}` 5u32 } #[define_opaque(OneLifetime)] fn concrete_lifetime() -> OneLifetime<'static> { + //[next]~^ ERROR: non-defining use of `OneLifetime<'_>` in the defining scope 6u32 - //~^ ERROR: expected generic lifetime parameter, found `'static` + //[current]~^ ERROR: expected generic lifetime parameter, found `'static` + } #[define_opaque(OneConst)] fn concrete_const() -> OneConst<{ 123 }> { - //~^ ERROR: expected generic constant parameter, found `123` + //[current]~^ ERROR: expected generic constant parameter, found `123` + //[next]~^^ ERROR: item does not constrain `OneConst::{opaque#0}` 7u32 } diff --git a/tests/ui/type-alias-impl-trait/higher_kinded_params3.rs b/tests/ui/type-alias-impl-trait/higher_kinded_params3.rs index 4fb2e60b5c5..04208faddde 100644 --- a/tests/ui/type-alias-impl-trait/higher_kinded_params3.rs +++ b/tests/ui/type-alias-impl-trait/higher_kinded_params3.rs @@ -24,8 +24,7 @@ type Successors<'a> = impl std::fmt::Debug + 'a; impl Terminator { #[define_opaque(Successors, Tait)] fn successors(&self, mut f: for<'x> fn(&'x ()) -> <&'x A as B>::C) -> Successors<'_> { - f = g; - //~^ ERROR mismatched types + f = g; //~ ERROR expected generic lifetime parameter, found `'x` } } diff --git a/tests/ui/type-alias-impl-trait/higher_kinded_params3.stderr b/tests/ui/type-alias-impl-trait/higher_kinded_params3.stderr index 558792987f3..8e6778bdd0b 100644 --- a/tests/ui/type-alias-impl-trait/higher_kinded_params3.stderr +++ b/tests/ui/type-alias-impl-trait/higher_kinded_params3.stderr @@ -1,15 +1,12 @@ -error[E0308]: mismatched types +error[E0792]: expected generic lifetime parameter, found `'x` --> $DIR/higher_kinded_params3.rs:27:9 | LL | type Tait<'a> = impl std::fmt::Debug + 'a; - | ------------------------- the expected opaque type + | -- this generic parameter must be used with a generic lifetime parameter ... LL | f = g; - | ^^^^^ one type is more general than the other - | - = note: expected fn pointer `for<'x> fn(&'x ()) -> Tait<'x>` - found fn pointer `for<'a> fn(&'a ()) -> &'a ()` + | ^^^^^ error: aborting due to 1 previous error -For more information about this error, try `rustc --explain E0308`. +For more information about this error, try `rustc --explain E0792`. diff --git a/tests/ui/type-alias-impl-trait/hkl_forbidden3.rs b/tests/ui/type-alias-impl-trait/hkl_forbidden3.rs index c7f04dc07bb..ba75b114a11 100644 --- a/tests/ui/type-alias-impl-trait/hkl_forbidden3.rs +++ b/tests/ui/type-alias-impl-trait/hkl_forbidden3.rs @@ -8,7 +8,7 @@ fn foo<'a>(x: &'a ()) -> &'a () { #[define_opaque(Opaque)] fn test() -> for<'a> fn(&'a ()) -> Opaque<'a> { - foo //~ ERROR: mismatched types + foo //~ ERROR: expected generic lifetime parameter, found `'a` } fn main() {} diff --git a/tests/ui/type-alias-impl-trait/hkl_forbidden3.stderr b/tests/ui/type-alias-impl-trait/hkl_forbidden3.stderr index b8c04185a7d..d699059e397 100644 --- a/tests/ui/type-alias-impl-trait/hkl_forbidden3.stderr +++ b/tests/ui/type-alias-impl-trait/hkl_forbidden3.stderr @@ -1,15 +1,12 @@ -error[E0308]: mismatched types +error[E0792]: expected generic lifetime parameter, found `'a` --> $DIR/hkl_forbidden3.rs:11:5 | LL | type Opaque<'a> = impl Sized + 'a; - | --------------- the expected opaque type + | -- this generic parameter must be used with a generic lifetime parameter ... LL | foo - | ^^^ one type is more general than the other - | - = note: expected fn pointer `for<'a> fn(&'a ()) -> Opaque<'a>` - found fn pointer `for<'a> fn(&'a ()) -> &'a ()` + | ^^^ error: aborting due to 1 previous error -For more information about this error, try `rustc --explain E0308`. +For more information about this error, try `rustc --explain E0792`. diff --git a/tests/ui/type-alias-impl-trait/in-assoc-ty-early-bound.rs b/tests/ui/type-alias-impl-trait/in-assoc-ty-early-bound.rs index baeba1d3de6..013651e8775 100644 --- a/tests/ui/type-alias-impl-trait/in-assoc-ty-early-bound.rs +++ b/tests/ui/type-alias-impl-trait/in-assoc-ty-early-bound.rs @@ -9,7 +9,7 @@ impl Foo for () { type Assoc<'a, 'b> = impl Sized; fn bar<'a: 'a, 'b: 'b>(x: &'a ()) -> Self::Assoc<'a, 'b> { let closure = |x: &'a ()| -> Self::Assoc<'b, 'a> { x }; - //~^ ERROR `<() as Foo>::Assoc<'b, 'a>` captures lifetime that does not appear in bounds + //~^ ERROR expected generic lifetime parameter, found `'_` x } } diff --git a/tests/ui/type-alias-impl-trait/in-assoc-ty-early-bound.stderr b/tests/ui/type-alias-impl-trait/in-assoc-ty-early-bound.stderr index a7d3e7f0be4..f399520e7fd 100644 --- a/tests/ui/type-alias-impl-trait/in-assoc-ty-early-bound.stderr +++ b/tests/ui/type-alias-impl-trait/in-assoc-ty-early-bound.stderr @@ -1,13 +1,12 @@ -error[E0700]: hidden type for `<() as Foo>::Assoc<'b, 'a>` captures lifetime that does not appear in bounds +error[E0792]: expected generic lifetime parameter, found `'_` --> $DIR/in-assoc-ty-early-bound.rs:11:60 | LL | type Assoc<'a, 'b> = impl Sized; - | ---------- opaque type defined here + | -- this generic parameter must be used with a generic lifetime parameter LL | fn bar<'a: 'a, 'b: 'b>(x: &'a ()) -> Self::Assoc<'a, 'b> { - | -- hidden type `&'a ()` captures the lifetime `'a` as defined here LL | let closure = |x: &'a ()| -> Self::Assoc<'b, 'a> { x }; | ^ error: aborting due to 1 previous error -For more information about this error, try `rustc --explain E0700`. +For more information about this error, try `rustc --explain E0792`. diff --git a/tests/ui/type-alias-impl-trait/in-assoc-ty-early-bound2.rs b/tests/ui/type-alias-impl-trait/in-assoc-ty-early-bound2.rs index 92c8a8f3216..21df53c43d7 100644 --- a/tests/ui/type-alias-impl-trait/in-assoc-ty-early-bound2.rs +++ b/tests/ui/type-alias-impl-trait/in-assoc-ty-early-bound2.rs @@ -13,7 +13,7 @@ impl Foo for () { { let _ = |x: &'a ()| { let _: Self::Assoc<'a> = x; - //~^ ERROR `<() as Foo>::Assoc<'a>` captures lifetime that does not appear in bound + //~^ ERROR expected generic lifetime parameter, found `'_` }; } } diff --git a/tests/ui/type-alias-impl-trait/in-assoc-ty-early-bound2.stderr b/tests/ui/type-alias-impl-trait/in-assoc-ty-early-bound2.stderr index 7ce4517fb1e..aaed03e739b 100644 --- a/tests/ui/type-alias-impl-trait/in-assoc-ty-early-bound2.stderr +++ b/tests/ui/type-alias-impl-trait/in-assoc-ty-early-bound2.stderr @@ -1,14 +1,12 @@ -error[E0700]: hidden type for `<() as Foo>::Assoc<'a>` captures lifetime that does not appear in bounds +error[E0792]: expected generic lifetime parameter, found `'_` --> $DIR/in-assoc-ty-early-bound2.rs:15:20 | LL | type Assoc<'a> = impl Sized; - | ---------- opaque type defined here -LL | fn bar<'a: 'a>() - | -- hidden type `&'a ()` captures the lifetime `'a` as defined here + | -- this generic parameter must be used with a generic lifetime parameter ... LL | let _: Self::Assoc<'a> = x; | ^^^^^^^^^^^^^^^ error: aborting due to 1 previous error -For more information about this error, try `rustc --explain E0700`. +For more information about this error, try `rustc --explain E0792`. 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 1a530d27971..4ddb06e40ff 100644 --- a/tests/ui/type-alias-impl-trait/issue-53092-2.rs +++ b/tests/ui/type-alias-impl-trait/issue-53092-2.rs @@ -2,11 +2,11 @@ #![allow(dead_code)] type Bug<T, U> = impl Fn(T) -> U + Copy; -//~^ ERROR cycle detected when computing type of `Bug::{opaque#0}` #[define_opaque(Bug)] const CONST_BUG: Bug<u8, ()> = unsafe { std::mem::transmute(|_: u8| ()) }; //~^ ERROR item does not constrain `Bug::{opaque#0}` +//~| ERROR: cannot transmute between types of different sizes, or dependently-sized types #[define_opaque(Bug)] fn make_bug<T, U: From<T>>() -> Bug<T, U> { 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 c8db9fdfc57..689f7a733cb 100644 --- a/tests/ui/type-alias-impl-trait/issue-53092-2.stderr +++ b/tests/ui/type-alias-impl-trait/issue-53092-2.stderr @@ -1,56 +1,5 @@ -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 borrow-checking `CONST_BUG`... - --> $DIR/issue-53092-2.rs:8:1 - | -LL | const CONST_BUG: Bug<u8, ()> = unsafe { std::mem::transmute(|_: u8| ()) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -note: ...which requires promoting constants in MIR for `CONST_BUG`... - --> $DIR/issue-53092-2.rs:8:1 - | -LL | const CONST_BUG: Bug<u8, ()> = unsafe { std::mem::transmute(|_: u8| ()) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -note: ...which requires const checking `CONST_BUG`... - --> $DIR/issue-53092-2.rs:8:1 - | -LL | const CONST_BUG: Bug<u8, ()> = unsafe { std::mem::transmute(|_: u8| ()) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -note: ...which requires building MIR for `CONST_BUG`... - --> $DIR/issue-53092-2.rs:8:1 - | -LL | const CONST_BUG: Bug<u8, ()> = unsafe { std::mem::transmute(|_: u8| ()) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -note: ...which requires match-checking `CONST_BUG`... - --> $DIR/issue-53092-2.rs:8:1 - | -LL | const CONST_BUG: Bug<u8, ()> = unsafe { std::mem::transmute(|_: u8| ()) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -note: ...which requires type-checking `CONST_BUG`... - --> $DIR/issue-53092-2.rs:8: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 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: 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}` - --> $DIR/issue-53092-2.rs:8:7 + --> $DIR/issue-53092-2.rs:7:7 | LL | const CONST_BUG: Bug<u8, ()> = unsafe { std::mem::transmute(|_: u8| ()) }; | ^^^^^^^^^ @@ -62,6 +11,15 @@ note: this opaque type is supposed to be constrained LL | type Bug<T, U> = impl Fn(T) -> U + Copy; | ^^^^^^^^^^^^^^^^^^^^^^ +error[E0512]: cannot transmute between types of different sizes, or dependently-sized types + --> $DIR/issue-53092-2.rs:7:41 + | +LL | const CONST_BUG: Bug<u8, ()> = unsafe { std::mem::transmute(|_: u8| ()) }; + | ^^^^^^^^^^^^^^^^^^^ + | + = note: source type: `{closure@$DIR/issue-53092-2.rs:7:61: 7:68}` (0 bits) + = note: target type: `{type error}` (the type has an unknown layout) + error: aborting due to 2 previous errors -For more information about this error, try `rustc --explain E0391`. +For more information about this error, try `rustc --explain E0512`. diff --git a/tests/ui/type-alias-impl-trait/issue-87455-static-lifetime-ice.rs b/tests/ui/type-alias-impl-trait/issue-87455-static-lifetime-ice.rs index 987fad2efea..476babdfb05 100644 --- a/tests/ui/type-alias-impl-trait/issue-87455-static-lifetime-ice.rs +++ b/tests/ui/type-alias-impl-trait/issue-87455-static-lifetime-ice.rs @@ -1,6 +1,6 @@ //@ check-pass -use std::error::Error as StdError; +use std::error::Error; use std::pin::Pin; use std::task::{Context, Poll}; @@ -51,7 +51,7 @@ impl<S> Stream for SseKeepAlive<S> where S: TryStream + Send + 'static, S::Ok: ServerSentEvent, - S::Error: StdError + Send + Sync + 'static, + S::Error: Error + Send + Sync + 'static, { type Item = Result<SseComment<&'static str>, ()>; fn poll_next(self: Pin<&mut Self>, _cx: &mut Context) -> Poll<Option<Self::Item>> { @@ -65,7 +65,7 @@ pub fn keep<S>( where S: TryStream + Send + 'static, S::Ok: ServerSentEvent + Send, - S::Error: StdError + Send + Sync + 'static, + S::Error: Error + Send + Sync + 'static, { SseKeepAlive { event_stream } } diff --git a/tests/ui/type-alias-impl-trait/no_inferrable_concrete_type.rs b/tests/ui/type-alias-impl-trait/no_inferrable_concrete_type.rs index 8e5e4719415..bd1d6651859 100644 --- a/tests/ui/type-alias-impl-trait/no_inferrable_concrete_type.rs +++ b/tests/ui/type-alias-impl-trait/no_inferrable_concrete_type.rs @@ -15,5 +15,6 @@ pub fn bar(x: Foo) -> Foo { fn main() { unsafe { let _: Foo = std::mem::transmute(0u8); + //~^ ERROR: cannot transmute between types of different sizes, or dependently-sized types } } diff --git a/tests/ui/type-alias-impl-trait/no_inferrable_concrete_type.stderr b/tests/ui/type-alias-impl-trait/no_inferrable_concrete_type.stderr index a57793d5a77..c9646a4e9a4 100644 --- a/tests/ui/type-alias-impl-trait/no_inferrable_concrete_type.stderr +++ b/tests/ui/type-alias-impl-trait/no_inferrable_concrete_type.stderr @@ -11,5 +11,15 @@ note: this opaque type is supposed to be constrained LL | pub type Foo = impl Copy; | ^^^^^^^^^ -error: aborting due to 1 previous error +error[E0512]: cannot transmute between types of different sizes, or dependently-sized types + --> $DIR/no_inferrable_concrete_type.rs:17:22 + | +LL | let _: Foo = std::mem::transmute(0u8); + | ^^^^^^^^^^^^^^^^^^^ + | + = note: source type: `u8` (8 bits) + = note: target type: `{type error}` (the type has an unknown layout) + +error: aborting due to 2 previous errors +For more information about this error, try `rustc --explain E0512`. diff --git a/tests/ui/type-alias-impl-trait/normalize-args-before-defining-use-check.rs b/tests/ui/type-alias-impl-trait/normalize-args-before-defining-use-check.rs new file mode 100644 index 00000000000..2879b8fe94c --- /dev/null +++ b/tests/ui/type-alias-impl-trait/normalize-args-before-defining-use-check.rs @@ -0,0 +1,33 @@ +#![feature(type_alias_impl_trait)] + +//@ revisions: current next +//@ ignore-compare-mode-next-solver (explicit revisions) +//@ [next] compile-flags: -Znext-solver +//@ check-pass + +// Regression test for trait-system-refactor-initiative#49. + +trait Mirror<'a> { + type Assoc; +} +impl<'a, T> Mirror<'a> for T { + type Assoc = T; +} + +type HrAmbigAlias<T> = impl Sized; +fn ret_tait<T>() -> for<'a> fn(HrAmbigAlias<<T as Mirror<'a>>::Assoc>) { + |_| () +} + +#[define_opaque(HrAmbigAlias)] +fn define_hr_ambig_alias<T>() { + let _: fn(T) = ret_tait::<T>(); +} + +type InUserType<T> = impl Sized; +#[define_opaque(InUserType)] +fn in_user_type<T>() { + let x: InUserType<<T as Mirror<'static>>::Assoc> = (); +} + +fn main() {} diff --git a/tests/ui/type/issue-7607-1.stderr b/tests/ui/type/issue-7607-1.stderr index db4c8f25dbc..69b6d62e987 100644 --- a/tests/ui/type/issue-7607-1.stderr +++ b/tests/ui/type/issue-7607-1.stderr @@ -3,6 +3,7 @@ error[E0412]: cannot find type `Fo` in this scope | LL | impl Fo { | ^^ help: a trait with a similar name exists: `Fn` + | --> $SRC_DIR/core/src/ops/function.rs:LL:COL | = note: similarly named trait `Fn` defined here diff --git a/tests/ui/type/pattern_types/or_patterns_invalid.rs b/tests/ui/type/pattern_types/or_patterns_invalid.rs index d341927601d..a99667c5412 100644 --- a/tests/ui/type/pattern_types/or_patterns_invalid.rs +++ b/tests/ui/type/pattern_types/or_patterns_invalid.rs @@ -13,14 +13,18 @@ use std::pat::pattern_type; fn main() { //~? ERROR: only non-overlapping pattern type ranges are allowed at present let not_adjacent: pattern_type!(i8 is -127..0 | 1..) = unsafe { std::mem::transmute(0) }; + //~^ ERROR: cannot transmute between types of different sizes, or dependently-sized types //~? ERROR: one pattern needs to end at `i8::MAX`, but was 29 instead let not_wrapping: pattern_type!(i8 is 10..20 | 20..30) = unsafe { std::mem::transmute(0) }; + //~^ ERROR: cannot transmute between types of different sizes, or dependently-sized types //~? ERROR: only signed integer base types are allowed for or-pattern pattern types let not_signed: pattern_type!(u8 is 10.. | 0..5) = unsafe { std::mem::transmute(0) }; + //~^ ERROR: cannot transmute between types of different sizes, or dependently-sized types //~? ERROR: allowed are two range patterns that are directly connected let not_simple_enough_for_mvp: pattern_type!(i8 is ..0 | 1..10 | 10..) = unsafe { std::mem::transmute(0) }; + //~^ ERROR: cannot transmute between types of different sizes, or dependently-sized types } diff --git a/tests/ui/type/pattern_types/or_patterns_invalid.stderr b/tests/ui/type/pattern_types/or_patterns_invalid.stderr index 6964788a6c2..e229c11386d 100644 --- a/tests/ui/type/pattern_types/or_patterns_invalid.stderr +++ b/tests/ui/type/pattern_types/or_patterns_invalid.stderr @@ -1,10 +1,47 @@ error: only non-overlapping pattern type ranges are allowed at present +error[E0512]: cannot transmute between types of different sizes, or dependently-sized types + --> $DIR/or_patterns_invalid.rs:15:69 + | +LL | let not_adjacent: pattern_type!(i8 is -127..0 | 1..) = unsafe { std::mem::transmute(0) }; + | ^^^^^^^^^^^^^^^^^^^ + | + = note: source type: `i32` (32 bits) + = note: target type: `(i8) is (-127..=-1 | 1..)` (the type has an unknown layout) + error: one pattern needs to end at `i8::MAX`, but was 29 instead +error[E0512]: cannot transmute between types of different sizes, or dependently-sized types + --> $DIR/or_patterns_invalid.rs:19:71 + | +LL | let not_wrapping: pattern_type!(i8 is 10..20 | 20..30) = unsafe { std::mem::transmute(0) }; + | ^^^^^^^^^^^^^^^^^^^ + | + = note: source type: `i32` (32 bits) + = note: target type: `(i8) is (10..=19 | 20..=29)` (the type has an unknown layout) + error: only signed integer base types are allowed for or-pattern pattern types at present +error[E0512]: cannot transmute between types of different sizes, or dependently-sized types + --> $DIR/or_patterns_invalid.rs:23:65 + | +LL | let not_signed: pattern_type!(u8 is 10.. | 0..5) = unsafe { std::mem::transmute(0) }; + | ^^^^^^^^^^^^^^^^^^^ + | + = note: source type: `i32` (32 bits) + = note: target type: `(u8) is (10.. | 0..=4)` (the type has an unknown layout) + error: the only or-pattern types allowed are two range patterns that are directly connected at their overflow site -error: aborting due to 4 previous errors +error[E0512]: cannot transmute between types of different sizes, or dependently-sized types + --> $DIR/or_patterns_invalid.rs:28:18 + | +LL | unsafe { std::mem::transmute(0) }; + | ^^^^^^^^^^^^^^^^^^^ + | + = note: source type: `i32` (32 bits) + = note: target type: `(i8) is (i8::MIN..=-1 | 1..=9 | 10..)` (the type has an unknown layout) + +error: aborting due to 8 previous errors +For more information about this error, try `rustc --explain E0512`. diff --git a/tests/ui/type/type-name-basic.rs b/tests/ui/type/type-name-basic.rs index 6a9f772e542..343bcae175a 100644 --- a/tests/ui/type/type-name-basic.rs +++ b/tests/ui/type/type-name-basic.rs @@ -5,7 +5,7 @@ #![allow(dead_code)] -use std::any::type_name; +use std::any::{Any, type_name, type_name_of_val}; use std::borrow::Cow; struct Foo<T>(T); @@ -29,6 +29,12 @@ macro_rules! t { } } +macro_rules! v { + ($v:expr, $str:literal) => { + assert_eq!(type_name_of_val(&$v), $str); + } +} + pub fn main() { t!(bool, "bool"); t!(char, "char"); @@ -62,29 +68,43 @@ pub fn main() { t!(Vec<Vec<u32>>, "alloc::vec::Vec<alloc::vec::Vec<u32>>"); t!(Foo<usize>, "type_name_basic::Foo<usize>"); - t!(Bar<'static>, "type_name_basic::Bar"); - t!(Baz<'static, u32>, "type_name_basic::Baz<u32>"); + t!(Bar<'static>, "type_name_basic::Bar<'_>"); + t!(Baz<'static, u32>, "type_name_basic::Baz<'_, u32>"); - // FIXME: lifetime omission means these all print badly. - t!(dyn TrL<'static>, "dyn type_name_basic::TrL<>"); - t!(dyn TrLA<'static, A = u32>, "dyn type_name_basic::TrLA<, A = u32>"); + t!(dyn TrL<'static>, "dyn type_name_basic::TrL<'_>"); + t!(dyn TrLA<'static, A = u32>, "dyn type_name_basic::TrLA<'_, A = u32>"); t!( dyn TrLT<'static, Cow<'static, ()>>, - "dyn type_name_basic::TrLT<, alloc::borrow::Cow<()>>" + "dyn type_name_basic::TrLT<'_, alloc::borrow::Cow<'_, ()>>" ); t!( dyn TrLTA<'static, u32, A = Cow<'static, ()>>, - "dyn type_name_basic::TrLTA<, u32, A = alloc::borrow::Cow<()>>" + "dyn type_name_basic::TrLTA<'_, u32, A = alloc::borrow::Cow<'_, ()>>" ); t!(fn(i32) -> i32, "fn(i32) -> i32"); - t!(dyn for<'a> Fn(&'a u32), "dyn core::ops::function::Fn(&u32)"); + t!(fn(&'static u32), "fn(&u32)"); + + // FIXME: these are sub-optimal, ideally the `for<...>` would be printed. + t!(for<'a> fn(&'a u32), "fn(&'_ u32)"); + t!(for<'a, 'b> fn(&'a u32, &'b u32), "fn(&'_ u32, &'_ u32)"); + t!(for<'a> fn(for<'b> fn(&'a u32, &'b u32)), "fn(fn(&'_ u32, &'_ u32))"); struct S<'a, T>(&'a T); impl<'a, T: Clone> S<'a, T> { fn test() { - t!(Cow<'a, T>, "alloc::borrow::Cow<u32>"); + t!(Cow<'a, T>, "alloc::borrow::Cow<'_, u32>"); } } S::<u32>::test(); + + struct Wrap<T>(T); + impl Wrap<&()> { + fn get(&self) -> impl Any { + struct Info; + Info + } + } + let a = Wrap(&()).get(); + v!(a, "type_name_basic::main::Wrap<&()>::get::Info"); } diff --git a/tests/ui/issues/issue-8767.rs b/tests/ui/typeck/impl-for-nonexistent-type-error-8767.rs index 972101a0bc3..005c676ed39 100644 --- a/tests/ui/issues/issue-8767.rs +++ b/tests/ui/typeck/impl-for-nonexistent-type-error-8767.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/8767 impl B { //~ ERROR cannot find type `B` in this scope } diff --git a/tests/ui/issues/issue-8767.stderr b/tests/ui/typeck/impl-for-nonexistent-type-error-8767.stderr index 66141628e28..0e37391a00f 100644 --- a/tests/ui/issues/issue-8767.stderr +++ b/tests/ui/typeck/impl-for-nonexistent-type-error-8767.stderr @@ -1,5 +1,5 @@ error[E0412]: cannot find type `B` in this scope - --> $DIR/issue-8767.rs:1:6 + --> $DIR/impl-for-nonexistent-type-error-8767.rs:2:6 | LL | impl B { | ^ not found in this scope diff --git a/tests/ui/typeck/issue-83693.stderr b/tests/ui/typeck/issue-83693.stderr index 34bca426116..0359b8af93a 100644 --- a/tests/ui/typeck/issue-83693.stderr +++ b/tests/ui/typeck/issue-83693.stderr @@ -3,6 +3,7 @@ error[E0412]: cannot find type `F` in this scope | LL | impl F { | ^ help: a trait with a similar name exists: `Fn` + | --> $SRC_DIR/core/src/ops/function.rs:LL:COL | = note: similarly named trait `Fn` defined here diff --git a/tests/ui/typeck/typeck-default-trait-impl-negation-send.stderr b/tests/ui/typeck/typeck-default-trait-impl-negation-send.stderr index 771272ad10b..761277775f3 100644 --- a/tests/ui/typeck/typeck-default-trait-impl-negation-send.stderr +++ b/tests/ui/typeck/typeck-default-trait-impl-negation-send.stderr @@ -4,7 +4,11 @@ error[E0277]: `MyNotSendable` cannot be sent between threads safely LL | is_send::<MyNotSendable>(); | ^^^^^^^^^^^^^ `MyNotSendable` cannot be sent between threads safely | - = help: the trait `Send` is not implemented for `MyNotSendable` +help: the trait `Send` is not implemented for `MyNotSendable` + --> $DIR/typeck-default-trait-impl-negation-send.rs:9:1 + | +LL | struct MyNotSendable { + | ^^^^^^^^^^^^^^^^^^^^ note: required by a bound in `is_send` --> $DIR/typeck-default-trait-impl-negation-send.rs:15:15 | diff --git a/tests/ui/typeck/typeck-default-trait-impl-negation-sync.stderr b/tests/ui/typeck/typeck-default-trait-impl-negation-sync.stderr index b9fca1a1b54..92629704c89 100644 --- a/tests/ui/typeck/typeck-default-trait-impl-negation-sync.stderr +++ b/tests/ui/typeck/typeck-default-trait-impl-negation-sync.stderr @@ -4,7 +4,11 @@ error[E0277]: `MyNotSync` cannot be shared between threads safely LL | is_sync::<MyNotSync>(); | ^^^^^^^^^ `MyNotSync` cannot be shared between threads safely | - = help: the trait `Sync` is not implemented for `MyNotSync` +help: the trait `Sync` is not implemented for `MyNotSync` + --> $DIR/typeck-default-trait-impl-negation-sync.rs:15:1 + | +LL | struct MyNotSync { + | ^^^^^^^^^^^^^^^^ note: required by a bound in `is_sync` --> $DIR/typeck-default-trait-impl-negation-sync.rs:29:15 | @@ -35,7 +39,11 @@ error[E0277]: `Managed` cannot be shared between threads safely LL | is_sync::<MyTypeManaged>(); | ^^^^^^^^^^^^^ `Managed` cannot be shared between threads safely | - = help: within `MyTypeManaged`, the trait `Sync` is not implemented for `Managed` +help: within `MyTypeManaged`, the trait `Sync` is not implemented for `Managed` + --> $DIR/typeck-default-trait-impl-negation-sync.rs:3:1 + | +LL | struct Managed; + | ^^^^^^^^^^^^^^ note: required because it appears within the type `MyTypeManaged` --> $DIR/typeck-default-trait-impl-negation-sync.rs:25:8 | diff --git a/tests/ui/typeck/typeck-unsafe-always-share.stderr b/tests/ui/typeck/typeck-unsafe-always-share.stderr index 154e504996b..c680c6ee27b 100644 --- a/tests/ui/typeck/typeck-unsafe-always-share.stderr +++ b/tests/ui/typeck/typeck-unsafe-always-share.stderr @@ -56,7 +56,11 @@ LL | test(NoSync); | | | required by a bound introduced by this call | - = help: the trait `Sync` is not implemented for `NoSync` +help: the trait `Sync` is not implemented for `NoSync` + --> $DIR/typeck-unsafe-always-share.rs:12:1 + | +LL | struct NoSync; + | ^^^^^^^^^^^^^ note: required by a bound in `test` --> $DIR/typeck-unsafe-always-share.rs:15:12 | diff --git a/tests/ui/ufcs/ufcs-partially-resolved.stderr b/tests/ui/ufcs/ufcs-partially-resolved.stderr index 69d6bd74a73..a854ecb0622 100644 --- a/tests/ui/ufcs/ufcs-partially-resolved.stderr +++ b/tests/ui/ufcs/ufcs-partially-resolved.stderr @@ -12,6 +12,7 @@ error[E0404]: expected trait, found enum `E` | LL | let _: <u8 as E>::N; | ^ help: a trait with a similar name exists: `Eq` + | --> $SRC_DIR/core/src/cmp.rs:LL:COL | = note: similarly named trait `Eq` defined here @@ -42,6 +43,7 @@ error[E0404]: expected trait, found enum `E` | LL | <u8 as E>::N; | ^ help: a trait with a similar name exists: `Eq` + | --> $SRC_DIR/core/src/cmp.rs:LL:COL | = note: similarly named trait `Eq` defined here @@ -63,6 +65,7 @@ error[E0404]: expected trait, found enum `E` | LL | let _: <u8 as E>::Y; | ^ help: a trait with a similar name exists: `Eq` + | --> $SRC_DIR/core/src/cmp.rs:LL:COL | = note: similarly named trait `Eq` defined here @@ -72,6 +75,7 @@ error[E0404]: expected trait, found enum `E` | LL | <u8 as E>::Y; | ^ help: a trait with a similar name exists: `Eq` + | --> $SRC_DIR/core/src/cmp.rs:LL:COL | = note: similarly named trait `Eq` defined here @@ -90,6 +94,7 @@ error[E0404]: expected trait, found enum `E` | LL | let _: <u8 as E>::N::NN; | ^ help: a trait with a similar name exists: `Eq` + | --> $SRC_DIR/core/src/cmp.rs:LL:COL | = note: similarly named trait `Eq` defined here @@ -120,6 +125,7 @@ error[E0404]: expected trait, found enum `E` | LL | <u8 as E>::N::NN; | ^ help: a trait with a similar name exists: `Eq` + | --> $SRC_DIR/core/src/cmp.rs:LL:COL | = note: similarly named trait `Eq` defined here @@ -141,6 +147,7 @@ error[E0404]: expected trait, found enum `E` | LL | let _: <u8 as E>::Y::NN; | ^ help: a trait with a similar name exists: `Eq` + | --> $SRC_DIR/core/src/cmp.rs:LL:COL | = note: similarly named trait `Eq` defined here @@ -150,6 +157,7 @@ error[E0404]: expected trait, found enum `E` | LL | <u8 as E>::Y::NN; | ^ help: a trait with a similar name exists: `Eq` + | --> $SRC_DIR/core/src/cmp.rs:LL:COL | = note: similarly named trait `Eq` defined here diff --git a/tests/ui/unboxed-closures/unboxed-closures-counter-not-moved.stderr b/tests/ui/unboxed-closures/unboxed-closures-counter-not-moved.stderr index 6450cc30ac0..190ef0f4724 100644 --- a/tests/ui/unboxed-closures/unboxed-closures-counter-not-moved.stderr +++ b/tests/ui/unboxed-closures/unboxed-closures-counter-not-moved.stderr @@ -4,7 +4,7 @@ warning: unused variable: `item` LL | for item in y { | ^^^^ help: if this is intentional, prefix it with an underscore: `_item` | - = note: `#[warn(unused_variables)]` on by default + = note: `#[warn(unused_variables)]` (part of `#[warn(unused)]`) on by default warning: value assigned to `counter` is never read --> $DIR/unboxed-closures-counter-not-moved.rs:24:9 @@ -13,7 +13,7 @@ LL | counter += 1; | ^^^^^^^ | = help: maybe it is overwritten before being read? - = note: `#[warn(unused_assignments)]` on by default + = note: `#[warn(unused_assignments)]` (part of `#[warn(unused)]`) on by default warning: unused variable: `counter` --> $DIR/unboxed-closures-counter-not-moved.rs:24:9 diff --git a/tests/ui/unboxed-closures/unboxed-closures-fnmut-as-fn.stderr b/tests/ui/unboxed-closures/unboxed-closures-fnmut-as-fn.stderr index 9c5d824185b..0dd6dcfe6a3 100644 --- a/tests/ui/unboxed-closures/unboxed-closures-fnmut-as-fn.stderr +++ b/tests/ui/unboxed-closures/unboxed-closures-fnmut-as-fn.stderr @@ -6,7 +6,11 @@ LL | let x = call_it(&S, 22); | | | required by a bound introduced by this call | - = help: the trait `Fn(isize)` is not implemented for `S` +help: the trait `Fn(isize)` is not implemented for `S` + --> $DIR/unboxed-closures-fnmut-as-fn.rs:8:1 + | +LL | struct S; + | ^^^^^^^^ = note: `S` implements `FnMut`, but it must implement `Fn`, which is more general note: required by a bound in `call_it` --> $DIR/unboxed-closures-fnmut-as-fn.rs:22:14 diff --git a/tests/ui/unboxed-closures/unboxed-closures-move-mutable.stderr b/tests/ui/unboxed-closures/unboxed-closures-move-mutable.stderr index 813e2eea568..24590128107 100644 --- a/tests/ui/unboxed-closures/unboxed-closures-move-mutable.stderr +++ b/tests/ui/unboxed-closures/unboxed-closures-move-mutable.stderr @@ -5,7 +5,7 @@ LL | move || x += 1; | ^ | = help: did you mean to capture by reference instead? - = note: `#[warn(unused_variables)]` on by default + = note: `#[warn(unused_variables)]` (part of `#[warn(unused)]`) on by default warning: unused variable: `x` --> $DIR/unboxed-closures-move-mutable.rs:20:17 diff --git a/tests/ui/unpretty/exhaustive.expanded.stdout b/tests/ui/unpretty/exhaustive.expanded.stdout index 0327ad5f92b..a12ea0786f9 100644 --- a/tests/ui/unpretty/exhaustive.expanded.stdout +++ b/tests/ui/unpretty/exhaustive.expanded.stdout @@ -13,6 +13,7 @@ #![feature(box_patterns)] #![feature(builtin_syntax)] #![feature(const_trait_impl)] +#![feature(coroutines)] #![feature(decl_macro)] #![feature(deref_patterns)] #![feature(explicit_tail_calls)] diff --git a/tests/ui/unpretty/exhaustive.hir.stderr b/tests/ui/unpretty/exhaustive.hir.stderr index aa411ce81eb..eb5c186bd2c 100644 --- a/tests/ui/unpretty/exhaustive.hir.stderr +++ b/tests/ui/unpretty/exhaustive.hir.stderr @@ -1,17 +1,17 @@ error[E0697]: closures cannot be static - --> $DIR/exhaustive.rs:209:9 + --> $DIR/exhaustive.rs:210:9 | LL | static || value; | ^^^^^^^^^ error[E0697]: closures cannot be static - --> $DIR/exhaustive.rs:210:9 + --> $DIR/exhaustive.rs:211:9 | LL | static move || value; | ^^^^^^^^^^^^^^ error[E0728]: `await` is only allowed inside `async` functions and blocks - --> $DIR/exhaustive.rs:239:13 + --> $DIR/exhaustive.rs:240:13 | LL | fn expr_await() { | --------------- this is not `async` @@ -20,19 +20,19 @@ LL | fut.await; | ^^^^^ only allowed inside `async` functions and blocks error: in expressions, `_` can only be used on the left-hand side of an assignment - --> $DIR/exhaustive.rs:288:9 + --> $DIR/exhaustive.rs:289:9 | LL | _; | ^ `_` not allowed here error[E0214]: parenthesized type parameters may only be used with a `Fn` trait - --> $DIR/exhaustive.rs:298:9 + --> $DIR/exhaustive.rs:299:9 | LL | x::(); | ^^^^^ only `Fn` traits may use parentheses error[E0214]: parenthesized type parameters may only be used with a `Fn` trait - --> $DIR/exhaustive.rs:299:9 + --> $DIR/exhaustive.rs:300:9 | LL | x::(T, T) -> T; | ^^^^^^^^^^^^^^ only `Fn` traits may use parentheses @@ -44,31 +44,31 @@ LL + x::<T, T> -> T; | error[E0214]: parenthesized type parameters may only be used with a `Fn` trait - --> $DIR/exhaustive.rs:300:9 + --> $DIR/exhaustive.rs:301:9 | LL | crate::() -> ()::expressions::() -> ()::expr_path; | ^^^^^^^^^^^^^^^ only `Fn` traits may use parentheses error[E0214]: parenthesized type parameters may only be used with a `Fn` trait - --> $DIR/exhaustive.rs:300:26 + --> $DIR/exhaustive.rs:301:26 | LL | crate::() -> ()::expressions::() -> ()::expr_path; | ^^^^^^^^^^^^^^^^^^^^^ only `Fn` traits may use parentheses error[E0214]: parenthesized type parameters may only be used with a `Fn` trait - --> $DIR/exhaustive.rs:303:9 + --> $DIR/exhaustive.rs:304:9 | LL | core::()::marker::()::PhantomData; | ^^^^^^^^ only `Fn` traits may use parentheses error[E0214]: parenthesized type parameters may only be used with a `Fn` trait - --> $DIR/exhaustive.rs:303:19 + --> $DIR/exhaustive.rs:304:19 | LL | core::()::marker::()::PhantomData; | ^^^^^^^^^^ only `Fn` traits may use parentheses error: `yield` can only be used in `#[coroutine]` closures, or `gen` blocks - --> $DIR/exhaustive.rs:390:9 + --> $DIR/exhaustive.rs:391:9 | LL | yield; | ^^^^^ @@ -79,7 +79,7 @@ LL | #[coroutine] fn expr_yield() { | ++++++++++++ error[E0703]: invalid ABI: found `C++` - --> $DIR/exhaustive.rs:470:23 + --> $DIR/exhaustive.rs:471:23 | LL | unsafe extern "C++" {} | ^^^^^ invalid ABI @@ -87,7 +87,7 @@ LL | unsafe extern "C++" {} = note: invoke `rustc --print=calling-conventions` for a full list of supported calling conventions error: `..` patterns are not allowed here - --> $DIR/exhaustive.rs:677:13 + --> $DIR/exhaustive.rs:678:13 | LL | let ..; | ^^ @@ -95,13 +95,13 @@ LL | let ..; = note: only allowed in tuple, tuple struct, and slice patterns error[E0214]: parenthesized type parameters may only be used with a `Fn` trait - --> $DIR/exhaustive.rs:792:16 + --> $DIR/exhaustive.rs:793:16 | LL | let _: T() -> !; | ^^^^^^^^ only `Fn` traits may use parentheses error[E0562]: `impl Trait` is not allowed in the type of variable bindings - --> $DIR/exhaustive.rs:806:16 + --> $DIR/exhaustive.rs:807:16 | LL | let _: impl Send; | ^^^^^^^^^ @@ -112,7 +112,7 @@ LL | let _: impl Send; = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0562]: `impl Trait` is not allowed in the type of variable bindings - --> $DIR/exhaustive.rs:807:16 + --> $DIR/exhaustive.rs:808:16 | LL | let _: impl Send + 'static; | ^^^^^^^^^^^^^^^^^^^ @@ -123,7 +123,7 @@ LL | let _: impl Send + 'static; = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0562]: `impl Trait` is not allowed in the type of variable bindings - --> $DIR/exhaustive.rs:808:16 + --> $DIR/exhaustive.rs:809:16 | LL | let _: impl 'static + Send; | ^^^^^^^^^^^^^^^^^^^ @@ -134,7 +134,7 @@ LL | let _: impl 'static + Send; = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0562]: `impl Trait` is not allowed in the type of variable bindings - --> $DIR/exhaustive.rs:809:16 + --> $DIR/exhaustive.rs:810:16 | LL | let _: impl ?Sized; | ^^^^^^^^^^^ @@ -145,7 +145,7 @@ LL | let _: impl ?Sized; = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0562]: `impl Trait` is not allowed in the type of variable bindings - --> $DIR/exhaustive.rs:810:16 + --> $DIR/exhaustive.rs:811:16 | LL | let _: impl [const] Clone; | ^^^^^^^^^^^^^^^^^^ @@ -156,7 +156,7 @@ LL | let _: impl [const] Clone; = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0562]: `impl Trait` is not allowed in the type of variable bindings - --> $DIR/exhaustive.rs:811:16 + --> $DIR/exhaustive.rs:812:16 | LL | let _: impl for<'a> Send; | ^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/unpretty/exhaustive.hir.stdout b/tests/ui/unpretty/exhaustive.hir.stdout index 68356a33c9e..924fb98ae18 100644 --- a/tests/ui/unpretty/exhaustive.hir.stdout +++ b/tests/ui/unpretty/exhaustive.hir.stdout @@ -12,6 +12,7 @@ #![feature(box_patterns)] #![feature(builtin_syntax)] #![feature(const_trait_impl)] +#![feature(coroutines)] #![feature(decl_macro)] #![feature(deref_patterns)] #![feature(explicit_tail_calls)] diff --git a/tests/ui/unpretty/exhaustive.rs b/tests/ui/unpretty/exhaustive.rs index b19d4f9fe2c..0983a0a7e43 100644 --- a/tests/ui/unpretty/exhaustive.rs +++ b/tests/ui/unpretty/exhaustive.rs @@ -12,6 +12,7 @@ #![feature(box_patterns)] #![feature(builtin_syntax)] #![feature(const_trait_impl)] +#![feature(coroutines)] #![feature(decl_macro)] #![feature(deref_patterns)] #![feature(explicit_tail_calls)] diff --git a/tests/ui/issues/issue-7344.rs b/tests/ui/unreachable-code/boolean-negation-in-unreachable-code-7344.rs index 406b24634f5..8fd091872c3 100644 --- a/tests/ui/issues/issue-7344.rs +++ b/tests/ui/unreachable-code/boolean-negation-in-unreachable-code-7344.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/7344 //@ run-pass #![allow(unused_must_use)] diff --git a/tests/ui/unsafe-fields/auto-traits.current.stderr b/tests/ui/unsafe-fields/auto-traits.current.stderr index 53a97458b7c..2483556b139 100644 --- a/tests/ui/unsafe-fields/auto-traits.current.stderr +++ b/tests/ui/unsafe-fields/auto-traits.current.stderr @@ -2,10 +2,15 @@ error[E0277]: the trait bound `UnsafeEnum: UnsafeAuto` is not satisfied --> $DIR/auto-traits.rs:24:22 | LL | impl_unsafe_auto(UnsafeEnum::Safe(42)); - | ---------------- ^^^^^^^^^^^^^^^^^^^^ the trait `UnsafeAuto` is not implemented for `UnsafeEnum` + | ---------------- ^^^^^^^^^^^^^^^^^^^^ unsatisfied trait bound | | | required by a bound introduced by this call | +help: the trait `UnsafeAuto` is not implemented for `UnsafeEnum` + --> $DIR/auto-traits.rs:9:1 + | +LL | enum UnsafeEnum { + | ^^^^^^^^^^^^^^^ note: required by a bound in `impl_unsafe_auto` --> $DIR/auto-traits.rs:20:29 | diff --git a/tests/ui/unsafe-fields/auto-traits.next.stderr b/tests/ui/unsafe-fields/auto-traits.next.stderr index 53a97458b7c..2483556b139 100644 --- a/tests/ui/unsafe-fields/auto-traits.next.stderr +++ b/tests/ui/unsafe-fields/auto-traits.next.stderr @@ -2,10 +2,15 @@ error[E0277]: the trait bound `UnsafeEnum: UnsafeAuto` is not satisfied --> $DIR/auto-traits.rs:24:22 | LL | impl_unsafe_auto(UnsafeEnum::Safe(42)); - | ---------------- ^^^^^^^^^^^^^^^^^^^^ the trait `UnsafeAuto` is not implemented for `UnsafeEnum` + | ---------------- ^^^^^^^^^^^^^^^^^^^^ unsatisfied trait bound | | | required by a bound introduced by this call | +help: the trait `UnsafeAuto` is not implemented for `UnsafeEnum` + --> $DIR/auto-traits.rs:9:1 + | +LL | enum UnsafeEnum { + | ^^^^^^^^^^^^^^^ note: required by a bound in `impl_unsafe_auto` --> $DIR/auto-traits.rs:20:29 | diff --git a/tests/ui/issues/auxiliary/issue-5844-aux.rs b/tests/ui/unsafe/auxiliary/aux-5844.rs index ea83378cad6..ea83378cad6 100644 --- a/tests/ui/issues/auxiliary/issue-5844-aux.rs +++ b/tests/ui/unsafe/auxiliary/aux-5844.rs diff --git a/tests/ui/unsafe/edition-2024-unsafe_op_in_unsafe_fn.stderr b/tests/ui/unsafe/edition-2024-unsafe_op_in_unsafe_fn.stderr index 8a26b45117c..b6804511ac2 100644 --- a/tests/ui/unsafe/edition-2024-unsafe_op_in_unsafe_fn.stderr +++ b/tests/ui/unsafe/edition-2024-unsafe_op_in_unsafe_fn.stderr @@ -11,7 +11,7 @@ note: an unsafe function restricts its caller, but its body is safe by default | LL | unsafe fn foo() { | ^^^^^^^^^^^^^^^ - = note: `#[warn(unsafe_op_in_unsafe_fn)]` on by default + = note: `#[warn(unsafe_op_in_unsafe_fn)]` (part of `#[warn(rust_2024_compatibility)]`) on by default warning: 1 warning emitted diff --git a/tests/ui/unsafe/extern-function-requires-unsafe-5844.rs b/tests/ui/unsafe/extern-function-requires-unsafe-5844.rs new file mode 100644 index 00000000000..11863ce647a --- /dev/null +++ b/tests/ui/unsafe/extern-function-requires-unsafe-5844.rs @@ -0,0 +1,8 @@ +// https://github.com/rust-lang/rust/issues/5844 +//@aux-build:aux-5844.rs + +extern crate aux_5844; + +fn main() { + aux_5844::rand(); //~ ERROR: requires unsafe +} diff --git a/tests/ui/issues/issue-5844.stderr b/tests/ui/unsafe/extern-function-requires-unsafe-5844.stderr index bae917fa72c..44dee178991 100644 --- a/tests/ui/issues/issue-5844.stderr +++ b/tests/ui/unsafe/extern-function-requires-unsafe-5844.stderr @@ -1,8 +1,8 @@ error[E0133]: call to unsafe function `rand` is unsafe and requires unsafe function or block - --> $DIR/issue-5844.rs:6:5 + --> $DIR/extern-function-requires-unsafe-5844.rs:7:5 | -LL | issue_5844_aux::rand(); - | ^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function +LL | aux_5844::rand(); + | ^^^^^^^^^^^^^^^^ call to unsafe function | = note: consult the function's documentation for information on how to avoid undefined behavior diff --git a/tests/ui/unsafe/unsafe_op_in_unsafe_fn/edition_2024_default.stderr b/tests/ui/unsafe/unsafe_op_in_unsafe_fn/edition_2024_default.stderr index 458a2180a82..35f9d3a4ebc 100644 --- a/tests/ui/unsafe/unsafe_op_in_unsafe_fn/edition_2024_default.stderr +++ b/tests/ui/unsafe/unsafe_op_in_unsafe_fn/edition_2024_default.stderr @@ -11,7 +11,7 @@ note: an unsafe function restricts its caller, but its body is safe by default | LL | unsafe fn foo() { | ^^^^^^^^^^^^^^^ - = note: `#[warn(unsafe_op_in_unsafe_fn)]` on by default + = note: `#[warn(unsafe_op_in_unsafe_fn)]` (part of `#[warn(rust_2024_compatibility)]`) on by default warning: 1 warning emitted diff --git a/tests/ui/unsized/issue-75707.stderr b/tests/ui/unsized/issue-75707.stderr index f5f2f7192aa..7bdb65500a9 100644 --- a/tests/ui/unsized/issue-75707.stderr +++ b/tests/ui/unsized/issue-75707.stderr @@ -2,8 +2,13 @@ error[E0277]: the trait bound `MyCall: Callback` is not satisfied --> $DIR/issue-75707.rs:15:9 | LL | f::<dyn Processing<Call = MyCall>>(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Callback` is not implemented for `MyCall` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unsatisfied trait bound | +help: the trait `Callback` is not implemented for `MyCall` + --> $DIR/issue-75707.rs:14:5 + | +LL | struct MyCall; + | ^^^^^^^^^^^^^ help: this trait has no implementations, consider adding one --> $DIR/issue-75707.rs:1:1 | diff --git a/tests/ui/unstable-feature-bound/unstable_inherent_method.stderr b/tests/ui/unstable-feature-bound/unstable_inherent_method.stderr index 2a1ae936cfe..3438e84079d 100644 --- a/tests/ui/unstable-feature-bound/unstable_inherent_method.stderr +++ b/tests/ui/unstable-feature-bound/unstable_inherent_method.stderr @@ -4,7 +4,7 @@ error: `#[unstable_feature_bound]` attribute cannot be used on required trait me LL | #[unstable_feature_bound(foo)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = help: `#[unstable_feature_bound]` can be applied to functions, trait impl blocks, traits + = help: `#[unstable_feature_bound]` can be applied to functions, trait impl blocks, and traits error: `#[unstable_feature_bound]` attribute cannot be used on trait methods in impl blocks --> $DIR/unstable_inherent_method.rs:18:5 @@ -12,7 +12,7 @@ error: `#[unstable_feature_bound]` attribute cannot be used on trait methods in LL | #[unstable_feature_bound(foo)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = help: `#[unstable_feature_bound]` can be applied to functions, trait impl blocks, traits + = help: `#[unstable_feature_bound]` can be applied to functions, trait impl blocks, and traits error: aborting due to 2 previous errors diff --git a/tests/ui/wasm/wasm-import-module.rs b/tests/ui/wasm/wasm-import-module.rs index 2b3bca9a411..c38fcb1a000 100644 --- a/tests/ui/wasm/wasm-import-module.rs +++ b/tests/ui/wasm/wasm-import-module.rs @@ -1,12 +1,12 @@ #![feature(link_cfg)] -#[link(name = "...", wasm_import_module)] //~ ERROR: must be of the form +#[link(name = "...", wasm_import_module)] //~ ERROR: malformed `link` attribute input extern "C" {} -#[link(name = "...", wasm_import_module(x))] //~ ERROR: must be of the form +#[link(name = "...", wasm_import_module(x))] //~ ERROR: malformed `link` attribute input extern "C" {} -#[link(name = "...", wasm_import_module())] //~ ERROR: must be of the form +#[link(name = "...", wasm_import_module())] //~ ERROR: malformed `link` attribute input extern "C" {} #[link(wasm_import_module = "foo", name = "bar")] //~ ERROR: `wasm_import_module` is incompatible with other arguments diff --git a/tests/ui/wasm/wasm-import-module.stderr b/tests/ui/wasm/wasm-import-module.stderr index 84f437941a7..f5ea449839b 100644 --- a/tests/ui/wasm/wasm-import-module.stderr +++ b/tests/ui/wasm/wasm-import-module.stderr @@ -1,20 +1,77 @@ -error: wasm import module must be of the form `wasm_import_module = "string"` - --> $DIR/wasm-import-module.rs:3:22 +error[E0539]: malformed `link` attribute input + --> $DIR/wasm-import-module.rs:3:1 | LL | #[link(name = "...", wasm_import_module)] - | ^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^------------------^^ + | | + | expected this to be of the form `wasm_import_module = "..."` + | + = note: for more information, visit <https://doc.rust-lang.org/reference/items/external-blocks.html#the-link-attribute> +help: try changing it to one of the following valid forms of the attribute + | +LL - #[link(name = "...", wasm_import_module)] +LL + #[link(name = "...")] + | +LL - #[link(name = "...", wasm_import_module)] +LL + #[link(name = "...", import_name_type = "decorated|noprefix|undecorated")] + | +LL - #[link(name = "...", wasm_import_module)] +LL + #[link(name = "...", kind = "dylib|static|...")] + | +LL - #[link(name = "...", wasm_import_module)] +LL + #[link(name = "...", kind = "dylib|static|...", wasm_import_module = "...", import_name_type = "decorated|noprefix|undecorated")] + | + = and 1 other candidate -error: wasm import module must be of the form `wasm_import_module = "string"` - --> $DIR/wasm-import-module.rs:6:22 +error[E0539]: malformed `link` attribute input + --> $DIR/wasm-import-module.rs:6:1 | LL | #[link(name = "...", wasm_import_module(x))] - | ^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^---------------------^^ + | | + | expected this to be of the form `wasm_import_module = "..."` + | + = note: for more information, visit <https://doc.rust-lang.org/reference/items/external-blocks.html#the-link-attribute> +help: try changing it to one of the following valid forms of the attribute + | +LL - #[link(name = "...", wasm_import_module(x))] +LL + #[link(name = "...")] + | +LL - #[link(name = "...", wasm_import_module(x))] +LL + #[link(name = "...", import_name_type = "decorated|noprefix|undecorated")] + | +LL - #[link(name = "...", wasm_import_module(x))] +LL + #[link(name = "...", kind = "dylib|static|...")] + | +LL - #[link(name = "...", wasm_import_module(x))] +LL + #[link(name = "...", kind = "dylib|static|...", wasm_import_module = "...", import_name_type = "decorated|noprefix|undecorated")] + | + = and 1 other candidate -error: wasm import module must be of the form `wasm_import_module = "string"` - --> $DIR/wasm-import-module.rs:9:22 +error[E0539]: malformed `link` attribute input + --> $DIR/wasm-import-module.rs:9:1 | LL | #[link(name = "...", wasm_import_module())] - | ^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^--------------------^^ + | | + | expected this to be of the form `wasm_import_module = "..."` + | + = note: for more information, visit <https://doc.rust-lang.org/reference/items/external-blocks.html#the-link-attribute> +help: try changing it to one of the following valid forms of the attribute + | +LL - #[link(name = "...", wasm_import_module())] +LL + #[link(name = "...")] + | +LL - #[link(name = "...", wasm_import_module())] +LL + #[link(name = "...", import_name_type = "decorated|noprefix|undecorated")] + | +LL - #[link(name = "...", wasm_import_module())] +LL + #[link(name = "...", kind = "dylib|static|...")] + | +LL - #[link(name = "...", wasm_import_module())] +LL + #[link(name = "...", kind = "dylib|static|...", wasm_import_module = "...", import_name_type = "decorated|noprefix|undecorated")] + | + = and 1 other candidate error: `wasm_import_module` is incompatible with other arguments in `#[link]` attributes --> $DIR/wasm-import-module.rs:12:8 @@ -36,3 +93,4 @@ LL | #[link(wasm_import_module = "foo", cfg(false))] error: aborting due to 6 previous errors +For more information about this error, try `rustc --explain E0539`. diff --git a/tests/ui/wf/hir-wf-canonicalized.stderr b/tests/ui/wf/hir-wf-canonicalized.stderr index 8938801ce3d..51db0e39de0 100644 --- a/tests/ui/wf/hir-wf-canonicalized.stderr +++ b/tests/ui/wf/hir-wf-canonicalized.stderr @@ -2,8 +2,13 @@ error[E0277]: the trait bound `Bar<'a, T>: Foo` is not satisfied --> $DIR/hir-wf-canonicalized.rs:10:15 | LL | callback: Box<dyn Callback<dyn Callback<Bar<'a, T>>>>, - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Foo` is not implemented for `Bar<'a, T>` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unsatisfied trait bound | +help: the trait `Foo` is not implemented for `Bar<'a, T>` + --> $DIR/hir-wf-canonicalized.rs:9:1 + | +LL | struct Bar<'a, T> { + | ^^^^^^^^^^^^^^^^^ help: this trait has no implementations, consider adding one --> $DIR/hir-wf-canonicalized.rs:3:1 | 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 26872f60fd3..a0b443ec850 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 @@ -6,7 +6,7 @@ LL | trait Foo<const N: Bar<2>> { | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! = note: for more information, see <https://doc.rust-lang.org/edition-guide/rust-2021/warnings-promoted-to-error.html> - = note: `#[warn(bare_trait_objects)]` on by default + = note: `#[warn(bare_trait_objects)]` (part of `#[warn(rust_2021_compatibility)]`) on by default help: if this is a dyn-compatible trait, use `dyn` | LL | trait Foo<const N: dyn Bar<2>> { diff --git a/tests/ui/wf/wf-packed-on-proj-of-type-as-unimpl-trait.stderr b/tests/ui/wf/wf-packed-on-proj-of-type-as-unimpl-trait.stderr index 8e3088c6f4a..3d066487654 100644 --- a/tests/ui/wf/wf-packed-on-proj-of-type-as-unimpl-trait.stderr +++ b/tests/ui/wf/wf-packed-on-proj-of-type-as-unimpl-trait.stderr @@ -2,8 +2,13 @@ error[E0277]: the trait bound `DefaultAllocator: Allocator` is not satisfied --> $DIR/wf-packed-on-proj-of-type-as-unimpl-trait.rs:28:12 | LL | struct Foo(Matrix<<DefaultAllocator as Allocator>::Buffer>); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Allocator` is not implemented for `DefaultAllocator` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unsatisfied trait bound | +help: the trait `Allocator` is not implemented for `DefaultAllocator` + --> $DIR/wf-packed-on-proj-of-type-as-unimpl-trait.rs:21:1 + | +LL | pub struct DefaultAllocator; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: this trait has no implementations, consider adding one --> $DIR/wf-packed-on-proj-of-type-as-unimpl-trait.rs:23:1 | diff --git a/tests/ui/where-clauses/unsupported_attribute.stderr b/tests/ui/where-clauses/unsupported_attribute.stderr index 411c895ed87..42a8a1350d2 100644 --- a/tests/ui/where-clauses/unsupported_attribute.stderr +++ b/tests/ui/where-clauses/unsupported_attribute.stderr @@ -48,7 +48,7 @@ error: `#[macro_use]` attribute cannot be used on where predicates LL | #[macro_use] T: Trait, | ^^^^^^^^^^^^ | - = help: `#[macro_use]` can be applied to modules, extern crates, crates + = help: `#[macro_use]` can be applied to modules, extern crates, and crates error: `#[macro_use]` attribute cannot be used on where predicates --> $DIR/unsupported_attribute.rs:21:5 @@ -56,7 +56,7 @@ error: `#[macro_use]` attribute cannot be used on where predicates LL | #[macro_use] 'a: 'static, | ^^^^^^^^^^^^ | - = help: `#[macro_use]` can be applied to modules, extern crates, crates + = help: `#[macro_use]` can be applied to modules, extern crates, and crates error: `#[deprecated]` attribute cannot be used on where predicates --> $DIR/unsupported_attribute.rs:24:5 @@ -64,7 +64,7 @@ error: `#[deprecated]` attribute cannot be used on where predicates LL | #[deprecated] T: Trait, | ^^^^^^^^^^^^^ | - = help: `#[deprecated]` can be applied to functions, data types, modules, unions, constants, statics, macro defs, type aliases, use statements, struct fields, traits, associated types, associated consts, enum variants, inherent impl blocks, crates + = help: `#[deprecated]` can be applied to functions, data types, modules, unions, constants, statics, macro defs, type aliases, use statements, foreign statics, struct fields, traits, associated types, associated consts, enum variants, inherent impl blocks, and crates error: `#[deprecated]` attribute cannot be used on where predicates --> $DIR/unsupported_attribute.rs:25:5 @@ -72,7 +72,7 @@ error: `#[deprecated]` attribute cannot be used on where predicates LL | #[deprecated] 'a: 'static, | ^^^^^^^^^^^^^ | - = help: `#[deprecated]` can be applied to functions, data types, modules, unions, constants, statics, macro defs, type aliases, use statements, struct fields, traits, associated types, associated consts, enum variants, inherent impl blocks, crates + = help: `#[deprecated]` can be applied to functions, data types, modules, unions, constants, statics, macro defs, type aliases, use statements, foreign statics, struct fields, traits, associated types, associated consts, enum variants, inherent impl blocks, and crates error: `#[automatically_derived]` attribute cannot be used on where predicates --> $DIR/unsupported_attribute.rs:26:5 diff --git a/tests/ui/where-clauses/where-clause-early-bound-lifetimes.stderr b/tests/ui/where-clauses/where-clause-early-bound-lifetimes.stderr index 34ed8bd2146..ebe609af38a 100644 --- a/tests/ui/where-clauses/where-clause-early-bound-lifetimes.stderr +++ b/tests/ui/where-clauses/where-clause-early-bound-lifetimes.stderr @@ -6,7 +6,7 @@ LL | trait TheTrait { fn dummy(&self) { } } | | | method in this trait | - = note: `#[warn(dead_code)]` on by default + = note: `#[warn(dead_code)]` (part of `#[warn(unused)]`) on by default warning: 1 warning emitted diff --git a/tests/ui/where-clauses/where-clause-method-substituion-rpass.stderr b/tests/ui/where-clauses/where-clause-method-substituion-rpass.stderr index 9a8faf7a64e..5161e2aabc1 100644 --- a/tests/ui/where-clauses/where-clause-method-substituion-rpass.stderr +++ b/tests/ui/where-clauses/where-clause-method-substituion-rpass.stderr @@ -6,7 +6,7 @@ LL | trait Foo<T> { fn dummy(&self, arg: T) { } } | | | method in this trait | - = note: `#[warn(dead_code)]` on by default + = note: `#[warn(dead_code)]` (part of `#[warn(unused)]`) on by default warning: 1 warning emitted diff --git a/tests/ui/where-clauses/where-clause-method-substituion.stderr b/tests/ui/where-clauses/where-clause-method-substituion.stderr index 1a1d9c13ab8..73aac3d54a3 100644 --- a/tests/ui/where-clauses/where-clause-method-substituion.stderr +++ b/tests/ui/where-clauses/where-clause-method-substituion.stderr @@ -2,8 +2,13 @@ error[E0277]: the trait bound `X: Foo<X>` is not satisfied --> $DIR/where-clause-method-substituion.rs:20:16 | LL | 1.method::<X>(); - | ^ the trait `Foo<X>` is not implemented for `X` + | ^ unsatisfied trait bound | +help: the trait `Foo<X>` is not implemented for `X` + --> $DIR/where-clause-method-substituion.rs:10:1 + | +LL | struct X; + | ^^^^^^^^ help: this trait has no implementations, consider adding one --> $DIR/where-clause-method-substituion.rs:1:1 | |
