diff options
Diffstat (limited to 'tests')
800 files changed, 8520 insertions, 2654 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/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..79347d0bbf6 100644 --- a/tests/assembly-llvm/targets/targets-elf.rs +++ b/tests/assembly-llvm/targets/targets-elf.rs @@ -1,6 +1,9 @@ //@ 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 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/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/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/function-arguments.rs b/tests/codegen-llvm/function-arguments.rs index a3fafbe6f82..db508682862 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,7 +129,7 @@ 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) {} @@ -138,12 +138,12 @@ pub fn notunpin_borrow(_: &NotUnpin) {} #[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) @@ -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-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/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/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/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/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/debuginfo/basic-stepping.rs b/tests/debuginfo/basic-stepping.rs index 6e1344d22a5..e7a70c8b087 100644 --- a/tests/debuginfo/basic-stepping.rs +++ b/tests/debuginfo/basic-stepping.rs @@ -3,6 +3,7 @@ //! Regression test for <https://github.com/rust-lang/rust/issues/33013>. //@ ignore-aarch64: Doesn't work yet. +//@ ignore-loongarch64: 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/index_array_and_slice.rs b/tests/mir-opt/building/index_array_and_slice.rs index f91b37567f7..42ede66d92b 100644 --- a/tests/mir-opt/building/index_array_and_slice.rs +++ b/tests/mir-opt/building/index_array_and_slice.rs @@ -55,7 +55,7 @@ struct WithSliceTail(f64, [i32]); fn index_custom(custom: &WithSliceTail, index: usize) -> &i32 { // CHECK: bb0: // CHECK: [[PTR:_.+]] = &raw const (fake) ((*_1).1: [i32]); - // CHECK: [[LEN:_.+]] = PtrMetadata(move [[PTR]]); + // CHECK: [[LEN:_.+]] = PtrMetadata(copy [[PTR]]); // CHECK: [[LT:_.+]] = Lt(copy _2, copy [[LEN]]); // CHECK: assert(move [[LT]], "index out of bounds{{.+}}", move [[LEN]], copy _2) -> [success: bb1, 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/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/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/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/sidebar-source-code.goml b/tests/rustdoc-gui/sidebar-source-code.goml index 0ac88612cef..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) 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/utils.goml b/tests/rustdoc-gui/utils.goml index 10439309402..e13aef6712f 100644 --- a/tests/rustdoc-gui/utils.goml +++ b/tests/rustdoc-gui/utils.goml @@ -39,6 +39,13 @@ 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|) diff --git a/tests/rustdoc-js-std/parser-errors.js b/tests/rustdoc-js-std/parser-errors.js index 49150cbd570..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, 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-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/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/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/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 396abb001ce..59b48e9f0ec 100644 --- a/tests/ui-fulldeps/session-diagnostic/diagnostic-derive.stderr +++ b/tests/ui-fulldeps/session-diagnostic/diagnostic-derive.stderr @@ -637,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/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..0fec35dabdd 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)); | ^^^^^^^^^^^^^^ @@ -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..ce8bd41f045 --- /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 | NoCapture | 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 | NoCapture | 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..ce8bd41f045 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)); | ^^^^^^^^^^^^^^ @@ -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-8498.rs b/tests/ui/array-slice-vec/matching-on-vector-slice-option-8498.rs index 92904e2198f..e243a247ed5 100644 --- a/tests/ui/issues/issue-8498.rs +++ b/tests/ui/array-slice-vec/matching-on-vector-slice-option-8498.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/8498 //@ run-pass pub fn main() { diff --git a/tests/ui/issues/issue-7784.rs b/tests/ui/array-slice-vec/pattern-matching-fixed-length-vectors-7784.rs index 90b88ae5727..7d987e92b63 100644 --- a/tests/ui/issues/issue-7784.rs +++ b/tests/ui/array-slice-vec/pattern-matching-fixed-length-vectors-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/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-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/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/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.stderr b/tests/ui/attributes/lint_on_root.stderr index f6eafc33d69..46b0b613a2f 100644 --- a/tests/ui/attributes/lint_on_root.stderr +++ b/tests/ui/attributes/lint_on_root.stderr @@ -14,7 +14,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! = 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 @@ -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.stderr b/tests/ui/attributes/malformed-attrs.stderr index d1d9fef2a40..69f9a18c179 100644 --- a/tests/ui/attributes/malformed-attrs.stderr +++ b/tests/ui/attributes/malformed-attrs.stderr @@ -41,32 +41,6 @@ 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 `sanitize` attribute input - --> $DIR/malformed-attrs.rs:92:1 - | -LL | #[sanitize] - | ^^^^^^^^^^^ - | -help: the following are the possible correct uses - | -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: malformed `instruction_set` attribute input --> $DIR/malformed-attrs.rs:106:1 | @@ -256,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 @@ -496,6 +470,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 | @@ -543,6 +523,24 @@ LL | #[coverage(off)] LL | #[coverage(on)] | ++++ +error[E0539]: malformed `sanitize` attribute input + --> $DIR/malformed-attrs.rs:92: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 | @@ -766,7 +764,7 @@ warning: `#[diagnostic::do_not_recommend]` does not expect any arguments 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 @@ -836,7 +834,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"]` @@ -848,7 +846,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 `#[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")]` @@ -860,7 +858,7 @@ 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]` @@ -871,7 +869,7 @@ 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]` @@ -882,7 +880,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 `#[ignore = "reason"]` and `#[ignore]` @@ -893,5 +891,5 @@ 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/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/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/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/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/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/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/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/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/check-cfg/target_feature.stderr b/tests/ui/check-cfg/target_feature.stderr index 5dd81f486c8..f6448147392 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` 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/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/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/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-8248.rs b/tests/ui/coercion/mut-trait-coercion-8248.rs index 95f626658cc..a45a4d94315 100644 --- a/tests/ui/issues/issue-8248.rs +++ b/tests/ui/coercion/mut-trait-coercion-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/mut-trait-coercion-8248.stderr index 8570bfaefad..0c7d5f9dc45 100644 --- a/tests/ui/issues/issue-8248.stderr +++ b/tests/ui/coercion/mut-trait-coercion-8248.stderr @@ -1,12 +1,12 @@ warning: method `dummy` is never used - --> $DIR/issue-8248.rs:4:8 + --> $DIR/mut-trait-coercion-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/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/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_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/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/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/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 d1527ec810c..77abaa42e31 100644 --- a/tests/ui/coverage-attr/name-value.stderr +++ b/tests/ui/coverage-attr/name-value.stderr @@ -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 880ad080953..5fcffacc7fa 100644 --- a/tests/ui/coverage-attr/word-only.stderr +++ b/tests/ui/coverage-attr/word-only.stderr @@ -43,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 @@ -77,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 @@ -98,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 @@ -119,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 @@ -140,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 @@ -174,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 @@ -195,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-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/issues/issue-8259.rs b/tests/ui/cross-crate/static-regions-in-cross-crate-8259.rs index e843f7f9c50..347cfa2aee1 100644 --- a/tests/ui/issues/issue-8259.rs +++ b/tests/ui/cross-crate/static-regions-in-cross-crate-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/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.stderr b/tests/ui/deprecation/deprecation-sanity.stderr index 57af76d8f24..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, foreign statics, 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/deriving/deriving-from-wrong-target.rs b/tests/ui/deriving/deriving-from-wrong-target.rs index 37c9300e28b..d0cab937b5d 100644 --- a/tests/ui/deriving/deriving-from-wrong-target.rs +++ b/tests/ui/deriving/deriving-from-wrong-target.rs @@ -29,8 +29,6 @@ struct S4 { enum E1 {} #[derive(From)] -//~^ ERROR the size for values of type `T` cannot be known at compilation time [E0277] -//~| ERROR the size for values of type `T` cannot be known at compilation time [E0277] struct SUnsizedField<T: ?Sized> { last: T, //~^ ERROR the size for values of type `T` cannot be known at compilation time [E0277] diff --git a/tests/ui/deriving/deriving-from-wrong-target.stderr b/tests/ui/deriving/deriving-from-wrong-target.stderr index 63eb8ec7b6e..4547cea5ba6 100644 --- a/tests/ui/deriving/deriving-from-wrong-target.stderr +++ b/tests/ui/deriving/deriving-from-wrong-target.stderr @@ -54,45 +54,7 @@ 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:31:10 - | -LL | #[derive(From)] - | ^^^^ doesn't have a size known at compile-time -... -LL | struct SUnsizedField<T: ?Sized> { - | - this type parameter needs to be `Sized` - | -note: required by an implicit `Sized` bound in `From` - --> $SRC_DIR/core/src/convert/mod.rs:LL:COL -help: consider removing the `?Sized` bound to make the type parameter `Sized` - | -LL - struct SUnsizedField<T: ?Sized> { -LL + struct SUnsizedField<T> { - | - -error[E0277]: the size for values of type `T` cannot be known at compilation time - --> $DIR/deriving-from-wrong-target.rs:31:10 - | -LL | #[derive(From)] - | ^^^^ doesn't have a size known at compile-time -... -LL | struct SUnsizedField<T: ?Sized> { - | - this type parameter needs to be `Sized` - | -note: required because it appears within the type `SUnsizedField<T>` - --> $DIR/deriving-from-wrong-target.rs:34:8 - | -LL | struct SUnsizedField<T: ?Sized> { - | ^^^^^^^^^^^^^ - = note: the return type of a function must have a statically known size -help: consider removing the `?Sized` bound to make the type parameter `Sized` - | -LL - struct SUnsizedField<T: ?Sized> { -LL + struct SUnsizedField<T> { - | - -error[E0277]: the size for values of type `T` cannot be known at compilation time - --> $DIR/deriving-from-wrong-target.rs:35:11 + --> $DIR/deriving-from-wrong-target.rs:33:11 | LL | struct SUnsizedField<T: ?Sized> { | - this type parameter needs to be `Sized` @@ -110,6 +72,6 @@ help: function arguments must have a statically known size, borrowed types alway LL | last: &T, | + -error: aborting due to 8 previous errors +error: aborting due to 6 previous errors For more information about this error, try `rustc --explain E0277`. 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/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-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-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/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-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-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-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..60666481bec 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 +//~| HELP remove the attribute #![link()] //~ 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,21 +459,25 @@ 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"] @@ -467,21 +511,25 @@ 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] @@ -524,12 +572,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 +587,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,16 +664,19 @@ 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 } @@ -668,21 +733,29 @@ 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"] 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..7488c68b59f 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:506: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:503: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] | ^^^^^^^^^^^^^^^ @@ -199,19 +199,19 @@ 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 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:483:1 | 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 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:535:1 | 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:685:1 | LL | #[link()] | ^^^^^^^^^ @@ -226,76 +226,64 @@ LL | | } | = 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 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:761: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 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:782:1 | LL | #[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:728:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:801:1 | 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 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:820:1 | 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 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:840:1 | 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 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:859:1 | 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 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:878:1 | 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 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:897:1 | 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 | = 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,97 +291,97 @@ 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:486: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 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:489:5 | 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 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:492:5 | 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 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:495:5 | 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 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:498:5 | 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:538: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 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:541:5 | 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 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:544:5 | 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 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:547:5 | 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 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:550: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 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:691:17 | LL | mod inner { #![link()] } | ------------^^^^^^^^^^-- not an `extern` block @@ -401,7 +389,7 @@ LL | mod inner { #![link()] } = 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:631:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:696:5 | LL | #[link()] fn f() { } | ^^^^^^^^^ ---------- not an `extern` block @@ -409,7 +397,7 @@ LL | #[link()] 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! 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:701:5 | LL | #[link()] struct S; | ^^^^^^^^^ --------- not an `extern` block @@ -417,7 +405,7 @@ LL | #[link()] 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! 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:706:5 | LL | #[link()] type T = S; | ^^^^^^^^^ ----------- not an `extern` block @@ -425,7 +413,7 @@ LL | #[link()] 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! 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:711:5 | LL | #[link()] impl S { } | ^^^^^^^^^ ---------- not an `extern` block @@ -433,309 +421,291 @@ LL | #[link()] 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: 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:716:5 | LL | #[link()] extern "Rust" {} | ^^^^^^^^^ | = 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 - | -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 | #[must_use] impl S { } - | ^^^^^^^^^^^ - 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:764: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 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:767:5 | 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 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:770: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 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:773:5 | 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:703:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:776:5 | LL | #[windows_subsystem = "windows"] impl S { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be in the root module - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:712:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:785: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 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:788:5 | LL | #[crate_name = "0900"] fn f() { } | ^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:718:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:791: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 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:794:5 | 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 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:797:5 | LL | #[crate_name = "0900"] 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:804: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 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:807:5 | 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 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:810:5 | 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 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:813:5 | 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 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:816:5 | 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:823: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 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:826:5 | 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 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:829:5 | 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 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:832:5 | 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 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:835:5 | 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:843: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 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:846:5 | 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 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:849:5 | 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 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:852:5 | 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 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:855:5 | 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:862: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 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:865:5 | 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 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:868:5 | 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 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:871:5 | 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 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:874:5 | 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:881: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 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:884:5 | 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 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:887:5 | 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 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:890:5 | 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 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:893:5 | 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:900: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 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:903:5 | 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 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:906:5 | 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 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:909:5 | 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 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:912:5 | 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 +714,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 +723,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 +732,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 +741,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 +750,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 +759,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 +768,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 +777,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 +786,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 +795,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 +804,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 +876,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 +885,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 +894,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 +903,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 +912,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 +921,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 +930,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 +939,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 +948,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 +957,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:510: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:516: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:522: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:528: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:571:1 | LL | #[cold] | ^^^^^^^ @@ -1068,7 +1038,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:578:17 | LL | mod inner { #![cold] } | ^^^^^^^^ @@ -1077,7 +1047,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:586:5 | LL | #[cold] struct S; | ^^^^^^^ @@ -1086,7 +1056,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:592:5 | LL | #[cold] type T = S; | ^^^^^^^ @@ -1095,7 +1065,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:598:5 | LL | #[cold] impl S { } | ^^^^^^^ @@ -1104,112 +1074,148 @@ 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:605: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:611: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:618: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:624: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:630: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:636: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:642: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:649: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:655: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:663: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:669: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:675: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:736: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:741: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:750: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:755: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: `#[should_panic]` attribute cannot be used on crates --> $DIR/issue-43106-gating-of-builtin-attrs.rs:50:1 @@ -1221,7 +1227,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 +1236,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 +1245,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 +1254,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/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/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/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/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/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/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/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/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/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/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-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-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-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-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-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/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/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/link-native-libs/link-attr-validation-early.stderr b/tests/ui/link-native-libs/link-attr-validation-early.stderr index 36cca6f27ef..d4fc2e272f8 100644 --- a/tests/ui/link-native-libs/link-attr-validation-early.stderr +++ b/tests/ui/link-native-libs/link-attr-validation-early.stderr @@ -7,7 +7,7 @@ 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 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 @@ -31,7 +31,7 @@ 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 `#[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")]` @@ -43,5 +43,5 @@ LL | #[link = "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 #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 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/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.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/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..37fbf93ffa1 --- /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: add an exclamation mark: `#![foo] +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..4ffb55d493a --- /dev/null +++ b/tests/ui/lint/unused/concat-in-crate-name-issue-137687.stderr @@ -0,0 +1,23 @@ +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: `#![foo]` + --> $DIR/concat-in-crate-name-issue-137687.rs:3:1 + | +LL | #[crate_name = concat !()] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = 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..9d61120463c 100644 --- a/tests/ui/lint/unused/unused-attr-macro-rules.stderr +++ b/tests/ui/lint/unused/unused-attr-macro-rules.stderr @@ -17,7 +17,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/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/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/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/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/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.stderr b/tests/ui/malformed/malformed-regressions.stderr index 4a00c9b4a7d..cab347a8062 100644 --- a/tests/ui/malformed/malformed-regressions.stderr +++ b/tests/ui/malformed/malformed-regressions.stderr @@ -7,7 +7,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 `#[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 @@ -59,7 +59,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 `#[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")]` @@ -71,7 +71,7 @@ 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 `#[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")]` @@ -83,7 +83,7 @@ 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 +94,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 +105,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-7867.rs b/tests/ui/match/mismatched-types-in-match-pattern-7867.rs index 87e7c831e68..9ff8755c819 100644 --- a/tests/ui/issues/issue-7867.rs +++ b/tests/ui/match/mismatched-types-in-match-pattern-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-pattern-7867.stderr index fcb69d775fa..8997f36114a 100644 --- a/tests/ui/issues/issue-7867.stderr +++ b/tests/ui/match/mismatched-types-in-match-pattern-7867.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/issue-7867.rs:9:9 + --> $DIR/mismatched-types-in-match-pattern-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..a87c47a9f12 100644 --- a/tests/ui/methods/method-call-lifetime-args-unresolved.stderr +++ b/tests/ui/methods/method-call-lifetime-args-unresolved.stderr @@ -20,7 +20,7 @@ LL | 0.clone::<'a>(); | = 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-self-param-error-7575.rs index 8b1fdf6c851..9793d43cc24 100644 --- a/tests/ui/issues/issue-7575.rs +++ b/tests/ui/methods/trait-method-self-param-error-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-self-param-error-7575.stderr b/tests/ui/methods/trait-method-self-param-error-7575.stderr new file mode 100644 index 00000000000..656db30352d --- /dev/null +++ b/tests/ui/methods/trait-method-self-param-error-7575.stderr @@ -0,0 +1,10 @@ +warning: trait `Foo` is never used + --> $DIR/trait-method-self-param-error-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/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/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/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/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/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.stderr b/tests/ui/parser/bad-lit-suffixes.stderr index 9a51cf70960..e1a8a6834f4 100644 --- a/tests/ui/parser/bad-lit-suffixes.stderr +++ b/tests/ui/parser/bad-lit-suffixes.stderr @@ -11,31 +11,11 @@ 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 +130,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 +160,23 @@ LL - #[must_use = "string"suffix] LL + #[must_use] | -error[E0805]: malformed `rustc_layout_scalar_valid_range_start` attribute input +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.) + +error[E0539]: malformed `rustc_layout_scalar_valid_range_start` attribute input --> $DIR/bad-lit-suffixes.rs:43:1 | LL | #[rustc_layout_scalar_valid_range_start(0suffix)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^---------^ - | | | - | | expected a single argument here + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-------^^ + | | | + | | expected an integer literal here | help: must be of the form: `#[rustc_layout_scalar_valid_range_start(start)]` 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/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-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/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/issues/issue-8391.rs b/tests/ui/pattern/match-with-at-binding-8391.rs index 20698eed18b..bc4e7be7989 100644 --- a/tests/ui/issues/issue-8391.rs +++ b/tests/ui/pattern/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-8860.rs b/tests/ui/pattern/ref-in-function-parameter-patterns-8860.rs index 3af61576fe1..1a67caf021c 100644 --- a/tests/ui/issues/issue-8860.rs +++ b/tests/ui/pattern/ref-in-function-parameter-patterns-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/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/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/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/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/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/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/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-7663.rs b/tests/ui/resolve/module-import-resolution-7663.rs index d2b2c727cab..872806594fc 100644 --- a/tests/ui/issues/issue-7663.rs +++ b/tests/ui/resolve/module-import-resolution-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/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 23f4e319c6d..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/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-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 index 49dc01c8daa..957ce780ad0 100644 --- a/tests/ui/sanitize-attr/invalid-sanitize.rs +++ b/tests/ui/sanitize-attr/invalid-sanitize.rs @@ -1,8 +1,7 @@ #![feature(sanitize)] -#[sanitize(brontosaurus = "off")] //~ ERROR invalid argument -fn main() { -} +#[sanitize(brontosaurus = "off")] //~ ERROR malformed `sanitize` attribute input +fn main() {} #[sanitize(address = "off")] //~ ERROR multiple `sanitize` attributes #[sanitize(address = "off")] @@ -12,11 +11,11 @@ fn multiple_consistent() {} #[sanitize(address = "off")] fn multiple_inconsistent() {} -#[sanitize(address = "bogus")] //~ ERROR invalid argument for `sanitize` +#[sanitize(address = "bogus")] //~ ERROR malformed `sanitize` attribute input fn wrong_value() {} #[sanitize = "off"] //~ ERROR malformed `sanitize` attribute input -fn name_value () {} +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 index 4bf81770b89..ec0a93be142 100644 --- a/tests/ui/sanitize-attr/invalid-sanitize.stderr +++ b/tests/ui/sanitize-attr/invalid-sanitize.stderr @@ -1,82 +1,115 @@ -error: malformed `sanitize` attribute input - --> $DIR/invalid-sanitize.rs:18:1 +error[E0539]: malformed `sanitize` attribute input + --> $DIR/invalid-sanitize.rs:3:1 | -LL | #[sanitize = "off"] - | ^^^^^^^^^^^^^^^^^^^ +LL | #[sanitize(brontosaurus = "off")] + | ^^^^^^^^^^^------------^^^^^^^^^^ + | | + | valid arguments are "address", "cfi", "kcfi", "memory", "memtag", "shadow_call_stack", "thread" or "hwaddress" | -help: the following are the possible correct uses +help: try changing it to one of the following valid forms of the attribute | -LL - #[sanitize = "off"] +LL - #[sanitize(brontosaurus = "off")] LL + #[sanitize(address = "on|off")] | -LL - #[sanitize = "off"] +LL - #[sanitize(brontosaurus = "off")] LL + #[sanitize(cfi = "on|off")] | -LL - #[sanitize = "off"] +LL - #[sanitize(brontosaurus = "off")] LL + #[sanitize(hwaddress = "on|off")] | -LL - #[sanitize = "off"] +LL - #[sanitize(brontosaurus = "off")] LL + #[sanitize(kcfi = "on|off")] | = and 5 other candidates -error: malformed `sanitize` attribute input - --> $DIR/invalid-sanitize.rs:21:1 - | -LL | #[sanitize] - | ^^^^^^^^^^^ - | -help: the following are the possible correct uses - | -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: multiple `sanitize` attributes - --> $DIR/invalid-sanitize.rs:7:1 + --> $DIR/invalid-sanitize.rs:6:1 | LL | #[sanitize(address = "off")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute | note: attribute also specified here - --> $DIR/invalid-sanitize.rs:8:1 + --> $DIR/invalid-sanitize.rs:7:1 | LL | #[sanitize(address = "off")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: multiple `sanitize` attributes - --> $DIR/invalid-sanitize.rs:11:1 + --> $DIR/invalid-sanitize.rs:10:1 | LL | #[sanitize(address = "on")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute | note: attribute also specified here - --> $DIR/invalid-sanitize.rs:12:1 + --> $DIR/invalid-sanitize.rs:11:1 | LL | #[sanitize(address = "off")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error: invalid argument for `sanitize` - --> $DIR/invalid-sanitize.rs:3:1 +error[E0539]: malformed `sanitize` attribute input + --> $DIR/invalid-sanitize.rs:14:1 | -LL | #[sanitize(brontosaurus = "off")] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +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")] | - = note: expected one of: `address`, `kernel_address`, `cfi`, `hwaddress`, `kcfi`, `memory`, `memtag`, `shadow_call_stack`, or `thread` + = and 5 other candidates -error: invalid argument for `sanitize` - --> $DIR/invalid-sanitize.rs:15:1 +error[E0539]: malformed `sanitize` attribute input + --> $DIR/invalid-sanitize.rs:17:1 | -LL | #[sanitize(address = "bogus")] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +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 | - = note: expected one of: `address`, `kernel_address`, `cfi`, `hwaddress`, `kcfi`, `memory`, `memtag`, `shadow_call_stack`, or `thread` +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/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/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-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/issues/auxiliary/issue-8044.rs b/tests/ui/structs-enums/auxiliary/aux-8044.rs index 2ec25f51cde..2ec25f51cde 100644 --- a/tests/ui/issues/auxiliary/issue-8044.rs +++ b/tests/ui/structs-enums/auxiliary/aux-8044.rs 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/structs-enums/struct-and-enum-usage-8044.rs b/tests/ui/structs-enums/struct-and-enum-usage-8044.rs new file mode 100644 index 00000000000..9b544f33f1c --- /dev/null +++ b/tests/ui/structs-enums/struct-and-enum-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/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/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/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/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/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/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/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/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/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/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-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-implements-kinds-in-default-methods-8171.rs index 6a03404cdca..59ea62c7690 100644 --- a/tests/ui/issues/issue-8171-default-method-self-inherit-builtin-trait.rs +++ b/tests/ui/traits/self-implements-kinds-in-default-methods-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-7563.rs b/tests/ui/traits/trait-implementation-and-usage-7563.rs index 9ee8857b999..8cfc7a14ffe 100644 --- a/tests/ui/issues/issue-7563.rs +++ b/tests/ui/traits/trait-implementation-and-usage-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/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/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/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 e1310e1f365..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"); @@ -91,4 +97,14 @@ pub fn main() { } } 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/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/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/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/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/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/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 cdd6e82b98d..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, foreign statics, 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, foreign statics, 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 | |
